Bug fixes and updates. Segv_location has changed slightly

This commit is contained in:
fishwaldo 2002-03-08 11:46:08 +00:00
parent d6d80072c0
commit 616a9558b8
12 changed files with 105 additions and 90 deletions

View file

@ -48,13 +48,13 @@ int squit_cmd(const char *who, const char *quitmsg) {
int spart_cmd(const char *who, const char *chan) {
sts("%s %s %s", who, (me.token ? TOK_PART : MSG_PART), chan);
part_chan(finduser(who), chan);
part_chan(finduser(who), (char *)chan);
return 1;
}
int sjoin_cmd(const char *who, const char *chan) {
sts(":%s %s %s", who, (me.token ? TOK_JOIN : MSG_JOIN), chan);
join_chan(finduser(who), chan);
join_chan(finduser(who), (char *)chan);
return 1;
}
@ -151,7 +151,7 @@ int ssvspart_cmd(const char *target, const char *chan) {
int skick_cmd(const char *who, const char *target, const char *chan, const char *reason) {
sts(":%s %s %s %s :%s", who, (me.token ? TOK_KICK : MSG_KICK), chan, target, (reason ? reason : "No Reason Given"));
part_chan(finduser(target), chan);
part_chan(finduser(target), (char *)chan);
return 1;
}
int swallops_cmd(const char *who, const char *msg,...) {

14
chans.c
View file

@ -5,7 +5,7 @@
** Based from GeoStats 1.1.0 by Johnathan George net@lite.net
*
** NetStats CVS Identification
** $Id: chans.c,v 1.4 2002/03/08 09:01:00 fishwaldo Exp $
** $Id: chans.c,v 1.5 2002/03/08 11:46:07 fishwaldo Exp $
*/
#include <fnmatch.h>
@ -26,6 +26,7 @@ Chans *new_chan(char *chan) {
Chans *c;
hnode_t *cn;
strcpy(segv_location, "new_chan");
c = malloc(sizeof(Chans));
strcpy(c->name, chan);
cn = hnode_create(c);
@ -38,6 +39,7 @@ Chans *new_chan(char *chan) {
}
void del_chan(Chans *c) {
hnode_t *cn;
strcpy(segv_location, "del_chan");
cn = hash_lookup(ch, c->name);
if (!cn) {
log("Hu, Deleting a Non Existand Channel?");
@ -53,7 +55,7 @@ void del_chan(Chans *c) {
void part_chan(User *u, char *chan) {
Chans *c;
hnode_t *un;
strcpy(segv_location, "part_chan");
if (!u) {
log("Ehh, Parting a Unknown User from Chan %s: %s", chan, recbuf);
return;
@ -84,7 +86,7 @@ void part_chan(User *u, char *chan) {
void change_user_nick(Chans *c, char *newnick, char *oldnick) {
hnode_t *cm;
strcpy(segv_location, "change_user_nick");
cm = hash_lookup(c->chanmembers, oldnick);
if (!cm) {
log("change_user_nick() %s isn't a member of %s", oldnick, c->name);
@ -102,7 +104,7 @@ void join_chan(User *u, char *chan) {
Chans *c;
hnode_t *un;
Chanmem *cm;
strcpy(segv_location, "join_chan");
if (!u) {
log("ehhh, Joining a Unknown user to %s: %s", chan, recbuf);
return;
@ -141,7 +143,7 @@ void chandump(User *u, char *chan) {
hscan_t sc, scm;
Chans *c;
Chanmem *cm;
strcpy(segv_location, "chandump");
if (!chan) {
sendcoders("Channels %d", hash_count(ch));
hash_scan_begin(&sc, ch);
@ -173,7 +175,7 @@ void chandump(User *u, char *chan) {
Chans *findchan(char *chan) {
Chans *c;
hnode_t *cn;
strcpy(segv_location, "findchan");
cn = hash_lookup(ch, chan);
if (cn) {
c = hnode_get(cn);

4
conf.c
View file

@ -71,7 +71,7 @@ done_mods = 0;
void cb_Module(char *arg, int configtype) {
int i;
segv_location= sstrdup("cb_Module");
strcpy(segv_location, "cb_Module");
for (i = 1; (i < NUM_MODULES) && (load_mods[i] != 0); i++) {
if (!strcasecmp(load_mods[i], arg)) {
return;
@ -85,7 +85,7 @@ int init_modules() {
int i;
int rval;
segv_location=sstrdup("init_modules");
strcpy(segv_location,"init_modules");
for (i = 1; (i < NUM_MODULES) && (load_mods[i] !=0); i++) {
#ifdef DEBUG
log("Loading Module %s", load_mods[i]);

44
dl.c
View file

@ -23,7 +23,7 @@ void init_dl() {
if (usr_mds);
};
void __init_mod_list() {
segv_location = sstrdup("__init_mod_list");
strcpy(segv_location, "__init_mod_list");
mh = hash_create(NUM_MODULES, 0, 0);
bh = hash_create(B_TABLE_SIZE, 0, 0);
@ -35,7 +35,7 @@ static Mod_Timer *new_timer(char *timer_name)
{
Mod_Timer *t;
hnode_t *tn;
segv_location = sstrdup("Mod_Timer");
strcpy(segv_location, "Mod_Timer");
#ifdef DEBUG
log("New Timer: %s", timer_name);
#endif
@ -56,7 +56,7 @@ static Mod_Timer *new_timer(char *timer_name)
Mod_Timer *findtimer(char *timer_name) {
hnode_t *tn;
segv_location = sstrdup("findtimer");
strcpy(segv_location, "findtimer");
tn = hash_lookup(th, timer_name);
if (tn) return (Mod_Timer *)hnode_get(tn);
return NULL;
@ -64,7 +64,7 @@ Mod_Timer *findtimer(char *timer_name) {
int add_mod_timer(char *func_name, char *timer_name, char *mod_name, int interval) {
Mod_Timer *Mod_timer_list;
segv_location = sstrdup("add_mod_timer");
strcpy(segv_location, "add_mod_timer");
if (dlsym((int *)get_dl_handle(mod_name), func_name) == NULL) {
@ -83,7 +83,7 @@ int add_mod_timer(char *func_name, char *timer_name, char *mod_name, int interva
int del_mod_timer(char *timer_name) {
Mod_Timer *list;
hnode_t *tn;
segv_location = sstrdup("del_mod_timer");
strcpy(segv_location, "del_mod_timer");
tn = hash_lookup(th, timer_name);
if (tn) {
@ -104,7 +104,7 @@ void list_module_timer(User *u) {
hscan_t ts;
hnode_t *tn;
segv_location = sstrdup("list_module_timer");
strcpy(segv_location, "list_module_timer");
privmsg(u->nick,s_Services,"Module timer List:");
hash_scan_begin(&ts, th);
while ((tn = hash_scan_next(&ts)) != NULL) {
@ -122,7 +122,7 @@ static Sock_List *new_sock(char *sock_name)
Sock_List *s;
hnode_t *sn;
segv_location = sstrdup("Sock_List");
strcpy(segv_location, "Sock_List");
#ifdef DEBUG
log("New Socket: %s", sock_name);
#endif
@ -142,7 +142,7 @@ static Sock_List *new_sock(char *sock_name)
Sock_List *findsock(char *sock_name) {
hnode_t *sn;
segv_location = sstrdup("findsock");
strcpy(segv_location, "findsock");
sn = hash_lookup(sockh, sock_name);
if (sn) return hnode_get(sn);
return NULL;
@ -151,7 +151,7 @@ Sock_List *findsock(char *sock_name) {
int add_socket(char *func_name, char *sock_name, int socknum, char *mod_name) {
Sock_List *Sockets_mod_list;
segv_location = sstrdup("add_Socket");
strcpy(segv_location, "add_Socket");
if (dlsym((int *)get_dl_handle(mod_name), func_name) == NULL) {
log("oh oh, the socket function doesn't exist");
@ -170,7 +170,7 @@ int add_socket(char *func_name, char *sock_name, int socknum, char *mod_name) {
int del_socket(char *sock_name) {
Sock_List *list;
hnode_t *sn;
segv_location = sstrdup("del_mod_timer");
strcpy(segv_location, "del_mod_timer");
sn = hash_lookup(sockh, sock_name);
if (sn) {
@ -191,7 +191,7 @@ void list_sockets(User *u) {
hscan_t ss;
hnode_t *sn;
segv_location = sstrdup("list_sockets");
strcpy(segv_location, "list_sockets");
privmsg(u->nick,s_Services,"Sockets List: (%d)", hash_count(sockh));
hash_scan_begin(&ss, sockh);
while ((sn = hash_scan_next(&ss)) != NULL) {
@ -208,7 +208,7 @@ static Mod_User *new_bot(char *bot_name)
{
Mod_User *u;
hnode_t *bn;
segv_location = sstrdup("Mod_User");
strcpy(segv_location, "Mod_User");
#ifdef DEBUG
log("New Bot: %s", bot_name);
#endif
@ -231,7 +231,7 @@ int add_mod_user(char *nick, char *mod_name) {
Module *list_ptr;
hnode_t *mn;
segv_location = sstrdup("add_mod_user");
strcpy(segv_location, "add_mod_user");
Mod_Usr_list = new_bot(nick);
@ -253,7 +253,7 @@ int add_mod_user(char *nick, char *mod_name) {
Mod_User *findbot(char *bot_name) {
hnode_t *bn;
segv_location = sstrdup("findbot");
strcpy(segv_location, "findbot");
bn = hash_lookup(bh, bot_name);
if (bn) {
return (Mod_User *)hnode_get(bn);
@ -265,7 +265,7 @@ int del_mod_user(char *bot_name) {
Mod_User *list;
hnode_t *bn;
segv_location = sstrdup("del_mod_user");
strcpy(segv_location, "del_mod_user");
bn = hash_lookup(bh, bot_name);
if (bn) {
@ -287,7 +287,7 @@ int bot_nick_change(char *oldnick, char *newnick)
User *u;
Mod_User *mod_tmp, *mod_ptr = NULL;
segv_location = sstrdup("bot_nick_change");
strcpy(segv_location, "bot_nick_change");
/* First, try to find out if the newnick is unique! */
#ifdef DEBUG
@ -330,7 +330,7 @@ void list_module_bots(User *u) {
Mod_User *mod_ptr = NULL;
hnode_t *bn;
hscan_t bs;
segv_location = sstrdup("list_module_bots");
strcpy(segv_location, "list_module_bots");
privmsg(u->nick,s_Services,"Module Bot List:");
hash_scan_begin(&bs, bh);
@ -372,7 +372,7 @@ int load_module(char *path1, User *u) {
Module *mod_ptr = NULL;
hnode_t *mn;
segv_location = sstrdup("load_module");
strcpy(segv_location, "load_module");
if (u == NULL) {
do_msg = 0;
@ -509,7 +509,7 @@ int load_module(char *path1, User *u) {
extern int get_dl_handle(char *mod_name) {
Module *list_ptr;
hnode_t *mn;
segv_location = sstrdup("get_dl_handle");
strcpy(segv_location, "get_dl_handle");
mn = hash_lookup(mh, mod_name);
@ -528,7 +528,7 @@ void list_module(User *u) {
hnode_t *mn;
hscan_t hs;
segv_location = sstrdup("list_module");
strcpy(segv_location, "list_module");
hash_scan_begin(&hs, mh);
while ((mn = hash_scan_next(&hs)) != NULL) {
mod_ptr=hnode_get(mn);
@ -558,7 +558,7 @@ int unload_module(char *module_name, User *u) {
int fmode;
segv_location = sstrdup("unload_module");
strcpy(segv_location, "unload_module");
/* Check to see if this Module has any timers registered.... */
notice(s_Services, "Unloading Module %s", module_name);
@ -589,7 +589,7 @@ int unload_module(char *module_name, User *u) {
del_bot(mod_ptr->nick, "Module Unloaded");
}
}
segv_location = sstrdup("unload_unlock");
strcpy(segv_location, "unload_unlock");
/* Unlock .so Module File to 755 Permissions */
/* Shmad Perscribes 666 */
modnme = fopen("Mod-Name.tmp","w");

9
hash.c
View file

@ -14,7 +14,7 @@
* into proprietary software; there is no requirement for such software to
* contain a copyright notice related to this source.
*
* $Id: hash.c,v 1.2 2002/02/28 10:33:10 fishwaldo Exp $
* $Id: hash.c,v 1.3 2002/03/08 11:46:07 fishwaldo Exp $
* $Name: $
*/
@ -22,11 +22,12 @@
#include <stddef.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#define HASH_IMPLEMENTATION
#include "hash.h"
#ifdef KAZLIB_RCSID
static const char rcsid[] = "$Id: hash.c,v 1.2 2002/02/28 10:33:10 fishwaldo Exp $";
static const char rcsid[] = "$Id: hash.c,v 1.3 2002/03/08 11:46:07 fishwaldo Exp $";
#endif
#define INIT_BITS 6
@ -827,10 +828,10 @@ static hash_val_t hash_fun_default(const void *key)
hash_val_t acc = 0;
while (*str) {
acc ^= randbox[(*str + acc) & 0xf];
acc ^= randbox[(tolower(*str) + acc) & 0xf];
acc = (acc << 1) | (acc >> 31);
acc &= 0xffffffffU;
acc ^= randbox[((*str++ >> 4) + acc) & 0xf];
acc ^= randbox[((tolower(*str++) >> 4) + acc) & 0xf];
acc = (acc << 2) | (acc >> 30);
acc &= 0xffffffffU;
}

32
ircd.c
View file

@ -203,7 +203,7 @@ int init_bot(char *nick, char *user, char *host, char *rname, char *modes, char
{
User *u;
char cmd[63];
segv_location = sstrdup("init_bot");
strcpy(segv_location, "init_bot");
u = finduser(nick);
if (u) {
log("Attempting to Login with a Nickname that already Exists: %s",nick);
@ -222,7 +222,7 @@ int init_bot(char *nick, char *user, char *host, char *rname, char *modes, char
int del_bot(char *nick, char *reason)
{
User *u;
segv_location = sstrdup("del_bot");
strcpy(segv_location, "del_bot");
u = finduser(nick);
#ifdef DEBUG
log("Killing %s for %s",nick,reason);
@ -246,7 +246,7 @@ void Module_Event(char *event, void *data) {
hscan_t ms;
hnode_t *mn;
segv_location = sstrdup("Module_Event");
strcpy(segv_location, "Module_Event");
hash_scan_begin(&ms, mh);
while ((mn = hash_scan_next(&ms)) != NULL) {
module_ptr = hnode_get(mn);
@ -257,7 +257,7 @@ void Module_Event(char *event, void *data) {
#ifdef DEBUG
log("Running Module %s for Comamnd %s -> %s",module_ptr->info->module_name, event, ev_list->cmd_name);
#endif
segv_location = sstrdup(module_ptr->info->module_name);
strcpy(segv_location, module_ptr->info->module_name);
strcpy(segvinmodule, module_ptr->info->module_name);
if (setjmp(sigvbuf) == 0) {
ev_list->function(data);
@ -265,7 +265,7 @@ void Module_Event(char *event, void *data) {
log("setjmp() Failed, Can't call Module %s\n", module_ptr->info->module_name);
}
strcpy(segvinmodule, "");
segv_location = sstrdup("Module_Event_Return");
strcpy(segv_location, "Module_Event_Return");
break;
}
ev_list++;
@ -352,7 +352,7 @@ void parse(char *line)
hscan_t ms;
hnode_t *mn;
segv_location = sstrdup("parse");
strcpy(segv_location, "parse");
strip(line);
strcpy(recbuf, line);
if (!(*line))
@ -401,9 +401,9 @@ void parse(char *line)
}
if (!strcasecmp(s_Services,av[0])) {
/* its to the Internal Services Bot */
segv_location = sstrdup("servicesbot");
strcpy(segv_location, "servicesbot");
servicesbot(origin,av, ac);
segv_location = sstrdup("ServicesBot_return");
strcpy(segv_location, "ServicesBot_return");
free(av);
return;
} else {
@ -422,13 +422,13 @@ void parse(char *line)
return;
}
segv_location = sstrdup(list->modname);
strcpy(segv_location, list->modname);
strcpy(segvinmodule, list->modname);
if (setjmp(sigvbuf) == 0) {
list->function(origin, av, ac);
}
strcpy(segvinmodule, "");
segv_location = sstrdup("Return from Module Message");
strcpy(segv_location, "Return from Module Message");
free(av);
return;
}
@ -437,18 +437,18 @@ void parse(char *line)
}
/* now, Parse the Command to the Internal Functions... */
segv_location = sstrdup("Parse - Internal Functions");
strcpy(segv_location, "Parse - Internal Functions");
for (I=0; I < ((sizeof(cmd_list) / sizeof(cmd_list[0])) -1); I++) {
if (!strcasecmp(cmd_list[I].name, cmd)) {
if (cmd_list[I].srvmsg == cmdptr) {
segv_location = sstrdup(cmd_list[I].name);
strcpy(segv_location, cmd_list[I].name);
cmd_list[I].function(origin, av, ac);
break; log("should never get here-Parse");
}
}
}
/* K, now Parse it to the Module functions */
segv_location = sstrdup("Parse - Module Functions");
strcpy(segv_location, "Parse - Module Functions");
hash_scan_begin(&ms, mh);
while ((mn = hash_scan_next(&ms)) != NULL) {
module_ptr = hnode_get(mn);
@ -460,13 +460,13 @@ void parse(char *line)
#ifdef DEBUG
log("Running Module %s for Function %s", module_ptr->info->module_name, fn_list->cmd_name);
#endif
segv_location = sstrdup(module_ptr->info->module_name);
strcpy(segv_location, module_ptr->info->module_name);
strcpy(segvinmodule, module_ptr->info->module_name);
if (setjmp(sigvbuf) == 0) {
fn_list->function(origin, av, ac);
}
strcpy(segvinmodule, "");
segv_location = sstrdup("Parse_Return_Module");
strcpy(segv_location, "Parse_Return_Module");
break;
log("Should never get here-Parse");
}
@ -491,7 +491,7 @@ they should update the internal Structures */
void init_ServBot()
{
char rname[63];
segv_location = sstrdup("init_ServBot");
strcpy(segv_location, "init_ServBot");
sprintf(rname, "/msg %s \2HELP\2", s_Services);
snewnick_cmd(s_Services, Servbot.user, Servbot.host, rname);
sumode_cmd(s_Services, s_Services, UMODE_SERVICES | UMODE_DEAF | UMODE_KIX);

12
main.c
View file

@ -38,7 +38,7 @@ int forked = 0;
int main()
{
FILE *fp;
segv_location = sstrdup("main");
strcpy(segv_location, "main");
strcpy(segvinmodule, "");
me.onchan = 0;
if (usr_mds)
@ -121,9 +121,11 @@ RETSIGTYPE serv_segv() {
if (strlen(segvinmodule) > 1) {
log("Uh Oh, Segmentation Fault in Modules Code %s", segvinmodule);
log("Location could be %s", segv_location);
log("Unloading Module and restoring stacks");
globops(me.name, "Oh Damn, Module %s Segv'd, Unloading Module", segvinmodule);
notice(s_Services, "Oh Damn, Module %s Segv'd, Unloading Module", segvinmodule);
notice(s_Services, "Location *could* be %s", segv_location);
strcpy(name, segvinmodule);
strcpy(segvinmodule, "");
unload_module(name, NULL);
@ -187,7 +189,7 @@ void RemoveLock()
char buf[512];
int fmode;
segv_location = sstrdup("main_RemoveLock");
strcpy(segv_location, "main_RemoveLock");
lckfile = fopen("data/Lock.db", "r");
@ -207,7 +209,7 @@ void start()
{
static int attempts = 0;
segv_location = sstrdup("start");
strcpy(segv_location, "start");
TimerReset();
init_server_hash();
init_user_hash();
@ -244,7 +246,7 @@ void start()
void login()
{
segv_location = sstrdup("login");
strcpy(segv_location, "login");
slogin_cmd(me.name, 1, me.infoline, me.pass);
sprotocol_cmd("TOKEN");
}
@ -254,7 +256,7 @@ void *smalloc(long size)
{
void *buf;
segv_location = sstrdup("smalloc");
strcpy(segv_location, "smalloc");
if (!size) {
log("smalloc(): illegal attempt to allocate 0 bytes!");
size = 1;

View file

@ -259,7 +259,7 @@ extern void ns_shutdown(User *u, char *reason)
hnode_t *mn;
char quitmsg[255];
segv_location = sstrdup("ns_shutdown");
strcpy(segv_location, "ns_shutdown");
/* Unload the Modules */
hash_scan_begin(&ms, mh);
while ((mn = hash_scan_next(&ms)) != NULL) {
@ -284,7 +284,7 @@ extern void ns_shutdown(User *u, char *reason)
static void ns_reload(User *u, char *reason)
{
char quitmsg[255];
segv_location = sstrdup("ns_reload");
strcpy(segv_location, "ns_reload");
globops(s_Services, "%s requested \2RELOAD\2 for %s", u->nick, reason);
log("%s requested RELOAD.", u->nick);
sprintf(quitmsg, "%s Sent RELOAD: %s", u->nick, (reason ? reason : "No reason"));
@ -321,7 +321,7 @@ static void ns_logs(User *u)
FILE *fp;
char buf[512];
segv_location = sstrdup("ns_logs");
strcpy(segv_location, "ns_logs");
fp = fopen("logs/stats.log", "r");
if (!fp) {
@ -339,7 +339,7 @@ static void ns_logs(User *u)
static void ns_jupe(User *u, char *server)
{
char infoline[255];
segv_location = sstrdup("ns_jupe");
strcpy(segv_location, "ns_jupe");
sprintf(infoline, "[Jupitered by %s]", u->nick);
sserver_cmd(server, 1, infoline);
log("%s!%s@%s jupitered %s", u->nick, u->username, u->hostname, server);
@ -347,7 +347,7 @@ static void ns_jupe(User *u, char *server)
static void ns_JOIN(User *u, char *chan)
{
segv_location = sstrdup("ns_JOIN");
strcpy(segv_location, "ns_JOIN");
globops(s_Services, "JOINING CHANNEL -\2(%s)\2- Thanks to %s!%s@%s)", chan, u->nick, u->username, u->hostname);
privmsg(me.chan, s_Services, "%s Asked me to Join %s, So, I'm Leaving %s", u->nick, chan, me.chan);
spart_cmd(s_Services, me.chan);
@ -359,7 +359,7 @@ static void ns_JOIN(User *u, char *chan)
void ns_debug_to_coders(char *u)
{
char realname[63];
segv_location = sstrdup("ns_debug_to_coders");
strcpy(segv_location, "ns_debug_to_coders");
if (!me.coder_debug) {
me.coder_debug = 1;
if (!u) {
@ -389,7 +389,7 @@ void ns_debug_to_coders(char *u)
static void ns_raw(User *u, char *message)
{
int sent;
segv_location = sstrdup("ns_raw");
strcpy(segv_location, "ns_raw");
notice(s_Services,"\2RAW COMMAND\2 \2%s\2 Issued a Raw Command!(%s)",u->nick, message);
#ifdef DEBUG
log("SENT: %s", message);
@ -405,7 +405,7 @@ static void ns_raw(User *u, char *message)
}
static void ns_user_dump(User *u)
{
segv_location = sstrdup("ns_user_dump");
strcpy(segv_location, "ns_user_dump");
if (!(UserLevel(u) >= 180)) {
privmsg(u->nick, s_Services, "Permission Denied, you need to be at least a NetAdmin to Enable Debug Mode!");
return;
@ -415,7 +415,7 @@ static void ns_user_dump(User *u)
}
static void ns_server_dump(User *u)
{
segv_location = sstrdup("ns_server_dump");
strcpy(segv_location, "ns_server_dump");
if (!(UserLevel(u) >= 180)) {
privmsg(u->nick, s_Services, "Permission Denied, you need to be at least a NetAdmin to Enable Debug Mode!");
return;
@ -425,7 +425,7 @@ static void ns_server_dump(User *u)
}
static void ns_chan_dump(User *u, char *chan)
{
segv_location = sstrdup("ns_chan_dump");
strcpy(segv_location, "ns_chan_dump");
if (!(UserLevel(u) >= 180)) {
privmsg(u->nick, s_Services, "Permission Denied, you need to be at least a NetAdmin to Enable Debug Mode!");
@ -437,7 +437,7 @@ static void ns_chan_dump(User *u, char *chan)
static void ns_uptime(User *u)
{
int uptime = time (NULL) - me.t_start;
segv_location = sstrdup("ns_uptime");
strcpy(segv_location, "ns_uptime");
log("Time Difference %d", uptime);
log("Statistical Server Up %d days, %d:%02d:%02d", uptime/86400, (uptime/3600) % 24, (uptime/60) % 60, uptime % 60);
@ -465,7 +465,7 @@ static void ns_uptime(User *u)
}
static void ns_version(User *u)
{
segv_location = sstrdup("ns_version");
strcpy(segv_location, "ns_version");
privmsg(u->nick, s_Services, "\2NeoStats Version Information\2");
privmsg(u->nick, s_Services, "NeoStats Version: %s", version);
privmsg(u->nick, s_Services, "http://www.neostats.net");
@ -474,7 +474,7 @@ static void ns_version(User *u)
static void ns_roots(User *u)
{
segv_location = sstrdup("ns_roots");
strcpy(segv_location, "ns_roots");
privmsg(u->nick, s_Services, "\2NeoStats ROOT users\2");
privmsg(u->nick, s_Services, "%s",me.roots);
privmsg(u->nick, s_Services, "These are setable in stats.cfg now");

8
sock.c
View file

@ -5,7 +5,7 @@
** Based from GeoStats 1.1.0 by Johnathan George net@lite.net
*
** NetStats CVS Identification
** $Id: sock.c,v 1.13 2002/03/05 12:59:58 fishwaldo Exp $
** $Id: sock.c,v 1.14 2002/03/08 11:46:08 fishwaldo Exp $
*/
#include "stats.h"
@ -53,10 +53,10 @@ void read_loop()
hnode_t *sn;
while (1) {
segv_location = sstrdup("Read_Loop");
strcpy(segv_location, "Read_Loop");
memset(buf, '\0', BUFSIZE);
chk();
segv_location = sstrdup("Read_Loop2");
strcpy(segv_location, "Read_Loop2");
FD_ZERO(&readfds);
TimeOut.tv_sec = 1;
TimeOut.tv_usec = 0;
@ -137,7 +137,7 @@ void ResetLogs()
char tmp[25];
time_t t = time(NULL);
segv_location = sstrdup("ResetLogs");
strcpy(segv_location, "ResetLogs");
strftime(tmp, 25, "logs/stats-%m-%d.log", localtime(&t));
rename("stats.log", tmp);
log("Started fresh logfile.");

12
stats.h
View file

@ -30,7 +30,6 @@
#include <setjmp.h>
#include "list.h"
#include "hash.h"
#include "config.h"
#if UNREAL == 1
@ -68,7 +67,7 @@ int servsock;
int times;
extern char s_Debug[MAXNICK], s_Services[MAXNICK];
extern const char version[];
char recbuf[BUFSIZE], *segv_location;
char recbuf[BUFSIZE], segv_location[255];
char segvinmodule[30];
jmp_buf sigvbuf;
@ -289,4 +288,13 @@ extern void servicesbot(char *nick, char **av, int ac);
extern void ns_debug_to_coders(char *);
extern void ns_shutdown(User *, char *);
/* chans.c */
extern void chandump(User *u, char *chan);
extern void part_chan(User *u, char *chan);
extern void join_chan(User *u, char *chan);
extern void change_user_nick(Chans *c, char *newnick, char *oldnick);
#endif

View file

@ -29,7 +29,7 @@ void chk()
hscan_t ts;
hnode_t *tn;
segv_location = sstrdup("chk");
strcpy(segv_location, "chk");
/* First, lets see if any modules have a function that is due to run..... */
hash_scan_begin(&ts, th);
while ((tn = hash_scan_next(&ts)) != NULL) {

26
users.c
View file

@ -5,7 +5,7 @@
** Based from GeoStats 1.1.0 by Johnathan George net@lite.net
*
** NetStats CVS Identification
** $Id: users.c,v 1.20 2002/03/08 09:00:31 fishwaldo Exp $
** $Id: users.c,v 1.21 2002/03/08 11:46:08 fishwaldo Exp $
*/
#include <fnmatch.h>
@ -33,6 +33,7 @@ User *new_user(const char *nick)
User *u;
hnode_t *un;
strcpy(segv_location, "new_user");
/* before we add a new user, we check the table */
if (!hash_verify(uh)) {
globops(me.name,"Eeeeek, Users table is corrupted! Continuing but expect a crash!");
@ -59,6 +60,7 @@ void AddUser(const char *nick, const char *user, const char *host, const char *s
#ifdef DEBUG
log("AddUser(): %s (%s@%s) -> %s", nick, user, host, server);
#endif
strcpy(segv_location, "AddUser");
u = finduser(nick);
if (u) {
log("trying to add a user that already exists? (%s)", nick);
@ -85,6 +87,7 @@ void DelUser(const char *nick)
hnode_t *un, *cn;
hscan_t sc;
strcpy(segv_location, "DelUser");
#ifdef DEBUG
log("DelUser(%s)", nick);
#endif
@ -108,10 +111,10 @@ void Change_User(User *u, const char *newnick)
{
hnode_t *un, *cm;
hscan_t cs;
strcpy(segv_location, "Change_User");
#ifdef DEBUG
log("Change_User(%s, %s)", u->nick, newnick);
#endif
un = hash_lookup(uh, u->nick);
if (!un) {
log("ChangeUser(%s) Failed!", u->nick);
@ -119,9 +122,9 @@ void Change_User(User *u, const char *newnick)
}
hash_scan_begin(&cs, u->chans);
while ((cm = hash_scan_next(&cs)) != NULL) {
change_user_nick(findchan(hnode_get(cm)), newnick, u->nick);
change_user_nick(findchan(hnode_get(cm)), (char *)newnick, u->nick);
}
strcpy(segv_location, "Change_User_Return");
hash_delete(uh, un);
strcpy(u->nick, newnick);
hash_insert(uh, un, u->nick);
@ -130,11 +133,7 @@ void sendcoders(char *message,...)
{
va_list ap;
char tmp[512];
#ifdef UNREAL
User *u;
hscan_t us;
hnode_t *un;
#endif
strcpy(segv_location, "sendcoders");
va_start(ap, message);
vsnprintf (tmp, 512, message, ap);
if (!me.coder_debug)
@ -155,14 +154,15 @@ User *finduser(const char *nick)
{
User *u;
hnode_t *un;
char *tmp;
strcpy(segv_location, "finduser");
un = hash_lookup(uh, nick);
if (un != NULL) {
u = hnode_get(un);
return u;
} else {
#ifdef DEBUG
log("FindUser(%s) -> NOTFOUND", nick);
#endif
return NULL;
}
@ -180,6 +180,7 @@ void UserDump()
User *u;
hnode_t *un, *cm;
hscan_t us, cs;
strcpy(segv_location, "UserDump");
sendcoders("Users======================");
hash_scan_begin(&us, uh);
while ((un = hash_scan_next(&us)) != NULL) {
@ -194,7 +195,7 @@ void UserDump()
int UserLevel(User *u) {
int i, tmplvl = 0;
strcpy(segv_location, "UserLevel");
for (i=0; i < ((sizeof(usr_mds) / sizeof(usr_mds[0])) -1);i++) {
if (u->Umode & usr_mds[i].umodes) {
if (usr_mds[i].level > tmplvl) tmplvl = usr_mds[i].level;
@ -221,6 +222,7 @@ void UserMode(const char *nick, const char *modes)
int i;
char tmpmode;
strcpy(segv_location, "UserMode");
u = finduser(nick);
if (!u) {
log("Warning, Changing Modes for a Unknown User %s!", nick);