| 23 |
|
*/ |
| 24 |
|
|
| 25 |
|
#include "stdinc.h" |
| 26 |
< |
#include "tools.h" |
| 26 |
> |
#include "list.h" |
| 27 |
|
#include "channel.h" |
| 28 |
|
#include "client.h" |
| 29 |
– |
#include "common.h" |
| 29 |
|
#include "irc_string.h" |
| 31 |
– |
#include "sprintf_irc.h" |
| 30 |
|
#include "ircd.h" |
| 31 |
+ |
#include "conf.h" |
| 32 |
|
#include "hostmask.h" |
| 33 |
|
#include "numeric.h" |
| 35 |
– |
#include "list.h" |
| 34 |
|
#include "fdlist.h" |
| 35 |
|
#include "s_bsd.h" |
| 36 |
< |
#include "s_conf.h" |
| 39 |
< |
#include "s_log.h" |
| 36 |
> |
#include "log.h" |
| 37 |
|
#include "s_misc.h" |
| 38 |
|
#include "send.h" |
| 39 |
|
#include "hash.h" |
| 43 |
– |
#include "handlers.h" |
| 40 |
|
#include "s_serv.h" |
| 45 |
– |
#include "msg.h" |
| 41 |
|
#include "s_gline.h" |
| 42 |
|
#include "parse.h" |
| 43 |
|
#include "modules.h" |
| 44 |
< |
#include "tools.h" |
| 45 |
< |
|
| 51 |
< |
static void me_kline(struct Client *, struct Client *, int, char **); |
| 52 |
< |
static void mo_kline(struct Client *, struct Client *, int, char **); |
| 53 |
< |
static void ms_kline(struct Client *, struct Client *, int, char **); |
| 54 |
< |
static void mo_dline(struct Client *, struct Client *, int, char **); |
| 55 |
< |
static void me_unkline(struct Client *, struct Client *, int, char **); |
| 56 |
< |
static void mo_unkline(struct Client *, struct Client *, int, char **); |
| 57 |
< |
static void ms_unkline(struct Client *, struct Client *, int, char **); |
| 58 |
< |
static void mo_undline(struct Client *, struct Client *, int, char **); |
| 59 |
< |
|
| 60 |
< |
#ifndef IPV6 |
| 61 |
< |
static char *make_cidr(char *dlhost, struct Client *); |
| 62 |
< |
#endif |
| 63 |
< |
|
| 64 |
< |
static int remove_tkline_match(const char *, const char *); |
| 65 |
< |
static int remove_tdline_match(const char *); |
| 66 |
< |
|
| 67 |
< |
struct Message kline_msgtab = { |
| 68 |
< |
"KLINE", 0, 0, 2, 0, MFLG_SLOW, 0, |
| 69 |
< |
{m_unregistered, m_not_oper, ms_kline, me_kline, mo_kline, m_ignore} |
| 70 |
< |
}; |
| 71 |
< |
|
| 72 |
< |
struct Message dline_msgtab = { |
| 73 |
< |
"DLINE", 0, 0, 2, 0, MFLG_SLOW, 0, |
| 74 |
< |
{m_unregistered, m_not_oper, m_error, m_ignore, mo_dline, m_ignore} |
| 75 |
< |
}; |
| 76 |
< |
|
| 77 |
< |
struct Message unkline_msgtab = { |
| 78 |
< |
"UNKLINE", 0, 0, 2, 0, MFLG_SLOW, 0, |
| 79 |
< |
{m_unregistered, m_not_oper, ms_unkline, me_unkline, mo_unkline, m_ignore} |
| 80 |
< |
}; |
| 81 |
< |
|
| 82 |
< |
struct Message undline_msgtab = { |
| 83 |
< |
"UNDLINE", 0, 0, 2, 0, MFLG_SLOW, 0, |
| 84 |
< |
{m_unregistered, m_not_oper, m_error, m_ignore, mo_undline, m_ignore} |
| 85 |
< |
}; |
| 44 |
> |
#include "conf_db.h" |
| 45 |
> |
#include "memory.h" |
| 46 |
|
|
| 87 |
– |
#ifndef STATIC_MODULES |
| 88 |
– |
void |
| 89 |
– |
_modinit(void) |
| 90 |
– |
{ |
| 91 |
– |
mod_add_cmd(&kline_msgtab); |
| 92 |
– |
mod_add_cmd(&unkline_msgtab); |
| 93 |
– |
mod_add_cmd(&dline_msgtab); |
| 94 |
– |
mod_add_cmd(&undline_msgtab); |
| 95 |
– |
add_capability("KLN", CAP_KLN, 1); |
| 96 |
– |
add_capability("UNKLN", CAP_UNKLN, 1); |
| 97 |
– |
} |
| 98 |
– |
|
| 99 |
– |
void |
| 100 |
– |
_moddeinit(void) |
| 101 |
– |
{ |
| 102 |
– |
mod_del_cmd(&kline_msgtab); |
| 103 |
– |
mod_del_cmd(&unkline_msgtab); |
| 104 |
– |
mod_del_cmd(&dline_msgtab); |
| 105 |
– |
mod_del_cmd(&undline_msgtab); |
| 106 |
– |
delete_capability("UNKLN"); |
| 107 |
– |
delete_capability("KLN"); |
| 108 |
– |
} |
| 109 |
– |
|
| 110 |
– |
const char *_version = "$Revision$"; |
| 111 |
– |
#endif |
| 112 |
– |
|
| 113 |
– |
/* Local function prototypes */ |
| 47 |
|
static int already_placed_kline(struct Client *, const char *, const char *, int); |
| 48 |
< |
static void apply_kline(struct Client *, struct ConfItem *, const char *, time_t); |
| 116 |
< |
static void apply_tkline(struct Client *, struct ConfItem *, int); |
| 48 |
> |
static void m_kline_add_kline(struct Client *, struct MaskItem *, time_t); |
| 49 |
|
|
| 50 |
|
static char buffer[IRCD_BUFSIZE]; |
| 51 |
+ |
static int remove_kline_match(const char *, const char *); |
| 52 |
+ |
|
| 53 |
|
|
| 54 |
|
/* mo_kline() |
| 55 |
|
* |
| 62 |
|
*/ |
| 63 |
|
static void |
| 64 |
|
mo_kline(struct Client *client_p, struct Client *source_p, |
| 65 |
< |
int parc, char **parv) |
| 65 |
> |
int parc, char *parv[]) |
| 66 |
|
{ |
| 67 |
|
char *reason = NULL; |
| 134 |
– |
char *oper_reason; |
| 68 |
|
char *user = NULL; |
| 69 |
|
char *host = NULL; |
| 70 |
|
const char *current_date; |
| 71 |
|
char *target_server = NULL; |
| 72 |
< |
struct ConfItem *conf; |
| 140 |
< |
struct AccessItem *aconf; |
| 72 |
> |
struct MaskItem *conf; |
| 73 |
|
time_t tkline_time = 0; |
| 74 |
|
time_t cur_time; |
| 75 |
|
|
| 76 |
< |
if (!IsOperK(source_p)) |
| 76 |
> |
if (!HasOFlag(source_p, OPER_FLAG_K)) |
| 77 |
|
{ |
| 78 |
|
sendto_one(source_p, form_str(ERR_NOPRIVS), |
| 79 |
|
me.name, source_p->name, "kline"); |
| 88 |
|
{ |
| 89 |
|
if (HasID(source_p)) |
| 90 |
|
{ |
| 91 |
< |
sendto_server(NULL, source_p, NULL, CAP_KLN|CAP_TS6, NOCAPS, LL_ICLIENT, |
| 91 |
> |
sendto_server(NULL, CAP_KLN|CAP_TS6, NOCAPS, |
| 92 |
|
":%s KLINE %s %lu %s %s :%s", |
| 93 |
|
source_p->id, target_server, (unsigned long)tkline_time, |
| 94 |
|
user, host, reason); |
| 95 |
< |
sendto_server(NULL, source_p, NULL, CAP_KLN, CAP_TS6, LL_ICLIENT, |
| 95 |
> |
sendto_server(NULL, CAP_KLN, CAP_TS6, |
| 96 |
|
":%s KLINE %s %lu %s %s :%s", |
| 97 |
|
source_p->name, target_server, (unsigned long)tkline_time, |
| 98 |
|
user, host, reason); |
| 99 |
|
} |
| 100 |
|
else |
| 101 |
< |
sendto_server(NULL, source_p, NULL, CAP_KLN, NOCAPS, LL_ICLIENT, |
| 101 |
> |
sendto_server(NULL, CAP_KLN, NOCAPS, |
| 102 |
|
":%s KLINE %s %lu %s %s :%s", |
| 103 |
|
source_p->name, target_server, (unsigned long)tkline_time, |
| 104 |
|
user, host, reason); |
| 105 |
|
|
| 106 |
|
/* Allow ON to apply local kline as well if it matches */ |
| 107 |
< |
if (!match(target_server, me.name)) |
| 107 |
> |
if (match(target_server, me.name)) |
| 108 |
|
return; |
| 109 |
|
} |
| 110 |
|
else |
| 111 |
|
cluster_a_line(source_p, "KLINE", CAP_KLN, SHARED_KLINE, |
| 112 |
< |
"%d %s %s :%s", tkline_time, user, host, reason); |
| 112 |
> |
"%d %s %s :%s", tkline_time, user, host, reason); |
| 113 |
|
|
| 114 |
< |
if (already_placed_kline(source_p, user, host, YES)) |
| 114 |
> |
if (already_placed_kline(source_p, user, host, 1)) |
| 115 |
|
return; |
| 116 |
|
|
| 185 |
– |
/* Look for an oper reason */ |
| 186 |
– |
if ((oper_reason = strchr(reason, '|')) != NULL) |
| 187 |
– |
*oper_reason++ = '\0'; |
| 188 |
– |
|
| 117 |
|
cur_time = CurrentTime; |
| 118 |
|
current_date = smalldate(cur_time); |
| 119 |
< |
conf = make_conf_item(KLINE_TYPE); |
| 192 |
< |
aconf = map_to_conf(conf); |
| 119 |
> |
conf = conf_make(CONF_KLINE); |
| 120 |
|
|
| 121 |
< |
DupString(aconf->host, host); |
| 122 |
< |
DupString(aconf->user, user); |
| 121 |
> |
conf->host = xstrdup(host); |
| 122 |
> |
conf->user = xstrdup(user); |
| 123 |
|
|
| 124 |
|
if (tkline_time != 0) |
| 125 |
< |
{ |
| 126 |
< |
ircsprintf(buffer, "Temporary K-line %d min. - %s (%s)", |
| 200 |
< |
(int)(tkline_time/60), reason, current_date); |
| 201 |
< |
DupString(aconf->reason, buffer); |
| 202 |
< |
|
| 203 |
< |
if (oper_reason != NULL) |
| 204 |
< |
DupString(aconf->oper_reason, oper_reason); |
| 205 |
< |
apply_tkline(source_p, conf, tkline_time); |
| 206 |
< |
} |
| 125 |
> |
snprintf(buffer, sizeof(buffer), "Temporary K-line %d min. - %s (%s)", |
| 126 |
> |
(int)(tkline_time/60), reason, current_date); |
| 127 |
|
else |
| 128 |
< |
{ |
| 209 |
< |
ircsprintf(buffer, "%s (%s)", reason, current_date); |
| 210 |
< |
DupString(aconf->reason, buffer); |
| 128 |
> |
snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date); |
| 129 |
|
|
| 130 |
< |
if (oper_reason != NULL) |
| 131 |
< |
DupString(aconf->oper_reason, oper_reason); |
| 214 |
< |
apply_kline(source_p, conf, current_date, cur_time); |
| 215 |
< |
} |
| 130 |
> |
conf->reason = xstrdup(buffer); |
| 131 |
> |
m_kline_add_kline(source_p, conf, tkline_time); |
| 132 |
|
} |
| 133 |
|
|
| 134 |
|
/* me_kline - handle remote kline. no propagation */ |
| 136 |
|
me_kline(struct Client *client_p, struct Client *source_p, |
| 137 |
|
int parc, char *parv[]) |
| 138 |
|
{ |
| 139 |
< |
struct ConfItem *conf=NULL; |
| 140 |
< |
struct AccessItem *aconf=NULL; |
| 225 |
< |
int tkline_time; |
| 139 |
> |
struct MaskItem *conf = NULL; |
| 140 |
> |
int tkline_time = 0; |
| 141 |
|
const char* current_date; |
| 142 |
|
time_t cur_time; |
| 143 |
< |
char *kuser, *khost, *kreason, *oper_reason; |
| 143 |
> |
char *kuser, *khost, *kreason; |
| 144 |
|
|
| 145 |
< |
if (parc != 6) |
| 145 |
> |
if (parc != 6 || EmptyString(parv[5])) |
| 146 |
|
return; |
| 147 |
|
|
| 148 |
< |
if (!match(parv[1], me.name)) |
| 148 |
> |
if (match(parv[1], me.name)) |
| 149 |
|
return; |
| 150 |
|
|
| 151 |
|
tkline_time = valid_tkline(parv[2], TK_SECONDS); |
| 153 |
|
khost = parv[4]; |
| 154 |
|
kreason = parv[5]; |
| 155 |
|
|
| 241 |
– |
if ((oper_reason = strchr(kreason, '|')) != NULL) |
| 242 |
– |
*oper_reason++ = '\0'; |
| 243 |
– |
|
| 156 |
|
cur_time = CurrentTime; |
| 157 |
|
current_date = smalldate(cur_time); |
| 158 |
|
|
| 159 |
< |
if (find_matching_name_conf(ULINE_TYPE, source_p->servptr->name, |
| 159 |
> |
if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name, |
| 160 |
|
source_p->username, source_p->host, |
| 161 |
|
SHARED_KLINE)) |
| 162 |
|
{ |
| 163 |
|
if (!IsClient(source_p) || |
| 164 |
< |
already_placed_kline(source_p, kuser, khost, YES)) |
| 164 |
> |
already_placed_kline(source_p, kuser, khost, 1)) |
| 165 |
|
return; |
| 166 |
|
|
| 167 |
< |
conf = make_conf_item(KLINE_TYPE); |
| 168 |
< |
aconf = map_to_conf(conf); |
| 169 |
< |
DupString(aconf->host, khost); |
| 258 |
< |
DupString(aconf->user, kuser); |
| 167 |
> |
conf = conf_make(CONF_KLINE); |
| 168 |
> |
conf->host = xstrdup(khost); |
| 169 |
> |
conf->user = xstrdup(kuser); |
| 170 |
|
|
| 171 |
|
if (tkline_time != 0) |
| 172 |
< |
{ |
| 173 |
< |
ircsprintf(buffer, "Temporary K-line %d min. - %s (%s)", |
| 263 |
< |
(int)(tkline_time/60), kreason, current_date); |
| 264 |
< |
DupString(aconf->reason, buffer); |
| 265 |
< |
|
| 266 |
< |
if (oper_reason != NULL) |
| 267 |
< |
DupString(aconf->oper_reason, oper_reason); |
| 268 |
< |
apply_tkline(source_p, conf, tkline_time); |
| 269 |
< |
} |
| 172 |
> |
snprintf(buffer, sizeof(buffer), "Temporary K-line %d min. - %s (%s)", |
| 173 |
> |
(int)(tkline_time/60), kreason, current_date); |
| 174 |
|
else |
| 175 |
< |
{ |
| 272 |
< |
ircsprintf(buffer, "%s (%s)", kreason, current_date); |
| 273 |
< |
DupString(aconf->reason, buffer); |
| 175 |
> |
snprintf(buffer, sizeof(buffer), "%s (%s)", kreason, current_date); |
| 176 |
|
|
| 177 |
< |
if (oper_reason != NULL) |
| 178 |
< |
DupString(aconf->oper_reason, oper_reason); |
| 277 |
< |
apply_kline(source_p, conf, current_date, cur_time); |
| 278 |
< |
} |
| 177 |
> |
conf->reason = xstrdup(buffer); |
| 178 |
> |
m_kline_add_kline(source_p, conf, tkline_time); |
| 179 |
|
} |
| 180 |
|
} |
| 181 |
|
|
| 182 |
|
static void |
| 183 |
|
ms_kline(struct Client *client_p, struct Client *source_p, |
| 184 |
< |
int parc, char *parv[]) |
| 184 |
> |
int parc, char *parv[]) |
| 185 |
|
{ |
| 186 |
< |
if (parc != 6) |
| 186 |
> |
if (parc != 6 || EmptyString(parv[5])) |
| 187 |
|
return; |
| 188 |
|
|
| 189 |
|
/* parv[0] parv[1] parv[2] parv[3] parv[4] parv[5] */ |
| 195 |
|
me_kline(client_p, source_p, parc, parv); |
| 196 |
|
} |
| 197 |
|
|
| 298 |
– |
/* apply_kline() |
| 299 |
– |
* |
| 300 |
– |
* inputs - |
| 301 |
– |
* output - NONE |
| 302 |
– |
* side effects - kline as given, is added to the hashtable |
| 303 |
– |
* and conf file |
| 304 |
– |
*/ |
| 305 |
– |
static void |
| 306 |
– |
apply_kline(struct Client *source_p, struct ConfItem *conf, |
| 307 |
– |
const char *current_date, time_t cur_time) |
| 308 |
– |
{ |
| 309 |
– |
struct AccessItem *aconf = map_to_conf(conf); |
| 310 |
– |
|
| 311 |
– |
add_conf_by_address(CONF_KILL, aconf); |
| 312 |
– |
write_conf_line(source_p, conf, current_date, cur_time); |
| 313 |
– |
/* Now, activate kline against current online clients */ |
| 314 |
– |
rehashed_klines = 1; |
| 315 |
– |
} |
| 316 |
– |
|
| 198 |
|
/* apply_tkline() |
| 199 |
|
* |
| 200 |
|
* inputs - |
| 202 |
|
* side effects - tkline as given is placed |
| 203 |
|
*/ |
| 204 |
|
static void |
| 205 |
< |
apply_tkline(struct Client *source_p, struct ConfItem *conf, |
| 206 |
< |
int tkline_time) |
| 205 |
> |
m_kline_add_kline(struct Client *source_p, struct MaskItem *conf, |
| 206 |
> |
time_t tkline_time) |
| 207 |
|
{ |
| 208 |
< |
struct AccessItem *aconf; |
| 328 |
< |
|
| 329 |
< |
aconf = (struct AccessItem *)map_to_conf(conf); |
| 330 |
< |
aconf->hold = CurrentTime + tkline_time; |
| 331 |
< |
add_temp_line(conf); |
| 332 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 333 |
< |
"%s added temporary %d min. K-Line for [%s@%s] [%s]", |
| 334 |
< |
get_oper_name(source_p), tkline_time/60, |
| 335 |
< |
aconf->user, aconf->host, |
| 336 |
< |
aconf->reason); |
| 337 |
< |
sendto_one(source_p, ":%s NOTICE %s :Added temporary %d min. K-Line [%s@%s]", |
| 338 |
< |
MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from), |
| 339 |
< |
source_p->name, tkline_time/60, aconf->user, aconf->host); |
| 340 |
< |
ilog(L_TRACE, "%s added temporary %d min. K-Line for [%s@%s] [%s]", |
| 341 |
< |
source_p->name, tkline_time/60, |
| 342 |
< |
aconf->user, aconf->host, aconf->reason); |
| 343 |
< |
log_oper_action(LOG_TEMP_KLINE_TYPE, source_p, "[%s@%s] [%s]\n", |
| 344 |
< |
aconf->user, aconf->host, aconf->reason); |
| 345 |
< |
rehashed_klines = 1; |
| 346 |
< |
} |
| 347 |
< |
|
| 348 |
< |
/* apply_tdline() |
| 349 |
< |
* |
| 350 |
< |
* inputs - |
| 351 |
< |
* output - NONE |
| 352 |
< |
* side effects - tkline as given is placed |
| 353 |
< |
*/ |
| 354 |
< |
static void |
| 355 |
< |
apply_tdline(struct Client *source_p, struct ConfItem *conf, |
| 356 |
< |
const char *current_date, int tkline_time) |
| 357 |
< |
{ |
| 358 |
< |
struct AccessItem *aconf; |
| 359 |
< |
|
| 360 |
< |
aconf = map_to_conf(conf); |
| 361 |
< |
aconf->hold = CurrentTime + tkline_time; |
| 362 |
< |
|
| 363 |
< |
add_temp_line(conf); |
| 364 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 365 |
< |
"%s added temporary %d min. D-Line for [%s] [%s]", |
| 366 |
< |
get_oper_name(source_p), tkline_time/60, |
| 367 |
< |
aconf->host, aconf->reason); |
| 368 |
< |
|
| 369 |
< |
sendto_one(source_p, ":%s NOTICE %s :Added temporary %d min. D-Line [%s]", |
| 370 |
< |
MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from), |
| 371 |
< |
source_p->name, tkline_time/60, aconf->host); |
| 372 |
< |
ilog(L_TRACE, "%s added temporary %d min. D-Line for [%s] [%s]", |
| 373 |
< |
source_p->name, tkline_time/60, aconf->host, aconf->reason); |
| 374 |
< |
log_oper_action(LOG_TEMP_DLINE_TYPE, source_p, "[%s@%s] [%s]\n", |
| 375 |
< |
aconf->user, aconf->host, aconf->reason); |
| 376 |
< |
rehashed_klines = 1; |
| 377 |
< |
} |
| 378 |
< |
|
| 379 |
< |
/* mo_dline() |
| 380 |
< |
* |
| 381 |
< |
* inputs - pointer to server |
| 382 |
< |
* - pointer to client |
| 383 |
< |
* - parameter count |
| 384 |
< |
* - parameter list |
| 385 |
< |
* output - |
| 386 |
< |
* side effects - D line is added |
| 387 |
< |
* |
| 388 |
< |
*/ |
| 389 |
< |
static void |
| 390 |
< |
mo_dline(struct Client *client_p, struct Client *source_p, |
| 391 |
< |
int parc, char *parv[]) |
| 392 |
< |
{ |
| 393 |
< |
char def_reason[] = "No reason"; |
| 394 |
< |
char *dlhost, *oper_reason, *reason; |
| 395 |
< |
const char *creason; |
| 396 |
< |
#ifndef IPV6 |
| 397 |
< |
struct Client *target_p; |
| 398 |
< |
#endif |
| 399 |
< |
struct irc_ssaddr daddr; |
| 400 |
< |
struct ConfItem *conf=NULL; |
| 401 |
< |
struct AccessItem *aconf=NULL; |
| 402 |
< |
time_t tkline_time=0; |
| 403 |
< |
int bits, t; |
| 404 |
< |
const char* current_date; |
| 405 |
< |
time_t cur_time; |
| 406 |
< |
|
| 407 |
< |
if (!IsOperK(source_p)) |
| 208 |
> |
if (tkline_time) |
| 209 |
|
{ |
| 210 |
< |
sendto_one(source_p, form_str(ERR_NOPRIVS), |
| 211 |
< |
me.name, source_p->name, "kline"); |
| 212 |
< |
return; |
| 210 |
> |
conf->until = CurrentTime + tkline_time; |
| 211 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 212 |
> |
"%s added temporary %d min. K-Line for [%s@%s] [%s]", |
| 213 |
> |
get_oper_name(source_p), tkline_time/60, |
| 214 |
> |
conf->user, conf->host, |
| 215 |
> |
conf->reason); |
| 216 |
> |
sendto_one(source_p, ":%s NOTICE %s :Added temporary %d min. K-Line [%s@%s]", |
| 217 |
> |
MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from), |
| 218 |
> |
source_p->name, tkline_time/60, conf->user, conf->host); |
| 219 |
> |
ilog(LOG_TYPE_KLINE, "%s added temporary %d min. K-Line for [%s@%s] [%s]", |
| 220 |
> |
source_p->name, tkline_time/60, |
| 221 |
> |
conf->user, conf->host, conf->reason); |
| 222 |
|
} |
| 413 |
– |
|
| 414 |
– |
if (parse_aline("DLINE", source_p, parc, parv, |
| 415 |
– |
AWILD, &dlhost, NULL, &tkline_time, NULL, &reason) < 0) |
| 416 |
– |
return; |
| 417 |
– |
|
| 418 |
– |
if ((t = parse_netmask(dlhost, NULL, &bits)) == HM_HOST) |
| 419 |
– |
{ |
| 420 |
– |
#ifdef IPV6 |
| 421 |
– |
sendto_one(source_p, ":%s NOTICE %s :Sorry, please supply an address.", |
| 422 |
– |
me.name, parv[0]); |
| 423 |
– |
return; |
| 424 |
– |
#else |
| 425 |
– |
if ((target_p = find_chasing(client_p, source_p, dlhost, NULL)) == NULL) |
| 426 |
– |
return; |
| 427 |
– |
|
| 428 |
– |
t = HM_IPV4; |
| 429 |
– |
if (IsServer(target_p)) |
| 430 |
– |
{ |
| 431 |
– |
sendto_one(source_p, |
| 432 |
– |
":%s NOTICE %s :Can't DLINE a server silly", |
| 433 |
– |
me.name, source_p->name); |
| 434 |
– |
return; |
| 435 |
– |
} |
| 436 |
– |
|
| 437 |
– |
if (!MyConnect(target_p)) |
| 438 |
– |
{ |
| 439 |
– |
sendto_one(source_p, |
| 440 |
– |
":%s NOTICE %s :Can't DLINE nick on another server", |
| 441 |
– |
me.name, source_p->name); |
| 442 |
– |
return; |
| 443 |
– |
} |
| 444 |
– |
|
| 445 |
– |
if (IsExemptKline(target_p)) |
| 446 |
– |
{ |
| 447 |
– |
sendto_one(source_p, |
| 448 |
– |
":%s NOTICE %s :%s is E-lined",me.name, |
| 449 |
– |
source_p->name, target_p->name); |
| 450 |
– |
return; |
| 451 |
– |
} |
| 452 |
– |
|
| 453 |
– |
if ((dlhost = make_cidr(dlhost, target_p)) == NULL) |
| 454 |
– |
return; |
| 455 |
– |
|
| 456 |
– |
bits = 0xFFFFFF00UL; |
| 457 |
– |
#endif |
| 458 |
– |
} |
| 459 |
– |
|
| 460 |
– |
if (bits < 8) |
| 461 |
– |
{ |
| 462 |
– |
sendto_one(source_p, |
| 463 |
– |
":%s NOTICE %s :For safety, bitmasks less than 8 require conf access.", |
| 464 |
– |
me.name, source_p->name); |
| 465 |
– |
return; |
| 466 |
– |
} |
| 467 |
– |
|
| 468 |
– |
|
| 469 |
– |
#ifdef IPV6 |
| 470 |
– |
if (t == HM_IPV6) |
| 471 |
– |
t = AF_INET6; |
| 223 |
|
else |
| 473 |
– |
#endif |
| 474 |
– |
t = AF_INET; |
| 475 |
– |
|
| 476 |
– |
parse_netmask(dlhost, &daddr, NULL); |
| 477 |
– |
|
| 478 |
– |
if ((aconf = find_dline_conf(&daddr, t)) != NULL) |
| 224 |
|
{ |
| 225 |
< |
creason = aconf->reason ? aconf->reason : def_reason; |
| 226 |
< |
if (IsConfExemptKline(aconf)) |
| 227 |
< |
sendto_one(source_p, |
| 228 |
< |
":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s", |
| 229 |
< |
me.name, source_p->name, dlhost, aconf->host, creason); |
| 230 |
< |
else |
| 231 |
< |
sendto_one(source_p, |
| 232 |
< |
":%s NOTICE %s :[%s] already D-lined by [%s] - %s", |
| 233 |
< |
me.name, source_p->name, dlhost, aconf->host, creason); |
| 489 |
< |
return; |
| 225 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 226 |
> |
"%s added K-Line for [%s@%s] [%s]", |
| 227 |
> |
get_oper_name(source_p), |
| 228 |
> |
conf->user, conf->host, conf->reason); |
| 229 |
> |
sendto_one(source_p, ":%s NOTICE %s :Added K-Line [%s@%s]", |
| 230 |
> |
MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from), |
| 231 |
> |
source_p->name, conf->user, conf->host); |
| 232 |
> |
ilog(LOG_TYPE_KLINE, "%s added K-Line for [%s@%s] [%s]", |
| 233 |
> |
source_p->name, conf->user, conf->host, conf->reason); |
| 234 |
|
} |
| 235 |
|
|
| 236 |
< |
cur_time = CurrentTime; |
| 237 |
< |
current_date = smalldate(cur_time); |
| 494 |
< |
|
| 495 |
< |
/* Look for an oper reason */ |
| 496 |
< |
if ((oper_reason = strchr(reason, '|')) != NULL) |
| 497 |
< |
*oper_reason++ = '\0'; |
| 498 |
< |
|
| 499 |
< |
if (!valid_comment(source_p, reason, YES)) |
| 500 |
< |
return; |
| 501 |
< |
|
| 502 |
< |
conf = make_conf_item(DLINE_TYPE); |
| 503 |
< |
aconf = map_to_conf(conf); |
| 504 |
< |
DupString(aconf->host, dlhost); |
| 505 |
< |
|
| 506 |
< |
if (tkline_time != 0) |
| 507 |
< |
{ |
| 508 |
< |
ircsprintf(buffer, "Temporary D-line %d min. - %s (%s)", |
| 509 |
< |
(int)(tkline_time/60), reason, current_date); |
| 510 |
< |
DupString(aconf->reason, buffer); |
| 511 |
< |
if (oper_reason != NULL) |
| 512 |
< |
DupString(aconf->oper_reason, oper_reason); |
| 513 |
< |
apply_tdline(source_p, conf, current_date, tkline_time); |
| 514 |
< |
} |
| 515 |
< |
else |
| 516 |
< |
{ |
| 517 |
< |
ircsprintf(buffer, "%s (%s)", reason, current_date); |
| 518 |
< |
DupString(aconf->reason, buffer); |
| 519 |
< |
if (oper_reason != NULL) |
| 520 |
< |
DupString(aconf->oper_reason, oper_reason); |
| 521 |
< |
add_conf_by_address(CONF_DLINE, aconf); |
| 522 |
< |
write_conf_line(source_p, conf, current_date, cur_time); |
| 523 |
< |
} |
| 236 |
> |
conf->setat = CurrentTime; |
| 237 |
> |
SetConfDatabase(conf); |
| 238 |
|
|
| 239 |
+ |
add_conf_by_address(CONF_KLINE, conf); |
| 240 |
|
rehashed_klines = 1; |
| 241 |
< |
} /* mo_dline() */ |
| 527 |
< |
|
| 241 |
> |
} |
| 242 |
|
|
| 243 |
|
/* already_placed_kline() |
| 244 |
|
* inputs - user to complain to, username & host to check for |
| 255 |
|
{ |
| 256 |
|
const char *reason; |
| 257 |
|
struct irc_ssaddr iphost, *piphost; |
| 258 |
< |
struct AccessItem *aconf; |
| 259 |
< |
int t; |
| 258 |
> |
struct MaskItem *conf = NULL; |
| 259 |
> |
int t = 0; |
| 260 |
> |
int aftype = 0; |
| 261 |
|
|
| 262 |
< |
if ((t = parse_netmask(lhost, &iphost, &t)) != HM_HOST) |
| 262 |
> |
if ((t = parse_netmask(lhost, &iphost, NULL)) != HM_HOST) |
| 263 |
|
{ |
| 264 |
|
#ifdef IPV6 |
| 265 |
|
if (t == HM_IPV6) |
| 266 |
< |
t = AF_INET6; |
| 266 |
> |
aftype = AF_INET6; |
| 267 |
|
else |
| 268 |
|
#endif |
| 269 |
< |
t = AF_INET; |
| 269 |
> |
aftype = AF_INET; |
| 270 |
|
piphost = &iphost; |
| 271 |
|
} |
| 272 |
|
else |
| 558 |
– |
{ |
| 559 |
– |
t = 0; |
| 273 |
|
piphost = NULL; |
| 561 |
– |
} |
| 274 |
|
|
| 275 |
< |
if ((aconf = find_conf_by_address(lhost, piphost, CONF_KILL, t, luser, NULL))) |
| 275 |
> |
if ((conf = find_conf_by_address(lhost, piphost, CONF_KLINE, aftype, luser, NULL, 0))) |
| 276 |
|
{ |
| 277 |
|
if (warn) |
| 278 |
|
{ |
| 279 |
< |
reason = aconf->reason ? aconf->reason : "No reason"; |
| 279 |
> |
reason = conf->reason ? conf->reason : CONF_NOREASON; |
| 280 |
|
sendto_one(source_p, |
| 281 |
|
":%s NOTICE %s :[%s@%s] already K-Lined by [%s@%s] - %s", |
| 282 |
< |
me.name, source_p->name, luser, lhost, aconf->user, |
| 283 |
< |
aconf->host, reason); |
| 282 |
> |
me.name, source_p->name, luser, lhost, conf->user, |
| 283 |
> |
conf->host, reason); |
| 284 |
|
} |
| 573 |
– |
return(1); |
| 574 |
– |
} |
| 285 |
|
|
| 286 |
< |
return(0); |
| 287 |
< |
} |
| 578 |
< |
|
| 579 |
< |
#ifndef IPV6 |
| 580 |
< |
static char * |
| 581 |
< |
make_cidr(char *dlhost, struct Client *target_p) |
| 582 |
< |
{ |
| 583 |
< |
static char cidr_form_host[HOSTLEN + 2]; |
| 584 |
< |
char *p; |
| 585 |
< |
|
| 586 |
< |
strlcpy(cidr_form_host, inetntoa((const char *)&target_p->localClient->ip), |
| 587 |
< |
sizeof(cidr_form_host)); |
| 588 |
< |
|
| 589 |
< |
if ((p = strchr(cidr_form_host,'.')) == NULL) |
| 590 |
< |
return(NULL); |
| 591 |
< |
|
| 592 |
< |
/* 192. <- p */ |
| 593 |
< |
p++; |
| 594 |
< |
if ((p = strchr(p,'.')) == NULL) |
| 595 |
< |
return(NULL); |
| 596 |
< |
|
| 597 |
< |
/* 192.168. <- p */ |
| 598 |
< |
p++; |
| 599 |
< |
if ((p = strchr(p,'.')) == NULL) |
| 600 |
< |
return(NULL); |
| 601 |
< |
|
| 602 |
< |
/* 192.168.0. <- p */ |
| 603 |
< |
p++; |
| 604 |
< |
*p++ = '0'; |
| 605 |
< |
*p++ = '/'; |
| 606 |
< |
*p++ = '2'; |
| 607 |
< |
*p++ = '4'; |
| 608 |
< |
*p++ = '\0'; |
| 286 |
> |
return 1; |
| 287 |
> |
} |
| 288 |
|
|
| 289 |
< |
return(cidr_form_host); |
| 289 |
> |
return 0; |
| 290 |
|
} |
| 612 |
– |
#endif |
| 291 |
|
|
| 292 |
|
/* |
| 293 |
|
** mo_unkline |
| 306 |
|
char *target_server = NULL; |
| 307 |
|
char *user, *host; |
| 308 |
|
|
| 309 |
< |
if (!IsOperUnkline(source_p)) |
| 309 |
> |
if (!HasOFlag(source_p, OPER_FLAG_UNKLINE)) |
| 310 |
|
{ |
| 311 |
|
sendto_one(source_p, form_str(ERR_NOPRIVS), |
| 312 |
|
me.name, source_p->name, "unkline"); |
| 313 |
|
return; |
| 314 |
|
} |
| 315 |
|
|
| 316 |
< |
if (parc < 2 || EmptyString(parv[1])) |
| 316 |
> |
if (EmptyString(parv[1])) |
| 317 |
|
{ |
| 318 |
|
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), |
| 319 |
|
me.name, source_p->name, "UNKLINE"); |
| 331 |
|
target_server, user, host); |
| 332 |
|
|
| 333 |
|
/* Allow ON to apply local unkline as well if it matches */ |
| 334 |
< |
if (!match(target_server, me.name)) |
| 334 |
> |
if (match(target_server, me.name)) |
| 335 |
|
return; |
| 336 |
|
} |
| 337 |
|
else |
| 338 |
|
cluster_a_line(source_p, "UNKLINE", CAP_UNKLN, SHARED_UNKLINE, |
| 339 |
< |
"%s %s", user, host); |
| 339 |
> |
"%s %s", user, host); |
| 340 |
|
|
| 341 |
< |
if (remove_tkline_match(host, user)) |
| 341 |
> |
if (remove_kline_match(host, user)) |
| 342 |
|
{ |
| 343 |
|
sendto_one(source_p, |
| 344 |
< |
":%s NOTICE %s :Un-klined [%s@%s] from temporary K-Lines", |
| 344 |
> |
":%s NOTICE %s :K-Line for [%s@%s] is removed", |
| 345 |
|
me.name, source_p->name, user, host); |
| 346 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 347 |
< |
"%s has removed the temporary K-Line for: [%s@%s]", |
| 346 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 347 |
> |
"%s has removed the K-Line for: [%s@%s]", |
| 348 |
|
get_oper_name(source_p), user, host); |
| 349 |
< |
ilog(L_NOTICE, "%s removed temporary K-Line for [%s@%s]", |
| 349 |
> |
ilog(LOG_TYPE_KLINE, "%s removed K-Line for [%s@%s]", |
| 350 |
|
source_p->name, user, host); |
| 673 |
– |
return; |
| 674 |
– |
} |
| 675 |
– |
|
| 676 |
– |
if (remove_conf_line(KLINE_TYPE, source_p, user, host) > 0) |
| 677 |
– |
{ |
| 678 |
– |
sendto_one(source_p, ":%s NOTICE %s :K-Line for [%s@%s] is removed", |
| 679 |
– |
me.name, source_p->name, user,host); |
| 680 |
– |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 681 |
– |
"%s has removed the K-Line for: [%s@%s]", |
| 682 |
– |
get_oper_name(source_p), user, host); |
| 683 |
– |
ilog(L_NOTICE, "%s removed K-Line for [%s@%s]", |
| 684 |
– |
source_p->name, user, host); |
| 351 |
|
} |
| 352 |
|
else |
| 353 |
|
sendto_one(source_p, ":%s NOTICE %s :No K-Line for [%s@%s] found", |
| 376 |
|
kuser = parv[2]; |
| 377 |
|
khost = parv[3]; |
| 378 |
|
|
| 379 |
< |
if (!IsClient(source_p) || !match(parv[1], me.name)) |
| 379 |
> |
if (!IsClient(source_p) || match(parv[1], me.name)) |
| 380 |
|
return; |
| 381 |
|
|
| 382 |
< |
if (find_matching_name_conf(ULINE_TYPE, |
| 382 |
> |
if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, |
| 383 |
|
source_p->servptr->name, |
| 384 |
|
source_p->username, source_p->host, |
| 385 |
|
SHARED_UNKLINE)) |
| 386 |
|
{ |
| 387 |
< |
if (remove_tkline_match(khost, kuser)) |
| 387 |
> |
if (remove_kline_match(khost, kuser)) |
| 388 |
|
{ |
| 389 |
|
sendto_one(source_p, |
| 390 |
< |
":%s NOTICE %s :Un-klined [%s@%s] from temporary K-Lines", |
| 390 |
> |
":%s NOTICE %s :K-Line for [%s@%s] is removed", |
| 391 |
|
me.name, source_p->name, kuser, khost); |
| 392 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 727 |
< |
"%s has removed the temporary K-Line for: [%s@%s]", |
| 728 |
< |
get_oper_name(source_p), kuser, khost); |
| 729 |
< |
ilog(L_NOTICE, "%s removed temporary K-Line for [%s@%s]", |
| 730 |
< |
source_p->name, kuser, khost); |
| 731 |
< |
return; |
| 732 |
< |
} |
| 733 |
< |
|
| 734 |
< |
if (remove_conf_line(KLINE_TYPE, source_p, kuser, khost) > 0) |
| 735 |
< |
{ |
| 736 |
< |
sendto_one(source_p, ":%s NOTICE %s :K-Line for [%s@%s] is removed", |
| 737 |
< |
me.name, source_p->name, kuser, khost); |
| 738 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 392 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 393 |
|
"%s has removed the K-Line for: [%s@%s]", |
| 394 |
< |
get_oper_name(source_p), kuser, khost); |
| 395 |
< |
|
| 742 |
< |
ilog(L_NOTICE, "%s removed K-Line for [%s@%s]", |
| 394 |
> |
get_oper_name(source_p), kuser, khost); |
| 395 |
> |
ilog(LOG_TYPE_KLINE, "%s removed K-Line for [%s@%s]", |
| 396 |
|
source_p->name, kuser, khost); |
| 397 |
|
} |
| 398 |
|
else |
| 422 |
|
* Side effects: Any matching tklines are removed. |
| 423 |
|
*/ |
| 424 |
|
static int |
| 425 |
< |
remove_tkline_match(const char *host, const char *user) |
| 425 |
> |
remove_kline_match(const char *host, const char *user) |
| 426 |
|
{ |
| 427 |
< |
struct AccessItem *tk_c; |
| 428 |
< |
dlink_node *tk_n; |
| 429 |
< |
struct irc_ssaddr addr, caddr; |
| 430 |
< |
int nm_t, cnm_t, bits, cbits; |
| 431 |
< |
nm_t = parse_netmask(host, &addr, &bits); |
| 432 |
< |
|
| 433 |
< |
DLINK_FOREACH(tk_n, temporary_klines.head) |
| 781 |
< |
{ |
| 782 |
< |
tk_c = map_to_conf(tk_n->data); |
| 783 |
< |
cnm_t = parse_netmask(tk_c->host, &caddr, &cbits); |
| 784 |
< |
if (cnm_t != nm_t || irccmp(user, tk_c->user)) |
| 785 |
< |
continue; |
| 786 |
< |
if ((nm_t==HM_HOST && !irccmp(tk_c->host, host)) || |
| 787 |
< |
(nm_t==HM_IPV4 && bits==cbits && match_ipv4(&addr, &caddr, bits)) |
| 427 |
> |
struct irc_ssaddr iphost, *piphost; |
| 428 |
> |
struct MaskItem *conf; |
| 429 |
> |
int t = 0; |
| 430 |
> |
int aftype = 0; |
| 431 |
> |
|
| 432 |
> |
if ((t = parse_netmask(host, &iphost, NULL)) != HM_HOST) |
| 433 |
> |
{ |
| 434 |
|
#ifdef IPV6 |
| 435 |
< |
|| (nm_t==HM_IPV6 && bits==cbits && match_ipv6(&addr, &caddr, bits)) |
| 435 |
> |
if (t == HM_IPV6) |
| 436 |
> |
aftype = AF_INET6; |
| 437 |
> |
else |
| 438 |
|
#endif |
| 439 |
< |
) |
| 440 |
< |
{ |
| 793 |
< |
dlinkDelete(tk_n, &temporary_klines); |
| 794 |
< |
delete_one_address_conf(tk_c->host, tk_c); |
| 795 |
< |
return(YES); |
| 796 |
< |
} |
| 439 |
> |
aftype = AF_INET; |
| 440 |
> |
piphost = &iphost; |
| 441 |
|
} |
| 442 |
+ |
else |
| 443 |
+ |
piphost = NULL; |
| 444 |
|
|
| 445 |
< |
return(NO); |
| 800 |
< |
} |
| 801 |
< |
|
| 802 |
< |
/* static int remove_tdline_match(const char *host, const char *user) |
| 803 |
< |
* Input: An ip to undline. |
| 804 |
< |
* Output: returns YES on success, NO if no tdline removed. |
| 805 |
< |
* Side effects: Any matching tdlines are removed. |
| 806 |
< |
*/ |
| 807 |
< |
static int |
| 808 |
< |
remove_tdline_match(const char *cidr) |
| 809 |
< |
{ |
| 810 |
< |
struct AccessItem *td_conf; |
| 811 |
< |
dlink_node *td_node; |
| 812 |
< |
struct irc_ssaddr addr, caddr; |
| 813 |
< |
int nm_t, cnm_t, bits, cbits; |
| 814 |
< |
nm_t = parse_netmask(cidr, &addr, &bits); |
| 815 |
< |
|
| 816 |
< |
DLINK_FOREACH(td_node, temporary_dlines.head) |
| 445 |
> |
if ((conf = find_conf_by_address(host, piphost, CONF_KLINE, aftype, user, NULL, 0))) |
| 446 |
|
{ |
| 447 |
< |
td_conf = map_to_conf(td_node->data); |
| 819 |
< |
cnm_t = parse_netmask(td_conf->host, &caddr, &cbits); |
| 820 |
< |
|
| 821 |
< |
if (cnm_t != nm_t) |
| 822 |
< |
continue; |
| 823 |
< |
|
| 824 |
< |
if((nm_t==HM_HOST && !irccmp(td_conf->host, cidr)) || |
| 825 |
< |
(nm_t==HM_IPV4 && bits==cbits && match_ipv4(&addr, &caddr, bits)) |
| 826 |
< |
#ifdef IPV6 |
| 827 |
< |
|| (nm_t==HM_IPV6 && bits==cbits && match_ipv6(&addr, &caddr, bits)) |
| 828 |
< |
#endif |
| 829 |
< |
) |
| 447 |
> |
if (IsConfDatabase(conf)) |
| 448 |
|
{ |
| 449 |
< |
dlinkDelete(td_node, &temporary_dlines); |
| 450 |
< |
delete_one_address_conf(td_conf->host, td_conf); |
| 833 |
< |
return(YES); |
| 449 |
> |
delete_one_address_conf(host, conf); |
| 450 |
> |
return 1; |
| 451 |
|
} |
| 452 |
|
} |
| 453 |
|
|
| 454 |
< |
return(NO); |
| 454 |
> |
return 0; |
| 455 |
|
} |
| 456 |
|
|
| 457 |
< |
/* |
| 458 |
< |
** m_undline |
| 459 |
< |
** added May 28th 2000 by Toby Verrall <toot@melnet.co.uk> |
| 460 |
< |
** based totally on m_unkline |
| 844 |
< |
** added to hybrid-7 7/11/2000 --is |
| 845 |
< |
** |
| 846 |
< |
** parv[0] = sender nick |
| 847 |
< |
** parv[1] = dline to remove |
| 848 |
< |
*/ |
| 849 |
< |
static void |
| 850 |
< |
mo_undline(struct Client *client_p, struct Client *source_p, |
| 851 |
< |
int parc, char *parv[]) |
| 852 |
< |
{ |
| 853 |
< |
const char *cidr; |
| 854 |
< |
|
| 855 |
< |
if (!IsOperUnkline(source_p)) |
| 856 |
< |
{ |
| 857 |
< |
sendto_one(source_p, form_str(ERR_NOPRIVS), |
| 858 |
< |
me.name, source_p->name, "undline"); |
| 859 |
< |
return; |
| 860 |
< |
} |
| 457 |
> |
static struct Message kline_msgtab = { |
| 458 |
> |
"KLINE", 0, 0, 2, MAXPARA, MFLG_SLOW, 0, |
| 459 |
> |
{m_unregistered, m_not_oper, ms_kline, me_kline, mo_kline, m_ignore} |
| 460 |
> |
}; |
| 461 |
|
|
| 462 |
< |
cidr = parv[1]; |
| 462 |
> |
static struct Message unkline_msgtab = { |
| 463 |
> |
"UNKLINE", 0, 0, 2, MAXPARA, MFLG_SLOW, 0, |
| 464 |
> |
{m_unregistered, m_not_oper, ms_unkline, me_unkline, mo_unkline, m_ignore} |
| 465 |
> |
}; |
| 466 |
|
|
| 467 |
< |
if (remove_tdline_match(cidr)) |
| 468 |
< |
{ |
| 469 |
< |
sendto_one(source_p, |
| 470 |
< |
":%s NOTICE %s :Un-Dlined [%s] from temporary D-Lines", |
| 471 |
< |
me.name, source_p->name, cidr); |
| 472 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 473 |
< |
"%s has removed the temporary D-Line for: [%s]", |
| 474 |
< |
get_oper_name(source_p), cidr); |
| 872 |
< |
ilog(L_NOTICE, "%s removed temporary D-Line for [%s]", source_p->name, cidr); |
| 873 |
< |
return; |
| 874 |
< |
} |
| 467 |
> |
static void |
| 468 |
> |
module_init(void) |
| 469 |
> |
{ |
| 470 |
> |
mod_add_cmd(&kline_msgtab); |
| 471 |
> |
mod_add_cmd(&unkline_msgtab); |
| 472 |
> |
add_capability("KLN", CAP_KLN, 1); |
| 473 |
> |
add_capability("UNKLN", CAP_UNKLN, 1); |
| 474 |
> |
} |
| 475 |
|
|
| 476 |
< |
if (remove_conf_line(DLINE_TYPE, source_p, cidr, NULL) > 0) |
| 477 |
< |
{ |
| 478 |
< |
sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed", |
| 479 |
< |
me.name, source_p->name, cidr); |
| 480 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 481 |
< |
"%s has removed the D-Line for: [%s]", |
| 482 |
< |
get_oper_name(source_p), cidr); |
| 883 |
< |
ilog(L_NOTICE, "%s removed D-Line for [%s]", |
| 884 |
< |
get_oper_name(source_p), cidr); |
| 885 |
< |
} |
| 886 |
< |
else |
| 887 |
< |
sendto_one(source_p, ":%s NOTICE %s :No D-Line for [%s] found", |
| 888 |
< |
me.name, source_p->name, cidr); |
| 476 |
> |
static void |
| 477 |
> |
module_exit(void) |
| 478 |
> |
{ |
| 479 |
> |
mod_del_cmd(&kline_msgtab); |
| 480 |
> |
mod_del_cmd(&unkline_msgtab); |
| 481 |
> |
delete_capability("UNKLN"); |
| 482 |
> |
delete_capability("KLN"); |
| 483 |
|
} |
| 484 |
+ |
|
| 485 |
+ |
struct module module_entry = { |
| 486 |
+ |
.node = { NULL, NULL, NULL }, |
| 487 |
+ |
.name = NULL, |
| 488 |
+ |
.version = "$Revision$", |
| 489 |
+ |
.handle = NULL, |
| 490 |
+ |
.modinit = module_init, |
| 491 |
+ |
.modexit = module_exit, |
| 492 |
+ |
.flags = 0 |
| 493 |
+ |
}; |