| 39 |
|
#include "send.h" |
| 40 |
|
#include "hash.h" |
| 41 |
|
#include "s_serv.h" |
| 42 |
– |
#include "s_gline.h" |
| 42 |
|
#include "parse.h" |
| 43 |
|
#include "modules.h" |
| 44 |
+ |
#include "conf_db.h" |
| 45 |
|
|
| 46 |
|
|
| 47 |
|
/* apply_tdline() |
| 51 |
|
* side effects - tkline as given is placed |
| 52 |
|
*/ |
| 53 |
|
static void |
| 54 |
< |
apply_tdline(struct Client *source_p, struct ConfItem *conf, |
| 55 |
< |
const char *current_date, int tkline_time) |
| 54 |
> |
apply_dline(struct Client *source_p, struct AccessItem *aconf, |
| 55 |
> |
time_t tkline_time) |
| 56 |
|
{ |
| 57 |
< |
struct AccessItem *aconf; |
| 58 |
< |
|
| 59 |
< |
aconf = map_to_conf(conf); |
| 60 |
< |
aconf->hold = CurrentTime + tkline_time; |
| 61 |
< |
SetConfTemporary(aconf); |
| 62 |
< |
add_conf_by_address(CONF_DLINE, aconf); |
| 63 |
< |
|
| 57 |
> |
if (tkline_time) |
| 58 |
> |
{ |
| 59 |
> |
aconf->hold = CurrentTime + tkline_time; |
| 60 |
> |
SetConfTemporary(aconf); |
| 61 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 62 |
> |
"%s added temporary %d min. D-Line for [%s] [%s]", |
| 63 |
> |
get_oper_name(source_p), tkline_time/60, |
| 64 |
> |
aconf->host, aconf->reason); |
| 65 |
> |
sendto_one(source_p, ":%s NOTICE %s :Added temporary %d min. D-Line [%s]", |
| 66 |
> |
MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from), |
| 67 |
> |
source_p->name, tkline_time/60, aconf->host); |
| 68 |
> |
ilog(LOG_TYPE_DLINE, "%s added temporary %d min. D-Line for [%s] [%s]", |
| 69 |
> |
get_oper_name(source_p), tkline_time/60, aconf->host, aconf->reason); |
| 70 |
> |
} |
| 71 |
> |
else |
| 72 |
> |
{ |
| 73 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 74 |
> |
"%s added D-Line for [%s] [%s]", |
| 75 |
> |
get_oper_name(source_p), aconf->host, aconf->reason); |
| 76 |
> |
sendto_one(source_p, ":%s NOTICE %s :Added D-Line [%s]", |
| 77 |
> |
MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from), |
| 78 |
> |
source_p->name, aconf->host); |
| 79 |
> |
ilog(LOG_TYPE_DLINE, "%s added D-Line for [%s] [%s]", |
| 80 |
> |
get_oper_name(source_p), aconf->host, aconf->reason); |
| 81 |
|
|
| 82 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 66 |
< |
"%s added temporary %d min. D-Line for [%s] [%s]", |
| 67 |
< |
get_oper_name(source_p), tkline_time/60, |
| 68 |
< |
aconf->host, aconf->reason); |
| 69 |
< |
|
| 70 |
< |
sendto_one(source_p, ":%s NOTICE %s :Added temporary %d min. D-Line [%s]", |
| 71 |
< |
MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from), |
| 72 |
< |
source_p->name, tkline_time/60, aconf->host); |
| 73 |
< |
ilog(LOG_TYPE_DLINE, "%s added temporary %d min. D-Line for [%s] [%s]", |
| 74 |
< |
source_p->name, tkline_time/60, aconf->host, aconf->reason); |
| 82 |
> |
} |
| 83 |
|
|
| 84 |
+ |
aconf->setat = CurrentTime; |
| 85 |
+ |
add_conf_by_address(CONF_DLINE, aconf); |
| 86 |
|
rehashed_klines = 1; |
| 87 |
|
} |
| 88 |
|
|
| 92 |
|
* Side effects: Any matching tdlines are removed. |
| 93 |
|
*/ |
| 94 |
|
static int |
| 95 |
< |
remove_tdline_match(const char *host) |
| 95 |
> |
remove_dline_match(const char *host) |
| 96 |
|
{ |
| 97 |
|
struct irc_ssaddr iphost, *piphost; |
| 98 |
|
struct AccessItem *aconf; |
| 116 |
|
|
| 117 |
|
if ((aconf = find_conf_by_address(host, piphost, CONF_DLINE, t, NULL, NULL, 0))) |
| 118 |
|
{ |
| 119 |
< |
if (IsConfTemporary(aconf)) |
| 119 |
> |
if (!IsConfMain(aconf)) |
| 120 |
|
{ |
| 121 |
|
delete_one_address_conf(host, aconf); |
| 122 |
|
return 1; |
| 141 |
|
int parc, char *parv[]) |
| 142 |
|
{ |
| 143 |
|
char def_reason[] = "<No reason specified>"; |
| 144 |
< |
char *dlhost = NULL, *oper_reason = NULL, *reason = NULL; |
| 144 |
> |
char *dlhost = NULL, *reason = NULL; |
| 145 |
|
char *target_server = NULL; |
| 146 |
|
const char *creason; |
| 147 |
|
const struct Client *target_p = NULL; |
| 256 |
|
cur_time = CurrentTime; |
| 257 |
|
current_date = smalldate(cur_time); |
| 258 |
|
|
| 249 |
– |
/* Look for an oper reason */ |
| 250 |
– |
if ((oper_reason = strchr(reason, '|')) != NULL) |
| 251 |
– |
*oper_reason++ = '\0'; |
| 252 |
– |
|
| 259 |
|
if (!valid_comment(source_p, reason, 1)) |
| 260 |
|
return; |
| 261 |
|
|
| 268 |
|
snprintf(buffer, sizeof(buffer), "Temporary D-line %d min. - %s (%s)", |
| 269 |
|
(int)(tkline_time/60), reason, current_date); |
| 270 |
|
DupString(aconf->reason, buffer); |
| 271 |
< |
if (oper_reason != NULL) |
| 266 |
< |
DupString(aconf->oper_reason, oper_reason); |
| 267 |
< |
apply_tdline(source_p, conf, current_date, tkline_time); |
| 271 |
> |
apply_dline(source_p, aconf, tkline_time); |
| 272 |
|
} |
| 273 |
|
else |
| 274 |
|
{ |
| 275 |
|
snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date); |
| 276 |
|
DupString(aconf->reason, buffer); |
| 277 |
< |
if (oper_reason != NULL) |
| 274 |
< |
DupString(aconf->oper_reason, oper_reason); |
| 275 |
< |
add_conf_by_address(CONF_DLINE, aconf); |
| 276 |
< |
write_conf_line(source_p, conf, current_date, cur_time); |
| 277 |
> |
apply_dline(source_p, aconf, 0); |
| 278 |
|
} |
| 279 |
|
|
| 280 |
|
rehashed_klines = 1; |
| 285 |
|
int parc, char *parv[]) |
| 286 |
|
{ |
| 287 |
|
char def_reason[] = "<No reason specified>"; |
| 288 |
< |
char *dlhost, *oper_reason, *reason; |
| 288 |
> |
char *dlhost, *reason; |
| 289 |
|
const char *creason; |
| 290 |
|
const struct Client *target_p = NULL; |
| 291 |
|
struct irc_ssaddr daddr; |
| 383 |
|
cur_time = CurrentTime; |
| 384 |
|
current_date = smalldate(cur_time); |
| 385 |
|
|
| 385 |
– |
/* Look for an oper reason */ |
| 386 |
– |
if ((oper_reason = strchr(reason, '|')) != NULL) |
| 387 |
– |
*oper_reason++ = '\0'; |
| 388 |
– |
|
| 386 |
|
if (!valid_comment(source_p, reason, 1)) |
| 387 |
|
return; |
| 388 |
|
|
| 395 |
|
snprintf(buffer, sizeof(buffer), "Temporary D-line %d min. - %s (%s)", |
| 396 |
|
(int)(tkline_time/60), reason, current_date); |
| 397 |
|
DupString(aconf->reason, buffer); |
| 398 |
< |
if (oper_reason != NULL) |
| 402 |
< |
DupString(aconf->oper_reason, oper_reason); |
| 403 |
< |
apply_tdline(source_p, conf, current_date, tkline_time); |
| 398 |
> |
apply_dline(source_p, aconf, tkline_time); |
| 399 |
|
} |
| 400 |
|
else |
| 401 |
|
{ |
| 402 |
|
snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date); |
| 403 |
|
DupString(aconf->reason, buffer); |
| 404 |
< |
if (oper_reason != NULL) |
| 410 |
< |
DupString(aconf->oper_reason, oper_reason); |
| 411 |
< |
add_conf_by_address(CONF_DLINE, aconf); |
| 412 |
< |
write_conf_line(source_p, conf, current_date, cur_time); |
| 404 |
> |
apply_dline(source_p, aconf, 0); |
| 405 |
|
} |
| 406 |
|
|
| 407 |
|
rehashed_klines = 1; |
| 455 |
|
cluster_a_line(source_p, "UNDLINE", CAP_UNDLN, SHARED_UNDLINE, |
| 456 |
|
"%s", addr); |
| 457 |
|
|
| 458 |
< |
if (remove_tdline_match(addr)) |
| 458 |
> |
if (remove_dline_match(addr)) |
| 459 |
|
{ |
| 460 |
|
sendto_one(source_p, |
| 461 |
< |
":%s NOTICE %s :Un-Dlined [%s] from temporary D-Lines", |
| 461 |
> |
":%s NOTICE %s :D-Line for [%s] is removed", |
| 462 |
|
me.name, source_p->name, addr); |
| 463 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 464 |
< |
"%s has removed the temporary D-Line for: [%s]", |
| 463 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 464 |
> |
"%s has removed the D-Line for: [%s]", |
| 465 |
|
get_oper_name(source_p), addr); |
| 474 |
– |
ilog(LOG_TYPE_DLINE, "%s removed temporary D-Line for [%s]", |
| 475 |
– |
source_p->name, addr); |
| 476 |
– |
return; |
| 477 |
– |
} |
| 478 |
– |
|
| 479 |
– |
if (remove_conf_line(DLINE_TYPE, source_p, addr, NULL) > 0) |
| 480 |
– |
{ |
| 481 |
– |
sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed", |
| 482 |
– |
me.name, source_p->name, addr); |
| 483 |
– |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 484 |
– |
"%s has removed the D-Line for: [%s]", |
| 485 |
– |
get_oper_name(source_p), addr); |
| 466 |
|
ilog(LOG_TYPE_DLINE, "%s removed D-Line for [%s]", |
| 467 |
|
get_oper_name(source_p), addr); |
| 468 |
|
} |
| 490 |
|
source_p->username, source_p->host, |
| 491 |
|
SHARED_UNDLINE)) |
| 492 |
|
{ |
| 493 |
< |
if (remove_tdline_match(addr)) |
| 493 |
> |
if (remove_dline_match(addr)) |
| 494 |
|
{ |
| 495 |
|
sendto_one(source_p, |
| 496 |
< |
":%s NOTICE %s :Un-Dlined [%s] from temporary D-Lines", |
| 496 |
> |
":%s NOTICE %s :D-Line for [%s] is removed", |
| 497 |
|
me.name, source_p->name, addr); |
| 498 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 519 |
< |
"%s has removed the temporary D-Line for: [%s]", |
| 520 |
< |
get_oper_name(source_p), addr); |
| 521 |
< |
ilog(LOG_TYPE_DLINE, "%s removed temporary D-Line for [%s]", |
| 522 |
< |
source_p->name, addr); |
| 523 |
< |
return; |
| 524 |
< |
} |
| 525 |
< |
|
| 526 |
< |
if (remove_conf_line(DLINE_TYPE, source_p, addr, NULL) > 0) |
| 527 |
< |
{ |
| 528 |
< |
sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed", |
| 529 |
< |
me.name, source_p->name, addr); |
| 530 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 498 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 499 |
|
"%s has removed the D-Line for: [%s]", |
| 500 |
|
get_oper_name(source_p), addr); |
| 501 |
< |
ilog(LOG_TYPE_DLINE, "%s removed D-Line for [%s]", |
| 501 |
> |
ilog(LOG_TYPE_DLINE, "%s removed temporary D-Line for [%s]", |
| 502 |
|
get_oper_name(source_p), addr); |
| 503 |
|
} |
| 504 |
|
else |