[srvx-commits] CVS: services/src chanserv.help,1.10.2.20,1.10.2.21 opserv.c,1.187.2.46,1.187.2.47
Brought to you by:
entrope
From: Paul C. <zo...@us...> - 2001-08-18 00:55:06
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv12330/src Modified Files: Tag: rel-1_0 chanserv.help opserv.c Log Message: DOcument CMD_SUSPEND_OVERRIDE flag, fix a crash in OpServ's cmd_access, and prevent srvx from crashing when the issuer of a ?trace kill is a victim. Index: chanserv.help =================================================================== RCS file: /cvsroot/srvx/services/src/chanserv.help,v retrieving revision 1.10.2.20 retrieving revision 1.10.2.21 diff -C2 -r1.10.2.20 -r1.10.2.21 *** chanserv.help 2001/08/09 12:28:39 1.10.2.20 --- chanserv.help 2001/08/18 00:55:03 1.10.2.21 *************** *** 181,184 **** --- 181,185 ---- "$b256$b Do not log command usage (usually for read-only commands)", "$b512$b User must be a helper", + "$b1024$b Command may be used in a suspended channel", "As a side note, the bits with values 8 and 16 are not useful by themselves. For example, channels that may only be used by users on a channel's userlist usually have bits 2, 4, 8 and 16 set (flags 30). Furthermore, the flags noted as \"Locked\" above cannot be turned off; they will be re-enabled silently if you try to turn them off."); "DELBAN" ("$bDELBAN$b", Index: opserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/opserv.c,v retrieving revision 1.187.2.46 retrieving revision 1.187.2.47 diff -C2 -r1.187.2.46 -r1.187.2.47 *** opserv.c 2001/08/16 02:39:18 1.187.2.46 --- opserv.c 2001/08/18 00:55:03 1.187.2.47 *************** *** 295,299 **** while (0) ! typedef void (*discrim_search_func)(struct userNode *match, void *extra); struct userNode *opserv; --- 295,299 ---- while (0) ! typedef int (*discrim_search_func)(struct userNode *match, void *extra); struct userNode *opserv; *************** *** 496,500 **** (void)channel; (void)argc; ! if (argv[1]) { target = argv[1]; } else { --- 496,500 ---- (void)channel; (void)argc; ! if(argc > 1) { target = argv[1]; } else { *************** *** 3012,3016 **** for (n=0; n<matched.used; n++) { ! dsf(matched.list[n], data); } --- 3012,3020 ---- for (n=0; n<matched.used; n++) { ! if(dsf(matched.list[n], data)) { ! /* If a search function returns true, it ran into a ! problem. Stop going through the list. */ ! break; ! } } *************** *** 3020,3042 **** } ! static void trace_print_func(struct userNode *match, void *extra) { struct discrim_and_source *das = extra; opserv_notice(das->source, "%s!%s@%s", match->nick, match->username, match->hostname); } ! static void trace_count_func(struct userNode *match, void *extra) { (void)match;(void)extra; } #if defined(HAVE_POLL) && defined(HAVE_PTHREAD) && !defined(__CYGWIN__) ! static void trace_scan_func(struct userNode *match, void *extra) { (void)extra; sockcheck_queue_address(match->ip, match->hostname); } #endif --- 3024,3049 ---- } ! static int trace_print_func(struct userNode *match, void *extra) { struct discrim_and_source *das = extra; opserv_notice(das->source, "%s!%s@%s", match->nick, match->username, match->hostname); + return 0; } ! static int trace_count_func(struct userNode *match, void *extra) { (void)match;(void)extra; + return 0; } #if defined(HAVE_POLL) && defined(HAVE_PTHREAD) && !defined(__CYGWIN__) ! static int trace_scan_func(struct userNode *match, void *extra) { (void)extra; sockcheck_queue_address(match->ip, match->hostname); + return 0; } #endif *************** *** 3048,3062 **** } ! static void trace_gline_func(struct userNode *match, void *extra) { struct discrim_and_source *das = extra; if (is_oper_victim(das->source, match)) opserv_block(match, das->source->handle_info->handle, das->discrim->reason); } ! static void trace_kill_func(struct userNode *match, void *extra) { struct discrim_and_source *das = extra; if (is_oper_victim(das->source, match)) { char *reason; --- 3055,3085 ---- } ! static int trace_gline_func(struct userNode *match, void *extra) { struct discrim_and_source *das = extra; + + /* See the comment in trace_kill_func() below. */ + if(das->source == match) { + return 0; + } + if (is_oper_victim(das->source, match)) opserv_block(match, das->source->handle_info->handle, das->discrim->reason); + + return 0; } ! static int trace_kill_func(struct userNode *match, void *extra) { struct discrim_and_source *das = extra; + + /* If the person who issues a trace kill is among its victims, + is_oper_vistim will dereference a pointer to a user that doesn't + exist anymore. We skip killing the issuing user to avoid this. */ + if(das->source == match) { + return 0; + } + if (is_oper_victim(das->source, match)) { char *reason; *************** *** 3069,3072 **** --- 3092,3097 ---- DelUser(match, opserv, true, reason); } + + return 0; } *************** *** 3084,3091 **** } ! static void trace_gag_func(struct userNode *match, void *extra) { struct discrim_and_source *das = extra; if (is_oper_victim(das->source, match)) { char *reason, *mask; --- 3109,3117 ---- } ! static int trace_gag_func(struct userNode *match, void *extra) { struct discrim_and_source *das = extra; + if (is_oper_victim(das->source, match)) { char *reason, *mask; *************** *** 3109,3112 **** --- 3135,3140 ---- } } + + return 0; } *************** *** 3319,3323 **** } ! void gag_helper_func(struct userNode *match, void *extra) { --- 3347,3351 ---- } ! static int gag_helper_func(struct userNode *match, void *extra) { *************** *** 3326,3332 **** /* TODO: may want to create a list of hosts to protect from glines, gags etc.. we could then test for such hosts here. */ ! if(IsPrivileged(match) || IsLocal(match->numeric)) return; match->modes |= FLAGS_GAGGED; ! return; } --- 3354,3360 ---- /* TODO: may want to create a list of hosts to protect from glines, gags etc.. we could then test for such hosts here. */ ! if(IsPrivileged(match) || IsLocal(match->numeric)) return 0; match->modes |= FLAGS_GAGGED; ! return 0; } *************** *** 3398,3407 **** } ! void ungag_helper_func(struct userNode *match, void *extra) { (void)extra; match->modes &= ~FLAGS_GAGGED; ! return; } --- 3426,3435 ---- } ! static int ungag_helper_func(struct userNode *match, void *extra) { (void)extra; match->modes &= ~FLAGS_GAGGED; ! return 0; } |