| 23 |
|
*/ |
| 24 |
|
|
| 25 |
|
#include "stdinc.h" |
| 26 |
< |
#include "tools.h" |
| 26 |
> |
#include "list.h" |
| 27 |
|
#include "s_user.h" |
| 28 |
|
#include "s_misc.h" |
| 29 |
|
#include "channel.h" |
| 35 |
|
#include "irc_string.h" |
| 36 |
|
#include "sprintf_irc.h" |
| 37 |
|
#include "s_bsd.h" |
| 38 |
– |
#include "irc_getnameinfo.h" |
| 38 |
|
#include "ircd.h" |
| 40 |
– |
#include "list.h" |
| 39 |
|
#include "listener.h" |
| 40 |
|
#include "motd.h" |
| 41 |
|
#include "numeric.h" |
| 42 |
|
#include "s_conf.h" |
| 43 |
|
#include "s_log.h" |
| 44 |
|
#include "s_serv.h" |
| 47 |
– |
#include "s_stats.h" |
| 45 |
|
#include "send.h" |
| 46 |
|
#include "supported.h" |
| 47 |
|
#include "whowas.h" |
| 48 |
|
#include "memory.h" |
| 49 |
|
#include "packet.h" |
| 50 |
+ |
#include "rng_mt.h" |
| 51 |
|
#include "userhost.h" |
| 52 |
|
#include "hook.h" |
| 53 |
|
#include "s_misc.h" |
| 54 |
|
#include "msg.h" |
| 55 |
< |
#include "pcre.h" |
| 55 |
> |
#include "watch.h" |
| 56 |
|
|
| 57 |
< |
int MaxClientCount = 1; |
| 58 |
< |
int MaxConnectionCount = 1; |
| 57 |
> |
unsigned int MaxClientCount = 1; |
| 58 |
> |
unsigned int MaxConnectionCount = 1; |
| 59 |
|
struct Callback *entering_umode_cb = NULL; |
| 60 |
|
struct Callback *umode_cb = NULL; |
| 63 |
– |
struct Callback *uid_get_cb = NULL; |
| 61 |
|
|
| 62 |
|
static char umode_buffer[IRCD_BUFSIZE]; |
| 63 |
|
|
| 64 |
|
static void user_welcome(struct Client *); |
| 65 |
|
static void report_and_set_user_flags(struct Client *, const struct AccessItem *); |
| 66 |
|
static int check_xline(struct Client *); |
| 67 |
< |
static int check_regexp_xline(struct Client *); |
| 68 |
< |
static void introduce_client(struct Client *, struct Client *); |
| 72 |
< |
static void *uid_get(va_list); |
| 67 |
> |
static void introduce_client(struct Client *); |
| 68 |
> |
static const char *uid_get(void); |
| 69 |
|
|
| 70 |
|
/* Used for building up the isupport string, |
| 71 |
|
* used with init_isupport, add_isupport, delete_isupport |
| 92 |
|
0, /* @ */ |
| 93 |
|
0, /* A */ |
| 94 |
|
0, /* B */ |
| 95 |
< |
0, /* C */ |
| 95 |
> |
UMODE_CCONN_FULL, /* C */ |
| 96 |
|
UMODE_DEAF, /* D */ |
| 97 |
|
0, /* E */ |
| 98 |
|
0, /* F */ |
| 162 |
|
unsigned int idx = 0; |
| 163 |
|
char *umode_buffer_ptr = umode_buffer; |
| 164 |
|
|
| 165 |
< |
for (; idx < (sizeof(user_modes) / sizeof(int)); ++idx) |
| 165 |
> |
for (; idx < (sizeof(user_modes) / sizeof(user_modes[0])); ++idx) |
| 166 |
|
if (user_modes[idx]) |
| 167 |
|
*umode_buffer_ptr++ = idx; |
| 168 |
|
|
| 197 |
|
Count.invisi, dlink_list_length(&global_serv_list)); |
| 198 |
|
else |
| 199 |
|
sendto_one(source_p, form_str(RPL_LUSERCLIENT), from, to, |
| 200 |
< |
(Count.total-Count.invisi), Count.invisi, 1); |
| 200 |
> |
(Count.total-Count.invisi), Count.invisi, 1); |
| 201 |
|
|
| 202 |
|
if (Count.oper > 0) |
| 203 |
|
sendto_one(source_p, form_str(RPL_LUSEROP), |
| 204 |
< |
from, to, Count.oper); |
| 204 |
> |
from, to, Count.oper); |
| 205 |
|
|
| 206 |
|
if (dlink_list_length(&unknown_list) > 0) |
| 207 |
|
sendto_one(source_p, form_str(RPL_LUSERUNKNOWN), |
| 208 |
< |
from, to, dlink_list_length(&unknown_list)); |
| 208 |
> |
from, to, dlink_list_length(&unknown_list)); |
| 209 |
|
|
| 210 |
|
if (dlink_list_length(&global_channel_list) > 0) |
| 211 |
|
sendto_one(source_p, form_str(RPL_LUSERCHANNELS), |
| 212 |
< |
from, to, |
| 217 |
< |
dlink_list_length(&global_channel_list)); |
| 212 |
> |
from, to, dlink_list_length(&global_channel_list)); |
| 213 |
|
|
| 214 |
|
if (!ConfigServerHide.hide_servers || IsOper(source_p)) |
| 215 |
|
{ |
| 216 |
|
sendto_one(source_p, form_str(RPL_LUSERME), |
| 217 |
< |
from, to, |
| 223 |
< |
Count.local, Count.myserver); |
| 217 |
> |
from, to, Count.local, Count.myserver); |
| 218 |
|
sendto_one(source_p, form_str(RPL_LOCALUSERS), |
| 219 |
< |
from, to, Count.local, Count.max_loc, |
| 220 |
< |
Count.local, Count.max_loc); |
| 219 |
> |
from, to, Count.local, Count.max_loc, |
| 220 |
> |
Count.local, Count.max_loc); |
| 221 |
|
} |
| 222 |
|
else |
| 223 |
|
{ |
| 224 |
|
sendto_one(source_p, form_str(RPL_LUSERME), |
| 225 |
< |
from, to, Count.total, 0); |
| 225 |
> |
from, to, Count.total, 0); |
| 226 |
|
sendto_one(source_p, form_str(RPL_LOCALUSERS), |
| 227 |
< |
from, to, Count.total, Count.max_tot, |
| 227 |
> |
from, to, Count.total, Count.max_tot, |
| 228 |
|
Count.total, Count.max_tot); |
| 229 |
|
} |
| 230 |
|
|
| 234 |
|
|
| 235 |
|
if (!ConfigServerHide.hide_servers || IsOper(source_p)) |
| 236 |
|
sendto_one(source_p, form_str(RPL_STATSCONN), from, to, |
| 237 |
< |
MaxConnectionCount, MaxClientCount, Count.totalrestartcount); |
| 237 |
> |
MaxConnectionCount, MaxClientCount, Count.totalrestartcount); |
| 238 |
|
|
| 239 |
|
if (Count.local > MaxClientCount) |
| 240 |
|
MaxClientCount = Count.local; |
| 279 |
|
** nick from local user or kill him/her... |
| 280 |
|
*/ |
| 281 |
|
void |
| 282 |
< |
register_local_user(struct Client *client_p, struct Client *source_p, |
| 289 |
< |
const char *nick, const char *username) |
| 282 |
> |
register_local_user(struct Client *source_p) |
| 283 |
|
{ |
| 284 |
+ |
const char *id = NULL; |
| 285 |
|
const struct AccessItem *aconf = NULL; |
| 286 |
< |
char ipaddr[HOSTIPLEN]; |
| 293 |
< |
dlink_node *ptr; |
| 294 |
< |
dlink_node *m; |
| 286 |
> |
dlink_node *ptr = NULL; |
| 287 |
|
|
| 288 |
|
assert(source_p != NULL); |
| 289 |
+ |
assert(source_p == source_p->from); |
| 290 |
|
assert(MyConnect(source_p)); |
| 291 |
< |
assert(source_p->username != username); |
| 291 |
> |
assert(!source_p->localClient->registration); |
| 292 |
> |
|
| 293 |
> |
ClearCap(source_p, CAP_TS6); |
| 294 |
|
|
| 295 |
|
if (ConfigFileEntry.ping_cookie) |
| 296 |
|
{ |
| 297 |
< |
if (!IsPingSent(source_p) && |
| 303 |
< |
source_p->localClient->random_ping == 0) |
| 297 |
> |
if (!IsPingSent(source_p) && source_p->localClient->random_ping == 0) |
| 298 |
|
{ |
| 299 |
< |
source_p->localClient->random_ping = (unsigned long)rand(); |
| 300 |
< |
sendto_one(source_p, "PING :%lu", |
| 299 |
> |
do |
| 300 |
> |
source_p->localClient->random_ping = genrand_int32(); |
| 301 |
> |
while (!source_p->localClient->random_ping); |
| 302 |
> |
|
| 303 |
> |
sendto_one(source_p, "PING :%u", |
| 304 |
|
source_p->localClient->random_ping); |
| 305 |
|
SetPingSent(source_p); |
| 306 |
|
return; |
| 314 |
|
/* Straight up the maximum rate of flooding... */ |
| 315 |
|
source_p->localClient->allow_read = MAX_FLOOD_BURST; |
| 316 |
|
|
| 317 |
< |
if (!execute_callback(client_check_cb, source_p, username)) |
| 317 |
> |
if (!execute_callback(client_check_cb, source_p, source_p->username)) |
| 318 |
|
return; |
| 319 |
|
|
| 320 |
|
if (valid_hostname(source_p->host) == 0) |
| 330 |
|
|
| 331 |
|
if (!IsGotId(source_p)) |
| 332 |
|
{ |
| 333 |
< |
const char *p = NULL; |
| 333 |
> |
char username[USERLEN + 1]; |
| 334 |
> |
const char *p = username; |
| 335 |
|
unsigned int i = 0; |
| 336 |
|
|
| 337 |
|
if (IsNeedIdentd(aconf)) |
| 338 |
|
{ |
| 339 |
< |
ServerStats->is_ref++; |
| 339 |
> |
++ServerStats.is_ref; |
| 340 |
|
sendto_one(source_p, ":%s NOTICE %s :*** Notice -- You need to install " |
| 341 |
|
"identd to use this server", me.name, source_p->name); |
| 342 |
|
exit_client(source_p, &me, "Install identd"); |
| 343 |
|
return; |
| 344 |
|
} |
| 345 |
|
|
| 346 |
< |
p = username; |
| 346 |
> |
strlcpy(username, source_p->username, sizeof(username)); |
| 347 |
|
|
| 348 |
|
if (!IsNoTilde(aconf)) |
| 349 |
|
source_p->username[i++] = '~'; |
| 350 |
|
|
| 351 |
< |
while (*p && i < USERLEN) |
| 354 |
< |
{ |
| 351 |
> |
for (; *p && i < USERLEN; ++p) |
| 352 |
|
if (*p != '[') |
| 353 |
|
source_p->username[i++] = *p; |
| 357 |
– |
p++; |
| 358 |
– |
} |
| 354 |
|
|
| 355 |
|
source_p->username[i] = '\0'; |
| 356 |
|
} |
| 362 |
|
|
| 363 |
|
if (!match_conf_password(pass, aconf)) |
| 364 |
|
{ |
| 365 |
< |
ServerStats->is_ref++; |
| 365 |
> |
++ServerStats.is_ref; |
| 366 |
|
sendto_one(source_p, form_str(ERR_PASSWDMISMATCH), |
| 367 |
|
me.name, source_p->name); |
| 368 |
|
exit_client(source_p, &me, "Bad Password"); |
| 378 |
|
/* report if user has &^>= etc. and set flags as needed in source_p */ |
| 379 |
|
report_and_set_user_flags(source_p, aconf); |
| 380 |
|
|
| 381 |
+ |
if (IsDead(source_p)) |
| 382 |
+ |
return; |
| 383 |
+ |
|
| 384 |
|
/* Limit clients - |
| 385 |
|
* We want to be able to have servers and F-line clients |
| 386 |
|
* connect, so save room for "buffer" connections. |
| 394 |
|
{ |
| 395 |
|
sendto_realops_flags(UMODE_FULL, L_ALL, |
| 396 |
|
"Too many clients, rejecting %s[%s].", |
| 397 |
< |
nick, source_p->host); |
| 398 |
< |
ServerStats->is_ref++; |
| 397 |
> |
source_p->name, source_p->host); |
| 398 |
> |
++ServerStats.is_ref; |
| 399 |
|
exit_client(source_p, &me, "Sorry, server is full - try later"); |
| 400 |
|
return; |
| 401 |
|
} |
| 406 |
|
char tmpstr2[IRCD_BUFSIZE]; |
| 407 |
|
|
| 408 |
|
sendto_realops_flags(UMODE_REJ, L_ALL, "Invalid username: %s (%s@%s)", |
| 409 |
< |
nick, source_p->username, source_p->host); |
| 410 |
< |
ServerStats->is_ref++; |
| 411 |
< |
ircsprintf(tmpstr2, "Invalid username [%s]", source_p->username); |
| 409 |
> |
source_p->name, source_p->username, source_p->host); |
| 410 |
> |
++ServerStats.is_ref; |
| 411 |
> |
snprintf(tmpstr2, sizeof(tmpstr2), "Invalid username [%s]", |
| 412 |
> |
source_p->username); |
| 413 |
|
exit_client(source_p, &me, tmpstr2); |
| 414 |
|
return; |
| 415 |
|
} |
| 416 |
|
|
| 417 |
< |
assert(source_p == client_p); |
| 419 |
< |
|
| 420 |
< |
/* end of valid user name check */ |
| 421 |
< |
if (check_xline(source_p) || check_regexp_xline(source_p)) |
| 422 |
< |
return; |
| 423 |
< |
|
| 424 |
< |
if (IsDead(client_p)) |
| 417 |
> |
if (check_xline(source_p)) |
| 418 |
|
return; |
| 419 |
|
|
| 420 |
< |
if (source_p->id[0] == '\0' && me.id[0]) |
| 421 |
< |
{ |
| 429 |
< |
char *id = (char *) execute_callback(uid_get_cb, source_p); |
| 430 |
< |
while (hash_find_id(id) != NULL) |
| 431 |
< |
id = uid_get(NULL); |
| 420 |
> |
while (hash_find_id((id = uid_get())) != NULL) |
| 421 |
> |
; |
| 422 |
|
|
| 423 |
< |
strlcpy(source_p->id, id, sizeof(source_p->id)); |
| 424 |
< |
hash_add_id(source_p); |
| 435 |
< |
} |
| 436 |
< |
|
| 437 |
< |
irc_getnameinfo((struct sockaddr *)&source_p->localClient->ip, |
| 438 |
< |
source_p->localClient->ip.ss_len, ipaddr, |
| 439 |
< |
HOSTIPLEN, NULL, 0, NI_NUMERICHOST); |
| 423 |
> |
strlcpy(source_p->id, id, sizeof(source_p->id)); |
| 424 |
> |
hash_add_id(source_p); |
| 425 |
|
|
| 426 |
|
sendto_realops_flags(UMODE_CCONN, L_ALL, |
| 427 |
< |
"Client connecting: %s (%s@%s) [%s] {%s} [%s]", |
| 428 |
< |
nick, source_p->username, source_p->host, |
| 427 |
> |
"Client connecting: %s (%s@%s) [%s] {%s} [%s] <%s>", |
| 428 |
> |
source_p->name, source_p->username, source_p->host, |
| 429 |
> |
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
| 430 |
> |
"255.255.255.255" : source_p->sockhost, |
| 431 |
> |
get_client_class(source_p), |
| 432 |
> |
source_p->info, source_p->id); |
| 433 |
> |
|
| 434 |
> |
sendto_realops_flags(UMODE_CCONN_FULL, L_ALL, |
| 435 |
> |
"CLICONN %s %s %s %s %s %s %s 0 %s", |
| 436 |
> |
source_p->name, source_p->username, source_p->host, |
| 437 |
|
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
| 438 |
< |
"255.255.255.255" : ipaddr, get_client_class(source_p), |
| 438 |
> |
"255.255.255.255" : source_p->sockhost, |
| 439 |
> |
get_client_class(source_p), |
| 440 |
> |
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
| 441 |
> |
"<hidden>" : source_p->localClient->client_host, |
| 442 |
> |
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
| 443 |
> |
"<hidden>" : source_p->localClient->client_server, |
| 444 |
|
source_p->info); |
| 445 |
|
|
| 448 |
– |
/* If they have died in send_* don't do anything. */ |
| 449 |
– |
if (IsDead(source_p)) |
| 450 |
– |
return; |
| 446 |
|
|
| 447 |
|
if (ConfigFileEntry.invisible_on_connect) |
| 448 |
+ |
{ |
| 449 |
|
source_p->umodes |= UMODE_INVISIBLE; |
| 450 |
< |
Count.invisi++; |
| 450 |
> |
++Count.invisi; |
| 451 |
> |
} |
| 452 |
|
|
| 453 |
|
if ((++Count.local) > Count.max_loc) |
| 454 |
|
{ |
| 459 |
|
Count.max_loc); |
| 460 |
|
} |
| 461 |
|
|
| 465 |
– |
SetClient(source_p); |
| 466 |
– |
|
| 467 |
– |
source_p->servptr = &me; |
| 468 |
– |
dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->users); |
| 469 |
– |
|
| 462 |
|
/* Increment our total user count here */ |
| 463 |
|
if (++Count.total > Count.max_tot) |
| 464 |
|
Count.max_tot = Count.total; |
| 465 |
< |
Count.totalrestartcount++; |
| 465 |
> |
++Count.totalrestartcount; |
| 466 |
> |
|
| 467 |
> |
assert(source_p->servptr == &me); |
| 468 |
> |
SetClient(source_p); |
| 469 |
> |
dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->client_list); |
| 470 |
|
|
| 471 |
|
source_p->localClient->allow_read = MAX_FLOOD_BURST; |
| 472 |
|
|
| 473 |
< |
if ((m = dlinkFindDelete(&unknown_list, source_p)) != NULL) |
| 474 |
< |
{ |
| 475 |
< |
free_dlink_node(m); |
| 476 |
< |
dlinkAdd(source_p, &source_p->localClient->lclient_node, &local_client_list); |
| 481 |
< |
} |
| 482 |
< |
else assert(0); |
| 473 |
> |
assert(dlinkFind(&unknown_list, source_p)); |
| 474 |
> |
|
| 475 |
> |
dlink_move_node(&source_p->localClient->lclient_node, |
| 476 |
> |
&unknown_list, &local_client_list); |
| 477 |
|
|
| 478 |
|
user_welcome(source_p); |
| 479 |
|
add_user_host(source_p->username, source_p->host, 0); |
| 480 |
|
SetUserHost(source_p); |
| 481 |
|
|
| 482 |
< |
introduce_client(client_p, source_p); |
| 482 |
> |
introduce_client(source_p); |
| 483 |
|
} |
| 484 |
|
|
| 485 |
|
/* register_remote_user() |
| 486 |
|
* |
| 487 |
< |
* inputs - client_p directly connected client |
| 494 |
< |
* - source_p remote or directly connected client |
| 487 |
> |
* inputs - source_p remote or directly connected client |
| 488 |
|
* - username to register as |
| 489 |
|
* - host name to register as |
| 490 |
|
* - server name |
| 494 |
|
* is introduced by a server. |
| 495 |
|
*/ |
| 496 |
|
void |
| 497 |
< |
register_remote_user(struct Client *client_p, struct Client *source_p, |
| 498 |
< |
const char *username, const char *host, const char *server, |
| 499 |
< |
const char *realname) |
| 497 |
> |
register_remote_user(struct Client *source_p, |
| 498 |
> |
const char *username, const char *host, const char *server, |
| 499 |
> |
const char *realname) |
| 500 |
|
{ |
| 501 |
< |
struct Client *target_p; |
| 501 |
> |
struct Client *target_p = NULL; |
| 502 |
|
|
| 503 |
|
assert(source_p != NULL); |
| 504 |
|
assert(source_p->username != username); |
| 505 |
|
|
| 506 |
|
strlcpy(source_p->host, host, sizeof(source_p->host)); |
| 514 |
– |
strlcpy(source_p->info, realname, sizeof(source_p->info)); |
| 507 |
|
strlcpy(source_p->username, username, sizeof(source_p->username)); |
| 508 |
|
|
| 517 |
– |
/* Increment our total user count here */ |
| 518 |
– |
if (++Count.total > Count.max_tot) |
| 519 |
– |
Count.max_tot = Count.total; |
| 520 |
– |
|
| 521 |
– |
source_p->from->serv->dep_users++; |
| 522 |
– |
|
| 509 |
|
/* |
| 510 |
|
* coming from another server, take the servers word for it |
| 511 |
|
*/ |
| 521 |
|
"No server %s for user %s[%s@%s] from %s", |
| 522 |
|
server, source_p->name, source_p->username, |
| 523 |
|
source_p->host, source_p->from->name); |
| 524 |
< |
kill_client(client_p, source_p, "%s (Server doesn't exist)", me.name); |
| 524 |
> |
kill_client(source_p->from, source_p, "%s (Server doesn't exist)", me.name); |
| 525 |
|
|
| 540 |
– |
/* XXX */ |
| 526 |
|
SetKilled(source_p); |
| 527 |
|
exit_client(source_p, &me, "Ghosted Client"); |
| 528 |
|
return; |
| 532 |
|
{ |
| 533 |
|
sendto_realops_flags(UMODE_DEBUG, L_ALL, |
| 534 |
|
"Bad User [%s] :%s USER %s@%s %s, != %s[%s]", |
| 535 |
< |
client_p->name, source_p->name, source_p->username, |
| 535 |
> |
source_p->from->name, source_p->name, source_p->username, |
| 536 |
|
source_p->host, source_p->servptr->name, |
| 537 |
|
target_p->name, target_p->from->name); |
| 538 |
< |
kill_client(client_p, source_p, |
| 538 |
> |
kill_client(source_p->from, source_p, |
| 539 |
|
"%s (NICK from wrong direction (%s != %s))", |
| 540 |
|
me.name, source_p->servptr->name, target_p->from->name); |
| 541 |
|
SetKilled(source_p); |
| 543 |
|
return; |
| 544 |
|
} |
| 545 |
|
|
| 546 |
+ |
/* Increment our total user count here */ |
| 547 |
+ |
if (++Count.total > Count.max_tot) |
| 548 |
+ |
Count.max_tot = Count.total; |
| 549 |
+ |
|
| 550 |
|
SetClient(source_p); |
| 551 |
< |
dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->users); |
| 551 |
> |
dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->client_list); |
| 552 |
|
add_user_host(source_p->username, source_p->host, 1); |
| 553 |
|
SetUserHost(source_p); |
| 554 |
|
|
| 555 |
< |
introduce_client(client_p, source_p); |
| 555 |
> |
introduce_client(source_p); |
| 556 |
|
} |
| 557 |
|
|
| 558 |
|
/* introduce_client() |
| 559 |
|
* |
| 560 |
< |
* inputs - client_p |
| 572 |
< |
* - source_p |
| 560 |
> |
* inputs - source_p |
| 561 |
|
* output - NONE |
| 562 |
|
* side effects - This common function introduces a client to the rest |
| 563 |
|
* of the net, either from a local client connect or |
| 564 |
|
* from a remote connect. |
| 565 |
|
*/ |
| 566 |
|
static void |
| 567 |
< |
introduce_client(struct Client *client_p, struct Client *source_p) |
| 567 |
> |
introduce_client(struct Client *source_p) |
| 568 |
|
{ |
| 569 |
< |
dlink_node *server_node; |
| 569 |
> |
dlink_node *server_node = NULL; |
| 570 |
|
static char ubuf[12]; |
| 571 |
|
|
| 572 |
|
if (MyClient(source_p)) |
| 574 |
|
else |
| 575 |
|
send_umode(NULL, source_p, 0, SEND_UMODES, ubuf); |
| 576 |
|
|
| 577 |
+ |
watch_check_hash(source_p, RPL_LOGON); |
| 578 |
+ |
|
| 579 |
|
if (*ubuf == '\0') |
| 580 |
|
{ |
| 581 |
|
ubuf[0] = '+'; |
| 582 |
|
ubuf[1] = '\0'; |
| 583 |
|
} |
| 584 |
|
|
| 585 |
< |
/* arghhh one could try not introducing new nicks to ll leafs |
| 586 |
< |
* but then you have to introduce them "on the fly" in SJOIN |
| 587 |
< |
* not fun. |
| 598 |
< |
* Its not going to cost much more bandwidth to simply let new |
| 599 |
< |
* nicks just ride on through. |
| 600 |
< |
*/ |
| 585 |
> |
DLINK_FOREACH(server_node, serv_list.head) |
| 586 |
> |
{ |
| 587 |
> |
struct Client *server = server_node->data; |
| 588 |
|
|
| 589 |
< |
/* We now introduce nicks "on the fly" in SJOIN anyway -- |
| 590 |
< |
* you _need_ to if you aren't going to burst everyone initially. |
| 604 |
< |
* |
| 605 |
< |
* Only send to non CAP_LL servers, unless we're a lazylink leaf, |
| 606 |
< |
* in that case just send it to the uplink. |
| 607 |
< |
* -davidt |
| 608 |
< |
* rewritten to cope with SIDs .. eww eww eww --is |
| 609 |
< |
*/ |
| 589 |
> |
if (server == source_p->from) |
| 590 |
> |
continue; |
| 591 |
|
|
| 592 |
< |
/* XXX THESE NEED A PREFIX!?!?!? */ |
| 593 |
< |
if (!ServerInfo.hub && uplink && IsCapable(uplink, CAP_LL) && |
| 613 |
< |
client_p != uplink) |
| 614 |
< |
{ |
| 615 |
< |
if (IsCapable(uplink, CAP_TS6) && HasID(source_p)) |
| 616 |
< |
{ |
| 617 |
< |
sendto_one(uplink, ":%s UID %s %d %lu %s %s %s %s %s :%s", |
| 592 |
> |
if (IsCapable(server, CAP_TS6) && HasID(source_p)) |
| 593 |
> |
sendto_one(server, ":%s UID %s %d %lu %s %s %s %s %s :%s", |
| 594 |
|
source_p->servptr->id, |
| 595 |
|
source_p->name, source_p->hopcount+1, |
| 596 |
< |
(unsigned long)source_p->tsinfo, |
| 596 |
> |
(unsigned long)source_p->tsinfo, |
| 597 |
|
ubuf, source_p->username, source_p->host, |
| 598 |
< |
((MyClient(source_p) && !IsIPSpoof(source_p)) ? |
| 599 |
< |
source_p->sockhost : "0"), |
| 624 |
< |
source_p->id, source_p->info); |
| 625 |
< |
} |
| 598 |
> |
(MyClient(source_p) && IsIPSpoof(source_p)) ? |
| 599 |
> |
"0" : source_p->sockhost, source_p->id, source_p->info); |
| 600 |
|
else |
| 601 |
< |
{ |
| 628 |
< |
sendto_one(uplink, "NICK %s %d %lu %s %s %s %s :%s", |
| 601 |
> |
sendto_one(server, "NICK %s %d %lu %s %s %s %s :%s", |
| 602 |
|
source_p->name, source_p->hopcount+1, |
| 603 |
< |
(unsigned long)source_p->tsinfo, |
| 603 |
> |
(unsigned long)source_p->tsinfo, |
| 604 |
|
ubuf, source_p->username, source_p->host, |
| 605 |
< |
source_p->servptr->name, |
| 633 |
< |
source_p->info); |
| 634 |
< |
} |
| 635 |
< |
} |
| 636 |
< |
else |
| 637 |
< |
{ |
| 638 |
< |
DLINK_FOREACH(server_node, serv_list.head) |
| 639 |
< |
{ |
| 640 |
< |
struct Client *server = server_node->data; |
| 641 |
< |
|
| 642 |
< |
if (IsCapable(server, CAP_LL) || server == client_p) |
| 643 |
< |
continue; |
| 644 |
< |
|
| 645 |
< |
if (IsCapable(server, CAP_TS6) && HasID(source_p)) |
| 646 |
< |
sendto_one(server, ":%s UID %s %d %lu %s %s %s %s %s :%s", |
| 647 |
< |
source_p->servptr->id, |
| 648 |
< |
source_p->name, source_p->hopcount+1, |
| 649 |
< |
(unsigned long)source_p->tsinfo, |
| 650 |
< |
ubuf, source_p->username, source_p->host, |
| 651 |
< |
((MyClient(source_p)&&!IsIPSpoof(source_p))?source_p->sockhost:"0"), |
| 652 |
< |
source_p->id, source_p->info); |
| 653 |
< |
else |
| 654 |
< |
sendto_one(server, "NICK %s %d %lu %s %s %s %s :%s", |
| 655 |
< |
source_p->name, source_p->hopcount+1, |
| 656 |
< |
(unsigned long)source_p->tsinfo, |
| 657 |
< |
ubuf, source_p->username, source_p->host, |
| 658 |
< |
source_p->servptr->name, |
| 659 |
< |
source_p->info); |
| 660 |
< |
} |
| 605 |
> |
source_p->servptr->name, source_p->info); |
| 606 |
|
} |
| 607 |
|
} |
| 608 |
|
|
| 622 |
|
|
| 623 |
|
assert(p != NULL); |
| 624 |
|
|
| 625 |
< |
if (('.' == *p) || (':' == *p)) |
| 626 |
< |
return (0); |
| 625 |
> |
if (*p == '.' || *p == ':') |
| 626 |
> |
return 0; |
| 627 |
|
|
| 628 |
< |
while (*p) |
| 684 |
< |
{ |
| 628 |
> |
for (; *p; ++p) |
| 629 |
|
if (!IsHostChar(*p)) |
| 630 |
< |
return (0); |
| 687 |
< |
p++; |
| 688 |
< |
} |
| 630 |
> |
return 0; |
| 631 |
|
|
| 632 |
< |
return (1); |
| 632 |
> |
return 1; |
| 633 |
|
} |
| 634 |
|
|
| 635 |
|
/* valid_username() |
| 651 |
|
|
| 652 |
|
assert(p != NULL); |
| 653 |
|
|
| 654 |
< |
if ('~' == *p) |
| 654 |
> |
if (*p == '~') |
| 655 |
|
++p; |
| 656 |
|
|
| 657 |
|
/* reject usernames that don't start with an alphanum |
| 659 |
|
* or "-hi-@somehost", "h-----@somehost" would still be accepted. |
| 660 |
|
*/ |
| 661 |
|
if (!IsAlNum(*p)) |
| 662 |
< |
return (0); |
| 662 |
> |
return 0; |
| 663 |
|
|
| 664 |
|
while (*++p) |
| 665 |
|
{ |
| 666 |
|
if ((*p == '.') && ConfigFileEntry.dots_in_ident) |
| 667 |
|
{ |
| 668 |
< |
dots++; |
| 669 |
< |
|
| 670 |
< |
if (dots > ConfigFileEntry.dots_in_ident) |
| 671 |
< |
return (0); |
| 730 |
< |
if (!IsUserChar(p[1])) |
| 731 |
< |
return (0); |
| 668 |
> |
if (++dots > ConfigFileEntry.dots_in_ident) |
| 669 |
> |
return 0; |
| 670 |
> |
if (!IsUserChar(*(p + 1))) |
| 671 |
> |
return 0; |
| 672 |
|
} |
| 673 |
|
else if (!IsUserChar(*p)) |
| 674 |
< |
return (0); |
| 674 |
> |
return 0; |
| 675 |
|
} |
| 676 |
|
|
| 677 |
< |
return (1); |
| 677 |
> |
return 1; |
| 678 |
|
} |
| 679 |
|
|
| 680 |
|
/* report_and_set_user_flags() |
| 749 |
|
} |
| 750 |
|
} |
| 751 |
|
|
| 812 |
– |
/* do_local_user() |
| 813 |
– |
* |
| 814 |
– |
* inputs - |
| 815 |
– |
* output - NONE |
| 816 |
– |
* side effects - |
| 817 |
– |
*/ |
| 818 |
– |
void |
| 819 |
– |
do_local_user(const char *nick, struct Client *client_p, struct Client *source_p, |
| 820 |
– |
const char *username, const char *host, const char *server, |
| 821 |
– |
const char *realname) |
| 822 |
– |
{ |
| 823 |
– |
assert(source_p != NULL); |
| 824 |
– |
assert(source_p->username != username); |
| 825 |
– |
|
| 826 |
– |
if (source_p == NULL) |
| 827 |
– |
return; |
| 828 |
– |
|
| 829 |
– |
if (!IsUnknown(source_p)) |
| 830 |
– |
{ |
| 831 |
– |
sendto_one(source_p, form_str(ERR_ALREADYREGISTRED), |
| 832 |
– |
me.name, nick); |
| 833 |
– |
return; |
| 834 |
– |
} |
| 835 |
– |
|
| 836 |
– |
source_p->flags |= FLAGS_GOTUSER; |
| 837 |
– |
|
| 838 |
– |
/* |
| 839 |
– |
* don't take the clients word for it, ever |
| 840 |
– |
*/ |
| 841 |
– |
source_p->servptr = &me; |
| 842 |
– |
|
| 843 |
– |
strlcpy(source_p->info, realname, sizeof(source_p->info)); |
| 844 |
– |
|
| 845 |
– |
if (!IsGotId(source_p)) |
| 846 |
– |
{ |
| 847 |
– |
/* save the username in the client |
| 848 |
– |
* If you move this you'll break ping cookies..you've been warned |
| 849 |
– |
*/ |
| 850 |
– |
strlcpy(source_p->username, username, sizeof(source_p->username)); |
| 851 |
– |
} |
| 852 |
– |
|
| 853 |
– |
if (source_p->name[0]) |
| 854 |
– |
{ |
| 855 |
– |
/* NICK already received, now I have USER... */ |
| 856 |
– |
register_local_user(client_p, source_p, source_p->name, username); |
| 857 |
– |
} |
| 858 |
– |
} |
| 859 |
– |
|
| 752 |
|
/* change_simple_umode() |
| 753 |
|
* |
| 754 |
|
* this callback can be hooked to allow special handling of |
| 757 |
|
static void * |
| 758 |
|
change_simple_umode(va_list args) |
| 759 |
|
{ |
| 760 |
+ |
struct Client *client_p; |
| 761 |
|
struct Client *source_p; |
| 762 |
|
int what; |
| 763 |
|
unsigned int flag; |
| 764 |
|
|
| 765 |
< |
va_arg(args, struct Client *); |
| 765 |
> |
client_p = va_arg(args, struct Client *); |
| 766 |
|
source_p = va_arg(args, struct Client *); |
| 767 |
|
what = va_arg(args, int); |
| 768 |
|
flag = va_arg(args, unsigned int); |
| 790 |
|
char **p, *m, buf[IRCD_BUFSIZE]; |
| 791 |
|
struct Client *target_p; |
| 792 |
|
int what = MODE_ADD, badflag = 0, i; |
| 793 |
< |
#if 0 |
| 794 |
< |
/* already covered by m_mode */ |
| 795 |
< |
if (parc < 2) |
| 903 |
< |
{ |
| 904 |
< |
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), |
| 905 |
< |
me.name, source_p->name, "MODE"); |
| 906 |
< |
return; |
| 907 |
< |
} |
| 908 |
< |
#endif |
| 793 |
> |
|
| 794 |
> |
assert(!(parc < 2)); |
| 795 |
> |
|
| 796 |
|
if ((target_p = find_person(client_p, parv[1])) == NULL) |
| 797 |
|
{ |
| 798 |
|
if (MyConnect(source_p)) |
| 801 |
|
return; |
| 802 |
|
} |
| 803 |
|
|
| 917 |
– |
/* Dont know why these were commented out.. |
| 918 |
– |
* put them back using new sendto() funcs |
| 919 |
– |
*/ |
| 804 |
|
if (IsServer(source_p)) |
| 805 |
|
{ |
| 806 |
|
sendto_realops_flags(UMODE_ALL, L_ADMIN, "*** Mode for User %s from %s", |
| 808 |
|
return; |
| 809 |
|
} |
| 810 |
|
|
| 811 |
< |
if (source_p != target_p || target_p->from != source_p->from) |
| 811 |
> |
if (source_p != target_p) |
| 812 |
|
{ |
| 813 |
|
sendto_one(source_p, form_str(ERR_USERSDONTMATCH), |
| 814 |
|
me.name, source_p->name); |
| 866 |
|
break; |
| 867 |
|
|
| 868 |
|
ClearOper(source_p); |
| 985 |
– |
source_p->umodes &= ~ConfigFileEntry.oper_only_umodes; |
| 869 |
|
Count.oper--; |
| 870 |
|
|
| 871 |
|
if (MyConnect(source_p)) |
| 874 |
|
|
| 875 |
|
detach_conf(source_p, OPER_TYPE); |
| 876 |
|
ClearOperFlags(source_p); |
| 877 |
+ |
source_p->umodes &= ~ConfigFileEntry.oper_only_umodes; |
| 878 |
|
|
| 879 |
|
if ((dm = dlinkFindDelete(&oper_list, source_p)) != NULL) |
| 880 |
|
free_dlink_node(dm); |
| 901 |
|
badflag = 1; |
| 902 |
|
} |
| 903 |
|
else |
| 904 |
< |
execute_callback(umode_cb, client_p, source_p, what, flag); |
| 904 |
> |
execute_callback(umode_cb, client_p, source_p, what, flag); |
| 905 |
|
} |
| 906 |
|
else |
| 907 |
|
{ |
| 938 |
|
if ((setflags & UMODE_INVISIBLE) && !IsInvisible(source_p)) |
| 939 |
|
--Count.invisi; |
| 940 |
|
|
| 941 |
< |
/* compare new flags with old flags and send string which |
| 941 |
> |
/* |
| 942 |
> |
* compare new flags with old flags and send string which |
| 943 |
|
* will cause servers to update correctly. |
| 944 |
|
*/ |
| 945 |
|
send_umode_out(client_p, source_p, setflags); |
| 948 |
|
/* send_umode() |
| 949 |
|
* send the MODE string for user (user) to connection client_p |
| 950 |
|
* -avalon |
| 951 |
+ |
* |
| 952 |
+ |
* inputs - client_p |
| 953 |
+ |
* - source_p |
| 954 |
+ |
* - int old |
| 955 |
+ |
* - sendmask mask of modes to send |
| 956 |
+ |
* - suplied umode_buf |
| 957 |
+ |
* output - NONE |
| 958 |
|
*/ |
| 959 |
|
void |
| 960 |
|
send_umode(struct Client *client_p, struct Client *source_p, |
| 961 |
|
unsigned int old, unsigned int sendmask, char *umode_buf) |
| 962 |
|
{ |
| 963 |
+ |
char *m = umode_buf; |
| 964 |
|
int what = 0; |
| 965 |
|
unsigned int i; |
| 966 |
|
unsigned int flag; |
| 1074 |
– |
char *m = umode_buf; |
| 967 |
|
|
| 968 |
< |
/* build a string in umode_buf to represent the change in the user's |
| 968 |
> |
/* |
| 969 |
> |
* build a string in umode_buf to represent the change in the user's |
| 970 |
|
* mode between the new (source_p->umodes) and 'old'. |
| 971 |
|
*/ |
| 972 |
|
for (i = 0; i < 128; i++) |
| 1005 |
|
*m = '\0'; |
| 1006 |
|
|
| 1007 |
|
if (*umode_buf && client_p) |
| 1008 |
< |
sendto_one(client_p, ":%s MODE %s :%s", |
| 1009 |
< |
source_p->name, source_p->name, umode_buf); |
| 1008 |
> |
sendto_one(client_p, ":%s!%s@%s MODE %s :%s", |
| 1009 |
> |
source_p->name, source_p->username, |
| 1010 |
> |
source_p->host, source_p->name, umode_buf); |
| 1011 |
|
} |
| 1012 |
|
|
| 1013 |
|
/* send_umode_out() |
| 1020 |
|
send_umode_out(struct Client *client_p, struct Client *source_p, |
| 1021 |
|
unsigned int old) |
| 1022 |
|
{ |
| 1023 |
< |
char buf[IRCD_BUFSIZE]; |
| 1023 |
> |
char buf[IRCD_BUFSIZE] = { '\0' }; |
| 1024 |
|
dlink_node *ptr = NULL; |
| 1025 |
|
|
| 1026 |
|
send_umode(NULL, source_p, old, IsOperHiddenAdmin(source_p) ? |
| 1027 |
|
SEND_UMODES & ~UMODE_ADMIN : SEND_UMODES, buf); |
| 1028 |
|
|
| 1029 |
< |
if (*buf) |
| 1029 |
> |
if (buf[0]) |
| 1030 |
|
{ |
| 1031 |
|
DLINK_FOREACH(ptr, serv_list.head) |
| 1032 |
|
{ |
| 1033 |
|
struct Client *target_p = ptr->data; |
| 1034 |
|
|
| 1035 |
|
if ((target_p != client_p) && (target_p != source_p)) |
| 1036 |
< |
{ |
| 1037 |
< |
if ((!(ServerInfo.hub && IsCapable(target_p, CAP_LL))) || |
| 1038 |
< |
(target_p->localClient->serverMask & |
| 1145 |
< |
source_p->lazyLinkClientExists)) |
| 1146 |
< |
sendto_one(target_p, ":%s MODE %s :%s", |
| 1147 |
< |
ID_or_name(source_p, target_p), |
| 1148 |
< |
ID_or_name(source_p, target_p), buf); |
| 1149 |
< |
} |
| 1036 |
> |
sendto_one(target_p, ":%s MODE %s :%s", |
| 1037 |
> |
ID_or_name(source_p, target_p), |
| 1038 |
> |
ID_or_name(source_p, target_p), buf); |
| 1039 |
|
} |
| 1040 |
|
} |
| 1041 |
|
|
| 1068 |
|
sendto_one(source_p, form_str(RPL_WELCOME), me.name, source_p->name, |
| 1069 |
|
ServerInfo.network_name, source_p->name); |
| 1070 |
|
sendto_one(source_p, form_str(RPL_YOURHOST), me.name, source_p->name, |
| 1071 |
< |
get_listener_name(source_p->localClient->listener), ircd_version); |
| 1071 |
> |
get_listener_name(source_p->localClient->listener), ircd_version); |
| 1072 |
|
sendto_one(source_p, form_str(RPL_CREATED), |
| 1073 |
< |
me.name, source_p->name, built_date); |
| 1073 |
> |
me.name, source_p->name, built_date); |
| 1074 |
|
sendto_one(source_p, form_str(RPL_MYINFO), |
| 1075 |
|
me.name, source_p->name, me.name, ircd_version, umode_buffer); |
| 1076 |
|
show_isupport(source_p); |
| 1083 |
|
|
| 1084 |
|
if (ConfigFileEntry.short_motd) |
| 1085 |
|
{ |
| 1086 |
< |
sendto_one(source_p, "NOTICE %s :*** Notice -- motd was last changed at %s", |
| 1087 |
< |
source_p->name, ConfigFileEntry.motd.lastChangedDate); |
| 1086 |
> |
sendto_one(source_p, ":%s NOTICE %s :*** Notice -- motd was last changed at %s", |
| 1087 |
> |
me.name, source_p->name, ConfigFileEntry.motd.lastChangedDate); |
| 1088 |
|
sendto_one(source_p, |
| 1089 |
< |
"NOTICE %s :*** Notice -- Please read the motd if you haven't " |
| 1090 |
< |
"read it", source_p->name); |
| 1089 |
> |
":%s NOTICE %s :*** Notice -- Please read the motd if you haven't " |
| 1090 |
> |
"read it", me.name, source_p->name); |
| 1091 |
|
sendto_one(source_p, form_str(RPL_MOTDSTART), |
| 1092 |
|
me.name, source_p->name, me.name); |
| 1093 |
|
sendto_one(source_p, form_str(RPL_MOTD), |
| 1109 |
|
static int |
| 1110 |
|
check_xline(struct Client *source_p) |
| 1111 |
|
{ |
| 1223 |
– |
struct ConfItem *conf; |
| 1224 |
– |
struct MatchItem *xconf; |
| 1225 |
– |
const char *reason; |
| 1226 |
– |
|
| 1227 |
– |
if ((conf = find_matching_name_conf(XLINE_TYPE, source_p->info, |
| 1228 |
– |
NULL, NULL, 0)) != NULL) |
| 1229 |
– |
{ |
| 1230 |
– |
xconf = map_to_conf(conf); |
| 1231 |
– |
xconf->count++; |
| 1232 |
– |
|
| 1233 |
– |
if (xconf->reason != NULL) |
| 1234 |
– |
reason = xconf->reason; |
| 1235 |
– |
else |
| 1236 |
– |
reason = "No Reason"; |
| 1237 |
– |
|
| 1238 |
– |
sendto_realops_flags(UMODE_REJ, L_ALL, |
| 1239 |
– |
"X-line Rejecting [%s] [%s], user %s [%s]", |
| 1240 |
– |
source_p->info, reason, |
| 1241 |
– |
get_client_name(source_p, HIDE_IP), |
| 1242 |
– |
source_p->sockhost); |
| 1243 |
– |
|
| 1244 |
– |
ServerStats->is_ref++; |
| 1245 |
– |
if(REJECT_HOLD_TIME > 0) |
| 1246 |
– |
{ |
| 1247 |
– |
sendto_one(source_p, ":%s NOTICE %s :Bad user info", |
| 1248 |
– |
me.name, source_p->name); |
| 1249 |
– |
source_p->localClient->reject_delay = CurrentTime + REJECT_HOLD_TIME; |
| 1250 |
– |
SetCaptured(source_p); |
| 1251 |
– |
} |
| 1252 |
– |
else |
| 1253 |
– |
exit_client(source_p, &me, "Bad user info"); |
| 1254 |
– |
return 1; |
| 1255 |
– |
} |
| 1256 |
– |
|
| 1257 |
– |
return 0; |
| 1258 |
– |
} |
| 1259 |
– |
|
| 1260 |
– |
static int |
| 1261 |
– |
check_regexp_xline(struct Client *source_p) |
| 1262 |
– |
{ |
| 1112 |
|
struct ConfItem *conf = NULL; |
| 1113 |
|
const char *reason = NULL; |
| 1114 |
|
|
| 1115 |
< |
if ((conf = find_matching_name_conf(RXLINE_TYPE, source_p->info, NULL, NULL, 0))) |
| 1115 |
> |
if ((conf = find_matching_name_conf(XLINE_TYPE, source_p->info, NULL, NULL, 0)) || |
| 1116 |
> |
(conf = find_matching_name_conf(RXLINE_TYPE, source_p->info, NULL, NULL, 0))) |
| 1117 |
|
{ |
| 1118 |
|
struct MatchItem *reg = map_to_conf(conf); |
| 1119 |
|
|
| 1125 |
|
reason = "No Reason"; |
| 1126 |
|
|
| 1127 |
|
sendto_realops_flags(UMODE_REJ, L_ALL, |
| 1128 |
< |
"X-line (REGEX) Rejecting [%s] [%s], user %s [%s]", |
| 1128 |
> |
"X-line Rejecting [%s] [%s], user %s [%s]", |
| 1129 |
|
source_p->info, reason, |
| 1130 |
|
get_client_name(source_p, HIDE_IP), |
| 1131 |
|
source_p->sockhost); |
| 1132 |
|
|
| 1133 |
< |
ServerStats->is_ref++; |
| 1134 |
< |
exit_client(source_p, &me, "Bad user info"); |
| 1133 |
> |
++ServerStats.is_ref; |
| 1134 |
> |
if (REJECT_HOLD_TIME > 0) |
| 1135 |
> |
{ |
| 1136 |
> |
sendto_one(source_p, ":%s NOTICE %s :Bad user info", |
| 1137 |
> |
me.name, source_p->name); |
| 1138 |
> |
source_p->localClient->reject_delay = CurrentTime + REJECT_HOLD_TIME; |
| 1139 |
> |
SetCaptured(source_p); |
| 1140 |
> |
} |
| 1141 |
> |
else |
| 1142 |
> |
exit_client(source_p, &me, "Bad user info"); |
| 1143 |
|
return 1; |
| 1144 |
|
} |
| 1145 |
|
|
| 1159 |
|
{ |
| 1160 |
|
unsigned int old = source_p->umodes; |
| 1161 |
|
const char *operprivs = ""; |
| 1162 |
< |
struct AccessItem *oconf; |
| 1162 |
> |
const struct AccessItem *oconf = NULL; |
| 1163 |
> |
|
| 1164 |
> |
assert(source_p->localClient->confs.head); |
| 1165 |
> |
oconf = map_to_conf((source_p->localClient->confs.head)->data); |
| 1166 |
|
|
| 1167 |
+ |
++Count.oper; |
| 1168 |
|
SetOper(source_p); |
| 1169 |
|
|
| 1170 |
< |
if (ConfigFileEntry.oper_umodes) |
| 1170 |
> |
if (oconf->modes) |
| 1171 |
> |
source_p->umodes |= oconf->modes; |
| 1172 |
> |
else if (ConfigFileEntry.oper_umodes) |
| 1173 |
|
source_p->umodes |= ConfigFileEntry.oper_umodes; |
| 1174 |
|
else |
| 1175 |
|
source_p->umodes |= (UMODE_SERVNOTICE|UMODE_OPERWALL| |
| 1176 |
< |
UMODE_WALLOP|UMODE_LOCOPS); |
| 1176 |
> |
UMODE_WALLOP|UMODE_LOCOPS); |
| 1177 |
|
|
| 1178 |
< |
Count.oper++; |
| 1178 |
> |
if (!(old & UMODE_INVISIBLE) && IsInvisible(source_p)) |
| 1179 |
> |
++Count.invisi; |
| 1180 |
> |
if ((old & UMODE_INVISIBLE) && !IsInvisible(source_p)) |
| 1181 |
> |
--Count.invisi; |
| 1182 |
|
|
| 1183 |
|
assert(dlinkFind(&oper_list, source_p) == NULL); |
| 1184 |
|
dlinkAdd(source_p, make_dlink_node(), &oper_list); |
| 1185 |
|
|
| 1319 |
– |
assert(source_p->localClient->confs.head); |
| 1320 |
– |
oconf = map_to_conf((source_p->localClient->confs.head)->data); |
| 1186 |
|
operprivs = oper_privs_as_string(oconf->port); |
| 1187 |
|
|
| 1188 |
|
SetOFlag(source_p, oconf->port); |
| 1201 |
|
send_message_file(source_p, &ConfigFileEntry.opermotd); |
| 1202 |
|
} |
| 1203 |
|
|
| 1204 |
< |
/* |
| 1340 |
< |
* Quick and dirty UID code for new proposed SID on EFnet |
| 1341 |
< |
* |
| 1342 |
< |
*/ |
| 1204 |
> |
static char new_uid[TOTALSIDUID + 1]; /* allow for \0 */ |
| 1205 |
|
|
| 1206 |
< |
static char new_uid[TOTALSIDUID+1]; /* allow for \0 */ |
| 1207 |
< |
static void add_one_to_uid(int i); |
| 1206 |
> |
int |
| 1207 |
> |
valid_sid(const char *sid) |
| 1208 |
> |
{ |
| 1209 |
> |
if (strlen(sid) == IRC_MAXSID) |
| 1210 |
> |
if (IsDigit(*sid)) |
| 1211 |
> |
if (IsAlNum(*(sid + 1)) && IsAlNum(*(sid + 2))) |
| 1212 |
> |
return 1; |
| 1213 |
> |
|
| 1214 |
> |
return 0; |
| 1215 |
> |
} |
| 1216 |
|
|
| 1217 |
|
/* |
| 1218 |
|
* init_uid() |
| 1230 |
|
|
| 1231 |
|
memset(new_uid, 0, sizeof(new_uid)); |
| 1232 |
|
|
| 1233 |
< |
if (ServerInfo.sid != NULL) |
| 1234 |
< |
{ |
| 1365 |
< |
memcpy(new_uid, ServerInfo.sid, IRCD_MIN(strlen(ServerInfo.sid), |
| 1366 |
< |
IRC_MAXSID)); |
| 1367 |
< |
memcpy(&me.id, ServerInfo.sid, IRCD_MIN(strlen(ServerInfo.sid), |
| 1368 |
< |
IRC_MAXSID)); |
| 1369 |
< |
hash_add_id(&me); |
| 1370 |
< |
} |
| 1233 |
> |
if (!EmptyString(ServerInfo.sid)) |
| 1234 |
> |
strlcpy(new_uid, ServerInfo.sid, sizeof(new_uid)); |
| 1235 |
|
|
| 1236 |
< |
for (i = 0; i < IRC_MAXSID; i++) |
| 1236 |
> |
for (i = 0; i < IRC_MAXSID; ++i) |
| 1237 |
|
if (new_uid[i] == '\0') |
| 1238 |
|
new_uid[i] = 'A'; |
| 1239 |
|
|
| 1240 |
< |
/* XXX if IRC_MAXUID != 6, this will have to be rewritten */ |
| 1240 |
> |
/* NOTE: if IRC_MAXUID != 6, this will have to be rewritten */ |
| 1241 |
|
/* Yes nenolod, I have known it was off by one ever since I wrote it |
| 1242 |
|
* But *JUST* for you, though, it really doesn't look as *pretty* |
| 1243 |
|
* -Dianora |
| 1244 |
|
*/ |
| 1245 |
< |
memcpy(new_uid+IRC_MAXSID, "AAAAA@", IRC_MAXUID); |
| 1245 |
> |
memcpy(new_uid + IRC_MAXSID, "AAAAA@", IRC_MAXUID); |
| 1246 |
|
|
| 1247 |
|
entering_umode_cb = register_callback("entering_umode", NULL); |
| 1248 |
|
umode_cb = register_callback("changing_umode", change_simple_umode); |
| 1385 |
– |
uid_get_cb = register_callback("uid_get", uid_get); |
| 1386 |
– |
} |
| 1387 |
– |
|
| 1388 |
– |
/* |
| 1389 |
– |
* uid_get |
| 1390 |
– |
* |
| 1391 |
– |
* inputs - struct Client * |
| 1392 |
– |
* output - new UID is returned to caller |
| 1393 |
– |
* side effects - new_uid is incremented by one. |
| 1394 |
– |
*/ |
| 1395 |
– |
static void * |
| 1396 |
– |
uid_get(va_list args) |
| 1397 |
– |
{ |
| 1398 |
– |
add_one_to_uid(TOTALSIDUID-1); /* index from 0 */ |
| 1399 |
– |
return ((void *) new_uid); |
| 1249 |
|
} |
| 1250 |
|
|
| 1251 |
|
/* |
| 1259 |
|
static void |
| 1260 |
|
add_one_to_uid(int i) |
| 1261 |
|
{ |
| 1262 |
< |
if (i != IRC_MAXSID) /* Not reached server SID portion yet? */ |
| 1262 |
> |
if (i != IRC_MAXSID) /* Not reached server SID portion yet? */ |
| 1263 |
|
{ |
| 1264 |
|
if (new_uid[i] == 'Z') |
| 1265 |
|
new_uid[i] = '0'; |
| 1268 |
|
new_uid[i] = 'A'; |
| 1269 |
|
add_one_to_uid(i-1); |
| 1270 |
|
} |
| 1271 |
< |
else new_uid[i] = new_uid[i] + 1; |
| 1271 |
> |
else |
| 1272 |
> |
++new_uid[i]; |
| 1273 |
|
} |
| 1274 |
|
else |
| 1275 |
|
{ |
| 1276 |
< |
/* XXX if IRC_MAXUID != 6, this will have to be rewritten */ |
| 1276 |
> |
/* NOTE: if IRC_MAXUID != 6, this will have to be rewritten */ |
| 1277 |
|
if (new_uid[i] == 'Z') |
| 1278 |
< |
memcpy(new_uid+IRC_MAXSID, "AAAAAA", IRC_MAXUID); |
| 1278 |
> |
memcpy(new_uid + IRC_MAXSID, "AAAAAA", IRC_MAXUID); |
| 1279 |
|
else |
| 1280 |
< |
new_uid[i] = new_uid[i] + 1; |
| 1280 |
> |
++new_uid[i]; |
| 1281 |
|
} |
| 1282 |
|
} |
| 1283 |
|
|
| 1284 |
|
/* |
| 1285 |
+ |
* uid_get |
| 1286 |
+ |
* |
| 1287 |
+ |
* inputs - struct Client * |
| 1288 |
+ |
* output - new UID is returned to caller |
| 1289 |
+ |
* side effects - new_uid is incremented by one. |
| 1290 |
+ |
*/ |
| 1291 |
+ |
static const char * |
| 1292 |
+ |
uid_get(void) |
| 1293 |
+ |
{ |
| 1294 |
+ |
add_one_to_uid(TOTALSIDUID - 1); /* index from 0 */ |
| 1295 |
+ |
return new_uid; |
| 1296 |
+ |
} |
| 1297 |
+ |
|
| 1298 |
+ |
/* |
| 1299 |
|
* init_isupport() |
| 1300 |
|
* |
| 1301 |
|
* input - NONE |
| 1309 |
|
|
| 1310 |
|
add_isupport("CALLERID", NULL, -1); |
| 1311 |
|
add_isupport("CASEMAPPING", CASEMAP, -1); |
| 1312 |
+ |
add_isupport("DEAF", "D", -1); |
| 1313 |
|
add_isupport("KICKLEN", NULL, KICKLEN); |
| 1314 |
|
add_isupport("MODES", NULL, MAXMODEPARAMS); |
| 1315 |
|
add_isupport("NICKLEN", NULL, NICKLEN-1); |
| 1438 |
|
if (++tokens == (MAXPARA-2) || len >= (sizeof(isupportbuffer)-reserve)) |
| 1439 |
|
{ /* arbritrary for now */ |
| 1440 |
|
if (*--p == ' ') |
| 1441 |
< |
*p = '\0'; |
| 1441 |
> |
*p = '\0'; |
| 1442 |
|
|
| 1443 |
|
addto_MessageLine(isupportFile, isupportbuffer); |
| 1444 |
|
p = isupportbuffer; |