[srvx-commits] CVS: services/src opserv.c,1.283,1.284 opserv.help,1.52,1.53
Brought to you by:
entrope
|
From: Entrope <en...@us...> - 2002-10-26 16:17:22
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv13028/src
Modified Files:
opserv.c opserv.help
Log Message:
add "log" trace criteria (really an action modifier, but .. whatever)
allow an oper to kill or gline self, since we handle that better now
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.283
retrieving revision 1.284
diff -C2 -r1.283 -r1.284
*** opserv.c 23 Oct 2002 12:37:54 -0000 1.283
--- opserv.c 26 Oct 2002 16:17:18 -0000 1.284
***************
*** 318,322 ****
char *mask_nick, *mask_ident, *mask_host, *mask_info, *server, *ip_mask_str, *reason;
unsigned long limit, ip_addr, ip_mask, min_level, max_level, domain_depth, duration, min_clones;
! unsigned int match_opers : 1, chan_req_modes : 2, chan_no_modes : 2;
time_t min_ts, max_ts;
} *discrim_t;
--- 318,323 ----
char *mask_nick, *mask_ident, *mask_host, *mask_info, *server, *ip_mask_str, *reason;
unsigned long limit, ip_addr, ip_mask, min_level, max_level, domain_depth, duration, min_clones;
! unsigned int match_opers : 1, option_log : 1;
! unsigned int chan_req_modes : 2, chan_no_modes : 2;
time_t min_ts, max_ts;
} *discrim_t;
***************
*** 2848,2857 ****
for (i=0; i<argc; i++) {
! /* Assume all criteria require arguments. */
if (i == argc - 1) {
opserv_notice(user, MSG_MISSING_PARAMS, argv[i]);
return NULL;
}
! if (!irccasecmp(argv[i], "mask")) {
if (!is_ircmask(argv[++i])) {
opserv_notice(user, OSMSG_INVALID_IRCMASK, argv[i]);
--- 2849,2862 ----
for (i=0; i<argc; i++) {
! if (irccasecmp(argv[i], "log") == 0) {
! discrim->option_log = 1;
! continue;
! }
! /* Assume all other criteria require arguments. */
if (i == argc - 1) {
opserv_notice(user, MSG_MISSING_PARAMS, argv[i]);
return NULL;
}
! if (irccasecmp(argv[i], "mask") == 0) {
if (!is_ircmask(argv[++i])) {
opserv_notice(user, OSMSG_INVALID_IRCMASK, argv[i]);
***************
*** 3053,3058 ****
}
for (nn=0; nn<matched.used; nn++) {
! if (dsf(matched.list[nn], data)) {
/* If a search function returns true, it ran into a
problem. Stop going through the list. */
--- 3058,3075 ----
}
+ if (!matched.used) {
+ userList_clean(&matched);
+ return 0;
+ }
+
+ if (discrim->option_log) {
+ log(OS_LOG, LOG_OTHER, "Logging matches for search:\n");
+ }
for (nn=0; nn<matched.used; nn++) {
! struct userNode *user = matched.list[nn];
! if (discrim->option_log) {
! log(OS_LOG, LOG_OTHER, " %s!%s@%s\n", user->nick, user->ident, user->hostname);
! }
! if (dsf(user, data)) {
/* If a search function returns true, it ran into a
problem. Stop going through the list. */
***************
*** 3060,3064 ****
}
}
!
count = matched.used;
userList_clean(&matched);
--- 3077,3083 ----
}
}
! if (discrim->option_log) {
! log(OS_LOG, LOG_OTHER, "End of matching users.\n");
! }
count = matched.used;
userList_clean(&matched);
***************
*** 3095,3101 ****
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, das->discrim->match_opers)) {
opserv_block(match, das->source->handle_info->handle, das->discrim->reason, das->discrim->duration);
--- 3114,3117 ----
***************
*** 3110,3118 ****
struct discrim_and_source *das = extra;
- /* If the person who issues a trace kill is among its victims,
- is_oper_victim 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, das->discrim->match_opers)) {
char *reason;
--- 3126,3129 ----
***************
*** 3581,3584 ****
--- 3592,3598 ----
if (discrim_match(alert->discrim, user)) {
+ if (alert->discrim->option_log) {
+ log(OS_LOG, LOG_OTHER, "Alert %s triggered by user %s!%s@%s (%s).\n", key, user->nick, user->ident, user->hostname, alert->discrim->reason);
+ }
switch (alert->reaction) {
case REACT_KILL:
***************
*** 3592,3596 ****
/* fall through to REACT_NOTICE case */
case REACT_NOTICE:
! opserv_alert(OSMSG_ALERT_TRIGGERED, key, user->nick, user->ident, user->hostname, alert->discrim->reason);
break;
}
--- 3606,3610 ----
/* fall through to REACT_NOTICE case */
case REACT_NOTICE:
! opserv_alert(OSMSG_ALERT_TRIGGERED, key, user->nick, user->ident, user->hostname, alert->discrim->reason);
break;
}
Index: opserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.help,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -r1.52 -r1.53
*** opserv.help 21 Oct 2002 03:49:14 -0000 1.52
--- opserv.help 26 Oct 2002 16:17:19 -0000 1.53
***************
*** 82,85 ****
--- 82,86 ----
"$bCLONES$b min Ignore clients from hosts with fewer than this many connections.",
"$bABUSE OPERS$b Force adverse actions to affect opers as well.",
+ "$bLOG$b Record matching users in $O's log file (in addition to acting).",
"Additionally, the $bCHANNEL$b target may be prefixed with @ to select channel operators, + to select voiced users (will not select chanops unless @ is also used), or - to select non-voiced non-chanop users. For example, CHANNEL #foo will select all users in #foo; CHANNEL +#foo will select only users voiced in #foo; CHANNEL @+#foo will select ops and voiced users in #foo; etc.");
"WHOIS" ("/msg $O WHOIS <nick>",
|