Debian Codegraph @

modules/operserv/rwatch.c

raw
1 /*
2 * Copyright (c) 2006 Atheme Development Group
3 * Rights to this code are documented in doc/LICENCE.
4 *
5 * This file contains functionality implementing OperServ RWATCH.
6 *
7 */
8
9 #include "atheme.h"
10
11 DECLARE_MODULE_V1
12 (
13 "operserv/rwatch", true, _modinit, _moddeinit,
14 PACKAGE_STRING,
15 VENDOR_STRING
16 );
17
18 static void rwatch_newuser(hook_user_nick_t *data);
19 static void rwatch_nickchange(hook_user_nick_t *data);
20
21 static void os_cmd_rwatch(sourceinfo_t *si, int parc, char *parv[]);
22 static void os_cmd_rwatch_list(sourceinfo_t *si, int parc, char *parv[]);
23 static void os_cmd_rwatch_add(sourceinfo_t *si, int parc, char *parv[]);
24 static void os_cmd_rwatch_del(sourceinfo_t *si, int parc, char *parv[]);
25 static void os_cmd_rwatch_set(sourceinfo_t *si, int parc, char *parv[]);
26
27 static void write_rwatchdb(database_handle_t *db);
28 static void load_rwatchdb(char *path);
29 static void db_h_rw(database_handle_t *db, const char *type);
30 static void db_h_rr(database_handle_t *db, const char *type);
31
32 mowgli_patricia_t *os_rwatch_cmds;
33
34 mowgli_list_t rwatch_list;
35
36 #define RWACT_SNOOP 1
37 #define RWACT_KLINE 2
38 #define RWACT_QUARANTINE 4
39
40 typedef struct rwatch_ rwatch_t;
41 struct rwatch_
42 {
43 char *regex;
44 int reflags; /* AREGEX_* */
45 char *reason;
46 int actions; /* RWACT_* */
47 atheme_regex_t *re;
48 };
49
50 command_t os_rwatch = { "RWATCH", N_("Performs actions on connecting clients matching regexes."), PRIV_USER_AUSPEX, 2, os_cmd_rwatch, { .path = "oservice/rwatch" } };
51
52 command_t os_rwatch_add = { "ADD", N_("Adds an entry to the regex watch list."), AC_NONE, 1, os_cmd_rwatch_add, { .path = "" } };
53 command_t os_rwatch_del = { "DEL", N_("Removes an entry from the regex watch list."), AC_NONE, 1, os_cmd_rwatch_del, { .path = "" } };
54 command_t os_rwatch_list = { "LIST", N_("Displays the regex watch list."), AC_NONE, 1, os_cmd_rwatch_list, { .path = "" } };
55 command_t os_rwatch_set = { "SET", N_("Changes actions on an entry in the regex watch list"), AC_NONE, 1, os_cmd_rwatch_set, { .path = "" } };
56
57 rwatch_t *rwread = NULL;
58 FILE *f;
59
60 void _modinit(module_t *m)
61 {
62 service_named_bind_command("operserv", &os_rwatch);
63
64 os_rwatch_cmds = mowgli_patricia_create(strcasecanon);
65
66 command_add(&os_rwatch_add, os_rwatch_cmds);
67 command_add(&os_rwatch_del, os_rwatch_cmds);
68 command_add(&os_rwatch_list, os_rwatch_cmds);
69 command_add(&os_rwatch_set, os_rwatch_cmds);
70
71 hook_add_event("user_add");
72 hook_add_user_add(rwatch_newuser);
73 hook_add_event("user_nickchange");
74 hook_add_user_nickchange(rwatch_nickchange);
75 hook_add_db_write(write_rwatchdb);
76
77 char path[BUFSIZE];
78 snprintf(path, BUFSIZE, "%s/%s", datadir, "rwatch.db");
79 f = fopen(path, "r");
80
81 if (f)
82 {
83 load_rwatchdb(path); /* because i'm lazy, let's pass path to the function */
84 fclose(f);
85 }
86 else
87 {
88 db_register_type_handler("RW", db_h_rw);
89 db_register_type_handler("RR", db_h_rr);
90 }
91 }
92
93 void _moddeinit(module_unload_intent_t intent)
94 {
95 mowgli_node_t *n, *tn;
96
97 MOWGLI_ITER_FOREACH_SAFE(n, tn, rwatch_list.head)
98 {
99 rwatch_t *rw = n->data;
100
101 free(rw->regex);
102 free(rw->reason);
103 if (rw->re != NULL)
104 regex_destroy(rw->re);
105 free(rw);
106
107 mowgli_node_delete(n, &rwatch_list);
108 mowgli_node_free(n);
109 }
110
111 service_named_unbind_command("operserv", &os_rwatch);
112
113 command_delete(&os_rwatch_add, os_rwatch_cmds);
114 command_delete(&os_rwatch_del, os_rwatch_cmds);
115 command_delete(&os_rwatch_list, os_rwatch_cmds);
116 command_delete(&os_rwatch_set, os_rwatch_cmds);
117
118 hook_del_user_add(rwatch_newuser);
119 hook_del_user_nickchange(rwatch_nickchange);
120 hook_del_db_write(write_rwatchdb);
121
122 db_unregister_type_handler("RW");
123 db_unregister_type_handler("RR");
124
125 mowgli_patricia_destroy(os_rwatch_cmds, NULL, NULL);
126 }
127
128 static void write_rwatchdb(database_handle_t *db)
129 {
130 mowgli_node_t *n;
131
132 MOWGLI_ITER_FOREACH(n, rwatch_list.head)
133 {
134 rwatch_t *rw = n->data;
135
136 db_start_row(db, "RW");
137 db_write_uint(db, rw->reflags);
138 db_write_str(db, rw->regex);
139 db_commit_row(db);
140
141 db_start_row(db, "RR");
142 db_write_uint(db, rw->actions);
143 db_write_str(db, rw->reason);
144 db_commit_row(db);
145 }
146 }
147
148 static void load_rwatchdb(char *path)
149 {
150 char *item, rBuf[BUFSIZE * 2];
151 rwatch_t *rw = NULL;
152 char newpath[BUFSIZE];
153
154 snprintf(newpath, BUFSIZE, "%s/%s", datadir, "rwatch.db.old");
155
156 while (fgets(rBuf, BUFSIZE * 2, f))
157 {
158 item = strtok(rBuf, " ");
159 if (!item)
160 continue;
161
162 strip(item);
163
164 if (!strcmp(item, "RW"))
165 {
166 char *reflagsstr = strtok(NULL, " ");
167 char *regex = strtok(NULL, "\n");
168
169 if (!reflagsstr || !regex || rw)
170 ; /* erroneous, don't add */
171 else
172 {
173 rw = (rwatch_t *)smalloc(sizeof(rwatch_t));
174
175 rw->regex = sstrdup(regex);
176 rw->reflags = atoi(reflagsstr);
177 rw->re = regex_create(rw->regex, rw->reflags);
178 }
179 }
180 else if (!strcmp(item, "RR"))
181 {
182 char *actionstr = strtok(NULL, " ");
183 char *reason = strtok(NULL, "\n");
184
185 if (!actionstr || !reason || !rw)
186 ; /* erroneous, don't add */
187 else
188 {
189 rw->actions = atoi(actionstr);
190 rw->reason = sstrdup(reason);
191 mowgli_node_add(rw, mowgli_node_create(), &rwatch_list);
192 rw = NULL;
193 }
194 }
195 }
196
197 fclose(f);
198
199 if ((srename(path, newpath)) < 0)
200 {
201 slog(LG_ERROR, "load_rwatchdb(): couldn't rename rwatch database.");
202 }
203 else
204 {
205 slog(LG_INFO, "The RWATCH database has been converted to the OpenSEX format.");
206 slog(LG_INFO, "The old RWATCH database now resides in rwatch.db.old which may be deleted.");
207 }
208
209 if (rw != NULL)
210 {
211 free(rw->regex);
212 free(rw->reason);
213 if (rw->re != NULL)
214 regex_destroy(rw->re);
215 free(rw);
216 }
217 }
218
219 static void db_h_rw(database_handle_t *db, const char *type)
220 {
221 int reflags = db_sread_uint(db);
222 const char *regex = db_sread_str(db);
223
224 rwread = (rwatch_t *)smalloc(sizeof(rwatch_t));
225 rwread->regex = sstrdup(regex);
226 rwread->reflags = reflags;
227 rwread->re = regex_create(rwread->regex, rwread->reflags);
228 }
229
230 static void db_h_rr(database_handle_t *db, const char *type)
231 {
232 int actions = db_sread_uint(db);
233 const char *reason = db_sread_str(db);
234
235 rwread->actions = actions;
236 rwread->reason = sstrdup(reason);
237 mowgli_node_add(rwread, mowgli_node_create(), &rwatch_list);
238 rwread = NULL;
239 }
240
241 static void os_cmd_rwatch(sourceinfo_t *si, int parc, char *parv[])
242 {
243 /* Grab args */
244 char *cmd = parv[0];
245 command_t *c;
246
247 /* Bad/missing arg */
248 if (!cmd)
249 {
250 command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "RWATCH");
251 command_fail(si, fault_needmoreparams, _("Syntax: RWATCH ADD|DEL|LIST|SET"));
252 return;
253 }
254
255 c = command_find(os_rwatch_cmds, cmd);
256 if (c == NULL)
257 {
258 command_fail(si, fault_badparams, _("Invalid command. Use \2/%s%s help\2 for a command listing."), (ircd->uses_rcommand == false) ? "msg " : "", si->service->disp);
259 return;
260 }
261
262 command_exec(si->service, si, c, parc - 1, parv + 1);
263 }
264
265 static void os_cmd_rwatch_add(sourceinfo_t *si, int parc, char *parv[])
266 {
267 mowgli_node_t *n;
268 char *pattern;
269 char *reason;
270 atheme_regex_t *regex;
271 rwatch_t *rw;
272 int flags;
273 char *args = parv[0];
274
275 if (args == NULL)
276 {
277 command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "RWATCH ADD");
278 command_fail(si, fault_needmoreparams, _("Syntax: RWATCH ADD /<regex>/[i] <reason>"));
279 return;
280 }
281
282 pattern = regex_extract(args, &args, &flags);
283 if (pattern == NULL)
284 {
285 command_fail(si, fault_badparams, STR_INVALID_PARAMS, "RWATCH ADD");
286 command_fail(si, fault_badparams, _("Syntax: RWATCH ADD /<regex>/[i] <reason>"));
287 return;
288 }
289
290 reason = args;
291 while (*reason == ' ')
292 reason++;
293 if (*reason == '\0')
294 {
295 command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "RWATCH ADD");
296 command_fail(si, fault_needmoreparams, _("Syntax: RWATCH ADD /<regex>/[i] <reason>"));
297 return;
298 }
299
300 MOWGLI_ITER_FOREACH(n, rwatch_list.head)
301 {
302 rwatch_t *t = n->data;
303
304 if (!strcmp(pattern, t->regex))
305 {
306 command_fail(si, fault_nochange, _("\2%s\2 already found in regex watch list; not adding."), pattern);
307 return;
308 }
309 }
310
311 regex = regex_create(pattern, flags);
312 if (regex == NULL)
313 {
314 command_fail(si, fault_badparams, _("The provided regex \2%s\2 is invalid."), pattern);
315 return;
316 }
317
318 rw = malloc(sizeof(rwatch_t));
319 rw->regex = sstrdup(pattern);
320 rw->reflags = flags;
321 rw->reason = sstrdup(reason);
322 rw->actions = RWACT_SNOOP | ((flags & AREGEX_KLINE) == AREGEX_KLINE ? RWACT_KLINE : 0);
323 rw->re = regex;
324
325 mowgli_node_add(rw, mowgli_node_create(), &rwatch_list);
326 command_success_nodata(si, _("Added \2%s\2 to regex watch list."), pattern);
327 logcommand(si, CMDLOG_ADMIN, "RWATCH:ADD: \2%s\2 (reason: \2%s\2)", pattern, reason);
328 }
329
330 static void os_cmd_rwatch_del(sourceinfo_t *si, int parc, char *parv[])
331 {
332 mowgli_node_t *n, *tn;
333 char *pattern;
334 int flags;
335 char *args = parv[0];
336
337 if (args == NULL)
338 {
339 command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "RWATCH DEL");
340 command_fail(si, fault_needmoreparams, _("Syntax: RWATCH DEL /<regex>/[i]"));
341 return;
342 }
343
344 pattern = regex_extract(args, &args, &flags);
345 if (pattern == NULL)
346 {
347 command_fail(si, fault_badparams, STR_INVALID_PARAMS, "RWATCH DEL");
348 command_fail(si, fault_badparams, _("Syntax: RWATCH DEL /<regex>/[i]"));
349 return;
350 }
351
352 MOWGLI_ITER_FOREACH_SAFE(n, tn, rwatch_list.head)
353 {
354 rwatch_t *rw = n->data;
355
356 if (!strcmp(rw->regex, pattern))
357 {
358 if (rw->actions & RWACT_KLINE)
359 {
360 if (!has_priv(si, PRIV_MASS_AKILL))
361 {
362 command_fail(si, fault_noprivs, STR_NO_PRIVILEGE, PRIV_MASS_AKILL);
363 return;
364 }
365 wallops("\2%s\2 disabled kline on regex watch pattern \2%s\2", get_oper_name(si), pattern);
366 }
367 if (rw->actions & RWACT_QUARANTINE)
368 {
369 if (!has_priv(si, PRIV_MASS_AKILL))
370 {
371 command_fail(si, fault_noprivs, STR_NO_PRIVILEGE, PRIV_MASS_AKILL);
372 return;
373 }
374 wallops("\2%s\2 disabled quarantine on regex watch pattern \2%s\2", get_oper_name(si), pattern);
375 }
376 free(rw->regex);
377 free(rw->reason);
378 if (rw->re != NULL)
379 regex_destroy(rw->re);
380 free(rw);
381 mowgli_node_delete(n, &rwatch_list);
382 mowgli_node_free(n);
383 command_success_nodata(si, _("Removed \2%s\2 from regex watch list."), pattern);
384 logcommand(si, CMDLOG_ADMIN, "RWATCH:DEL: \2%s\2", pattern);
385 return;
386 }
387 }
388
389 command_fail(si, fault_nochange, _("\2%s\2 not found in regex watch list."), pattern);
390 }
391
392 static void os_cmd_rwatch_list(sourceinfo_t *si, int parc, char *parv[])
393 {
394 mowgli_node_t *n;
395
396 MOWGLI_ITER_FOREACH(n, rwatch_list.head)
397 {
398 rwatch_t *rw = n->data;
399
400 command_success_nodata(si, "%s (%s%s%s%s) - %s",
401 rw->regex,
402 rw->reflags & AREGEX_ICASE ? "i" : "",
403 rw->reflags & AREGEX_PCRE ? "p" : "",
404 rw->actions & RWACT_SNOOP ? "S" : "",
405 rw->actions & RWACT_KLINE ? "\2K\2" : "",
406 rw->reason);
407 }
408 command_success_nodata(si, _("End of RWATCH LIST"));
409 logcommand(si, CMDLOG_GET, "RWATCH:LIST");
410 }
411
412 static void os_cmd_rwatch_set(sourceinfo_t *si, int parc, char *parv[])
413 {
414 mowgli_node_t *n, *tn;
415 char *pattern;
416 char *opts;
417 int addflags = 0, removeflags = 0;
418 int flags;
419 char *args = parv[0];
420
421 if (args == NULL)
422 {
423 command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "RWATCH SET");
424 command_fail(si, fault_needmoreparams, _("Syntax: RWATCH SET /<regex>/[i] [KLINE] [NOKLINE] [SNOOP] [NOSNOOP] [QUARANTINE] [NOQUARANTINE]"));
425 return;
426 }
427
428 pattern = regex_extract(args, &args, &flags);
429 if (pattern == NULL)
430 {
431 command_fail(si, fault_badparams, STR_INVALID_PARAMS, "RWATCH SET");
432 command_fail(si, fault_badparams, _("Syntax: RWATCH SET /<regex>/[i] [KLINE] [NOKLINE] [SNOOP] [NOSNOOP] [QUARANTINE] [NOQUARANTINE]"));
433 return;
434 }
435 while (*args == ' ')
436 args++;
437
438 if (*args == '\0')
439 {
440 command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "RWATCH SET");
441 command_fail(si, fault_needmoreparams, _("Syntax: RWATCH SET /<regex>/[i] [KLINE] [NOKLINE] [SNOOP] [NOSNOOP] [QUARANTINE] [NOQUARANTINE]"));
442 return;
443 }
444
445 opts = args;
446 while (*args != '\0')
447 {
448 if (!strncasecmp(args, "KLINE", 5))
449 addflags |= RWACT_KLINE, removeflags &= ~RWACT_KLINE, args += 5;
450 else if (!strncasecmp(args, "NOKLINE", 7))
451 removeflags |= RWACT_KLINE, addflags &= ~RWACT_KLINE, args += 7;
452 else if (!strncasecmp(args, "SNOOP", 5))
453 addflags |= RWACT_SNOOP, removeflags &= ~RWACT_SNOOP, args += 5;
454 else if (!strncasecmp(args, "NOSNOOP", 7))
455 removeflags |= RWACT_SNOOP, addflags &= ~RWACT_SNOOP, args += 7;
456 else if (!strncasecmp(args, "QUARANTINE", 10))
457 addflags |= RWACT_QUARANTINE, removeflags &= ~RWACT_QUARANTINE, args += 10;
458 else if (!strncasecmp(args, "NOQUARANTINE", 12))
459 removeflags |= RWACT_QUARANTINE, addflags &= ~RWACT_QUARANTINE, args += 12;
460
461 if (*args != '\0' && *args != ' ')
462 {
463 command_fail(si, fault_badparams, STR_INVALID_PARAMS, "RWATCH SET");
464 command_fail(si, fault_badparams, _("Syntax: RWATCH SET /<regex>/[i] [KLINE] [NOKLINE] [SNOOP] [NOSNOOP] [QUARANTINE] [NOQUARANTINE]"));
465 return;
466 }
467 while (*args == ' ')
468 args++;
469 }
470
471 if ((addflags | removeflags) & RWACT_KLINE && !has_priv(si, PRIV_MASS_AKILL))
472 {
473 command_fail(si, fault_noprivs, STR_NO_PRIVILEGE, PRIV_MASS_AKILL);
474 return;
475 }
476
477 if ((addflags | removeflags) & RWACT_QUARANTINE && !has_priv(si, PRIV_MASS_AKILL))
478 {
479 command_fail(si, fault_noprivs, STR_NO_PRIVILEGE, PRIV_MASS_AKILL);
480 return;
481 }
482
483 MOWGLI_ITER_FOREACH_SAFE(n, tn, rwatch_list.head)
484 {
485 rwatch_t *rw = n->data;
486
487 if (!strcmp(rw->regex, pattern))
488 {
489 if (((~rw->actions & addflags) | (rw->actions & removeflags)) == 0)
490 {
491 command_fail(si, fault_nochange, _("Options for \2%s\2 unchanged."), pattern);
492 return;
493 }
494 rw->actions |= addflags;
495 rw->actions &= ~removeflags;
496 command_success_nodata(si, _("Set options \2%s\2 on \2%s\2."), opts, pattern);
497
498 if (addflags & RWACT_KLINE)
499 wallops("\2%s\2 enabled kline on regex watch pattern \2%s\2", get_oper_name(si), pattern);
500 if (removeflags & RWACT_KLINE)
501 wallops("\2%s\2 disabled kline on regex watch pattern \2%s\2", get_oper_name(si), pattern);
502
503 if (addflags & RWACT_QUARANTINE)
504 wallops("\2%s\2 enabled quarantine on regex watch pattern \2%s\2", get_oper_name(si), pattern);
505 if (removeflags & RWACT_QUARANTINE)
506 wallops("\2%s\2 disabled quarantine on regex watch pattern \2%s\2", get_oper_name(si), pattern);
507
508 logcommand(si, CMDLOG_ADMIN, "RWATCH:SET: \2%s\2 \2%s\2", pattern, opts);
509 return;
510 }
511 }
512
513 command_fail(si, fault_nosuch_target, _("\2%s\2 not found in regex watch list."), pattern);
514 }
515
516 static void rwatch_newuser(hook_user_nick_t *data)
517 {
518 user_t *u = data->u;
519 char usermask[NICKLEN+USERLEN+HOSTLEN+GECOSLEN];
520 mowgli_node_t *n;
521 rwatch_t *rw;
522
523 /* If the user has been killed, don't do anything. */
524 if (!u)
525 return;
526
527 if (is_internal_client(u))
528 return;
529
530 snprintf(usermask, sizeof usermask, "%s!%s@%s %s", u->nick, u->user, u->host, u->gecos);
531
532 MOWGLI_ITER_FOREACH(n, rwatch_list.head)
533 {
534 rw = n->data;
535 if (!rw->re)
536 continue;
537 if (regex_match(rw->re, usermask))
538 {
539 if (rw->actions & RWACT_SNOOP)
540 {
541 slog(LG_INFO, "RWATCH:%s \2%s\2 matches \2%s\2 (reason: \2%s\2)",
542 rw->actions & RWACT_KLINE ? "KLINE:" : "",
543 usermask, rw->regex, rw->reason);
544 }
545 if (rw->actions & RWACT_KLINE)
546 {
547 if (is_autokline_exempt(u))
548 slog(LG_INFO, "rwatch_newuser(): not klining *@%s (user %s!%s@%s is autokline exempt but matches %s %s)",
549 u->host, u->nick, u->user, u->host,
550 rw->regex, rw->reason);
551 else
552 {
553 slog(LG_VERBOSE, "rwatch_newuser(): klining *@%s (user %s!%s@%s matches %s %s)",
554 u->host, u->nick, u->user, u->host,
555 rw->regex, rw->reason);
556 if (! (u->flags & UF_KLINESENT)) {
557 kline_sts("*", "*", u->host, 86400, rw->reason);
558 u->flags |= UF_KLINESENT;
559 }
560 }
561 }
562 else if (rw->actions & RWACT_QUARANTINE)
563 {
564 if (is_autokline_exempt(u))
565 slog(LG_INFO, "rwatch_newuser(): not qurantining *@%s (user %s!%s@%s is autokline exempt but matches %s %s)",
566 u->host, u->nick, u->user, u->host,
567 rw->regex, rw->reason);
568 else
569 {
570 slog(LG_VERBOSE, "rwatch_newuser(): quaranting *@%s (user %s!%s@%s matches %s %s)",
571 u->host, u->nick, u->user, u->host,
572 rw->regex, rw->reason);
573 quarantine_sts(service_find("operserv")->me, u, 86400, rw->reason);
574 }
575 }
576 }
577 }
578 }
579
580 static void rwatch_nickchange(hook_user_nick_t *data)
581 {
582 user_t *u = data->u;
583 char usermask[NICKLEN+USERLEN+HOSTLEN+GECOSLEN];
584 char oldusermask[NICKLEN+USERLEN+HOSTLEN+GECOSLEN];
585 mowgli_node_t *n;
586 rwatch_t *rw;
587
588 /* If the user has been killed, don't do anything. */
589 if (!u)
590 return;
591
592 if (is_internal_client(u))
593 return;
594
595 snprintf(usermask, sizeof usermask, "%s!%s@%s %s", u->nick, u->user, u->host, u->gecos);
596 snprintf(oldusermask, sizeof oldusermask, "%s!%s@%s %s", data->oldnick, u->user, u->host, u->gecos);
597
598 MOWGLI_ITER_FOREACH(n, rwatch_list.head)
599 {
600 rw = n->data;
601 if (!rw->re)
602 continue;
603 if (regex_match(rw->re, usermask))
604 {
605 /* Only process if they did not match before. */
606 if (regex_match(rw->re, oldusermask))
607 continue;
608 if (rw->actions & RWACT_SNOOP)
609 {
610 slog(LG_INFO, "RWATCH:NICKCHANGE:%s \2%s\2 -> \2%s\2 matches \2%s\2 (reason: \2%s\2)",
611 rw->actions & RWACT_KLINE ? "KLINE:" : "",
612 data->oldnick, usermask, rw->regex, rw->reason);
613 }
614 if (rw->actions & RWACT_KLINE)
615 {
616 if (is_autokline_exempt(u))
617 slog(LG_INFO, "rwatch_nickchange(): not klining *@%s (user %s -> %s!%s@%s is autokline exempt but matches %s %s)",
618 u->host, data->oldnick, u->nick, u->user, u->host,
619 rw->regex, rw->reason);
620 else
621 {
622 slog(LG_VERBOSE, "rwatch_nickchange(): klining *@%s (user %s -> %s!%s@%s matches %s %s)",
623 u->host, data->oldnick, u->nick, u->user, u->host,
624 rw->regex, rw->reason);
625 if (! (u->flags & UF_KLINESENT)) {
626 kline_sts("*", "*", u->host, 86400, rw->reason);
627 u->flags |= UF_KLINESENT;
628 }
629 }
630 }
631 else if (rw->actions & RWACT_QUARANTINE)
632 {
633 if (is_autokline_exempt(u))
634 slog(LG_INFO, "rwatch_newuser(): not qurantining *@%s (user %s!%s@%s is autokline exempt but matches %s %s)",
635 u->host, u->nick, u->user, u->host,
636 rw->regex, rw->reason);
637 else
638 {
639 slog(LG_VERBOSE, "rwatch_newuser(): quaranting *@%s (user %s!%s@%s matches %s %s)",
640 u->host, u->nick, u->user, u->host,
641 rw->regex, rw->reason);
642 quarantine_sts(service_find("operserv")->me, u, 86400, rw->reason);
643 }
644 }
645 }
646 }
647 }
648
649 /* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs
650 * vim:ts=8
651 * vim:sw=8
652 * vim:noexpandtab
653 */