2 * ircd-ratbox: A slightly useful ircd.
3 * m_kline.c: Bans/unbans a user.
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2005 ircd-ratbox development team
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
37 #include "s_newconf.h"
49 static int mo_kline(struct Client
*, struct Client
*, int, const char **);
50 static int ms_kline(struct Client
*, struct Client
*, int, const char **);
51 static int me_kline(struct Client
*, struct Client
*, int, const char **);
52 static int mo_unkline(struct Client
*, struct Client
*, int, const char **);
53 static int ms_unkline(struct Client
*, struct Client
*, int, const char **);
54 static int me_unkline(struct Client
*, struct Client
*, int, const char **);
56 struct Message kline_msgtab
= {
57 "KLINE", 0, 0, 0, MFLG_SLOW
,
58 {mg_unreg
, mg_not_oper
, {ms_kline
, 5}, {ms_kline
, 5}, {me_kline
, 5}, {mo_kline
, 3}}
61 struct Message unkline_msgtab
= {
62 "UNKLINE", 0, 0, 0, MFLG_SLOW
,
63 {mg_unreg
, mg_not_oper
, {ms_unkline
, 4}, {ms_unkline
, 4}, {me_unkline
, 3}, {mo_unkline
, 2}}
66 mapi_clist_av1 kline_clist
[] = { &kline_msgtab
, &unkline_msgtab
, NULL
};
68 DECLARE_MODULE_AV1(kline
, NULL
, NULL
, kline_clist
, NULL
, NULL
, "$Revision$");
70 /* Local function prototypes */
71 static int find_user_host(struct Client
*source_p
, const char *userhost
, char *user
, char *host
);
72 static int valid_comment(struct Client
*source_p
, char *comment
);
73 static int valid_user_host(struct Client
*source_p
, const char *user
, const char *host
);
74 static int valid_wild_card(struct Client
*source_p
, const char *user
, const char *host
);
76 static void handle_remote_kline(struct Client
*source_p
, int tkline_time
,
77 const char *user
, const char *host
, const char *reason
);
78 static void apply_kline(struct Client
*source_p
, struct ConfItem
*aconf
,
79 const char *reason
, const char *oper_reason
);
80 static void apply_tkline(struct Client
*source_p
, struct ConfItem
*aconf
,
81 const char *, const char *, int);
82 static void apply_prop_kline(struct Client
*source_p
, struct ConfItem
*aconf
,
83 const char *, const char *, int);
84 static int already_placed_kline(struct Client
*, const char *, const char *, int);
86 static void handle_remote_unkline(struct Client
*source_p
, const char *user
, const char *host
);
87 static void remove_permkline_match(struct Client
*, struct ConfItem
*);
88 static int remove_temp_kline(struct Client
*, struct ConfItem
*);
89 static void remove_prop_kline(struct Client
*, struct ConfItem
*);
93 * parv[1] - temp time or user@host
94 * parv[2] - user@host, "ON", or reason
95 * parv[3] - "ON", reason, or server to target
96 * parv[4] - server to target, or reason
100 mo_kline(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char **parv
)
102 char def
[] = "No Reason";
103 char user
[USERLEN
+ 2];
104 char host
[HOSTLEN
+ 2];
107 const char *target_server
= NULL
;
108 struct ConfItem
*aconf
;
113 if(!IsOperK(source_p
))
115 sendto_one(source_p
, form_str(ERR_NOPRIVS
), me
.name
, source_p
->name
, "kline");
119 if((tkline_time
= valid_temp_time(parv
[loc
])) >= 0)
121 /* we just set tkline_time to -1! */
125 if(find_user_host(source_p
, parv
[loc
], user
, host
) == 0)
130 if(parc
>= loc
+ 2 && !irccmp(parv
[loc
], "ON"))
132 if(!IsOperRemoteBan(source_p
))
134 sendto_one(source_p
, form_str(ERR_NOPRIVS
),
135 me
.name
, source_p
->name
, "remoteban");
139 target_server
= parv
[loc
+ 1];
143 if(parc
<= loc
|| EmptyString(parv
[loc
]))
145 sendto_one(source_p
, form_str(ERR_NEEDMOREPARAMS
),
146 me
.name
, source_p
->name
, "KLINE");
150 reason
= LOCAL_COPY(parv
[loc
]);
152 if(target_server
!= NULL
)
154 propagate_generic(source_p
, "KLINE", target_server
, CAP_KLN
,
155 "%d %s %s :%s", tkline_time
, user
, host
, reason
);
157 /* If we are sending it somewhere that doesnt include us, stop */
158 if(!match(target_server
, me
.name
))
161 /* Set as local-only. */
164 /* if we have cluster servers, send it to them.. */
165 else if(!propagated
&& rb_dlink_list_length(&cluster_conf_list
) > 0)
166 cluster_generic(source_p
, "KLINE",
167 (tkline_time
> 0) ? SHARED_TKLINE
: SHARED_PKLINE
, CAP_KLN
,
168 "%lu %s %s :%s", tkline_time
, user
, host
, reason
);
170 if(!valid_user_host(source_p
, user
, host
) ||
171 !valid_wild_card(source_p
, user
, host
) || !valid_comment(source_p
, reason
))
174 if(propagated
&& tkline_time
== 0)
176 sendto_one_notice(source_p
, ":Cannot set a permanent global ban");
180 if(already_placed_kline(source_p
, user
, host
, tkline_time
))
185 aconf
->status
= CONF_KILL
;
186 aconf
->created
= rb_current_time();
187 aconf
->host
= rb_strdup(host
);
188 aconf
->user
= rb_strdup(user
);
190 aconf
->info
.oper
= operhash_add(get_oper_name(source_p
));
192 /* Look for an oper reason */
193 if((oper_reason
= strchr(reason
, '|')) != NULL
)
198 if(!EmptyString(oper_reason
))
199 aconf
->spasswd
= rb_strdup(oper_reason
);
201 aconf
->passwd
= rb_strdup(reason
);
204 apply_prop_kline(source_p
, aconf
, reason
, oper_reason
, tkline_time
);
205 else if(tkline_time
> 0)
206 apply_tkline(source_p
, aconf
, reason
, oper_reason
, tkline_time
);
208 apply_kline(source_p
, aconf
, reason
, oper_reason
);
210 if(ConfigFileEntry
.kline_delay
)
212 if(kline_queued
== 0)
214 rb_event_addonce("check_klines", check_klines_event
, NULL
,
215 ConfigFileEntry
.kline_delay
);
227 * parv[1] - server targeted at
228 * parv[2] - tkline time (0 if perm)
234 ms_kline(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
236 int tkline_time
= atoi(parv
[2]);
238 /* 1.5-3 and earlier contains a bug that allows remote klines to be
239 * sent with an empty reason field. This is a protocol violation,
240 * but its not worth dropping the link over.. --anfl
242 if(parc
< 6 || EmptyString(parv
[5]))
245 propagate_generic(source_p
, "KLINE", parv
[1], CAP_KLN
,
246 "%d %s %s :%s", tkline_time
, parv
[3], parv
[4], parv
[5]);
248 if(!match(parv
[1], me
.name
))
251 if(!IsPerson(source_p
))
254 handle_remote_kline(source_p
, tkline_time
, parv
[3], parv
[4], parv
[5]);
259 me_kline(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
261 /* <tkline_time> <user> <host> :<reason> */
262 if(!IsPerson(source_p
))
265 handle_remote_kline(source_p
, atoi(parv
[1]), parv
[2], parv
[3], parv
[4]);
270 handle_remote_kline(struct Client
*source_p
, int tkline_time
,
271 const char *user
, const char *host
, const char *kreason
)
273 char *reason
= LOCAL_COPY(kreason
);
274 struct ConfItem
*aconf
= NULL
;
277 if(!find_shared_conf(source_p
->username
, source_p
->host
,
278 source_p
->servptr
->name
,
279 (tkline_time
> 0) ? SHARED_TKLINE
: SHARED_PKLINE
))
282 if(!valid_user_host(source_p
, user
, host
) ||
283 !valid_wild_card(source_p
, user
, host
) || !valid_comment(source_p
, reason
))
286 if(already_placed_kline(source_p
, user
, host
, tkline_time
))
291 aconf
->status
= CONF_KILL
;
292 aconf
->created
= rb_current_time();
293 aconf
->user
= rb_strdup(user
);
294 aconf
->host
= rb_strdup(host
);
295 aconf
->info
.oper
= operhash_add(get_oper_name(source_p
));
297 /* Look for an oper reason */
298 if((oper_reason
= strchr(reason
, '|')) != NULL
)
303 if(!EmptyString(oper_reason
))
304 aconf
->spasswd
= rb_strdup(oper_reason
);
306 aconf
->passwd
= rb_strdup(reason
);
309 apply_tkline(source_p
, aconf
, reason
, oper_reason
, tkline_time
);
311 apply_kline(source_p
, aconf
, reason
, oper_reason
);
313 if(ConfigFileEntry
.kline_delay
)
315 if(kline_queued
== 0)
317 rb_event_addonce("check_klines", check_klines_event
, NULL
,
318 ConfigFileEntry
.kline_delay
);
330 * parv[1] - kline to remove
331 * parv[2] - optional "ON"
332 * parv[3] - optional target server
335 mo_unkline(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
340 char *h
= LOCAL_COPY(parv
[1]);
341 struct ConfItem
*aconf
;
344 if(!IsOperUnkline(source_p
))
346 sendto_one(source_p
, form_str(ERR_NOPRIVS
), me
.name
, source_p
->name
, "unkline");
350 if((host
= strchr(h
, '@')) || *h
== '*' || strchr(h
, '.') || strchr(h
, ':'))
352 /* Explicit user@host mask given */
354 if(host
) /* Found user@host */
358 /* check for @host */
364 /* check for user@ */
370 user
= splat
; /* no @ found, assume its *@somehost */
376 sendto_one_notice(source_p
, ":Invalid parameters");
380 /* possible remote kline.. */
381 if((parc
> 3) && (irccmp(parv
[2], "ON") == 0))
383 if(!IsOperRemoteBan(source_p
))
385 sendto_one(source_p
, form_str(ERR_NOPRIVS
),
386 me
.name
, source_p
->name
, "remoteban");
390 propagate_generic(source_p
, "UNKLINE", parv
[3], CAP_UNKLN
, "%s %s", user
, host
);
392 if(match(parv
[3], me
.name
) == 0)
398 aconf
= find_exact_conf_by_address(host
, CONF_KILL
, user
);
400 /* No clustering for removing a propagated kline */
401 if(propagated
&& (aconf
== NULL
|| !aconf
->lifetime
) &&
402 rb_dlink_list_length(&cluster_conf_list
) > 0)
403 cluster_generic(source_p
, "UNKLINE", SHARED_UNKLINE
, CAP_UNKLN
,
404 "%s %s", user
, host
);
408 sendto_one_notice(source_p
, ":No K-Line for %s@%s", user
, host
);
415 remove_prop_kline(source_p
, aconf
);
417 sendto_one_notice(source_p
, ":Cannot remove global K-Line %s@%s on specific servers", user
, host
);
421 if(remove_temp_kline(source_p
, aconf
))
424 remove_permkline_match(source_p
, aconf
);
431 * parv[1] - target server
432 * parv[2] - user to unkline
433 * parv[3] - host to unkline
436 ms_unkline(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
438 /* parv[0] parv[1] parv[2] parv[3]
439 * oper target server user host */
440 propagate_generic(source_p
, "UNKLINE", parv
[1], CAP_UNKLN
, "%s %s", parv
[2], parv
[3]);
442 if(!match(parv
[1], me
.name
))
445 if(!IsPerson(source_p
))
448 handle_remote_unkline(source_p
, parv
[2], parv
[3]);
453 me_unkline(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
456 if(!IsPerson(source_p
))
459 handle_remote_unkline(source_p
, parv
[1], parv
[2]);
464 handle_remote_unkline(struct Client
*source_p
, const char *user
, const char *host
)
466 struct ConfItem
*aconf
;
468 if(!find_shared_conf(source_p
->username
, source_p
->host
,
469 source_p
->servptr
->name
, SHARED_UNKLINE
))
472 aconf
= find_exact_conf_by_address(host
, CONF_KILL
, user
);
475 sendto_one_notice(source_p
, ":No K-Line for %s@%s", user
, host
);
480 sendto_one_notice(source_p
, ":Cannot remove global K-Line %s@%s on specific servers", user
, host
);
484 if(remove_temp_kline(source_p
, aconf
))
487 remove_permkline_match(source_p
, aconf
);
494 * side effects - kline as given, is added to the hashtable
498 apply_kline(struct Client
*source_p
, struct ConfItem
*aconf
,
499 const char *reason
, const char *oper_reason
)
501 add_conf_by_address(aconf
->host
, CONF_KILL
, aconf
->user
, NULL
, aconf
);
502 bandb_add(BANDB_KLINE
, source_p
, aconf
->user
, aconf
->host
,
503 reason
, EmptyString(oper_reason
) ? NULL
: oper_reason
, 0);
505 /* no oper reason.. */
506 if(EmptyString(oper_reason
))
508 sendto_realops_snomask(SNO_GENERAL
, L_ALL
,
509 "%s added K-Line for [%s@%s] [%s]",
510 get_oper_name(source_p
), aconf
->user
, aconf
->host
, reason
);
511 ilog(L_KLINE
, "K %s 0 %s %s %s",
512 get_oper_name(source_p
), aconf
->user
, aconf
->host
, reason
);
516 sendto_realops_snomask(SNO_GENERAL
, L_ALL
,
517 "%s added K-Line for [%s@%s] [%s|%s]",
518 get_oper_name(source_p
), aconf
->user
, aconf
->host
,
519 reason
, oper_reason
);
520 ilog(L_KLINE
, "K %s 0 %s %s %s|%s",
521 get_oper_name(source_p
), aconf
->user
, aconf
->host
, reason
, oper_reason
);
524 sendto_one_notice(source_p
, ":Added K-Line [%s@%s]",
525 aconf
->user
, aconf
->host
);
532 * side effects - tkline as given is placed
535 apply_tkline(struct Client
*source_p
, struct ConfItem
*aconf
,
536 const char *reason
, const char *oper_reason
, int tkline_time
)
538 aconf
->hold
= rb_current_time() + tkline_time
;
539 add_temp_kline(aconf
);
541 /* no oper reason.. */
542 if(EmptyString(oper_reason
))
544 sendto_realops_snomask(SNO_GENERAL
, L_ALL
,
545 "%s added temporary %d min. K-Line for [%s@%s] [%s]",
546 get_oper_name(source_p
), tkline_time
/ 60,
547 aconf
->user
, aconf
->host
, reason
);
548 ilog(L_KLINE
, "K %s %d %s %s %s",
549 get_oper_name(source_p
), tkline_time
/ 60, aconf
->user
, aconf
->host
, reason
);
553 sendto_realops_snomask(SNO_GENERAL
, L_ALL
,
554 "%s added temporary %d min. K-Line for [%s@%s] [%s|%s]",
555 get_oper_name(source_p
), tkline_time
/ 60,
556 aconf
->user
, aconf
->host
, reason
, oper_reason
);
557 ilog(L_KLINE
, "K %s %d %s %s %s|%s",
558 get_oper_name(source_p
), tkline_time
/ 60,
559 aconf
->user
, aconf
->host
, reason
, oper_reason
);
562 sendto_one_notice(source_p
, ":Added temporary %d min. K-Line [%s@%s]",
563 tkline_time
/ 60, aconf
->user
, aconf
->host
);
567 apply_prop_kline(struct Client
*source_p
, struct ConfItem
*aconf
,
568 const char *reason
, const char *oper_reason
, int tkline_time
)
571 struct ConfItem
*oldconf
;
573 aconf
->flags
|= CONF_FLAGS_MYOPER
| CONF_FLAGS_TEMPORARY
;
574 aconf
->hold
= rb_current_time() + tkline_time
;
575 aconf
->lifetime
= aconf
->hold
;
577 ptr
= find_prop_ban(aconf
->status
, aconf
->user
, aconf
->host
);
581 /* Remember at least as long as the old one. */
582 if(oldconf
->lifetime
> aconf
->lifetime
)
583 aconf
->lifetime
= oldconf
->lifetime
;
584 /* Force creation time to increase. */
585 if(oldconf
->created
>= aconf
->created
)
586 aconf
->created
= oldconf
->created
+ 1;
587 /* Tell deactivate_conf() to destroy it. */
588 oldconf
->lifetime
= rb_current_time();
589 deactivate_conf(oldconf
, ptr
);
592 rb_dlinkAddAlloc(aconf
, &prop_bans
);
593 add_conf_by_address(aconf
->host
, CONF_KILL
, aconf
->user
, NULL
, aconf
);
595 /* no oper reason.. */
596 if(EmptyString(oper_reason
))
598 sendto_realops_snomask(SNO_GENERAL
, L_ALL
,
599 "%s added global %d min. K-Line for [%s@%s] [%s]",
600 get_oper_name(source_p
), tkline_time
/ 60,
601 aconf
->user
, aconf
->host
, reason
);
602 ilog(L_KLINE
, "K %s %d %s %s %s",
603 get_oper_name(source_p
), tkline_time
/ 60, aconf
->user
, aconf
->host
, reason
);
607 sendto_realops_snomask(SNO_GENERAL
, L_ALL
,
608 "%s added global %d min. K-Line for [%s@%s] [%s|%s]",
609 get_oper_name(source_p
), tkline_time
/ 60,
610 aconf
->user
, aconf
->host
, reason
, oper_reason
);
611 ilog(L_KLINE
, "K %s %d %s %s %s|%s",
612 get_oper_name(source_p
), tkline_time
/ 60,
613 aconf
->user
, aconf
->host
, reason
, oper_reason
);
616 sendto_one_notice(source_p
, ":Added global %d min. K-Line [%s@%s]",
617 tkline_time
/ 60, aconf
->user
, aconf
->host
);
619 sendto_server(NULL
, NULL
, CAP_BAN
|CAP_TS6
, NOCAPS
,
620 ":%s BAN + K %s %s %lu %d %d * :%s%s%s",
621 source_p
->id
, aconf
->user
, aconf
->host
,
622 (unsigned long)aconf
->created
,
623 (int)(aconf
->hold
- aconf
->created
),
624 (int)(aconf
->lifetime
- aconf
->created
),
626 oper_reason
? "|" : "",
627 oper_reason
? oper_reason
: "");
632 * inputs - client placing kline, user@host, user buffer, host buffer
633 * output - 0 if not ok to kline, 1 to kline i.e. if valid user host
637 find_user_host(struct Client
*source_p
, const char *userhost
, char *luser
, char *lhost
)
641 hostp
= strchr(userhost
, '@');
643 if(hostp
!= NULL
) /* I'm a little user@host */
645 *(hostp
++) = '\0'; /* short and squat */
647 rb_strlcpy(luser
, userhost
, USERLEN
+ 1); /* here is my user */
651 rb_strlcpy(lhost
, hostp
, HOSTLEN
+ 1); /* here is my host */
657 /* no '@', no '.', so its not a user@host or host, therefore
658 * its a nick, which support was removed for.
660 if(strchr(userhost
, '.') == NULL
&& strchr(userhost
, ':') == NULL
)
662 sendto_one_notice(source_p
, ":K-Line must be a user@host or host");
666 luser
[0] = '*'; /* no @ found, assume its *@somehost */
668 rb_strlcpy(lhost
, userhost
, HOSTLEN
+ 1);
676 * inputs - user buffer, host buffer
677 * output - 0 if invalid, 1 if valid
681 valid_user_host(struct Client
*source_p
, const char *luser
, const char *lhost
)
683 /* # is invalid, as are '!' (n!u@h kline) and '@' (u@@h kline) */
684 if(strchr(lhost
, '#') || strchr(luser
, '#') || strchr(luser
, '!') || strchr(lhost
, '@'))
686 sendto_one_notice(source_p
, ":Invalid K-Line");
695 * input - user buffer, host buffer
696 * output - 0 if invalid, 1 if valid
700 valid_wild_card(struct Client
*source_p
, const char *luser
, const char *lhost
)
707 /* user has no wildcards, always accept -- jilles */
708 if(!strchr(luser
, '?') && !strchr(luser
, '*'))
711 /* check there are enough non wildcard chars */
713 while((tmpch
= *p
++))
715 if(!IsKWildChar(tmpch
))
717 /* found enough chars, return */
718 if(++nonwild
>= ConfigFileEntry
.min_nonwildcard
)
723 /* try host, as user didnt contain enough */
724 /* special case for cidr masks -- jilles */
725 if((p
= strrchr(lhost
, '/')) != NULL
&& IsDigit(p
[1]))
727 bitlen
= atoi(p
+ 1);
728 /* much like non-cidr for ipv6, rather arbitrary for ipv4 */
731 (strchr(lhost
, ':') ? 4 * (ConfigFileEntry
.min_nonwildcard
- nonwild
) : 6 -
738 while((tmpch
= *p
++))
740 if(!IsKWildChar(tmpch
))
741 if(++nonwild
>= ConfigFileEntry
.min_nonwildcard
)
746 sendto_one_notice(source_p
,
747 ":Please include at least %d non-wildcard "
748 "characters with the user@host", ConfigFileEntry
.min_nonwildcard
);
754 * inputs - pointer to client
755 * - pointer to comment
756 * output - 0 if no valid comment, 1 if valid
757 * side effects - NONE
760 valid_comment(struct Client
*source_p
, char *comment
)
762 if(strchr(comment
, '"'))
764 sendto_one_notice(source_p
, ":Invalid character '\"' in comment");
768 if(strlen(comment
) > BANREASONLEN
)
769 comment
[BANREASONLEN
] = '\0';
774 /* already_placed_kline()
776 * inputs - source to notify, user@host to check, tkline time
777 * outputs - 1 if a perm kline or a tkline when a tkline is being
779 * side effects - notifies source_p kline exists
781 /* Note: This currently works if the new K-line is a special case of an
782 * existing K-line, but not the other way round. To do that we would
783 * have to walk the hash and check every existing K-line. -A1kmm.
786 already_placed_kline(struct Client
*source_p
, const char *luser
, const char *lhost
, int tkline
)
788 const char *reason
, *p
;
789 struct rb_sockaddr_storage iphost
, *piphost
;
790 struct ConfItem
*aconf
;
793 aconf
= find_exact_conf_by_address(lhost
, CONF_KILL
, luser
);
794 if(aconf
== NULL
&& ConfigFileEntry
.non_redundant_klines
)
797 if((t
= parse_netmask(lhost
, (struct sockaddr
*) &iphost
, &bits
)) != HM_HOST
)
811 aconf
= find_conf_by_address(lhost
, NULL
, NULL
, (struct sockaddr
*) piphost
,
812 CONF_KILL
, t
, luser
, NULL
);
815 /* The above was really a lookup of a single IP,
816 * so check if the new kline is wider than the
820 p
= strchr(aconf
->host
, '/');
821 if(bits
> 0 && (p
== NULL
|| bits
< atoi(p
+ 1)))
827 /* setting a tkline, or existing one is perm */
828 if(tkline
|| ((aconf
->flags
& CONF_FLAGS_TEMPORARY
) == 0))
830 reason
= aconf
->passwd
? aconf
->passwd
: "<No Reason>";
832 sendto_one_notice(source_p
,
833 ":[%s@%s] already K-Lined by [%s@%s] - %s",
834 luser
, lhost
, aconf
->user
, aconf
->host
, reason
);
842 /* remove_permkline_match()
844 * hunts for a permanent kline, and removes it.
847 remove_permkline_match(struct Client
*source_p
, struct ConfItem
*aconf
)
849 sendto_one_notice(source_p
, ":K-Line for [%s@%s] is removed", aconf
->user
, aconf
->host
);
851 sendto_realops_snomask(SNO_GENERAL
, L_ALL
,
852 "%s has removed the K-Line for: [%s@%s]",
853 get_oper_name(source_p
), aconf
->user
, aconf
->host
);
855 ilog(L_KLINE
, "UK %s %s %s", get_oper_name(source_p
), aconf
->user
, aconf
->host
);
857 remove_reject_mask(aconf
->user
, aconf
->host
);
858 bandb_del(BANDB_KLINE
, aconf
->user
, aconf
->host
);
859 delete_one_address_conf(aconf
->host
, aconf
);
864 /* remove_temp_kline()
866 * inputs - username, hostname to unkline
868 * side effects - tries to unkline anything that matches
871 remove_temp_kline(struct Client
*source_p
, struct ConfItem
*aconf
)
876 for(i
= 0; i
< LAST_TEMP_TYPE
; i
++)
878 RB_DLINK_FOREACH(ptr
, temp_klines
[i
].head
)
880 if(aconf
== ptr
->data
)
882 sendto_one_notice(source_p
,
883 ":Un-klined [%s@%s] from temporary k-lines",
884 aconf
->user
, aconf
->host
);
885 sendto_realops_snomask(SNO_GENERAL
, L_ALL
,
886 "%s has removed the temporary K-Line for: [%s@%s]",
887 get_oper_name(source_p
), aconf
->user
,
890 ilog(L_KLINE
, "UK %s %s %s",
891 get_oper_name(source_p
), aconf
->user
, aconf
->host
);
892 rb_dlinkDestroy(ptr
, &temp_klines
[i
]);
893 remove_reject_mask(aconf
->user
, aconf
->host
);
894 delete_one_address_conf(aconf
->host
, aconf
);
904 remove_prop_kline(struct Client
*source_p
, struct ConfItem
*aconf
)
908 ptr
= rb_dlinkFind(aconf
, &prop_bans
);
911 sendto_one_notice(source_p
,
912 ":Un-klined [%s@%s] from global k-lines",
913 aconf
->user
, aconf
->host
);
914 sendto_realops_snomask(SNO_GENERAL
, L_ALL
,
915 "%s has removed the global K-Line for: [%s@%s]",
916 get_oper_name(source_p
), aconf
->user
,
919 ilog(L_KLINE
, "UK %s %s %s",
920 get_oper_name(source_p
), aconf
->user
, aconf
->host
);
921 if(aconf
->created
< rb_current_time())
922 aconf
->created
= rb_current_time();
925 operhash_delete(aconf
->info
.oper
);
926 aconf
->info
.oper
= operhash_add(get_oper_name(source_p
));
927 aconf
->flags
|= CONF_FLAGS_MYOPER
| CONF_FLAGS_TEMPORARY
;
928 sendto_server(NULL
, NULL
, CAP_BAN
|CAP_TS6
, NOCAPS
,
929 ":%s BAN - K %s %s %lu %d %d * :*",
930 source_p
->id
, aconf
->user
, aconf
->host
,
931 (unsigned long)aconf
->created
,
933 (int)(aconf
->lifetime
- aconf
->created
));
934 remove_reject_mask(aconf
->user
, aconf
->host
);
935 deactivate_conf(aconf
, ptr
);