[srvx-commits] CVS: services/src helpserv.c,1.71,1.72 log.c,1.60,1.61 log.h,1.25,1.26 modcmd.c,1.58,
Brought to you by:
entrope
From: Entrope <en...@us...> - 2003-07-15 21:25:48
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv9969/src Modified Files: helpserv.c log.c log.h modcmd.c Log Message: for log_audit(), pass channel name char* instead of chanNode* (in case the command makes the channel go away) Index: helpserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/helpserv.c,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -r1.71 -r1.72 *** helpserv.c 8 Jul 2003 14:39:25 -0000 1.71 --- helpserv.c 15 Jul 2003 21:25:45 -0000 1.72 *************** *** 963,967 **** if (cmd->func) { if (cmd->func(user, hs, 0, argc, argv+argv_shift)) { ! log_audit(HS_LOG, LOG_COMMAND, user, hs->helpserv, hs->helpchan, 0, text); } } else { --- 963,967 ---- if (cmd->func) { if (cmd->func(user, hs, 0, argc, argv+argv_shift)) { ! log_audit(HS_LOG, LOG_COMMAND, user, hs->helpserv, hs->helpchan->name, 0, text); } } else { Index: log.c =================================================================== RCS file: /cvsroot/srvx/services/src/log.c,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -r1.60 -r1.61 *** log.c 15 Jul 2003 00:50:00 -0000 1.60 --- log.c 15 Jul 2003 21:25:45 -0000 1.61 *************** *** 443,447 **** void ! log_audit(struct log_type *type, enum log_severity sev, struct userNode *user, struct userNode *bot, struct chanNode *channel, unsigned int flags, const char *command) { struct logEntry *entry; --- 443,447 ---- void ! log_audit(struct log_type *type, enum log_severity sev, struct userNode *user, struct userNode *bot, const char *channel_name, unsigned int flags, const char *command) { struct logEntry *entry; *************** *** 457,461 **** size = sizeof(*entry) + strlen(user->nick) + strlen(command) + 2; if (user->handle_info) size += strlen(user->handle_info->handle) + 1; ! if (channel) size += strlen(channel->name) + 1; if (flags & AUDIT_HOSTMASK) size += strlen(user->ident) + strlen(user->hostname) + 2; entry = calloc(1, size); --- 457,461 ---- size = sizeof(*entry) + strlen(user->nick) + strlen(command) + 2; if (user->handle_info) size += strlen(user->handle_info->handle) + 1; ! if (channel_name) size += strlen(channel_name) + 1; if (flags & AUDIT_HOSTMASK) size += strlen(user->ident) + strlen(user->hostname) + 2; entry = calloc(1, size); *************** *** 464,470 **** entry->slvl = sev; entry->bot = bot; ! if (channel) { ! size = strlen(channel->name) + 1; ! entry->channel_name = memcpy(str_next, channel->name, size); str_next += size; } --- 464,470 ---- entry->slvl = sev; entry->bot = bot; ! if (channel_name) { ! size = strlen(channel_name) + 1; ! entry->channel_name = memcpy(str_next, channel_name, size); str_next += size; } Index: log.h =================================================================== RCS file: /cvsroot/srvx/services/src/log.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** log.h 10 Jul 2003 23:06:22 -0000 1.25 --- log.h 15 Jul 2003 21:25:45 -0000 1.26 *************** *** 43,47 **** void log_debug(void); - /* bitmap values in flags parameter to log_audit */ #define AUDIT_HOSTMASK 0x01 --- 43,46 ---- *************** *** 49,53 **** struct log_type *log_register_type(const char *name, struct userNode *bot, const char *default_log); /* constraint for log_audit: sev one of LOG_COMMAND, LOG_OVERRIDE, LOG_STAFF */ ! void log_audit(struct log_type *type, enum log_severity sev, struct userNode *user, struct userNode *bot, struct chanNode *channel, unsigned int flags, const char *command); /* constraint for log_module: sev < LOG_COMMAND */ void log_module(struct log_type *type, enum log_severity sev, const char *format, ...) PRINTF_LIKE(3, 4); --- 48,52 ---- struct log_type *log_register_type(const char *name, struct userNode *bot, const char *default_log); /* constraint for log_audit: sev one of LOG_COMMAND, LOG_OVERRIDE, LOG_STAFF */ ! void log_audit(struct log_type *type, enum log_severity sev, struct userNode *user, struct userNode *bot, const char *channel_name, unsigned int flags, const char *command); /* constraint for log_module: sev < LOG_COMMAND */ void log_module(struct log_type *type, enum log_severity sev, const char *format, ...) PRINTF_LIKE(3, 4); Index: modcmd.c =================================================================== RCS file: /cvsroot/srvx/services/src/modcmd.c,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -r1.58 -r1.59 *** modcmd.c 15 Jul 2003 00:49:31 -0000 1.58 --- modcmd.c 15 Jul 2003 21:25:45 -0000 1.59 *************** *** 625,628 **** --- 625,630 ---- struct svccmd *cmd; unsigned int cmd_arg, perms, flags, options; + char channel_name[CHANNELLEN+1]; + options = (server_qualified ? SVCCMD_QUALIFIED : 0) | (channel ? SVCCMD_IN_CHANNEL : 0) | SVCCMD_DEBIT | SVCCMD_NOISY; /* Find the command argument. */ *************** *** 719,722 **** --- 721,726 ---- if (perms & ACTION_NOCHANNEL) channel = NULL; + if (channel) safestrncpy(channel_name, channel->name, sizeof(channel_name)); + else channel_name[0] = 0; if (!cmd->command->func(user, channel, argc, argv, cmd)) return 0; if (!(flags & MODCMD_NO_LOG)) { *************** *** 727,731 **** /* Unsplit argv after running the function to get the benefit * of any mangling/hiding done by the commands. */ ! log_audit(cmd->command->parent->clog, slvl, user, service->bot, channel, ((flags & MODCMD_LOG_HOSTMASK) ? AUDIT_HOSTMASK : 0), unsplit_string(argv, argc, NULL)); } return 1; --- 731,735 ---- /* Unsplit argv after running the function to get the benefit * of any mangling/hiding done by the commands. */ ! log_audit(cmd->command->parent->clog, slvl, user, service->bot, channel_name, ((flags & MODCMD_LOG_HOSTMASK) ? AUDIT_HOSTMASK : 0), unsplit_string(argv, argc, NULL)); } return 1; |