a huge amount of fixes with regards to memory leaks and fixed a bugger of a memleak in connectserv

made connectserv support SMODE for ultimate3 now as well
This commit is contained in:
fishwaldo 2003-01-23 10:53:38 +00:00
parent 6f1a19b61c
commit 35a928a3cd
9 changed files with 222 additions and 111 deletions

View file

@ -31,6 +31,9 @@ NeoStats ChangeLog - Anything we add/remove/fix/change is in here (even our rant
- ultimate3 SMODE support
- Ultiamte3 SMODE broke ConnectServ. Bah Humbug
- stopped double global messages when a module is loaded/unloaded
- some more memory leaks found with memprof and a 4000 user network!!!!
- Drastically reduced the amount of memory that Neostats now uses. 4000 users used to be around 12Mbs, got it down to 3.6Mbs
- Fixed up connectserv for SMODE support
* NeoStats * Shmad & Fish * Version 2.5.0-Release Candidate 2
- Misc. Updates (S)

View file

@ -20,7 +20,7 @@
** USA
**
** NeoStats CVS Identification
** $Id: Ultimate.c,v 1.35 2003/01/13 07:20:53 fishwaldo Exp $
** $Id: Ultimate.c,v 1.36 2003/01/23 10:53:38 fishwaldo Exp $
*/
#include "stats.h"
@ -369,7 +369,7 @@ int ssvshost_cmd(const char *who, const char *vhost) {
log("Can't Find user %s for ssvshost_cmd", who);
return 0;
} else {
strcpy(u->vhost, vhost);
strncpy(u->vhost, vhost, MAXHOST);
#ifdef ULTIMATE3
sts(":%s %s %s %s", me.name, (me.token ? TOK_SETHOST : MSG_SETHOST), who, vhost);
#elif ULTIMATE

32
chans.c
View file

@ -19,7 +19,7 @@
** USA
**
** NeoStats CVS Identification
** $Id: chans.c,v 1.39 2003/01/15 14:18:47 fishwaldo Exp $
** $Id: chans.c,v 1.40 2003/01/23 10:53:38 fishwaldo Exp $
*/
#include <fnmatch.h>
@ -58,7 +58,7 @@ extern void Change_Topic(char *owner, Chans *c, time_t time, char *topic) {
char **av;
int ac = 0;
strncpy(c->topic, topic, BUFSIZE);
strncpy(c->topicowner, owner, BUFSIZE);
strncpy(c->topicowner, owner, MAXHOST);
c->topictime = time;
AddStringToList(&av, c->name, &ac);
AddStringToList(&av, owner, &ac);
@ -130,12 +130,12 @@ int ChanMode(char *origin, char **av, int ac) {
m = lnode_get(mn);
/* mode limit and mode key replace current values */
if ((m->mode == MODE_LIMIT) && (cFlagTab[i].mode == MODE_LIMIT)) {
strcpy(m->param, av[j]);
strncpy(m->param, av[j], PARAMSIZE);
j++;
modeexists = 1;
break;
} else if ((m->mode == MODE_KEY) && (cFlagTab[i].mode == MODE_KEY)) {
strcpy(m->param, av[j]);
strncpy(m->param, av[j], PARAMSIZE);
j++;
modeexists = 1;
break;
@ -152,7 +152,7 @@ int ChanMode(char *origin, char **av, int ac) {
if (modeexists != 1) {
m = smalloc(sizeof(ModesParm));
m->mode = cFlagTab[i].mode;
strcpy(m->param, av[j]);
strncpy(m->param, av[j], PARAMSIZE);
mn = lnode_create(m);
if (list_isfull(c->modeparms)) {
log("Eeek, Can't add additional Modes to Channel %s. Modelist is full", c->name);
@ -253,7 +253,7 @@ Chans *new_chan(char *chan) {
strcpy(segv_location, "new_chan");
c = smalloc(sizeof(Chans));
strcpy(c->name, chan);
strncpy(c->name, chan, CHANLEN);
cn = hnode_create(c);
if (hash_isfull(ch)) {
log("Eeek, Channel Hash is full");
@ -292,6 +292,7 @@ void del_chan(Chans *c) {
}
list_destroy_nodes(c->modeparms);
list_destroy(c->modeparms);
list_destroy(c->chanmembers);
hash_delete(ch, cn);
hnode_destroy(cn);
free(c);
@ -315,6 +316,7 @@ void part_chan(User *u, char *chan) {
Chans *c;
lnode_t *un;
char **av;
Chanmem *cm;
int ac = 0;
strcpy(segv_location, "part_chan");
#ifdef DEBUG
@ -343,7 +345,9 @@ void part_chan(User *u, char *chan) {
UserDump(u->nick);
}
} else {
cm = lnode_get(un);
lnode_destroy(list_delete(c->chanmembers, un));
free(cm);
AddStringToList(&av, c->name, &ac);
AddStringToList(&av, u->nick, &ac);
Module_Event("PARTCHAN", av, ac);
@ -411,7 +415,7 @@ void change_user_nick(Chans *c, char *newnick, char *oldnick) {
log("Change_User_Nick(): NewNick %s, OldNick %s", newnick, oldnick);
#endif
cml = lnode_get(cm);
strcpy(cml->nick, newnick);
strncpy(cml->nick, newnick, MAXNICK);
}
}
@ -469,7 +473,7 @@ void join_chan(User *u, char *chan) {
}
/* add this users details to the channel members hash */
cm = smalloc(sizeof(Chanmem));
strcpy(cm->nick, u->nick);
strncpy(cm->nick, u->nick, MAXNICK);
cm->joint = time(NULL);
cm->flags = 0;
cn = lnode_create(cm);
@ -487,6 +491,9 @@ void join_chan(User *u, char *chan) {
}
if (list_isfull(c->chanmembers)) {
log("ekk, Channel %s Members list is full", c->name);
lnode_destroy(cn);
free(cm);
return;
} else {
list_append(c->chanmembers, cn);
}
@ -494,6 +501,7 @@ void join_chan(User *u, char *chan) {
un = lnode_create(c->name);
if (list_isfull(u->chans)) {
log("eek, User %s members list is full", u->nick);
lnode_destroy(un);
} else {
list_append(u->chans, un);
}
@ -542,7 +550,7 @@ void chandump(char *chan) {
strcpy(mode, "+");
for (i = 0; i < ((sizeof(cFlagTab) / sizeof(cFlagTab[0])) - 1); i++) {
if (c->modes & cFlagTab[i].mode) {
sprintf(mode, "%s%c", mode, cFlagTab[i].flag);
snprintf(mode, 10, "%s%c", mode, cFlagTab[i].flag);
}
}
sendcoders("Channel: %s Members: %d (List %d) Flags %s", c->name, c->cur_users, list_count(c->chanmembers), mode);
@ -564,7 +572,7 @@ void chandump(char *chan) {
strcpy(mode, "+");
for (i = 0; i < ((sizeof(cFlagTab) / sizeof(cFlagTab[0])) - 1); i++) {
if (cm->flags & cFlagTab[i].mode) {
sprintf(mode, "%s%c", mode, cFlagTab[i].flag);
snprintf(mode, 10, "%s%c", mode, cFlagTab[i].flag);
}
}
sendcoders("Members: %s Modes %s Joined %d", cm->nick, mode, cm->joint);
@ -579,7 +587,7 @@ void chandump(char *chan) {
strcpy(mode, "+");
for (i = 0; i < ((sizeof(cFlagTab) / sizeof(cFlagTab[0])) - 1); i++) {
if (c->modes & cFlagTab[i].mode) {
sprintf(mode, "%s%c", mode, cFlagTab[i].flag);
snprintf(mode, 10, "%s%c", mode, cFlagTab[i].flag);
}
}
sendcoders("Channel: %s Members: %d (List %d) Flags %s", c->name, c->cur_users, list_count(c->chanmembers), mode);
@ -600,7 +608,7 @@ void chandump(char *chan) {
strcpy(mode, "+");
for (i = 0; i < ((sizeof(cFlagTab) / sizeof(cFlagTab[0])) - 1); i++) {
if (cm->flags & cFlagTab[i].mode) {
sprintf(mode, "%s%c", mode, cFlagTab[i].flag);
snprintf(mode, 10, "%s%c", mode, cFlagTab[i].flag);
}
}
sendcoders("Members: %s Modes %s Joined: %d", cm->nick, mode, cm->joint);

View file

@ -20,7 +20,7 @@
** USA
**
** NeoStats CVS Identification
** $Id: cs.c,v 1.16 2003/01/21 13:15:33 fishwaldo Exp $
** $Id: cs.c,v 1.17 2003/01/23 10:53:38 fishwaldo Exp $
*/
#include <stdio.h>
@ -36,6 +36,7 @@ char *s_ConnectServ;
extern const char *cs_help[];
int cs_new_user(char **av, int ac);
int cs_user_modes(char **av, int ac);
int cs_user_smodes(char **av, int ac);
int cs_del_user(char **av, int ac);
int cs_user_kill(char **av, int ac);
int cs_user_nick(char **av, int ac);
@ -147,7 +148,9 @@ EventFnList my_event_list[] = {
{ "ONLINE", Online},
{ "SIGNON", cs_new_user},
{ "UMODE", cs_user_modes},
{ "SMODE", cs_user_modes},
#ifdef ULTIMATE3
{ "SMODE", cs_user_smodes},
#endif
{ "SIGNOFF", cs_del_user},
{ "KILL", cs_user_kill},
{ "NICK_CHANGE", cs_user_nick},
@ -237,21 +240,24 @@ int cs_del_user(char **av, int ac) {
/* Approximate Segfault Location */
strcpy(segv_location, "cs_del_user");
u = finduser(av[0]);
cmd = sstrdup(recbuf);
lcl = sstrdup(recbuf);
lcl = sstrdup(recbuf);
QuitCount = split_buf(cmd, &Quit, 0);
QuitMsg = joinbuf (Quit, QuitCount, 2);
QuitMsg = joinbuf (Quit, QuitCount, 2);
/* Local Kill Watch For Signoff */
if (kill_watch) {
if (strstr(cmd ,"Local kill by") && strstr(cmd, "[") && strstr(cmd, "]")) {
LocalCount = split_buf(lcl, &Local, 0);
KillMsg = joinbuf (Local, LocalCount, 7);
KillMsg = joinbuf (Local, LocalCount, 7);
if (is_synced) chanalert(s_ConnectServ, "\2LOCAL KILL\2 %s (%s@%s) was Killed by %s - Reason sighted: \2%s\2", u->nick, u->username, u->hostname, Local[6], KillMsg);
free(KillMsg);
free(KillMsg);
free(QuitMsg);
free(cmd);
free(lcl);
return 1;
}
@ -260,10 +266,13 @@ int cs_del_user(char **av, int ac) {
/* Print Disconnection Notice */
if (sign_watch) {
if (is_synced) chanalert(s_ConnectServ, "\2SIGNOFF\2 %s (%s@%s) has Signed off at %s - %s", u->nick, u->username, u->hostname, u->server->name, QuitMsg);
}
free(QuitMsg);
return 1;
}
free(QuitMsg);
free(cmd);
free(lcl);
free(Quit);
QuitCount = 0;
return 1;
}
@ -291,6 +300,130 @@ int cs_user_modes(char **av, int ac) {
case '-': add = 0; break;
}
while (*av[1]++) {
switch(*av[1]) {
case '+': add = 1; break;
case '-': add = 0; break;
#ifndef ULTIMATE3
/* these modes in Ultimate3 are Smodes */
case NETADMIN_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2NetAdmin\2 %s is Now a Network Administrator", u->nick);
} else {
if (is_synced) chanalert(s_ConnectServ, "\2NetAdmin\2 %s is No Longer a Network Administrator", u->nick);
}
break;
case CONETADMIN_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2Co-NetAdmin\2 %s is Now a Co-Network Administrator", u->nick);
} else {
if (is_synced) chanalert(s_ConnectServ, "\2Co-NetAdmin\2 %s is No Longer a Co-Network Administrator", u->nick);
}
break;
case TECHADMIN_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2TechAdmin\2 %s is Now a Network Technical Administrator", u->nick);
} else {
if (is_synced) chanalert(s_ConnectServ, "\2TechAdmin\2 %s is No Longer a Network Technical Administrator", u->nick);
}
break;
case SERVERADMIN_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2ServerAdmin\2 %s is Now a Server Administrator on %s", u->nick, u->server->name);
} else {
if (is_synced) chanalert(s_ConnectServ, "\2ServerAdmin\2 %s is No Longer a Server Administrator on %s", u->nick, u->server->name);
}
break;
case COSERVERADMIN_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2Co-ServerAdmin\2 %s is Now a Co-Server Administrator on %s", u->nick, u->server->name);
} else {
if (is_synced) chanalert(s_ConnectServ, "\2Co-ServerAdmin\2 %s is No Longer a Co-Server Administrator on %s", u->nick, u->server->name);
}
break;
case GUESTADMIN_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2GuestAdmin\2 %s is Now a Guest Administrator on %s", u->nick, u->server->name);
} else {
if (is_synced) chanalert(s_ConnectServ, "\2GuestAdmin\2 %s is No Longer a Guest Administrator on %s", u->nick, u->server->name);
}
break;
/* these modes are not used in Ultimate3 */
case BOT_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2Bot\2 %s is Now a Bot", u->nick);
} else {
if (is_synced) chanalert(s_ConnectServ, "\2Bot\2 %s is No Longer a Bot", u->nick);
}
break;
case INVISIBLE_MODE:
if (add) {
globops(s_ConnectServ,"\2%s\2 Is Using \2Invisible Mode\2",u->nick);
} else {
globops(s_ConnectServ,"\2%s\2 Is no longer using \2Invisible Mode\2",u->nick);
}
break;
#endif
case SERVICESADMIN_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2ServicesAdmin\2 %s is Now a Services Administrator", u->nick);
} else {
if (is_synced) chanalert(s_ConnectServ, "\2ServicesAdmin\2 %s is No Longer a Services Administrator", u->nick);
}
break;
case OPER_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2Oper\2 %s is Now a Oper on %s", u->nick, u->server->name);
} else {
if (is_synced) chanalert(s_ConnectServ, "\2Oper\2 %s is No Longer a Oper on %s", u->nick, u->server->name);
}
break;
case LOCOP_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2LocalOper\2 %s is Now a Local Oper on %s", u->nick, u->server->name);
} else {
if (is_synced) chanalert(s_ConnectServ, "\2LocalOper\2 %s is No Longer a Local Oper on %s", u->nick, u->server->name);
}
break;
case NETSERVICE_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2Services\2 %s is Now a Network Service", u->nick);
} else {
if (is_synced) chanalert(s_ConnectServ, "\2Services\2 %s is No Longer a Network Service", u->nick);
}
break;
default:
break;
}
}
return 1;
}
#ifdef ULTIMATE3
/* smode support for Ultimate3 */
int cs_user_smodes(char **av, int ac) {
int add = 1;
char *modes;
User *u;
/* Approximate Segfault Location */
strcpy(segv_location, "cs_user_modes");
if (mode_watch != 1) return -1;
u = finduser(av[0]);
if (!u) {
cslog("Changing modes for unknown user: %s", u->nick);
return -1;
}
if (!u->modes) return -1;
modes = u->modes;
switch (*av[1]) {
case '+': add = 1; break;
case '-': add = 0; break;
}
while (*av[1]++) {
switch(*av[1]) {
case '+': add = 1; break;
@ -309,13 +442,6 @@ int cs_user_modes(char **av, int ac) {
if (is_synced) chanalert(s_ConnectServ, "\2Co-NetAdmin\2 %s is No Longer a Co-Network Administrator", u->nick);
}
break;
case NETSERVICE_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2Services\2 %s is Now a Network Service", u->nick);
} else {
if (is_synced) chanalert(s_ConnectServ, "\2Services\2 %s is No Longer a Network Service", u->nick);
}
break;
case TECHADMIN_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2TechAdmin\2 %s is Now a Network Technical Administrator", u->nick);
@ -323,6 +449,13 @@ int cs_user_modes(char **av, int ac) {
if (is_synced) chanalert(s_ConnectServ, "\2TechAdmin\2 %s is No Longer a Network Technical Administrator", u->nick);
}
break;
case COTECHADMIN_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2Co-TechAdmin\2 %s is Now a Network Co-Technical Administrator", u->nick);
} else {
if (is_synced) chanalert(s_ConnectServ, "\2Co-TechAdmin\2 %s is No Longer a Network Co-Technical Administrator", u->nick);
}
break;
case SERVERADMIN_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2ServerAdmin\2 %s is Now a Server Administrator on %s", u->nick, u->server->name);
@ -330,13 +463,6 @@ int cs_user_modes(char **av, int ac) {
if (is_synced) chanalert(s_ConnectServ, "\2ServerAdmin\2 %s is No Longer a Server Administrator on %s", u->nick, u->server->name);
}
break;
case SERVICESADMIN_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2ServicesAdmin\2 %s is Now a Services Administrator", u->nick);
} else {
if (is_synced) chanalert(s_ConnectServ, "\2ServicesAdmin\2 %s is No Longer a Services Administrator", u->nick);
}
break;
case COSERVERADMIN_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2Co-ServerAdmin\2 %s is Now a Co-Server Administrator on %s", u->nick, u->server->name);
@ -351,41 +477,13 @@ int cs_user_modes(char **av, int ac) {
if (is_synced) chanalert(s_ConnectServ, "\2GuestAdmin\2 %s is No Longer a Guest Administrator on %s", u->nick, u->server->name);
}
break;
case BOT_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2Bot\2 %s is Now a Bot", u->nick);
} else {
if (is_synced) chanalert(s_ConnectServ, "\2Bot\2 %s is No Longer a Bot", u->nick);
}
break;
case INVISIBLE_MODE:
if (add) {
globops(s_ConnectServ,"\2%s\2 Is Using \2Invisible Mode\2",u->nick);
} else {
globops(s_ConnectServ,"\2%s\2 Is no longer using \2Invisible Mode\2",u->nick);
}
break;
case OPER_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2Oper\2 %s is Now a Oper on %s", u->nick, u->server->name);
} else {
if (is_synced) chanalert(s_ConnectServ, "\2Oper\2 %s is No Longer a Oper on %s", u->nick, u->server->name);
}
break;
case LOCOP_MODE:
if (add) {
if (is_synced) chanalert(s_ConnectServ, "\2LocalOper\2 %s is Now a Local Oper on %s", u->nick, u->server->name);
} else {
if (is_synced) chanalert(s_ConnectServ, "\2LocalOper\2 %s is No Longer a Local Oper on %s", u->nick, u->server->name);
}
break;
default:
break;
}
}
return 1;
}
#endif
/* Routine for KILL message to be echoed */
int cs_user_kill(char **av, int ac) {

View file

@ -20,7 +20,7 @@
** USA
**
** NeoStats CVS Identification
** $Id: cs.h,v 1.7 2003/01/13 07:20:53 fishwaldo Exp $
** $Id: cs.h,v 1.8 2003/01/23 10:53:38 fishwaldo Exp $
*/
@ -30,13 +30,14 @@
#ifdef ULTIMATE3
#define LOCOP_MODE 'O'
#define OPER_MODE 'o'
#define GUESTADMIN_MODE 'j'
#define COSERVERADMIN_MODE 'J'
#define GUESTADMIN_MODE 'G'
#define COSERVERADMIN_MODE 'a'
#define SERVERADMIN_MODE 'A'
#define CONETADMIN_MODE 't'
#define NETADMIN_MODE 'T'
#define TECHADMIN_MODE '7' /* Set to a number as we dont use */
#define SERVICESADMIN_MODE 'P'
#define CONETADMIN_MODE 'n'
#define NETADMIN_MODE 'N'
#define COTECHADMIN_MODE 't'
#define TECHADMIN_MODE 'T' /* Set to a number as we dont use */
#define SERVICESADMIN_MODE 'a'
#define NETSERVICE_MODE 'S'
#define INVISIBLE_MODE '8' /* Set to a number as we dont use */
#define BOT_MODE '9' /* Set to a number as we dont use */

View file

@ -22,7 +22,7 @@
** USA
**
** NeoStats CVS Identification
** $Id: database.c,v 1.11 2003/01/22 16:36:58 fishwaldo Exp $
** $Id: database.c,v 1.12 2003/01/23 10:53:38 fishwaldo Exp $
*/
@ -230,21 +230,19 @@ void LoadStats()
lnode_destroy(cn);
free(c);
}
#if 0
free(name);
free(topics);
free(totmem);
free(kicks);
free(lastseen);
free(maxmems);
free(t_maxmems);
free(maxkicks);
free(t_maxkicks);
free(maxjoins);
free(t_maxjoins);
#endif
}
}
free(name);
free(topics);
free(totmem);
free(kicks);
free(lastseen);
free(maxmems);
free(t_maxmems);
free(maxkicks);
free(t_maxkicks);
free(maxjoins);
free(t_maxjoins);
fclose(fp);

20
ircd.c
View file

@ -22,7 +22,7 @@
** USA
**
** NeoStats CVS Identification
** $Id: ircd.c,v 1.108 2003/01/21 13:09:23 fishwaldo Exp $
** $Id: ircd.c,v 1.109 2003/01/23 10:53:38 fishwaldo Exp $
*/
#include <setjmp.h>
@ -477,7 +477,7 @@ void parse(char *line)
strcpy(segv_location, "parse");
strip(line);
strcpy(recbuf, line);
strncpy(recbuf, line, BUFSIZE);
if (!(*line))
return;
#ifdef DEBUG
@ -728,7 +728,7 @@ void Srv_Sjoin(char *origin, char **argv, int argc) {
if (cFlagTab[i].parameters) {
m = smalloc(sizeof(ModesParm));
m->mode = cFlagTab[i].mode;
strcpy(m->param, argv[j]);
strncpy(m->param, argv[j], PARAMSIZE);
mn = lnode_create(m);
if (!list_isfull(tl)) {
list_append(tl, mn);
@ -775,7 +775,7 @@ void Srv_Sjoin(char *origin, char **argv, int argc) {
mode |= MODE_VOICE;
modes++;
} else {
strcpy(nick, modes);
strncpy(nick, modes, MAXNICK);
ok = 0;
break;
}
@ -997,9 +997,9 @@ void Usr_Vhost(char *origin, char **argv, int argc) {
#endif
if (u) {
#ifndef ULTIMATE3
strcpy(u->vhost, argv[0]);
strncpy(u->vhost, argv[0], MAXHOST);
#else
strcpy(u->vhost, argv[1]);
strncpy(u->vhost, argv[1], MAXHOST);
#endif
}
}
@ -1111,7 +1111,7 @@ void Srv_Vctrl(char *origin, char **argv, int argc) {
ircd_srv.nicklg = atoi(argv[1]);
ircd_srv.modex = atoi(argv[2]);
ircd_srv.gc = atoi(argv[3]);
strcpy(me.netname, argv[14]);
strncpy(me.netname, argv[14], MAXPASS);
vctrl_cmd();
}
#endif
@ -1124,8 +1124,8 @@ void Srv_Svinfo(char *origin, char **argv, int argc) {
void Srv_Netinfo(char *origin, char **argv, int argc) {
me.onchan = 1;
ircd_srv.uprot = atoi(argv[2]);
strcpy(ircd_srv.cloak, argv[3]);
strcpy(me.netname, argv[7]);
strncpy(ircd_srv.cloak, argv[3], 10);
strncpy(me.netname, argv[7], MAXPASS);
#if !defined(HYBRID7) && !defined(NEOIRCD)
snetinfo_cmd();
@ -1216,7 +1216,7 @@ void Srv_Nick(char *origin, char **argv, int argc) {
Module_Event("SIGNON", av, ac);
u = finduser(argv[0]);
if (u) {
strcpy(u->vhost, argv[6]);
strncpy(u->vhost, argv[6], MAXHOST);
}
#ifdef DEBUG
log("Mode: UserMode: %s",argv[3]);

16
stats.h
View file

@ -20,7 +20,7 @@
** USA
**
** NeoStats CVS Identification
** $Id: stats.h,v 1.67 2003/01/22 16:37:38 fishwaldo Exp $
** $Id: stats.h,v 1.68 2003/01/23 10:53:38 fishwaldo Exp $
*/
#ifndef STATS_H
@ -77,6 +77,8 @@
#define MAXPASS 32
#define MAXNICK 32
#define MAXUSER 10
#define MODESIZE 53
#define PARAMSIZE MAXNICK+MAXUSER+MAXHOST+10
#define NUM_MODULES 255
@ -184,16 +186,16 @@ struct server_ {
struct user_ {
char nick[MAXNICK];
char hostname[BUFSIZE];
char username[BUFSIZE];
char vhost[BUFSIZE];
char hostname[MAXHOST];
char username[MAXUSER];
char vhost[MAXHOST];
Server *server;
MyUser *myuser;
int flood;
int is_away;
time_t t_flood;
long hash;
char modes[BUFSIZE];
char modes[MODESIZE];
int ulevel;
long Umode;
list_t *chans;
@ -211,7 +213,7 @@ struct chans_ {
list_t *chanmembers;
list_t *modeparms;
char topic[BUFSIZE];
char topicowner[BUFSIZE];
char topicowner[MAXHOST]; /* becuase a "server" can be a topic owner */
time_t topictime;
} chans_;
@ -223,7 +225,7 @@ struct chanmem_ {
struct modeparms_ {
long mode;
char param[512];
char param[PARAMSIZE];
} modeparms_;

11
users.c
View file

@ -22,7 +22,7 @@
** USA
**
** NeoStats CVS Identification
** $Id: users.c,v 1.41 2003/01/06 12:07:25 fishwaldo Exp $
** $Id: users.c,v 1.42 2003/01/23 10:53:38 fishwaldo Exp $
*/
#include <fnmatch.h>
@ -85,8 +85,8 @@ void AddUser(const char *nick, const char *user, const char *host, const char *s
}
u = new_user(nick);
strcpy(u->hostname,host);
strcpy(u->username, user);
strncpy(u->hostname,host, MAXHOST);
strncpy(u->username, user, MAXUSER);
u->server = findserver(server);
u->t_flood = time(NULL);
u->flood = 0;
@ -126,6 +126,7 @@ void DelUser(const char *nick)
hash_delete(uh, un);
hnode_destroy(un);
list_destroy(u->chans);
free(u);
}
@ -149,7 +150,7 @@ void Change_User(User *u, const char *newnick)
}
strcpy(segv_location, "Change_User_Return");
hash_delete(uh, un);
strcpy(u->nick, newnick);
strncpy(u->nick, newnick, MAXNICK);
hash_insert(uh, un, u->nick);
}
@ -313,7 +314,7 @@ void UserMode(const char *nick, const char *modes)
#endif
log("Modes: %s", modes);
#endif
strcpy(u->modes, modes);
strncpy(u->modes, modes, MODESIZE);
tmpmode = *(modes);
while (tmpmode) {
switch(tmpmode) {