| 1 |
|
/* |
| 2 |
|
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
| 3 |
|
* |
| 4 |
< |
* Copyright (c) 2002-2014 ircd-hybrid development team |
| 4 |
> |
* Copyright (c) 1997-2014 ircd-hybrid development team |
| 5 |
|
* |
| 6 |
|
* This program is free software; you can redistribute it and/or modify |
| 7 |
|
* it under the terms of the GNU General Public License as published by |
| 136 |
|
* side effects - D line is added |
| 137 |
|
* |
| 138 |
|
*/ |
| 139 |
< |
static void |
| 139 |
> |
static int |
| 140 |
|
mo_dline(struct Client *client_p, struct Client *source_p, |
| 141 |
|
int parc, char *parv[]) |
| 142 |
|
{ |
| 158 |
|
{ |
| 159 |
|
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, |
| 160 |
|
source_p->name, "dline"); |
| 161 |
< |
return; |
| 161 |
> |
return 0; |
| 162 |
|
} |
| 163 |
|
|
| 164 |
|
if (parse_aline("DLINE", source_p, parc, parv, AWILD, &dlhost, |
| 165 |
|
NULL, &tkline_time, &target_server, &reason) < 0) |
| 166 |
< |
return; |
| 166 |
> |
return 0; |
| 167 |
|
|
| 168 |
|
if (target_server != NULL) |
| 169 |
|
{ |
| 173 |
|
|
| 174 |
|
/* Allow ON to apply local kline as well if it matches */ |
| 175 |
|
if (match(target_server, me.name)) |
| 176 |
< |
return; |
| 176 |
> |
return 0; |
| 177 |
|
} |
| 178 |
|
else |
| 179 |
|
cluster_a_line(source_p, "DLINE", CAP_DLN, SHARED_DLINE, |
| 182 |
|
if ((t = parse_netmask(dlhost, NULL, &bits)) == HM_HOST) |
| 183 |
|
{ |
| 184 |
|
if ((target_p = find_chasing(source_p, dlhost, NULL)) == NULL) |
| 185 |
< |
return; |
| 185 |
> |
return 0; |
| 186 |
|
|
| 187 |
|
if (!MyConnect(target_p)) |
| 188 |
|
{ |
| 189 |
|
sendto_one(source_p, |
| 190 |
|
":%s NOTICE %s :Can't DLINE nick on another server", |
| 191 |
|
me.name, source_p->name); |
| 192 |
< |
return; |
| 192 |
> |
return 0; |
| 193 |
|
} |
| 194 |
|
|
| 195 |
|
if (IsExemptKline(target_p)) |
| 196 |
|
{ |
| 197 |
|
sendto_one(source_p, ":%s NOTICE %s :%s is E-lined", |
| 198 |
|
me.name, source_p->name, target_p->name); |
| 199 |
< |
return; |
| 199 |
> |
return 0; |
| 200 |
|
} |
| 201 |
|
|
| 202 |
|
getnameinfo((struct sockaddr *)&target_p->localClient->ip, |
| 212 |
|
sendto_one(source_p, |
| 213 |
|
":%s NOTICE %s :For safety, bitmasks less than 8 require conf access.", |
| 214 |
|
me.name, source_p->name); |
| 215 |
< |
return; |
| 215 |
> |
return 0; |
| 216 |
|
} |
| 217 |
|
|
| 218 |
|
#ifdef IPV6 |
| 234 |
|
else |
| 235 |
|
sendto_one(source_p, ":%s NOTICE %s :[%s] already D-lined by [%s] - %s", |
| 236 |
|
me.name, source_p->name, dlhost, conf->host, creason); |
| 237 |
< |
return; |
| 237 |
> |
return 0; |
| 238 |
|
} |
| 239 |
|
|
| 240 |
|
cur_time = CurrentTime; |
| 241 |
|
current_date = smalldate(cur_time); |
| 242 |
|
|
| 243 |
|
if (!valid_comment(source_p, reason, 1)) |
| 244 |
< |
return; |
| 244 |
> |
return 0; |
| 245 |
|
|
| 246 |
|
conf = conf_make(CONF_DLINE); |
| 247 |
|
conf->host = xstrdup(dlhost); |
| 255 |
|
conf->reason = xstrdup(buffer); |
| 256 |
|
apply_dline(source_p, conf, tkline_time); |
| 257 |
|
rehashed_klines = 1; |
| 258 |
+ |
return 0; |
| 259 |
|
} |
| 260 |
|
|
| 261 |
< |
static void |
| 261 |
> |
static int |
| 262 |
|
ms_dline(struct Client *client_p, struct Client *source_p, |
| 263 |
|
int parc, char *parv[]) |
| 264 |
|
{ |
| 276 |
|
char buffer[IRCD_BUFSIZE]; |
| 277 |
|
|
| 278 |
|
if (parc != 5 || EmptyString(parv[4])) |
| 279 |
< |
return; |
| 279 |
> |
return 0; |
| 280 |
|
|
| 281 |
|
/* parv[0] parv[1] parv[2] parv[3] parv[4] */ |
| 282 |
|
/* oper target_server tkline_time host reason */ |
| 285 |
|
parv[1], parv[2], parv[3], parv[4]); |
| 286 |
|
|
| 287 |
|
if (match(parv[1], me.name)) |
| 288 |
< |
return; |
| 288 |
> |
return 0; |
| 289 |
|
|
| 290 |
|
tkline_time = valid_tkline(parv[2], TK_SECONDS); |
| 291 |
|
dlhost = parv[3]; |
| 297 |
|
SHARED_DLINE)) |
| 298 |
|
{ |
| 299 |
|
if (!IsClient(source_p)) |
| 300 |
< |
return; |
| 300 |
> |
return 0; |
| 301 |
> |
|
| 302 |
|
if ((t = parse_netmask(dlhost, NULL, &bits)) == HM_HOST) |
| 303 |
|
{ |
| 304 |
|
if ((target_p = find_chasing(source_p, dlhost, NULL)) == NULL) |
| 305 |
< |
return; |
| 305 |
> |
return 0; |
| 306 |
|
|
| 307 |
|
if (!MyConnect(target_p)) |
| 308 |
|
{ |
| 309 |
|
sendto_one(source_p, |
| 310 |
|
":%s NOTICE %s :Can't DLINE nick on another server", |
| 311 |
|
me.name, source_p->name); |
| 312 |
< |
return; |
| 312 |
> |
return 0; |
| 313 |
|
} |
| 314 |
|
|
| 315 |
|
if (IsExemptKline(target_p)) |
| 317 |
|
sendto_one(source_p, |
| 318 |
|
":%s NOTICE %s :%s is E-lined", me.name, |
| 319 |
|
source_p->name, target_p->name); |
| 320 |
< |
return; |
| 320 |
> |
return 0; |
| 321 |
|
} |
| 322 |
|
|
| 323 |
|
getnameinfo((struct sockaddr *)&target_p->localClient->ip, |
| 333 |
|
sendto_one(source_p, |
| 334 |
|
":%s NOTICE %s :For safety, bitmasks less than 8 require conf access.", |
| 335 |
|
me.name, source_p->name); |
| 336 |
< |
return; |
| 336 |
> |
return 0; |
| 337 |
|
} |
| 338 |
|
|
| 339 |
|
#ifdef IPV6 |
| 356 |
|
sendto_one(source_p, |
| 357 |
|
":%s NOTICE %s :[%s] already D-lined by [%s] - %s", |
| 358 |
|
me.name, source_p->name, dlhost, conf->host, creason); |
| 359 |
< |
return; |
| 359 |
> |
return 0; |
| 360 |
|
} |
| 361 |
|
|
| 362 |
|
cur_time = CurrentTime; |
| 363 |
|
current_date = smalldate(cur_time); |
| 364 |
|
|
| 365 |
|
if (!valid_comment(source_p, reason, 1)) |
| 366 |
< |
return; |
| 366 |
> |
return 0; |
| 367 |
|
|
| 368 |
|
conf = conf_make(CONF_DLINE); |
| 369 |
|
conf->host = xstrdup(dlhost); |
| 378 |
|
apply_dline(source_p, conf, tkline_time); |
| 379 |
|
rehashed_klines = 1; |
| 380 |
|
} |
| 381 |
+ |
|
| 382 |
+ |
return 0; |
| 383 |
|
} |
| 384 |
|
|
| 385 |
|
/* |
| 391 |
|
** parv[0] = sender nick |
| 392 |
|
** parv[1] = dline to remove |
| 393 |
|
*/ |
| 394 |
< |
static void |
| 394 |
> |
static int |
| 395 |
|
mo_undline(struct Client *client_p, struct Client *source_p, |
| 396 |
|
int parc, char *parv[]) |
| 397 |
|
{ |
| 402 |
|
{ |
| 403 |
|
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, |
| 404 |
|
source_p->name, "undline"); |
| 405 |
< |
return; |
| 405 |
> |
return 0; |
| 406 |
|
} |
| 407 |
|
|
| 408 |
|
if (parc < 2 || EmptyString(parv[1])) |
| 409 |
|
{ |
| 410 |
|
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), |
| 411 |
|
me.name, source_p->name, "UNDLINE"); |
| 412 |
< |
return; |
| 412 |
> |
return 0; |
| 413 |
|
} |
| 414 |
|
|
| 415 |
|
if (parse_aline("UNDLINE", source_p, parc, parv, 0, &user, |
| 416 |
|
&addr, NULL, &target_server, NULL) < 0) |
| 417 |
< |
return; |
| 417 |
> |
return 0; |
| 418 |
|
|
| 419 |
|
if (target_server != NULL) |
| 420 |
|
{ |
| 423 |
|
|
| 424 |
|
/* Allow ON to apply local unkline as well if it matches */ |
| 425 |
|
if (match(target_server, me.name)) |
| 426 |
< |
return; |
| 426 |
> |
return 0; |
| 427 |
|
} |
| 428 |
|
else |
| 429 |
|
cluster_a_line(source_p, "UNDLINE", CAP_UNDLN, SHARED_UNDLINE, |
| 442 |
|
else |
| 443 |
|
sendto_one(source_p, ":%s NOTICE %s :No D-Line for [%s] found", |
| 444 |
|
me.name, source_p->name, addr); |
| 445 |
+ |
return 0; |
| 446 |
|
} |
| 447 |
|
|
| 448 |
< |
static void |
| 449 |
< |
me_undline(struct Client *client_p, struct Client *source_p, |
| 448 |
> |
static int |
| 449 |
> |
ms_undline(struct Client *client_p, struct Client *source_p, |
| 450 |
|
int parc, char *parv[]) |
| 451 |
|
{ |
| 452 |
< |
const char *addr = NULL; |
| 452 |
> |
const char *addr = parv[1]; |
| 453 |
|
|
| 454 |
|
if (parc != 3 || EmptyString(parv[2])) |
| 455 |
< |
return; |
| 455 |
> |
return 0; |
| 456 |
|
|
| 457 |
< |
addr = parv[2]; |
| 457 |
> |
sendto_match_servs(source_p, parv[1], CAP_UNDLN, |
| 458 |
> |
"UNDLINE %s %s", |
| 459 |
> |
parv[1], parv[2]); |
| 460 |
|
|
| 461 |
|
if (!IsClient(source_p) || match(parv[1], me.name)) |
| 462 |
< |
return; |
| 462 |
> |
return 0; |
| 463 |
|
|
| 464 |
|
if (HasFlag(source_p, FLAGS_SERVICE) || |
| 465 |
|
find_matching_name_conf(CONF_ULINE, source_p->servptr->name, |
| 480 |
|
sendto_one(source_p, ":%s NOTICE %s :No D-Line for [%s] found", |
| 481 |
|
me.name, source_p->name, addr); |
| 482 |
|
} |
| 476 |
– |
} |
| 477 |
– |
|
| 478 |
– |
static void |
| 479 |
– |
ms_undline(struct Client *client_p, struct Client *source_p, |
| 480 |
– |
int parc, char *parv[]) |
| 481 |
– |
{ |
| 482 |
– |
if (parc != 3 || EmptyString(parv[2])) |
| 483 |
– |
return; |
| 483 |
|
|
| 484 |
< |
sendto_match_servs(source_p, parv[1], CAP_UNDLN, |
| 486 |
< |
"UNDLINE %s %s", |
| 487 |
< |
parv[1], parv[2]); |
| 488 |
< |
|
| 489 |
< |
me_undline(client_p, source_p, parc, parv); |
| 484 |
> |
return 0; |
| 485 |
|
} |
| 486 |
|
|
| 487 |
|
static struct Message dline_msgtab = |