| 67 |
|
static void user_welcome(struct Client *); |
| 68 |
|
static void report_and_set_user_flags(struct Client *, const struct AccessItem *); |
| 69 |
|
static int check_xline(struct Client *); |
| 70 |
– |
static int check_regexp_xline(struct Client *); |
| 70 |
|
static void introduce_client(struct Client *, struct Client *); |
| 71 |
|
static void *uid_get(va_list); |
| 72 |
|
|
| 200 |
|
Count.invisi, dlink_list_length(&global_serv_list)); |
| 201 |
|
else |
| 202 |
|
sendto_one(source_p, form_str(RPL_LUSERCLIENT), from, to, |
| 203 |
< |
(Count.total-Count.invisi), Count.invisi, 1); |
| 203 |
> |
(Count.total-Count.invisi), Count.invisi, 1); |
| 204 |
|
|
| 205 |
|
if (Count.oper > 0) |
| 206 |
|
sendto_one(source_p, form_str(RPL_LUSEROP), |
| 207 |
< |
from, to, Count.oper); |
| 207 |
> |
from, to, Count.oper); |
| 208 |
|
|
| 209 |
|
if (dlink_list_length(&unknown_list) > 0) |
| 210 |
|
sendto_one(source_p, form_str(RPL_LUSERUNKNOWN), |
| 211 |
< |
from, to, dlink_list_length(&unknown_list)); |
| 211 |
> |
from, to, dlink_list_length(&unknown_list)); |
| 212 |
|
|
| 213 |
|
if (dlink_list_length(&global_channel_list) > 0) |
| 214 |
|
sendto_one(source_p, form_str(RPL_LUSERCHANNELS), |
| 215 |
< |
from, to, |
| 217 |
< |
dlink_list_length(&global_channel_list)); |
| 215 |
> |
from, to, dlink_list_length(&global_channel_list)); |
| 216 |
|
|
| 217 |
|
if (!ConfigServerHide.hide_servers || IsOper(source_p)) |
| 218 |
|
{ |
| 219 |
|
sendto_one(source_p, form_str(RPL_LUSERME), |
| 220 |
< |
from, to, |
| 223 |
< |
Count.local, Count.myserver); |
| 220 |
> |
from, to, Count.local, Count.myserver); |
| 221 |
|
sendto_one(source_p, form_str(RPL_LOCALUSERS), |
| 222 |
< |
from, to, Count.local, Count.max_loc, |
| 223 |
< |
Count.local, Count.max_loc); |
| 222 |
> |
from, to, Count.local, Count.max_loc, |
| 223 |
> |
Count.local, Count.max_loc); |
| 224 |
|
} |
| 225 |
|
else |
| 226 |
|
{ |
| 227 |
|
sendto_one(source_p, form_str(RPL_LUSERME), |
| 228 |
< |
from, to, Count.total, 0); |
| 228 |
> |
from, to, Count.total, 0); |
| 229 |
|
sendto_one(source_p, form_str(RPL_LOCALUSERS), |
| 230 |
< |
from, to, Count.total, Count.max_tot, |
| 230 |
> |
from, to, Count.total, Count.max_tot, |
| 231 |
|
Count.total, Count.max_tot); |
| 232 |
|
} |
| 233 |
|
|
| 237 |
|
|
| 238 |
|
if (!ConfigServerHide.hide_servers || IsOper(source_p)) |
| 239 |
|
sendto_one(source_p, form_str(RPL_STATSCONN), from, to, |
| 240 |
< |
MaxConnectionCount, MaxClientCount, Count.totalrestartcount); |
| 240 |
> |
MaxConnectionCount, MaxClientCount, Count.totalrestartcount); |
| 241 |
|
|
| 242 |
|
if (Count.local > MaxClientCount) |
| 243 |
|
MaxClientCount = Count.local; |
| 287 |
|
{ |
| 288 |
|
const struct AccessItem *aconf = NULL; |
| 289 |
|
char ipaddr[HOSTIPLEN]; |
| 290 |
< |
dlink_node *ptr; |
| 291 |
< |
dlink_node *m; |
| 290 |
> |
dlink_node *ptr = NULL; |
| 291 |
> |
dlink_node *m = NULL; |
| 292 |
|
|
| 293 |
|
assert(source_p != NULL); |
| 294 |
|
assert(MyConnect(source_p)); |
| 295 |
|
assert(source_p->username != username); |
| 296 |
+ |
assert(!source_p->localClient->registration); |
| 297 |
+ |
|
| 298 |
+ |
ClearCap(client_p, CAP_TS6); |
| 299 |
|
|
| 300 |
|
if (ConfigFileEntry.ping_cookie) |
| 301 |
|
{ |
| 417 |
|
|
| 418 |
|
assert(source_p == client_p); |
| 419 |
|
|
| 420 |
< |
/* end of valid user name check */ |
| 421 |
< |
if (check_xline(source_p) || check_regexp_xline(source_p)) |
| 420 |
> |
if (check_xline(source_p)) |
| 421 |
|
return; |
| 422 |
|
|
| 423 |
|
if (IsDead(client_p)) |
| 424 |
|
return; |
| 425 |
|
|
| 426 |
< |
if (source_p->id[0] == '\0' && me.id[0]) |
| 426 |
> |
if (me.id[0]) |
| 427 |
|
{ |
| 428 |
< |
char *id = (char *) execute_callback(uid_get_cb, source_p); |
| 428 |
> |
const char *id = execute_callback(uid_get_cb, source_p); |
| 429 |
> |
|
| 430 |
|
while (hash_find_id(id) != NULL) |
| 431 |
|
id = uid_get(NULL); |
| 432 |
|
|
| 450 |
|
return; |
| 451 |
|
|
| 452 |
|
if (ConfigFileEntry.invisible_on_connect) |
| 453 |
+ |
{ |
| 454 |
|
source_p->umodes |= UMODE_INVISIBLE; |
| 455 |
< |
Count.invisi++; |
| 455 |
> |
Count.invisi++; |
| 456 |
> |
} |
| 457 |
|
|
| 458 |
|
if ((++Count.local) > Count.max_loc) |
| 459 |
|
{ |
| 504 |
|
*/ |
| 505 |
|
void |
| 506 |
|
register_remote_user(struct Client *client_p, struct Client *source_p, |
| 507 |
< |
const char *username, const char *host, const char *server, |
| 508 |
< |
const char *realname) |
| 507 |
> |
const char *username, const char *host, const char *server, |
| 508 |
> |
const char *realname) |
| 509 |
|
{ |
| 510 |
< |
struct Client *target_p; |
| 510 |
> |
struct Client *target_p = NULL; |
| 511 |
|
|
| 512 |
|
assert(source_p != NULL); |
| 513 |
|
assert(source_p->username != username); |
| 516 |
|
strlcpy(source_p->info, realname, sizeof(source_p->info)); |
| 517 |
|
strlcpy(source_p->username, username, sizeof(source_p->username)); |
| 518 |
|
|
| 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 |
– |
|
| 519 |
|
/* |
| 520 |
|
* coming from another server, take the servers word for it |
| 521 |
|
*/ |
| 533 |
|
source_p->host, source_p->from->name); |
| 534 |
|
kill_client(client_p, source_p, "%s (Server doesn't exist)", me.name); |
| 535 |
|
|
| 540 |
– |
/* XXX */ |
| 536 |
|
SetKilled(source_p); |
| 537 |
|
exit_client(source_p, &me, "Ghosted Client"); |
| 538 |
|
return; |
| 553 |
|
return; |
| 554 |
|
} |
| 555 |
|
|
| 556 |
+ |
/* Increment our total user count here */ |
| 557 |
+ |
if (++Count.total > Count.max_tot) |
| 558 |
+ |
Count.max_tot = Count.total; |
| 559 |
+ |
|
| 560 |
+ |
++source_p->from->serv->dep_users; |
| 561 |
+ |
|
| 562 |
|
SetClient(source_p); |
| 563 |
|
dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->users); |
| 564 |
|
add_user_host(source_p->username, source_p->host, 1); |
| 579 |
|
static void |
| 580 |
|
introduce_client(struct Client *client_p, struct Client *source_p) |
| 581 |
|
{ |
| 582 |
< |
dlink_node *server_node; |
| 582 |
> |
dlink_node *server_node = NULL; |
| 583 |
|
static char ubuf[12]; |
| 584 |
|
|
| 585 |
|
if (MyClient(source_p)) |
| 608 |
|
* -davidt |
| 609 |
|
* rewritten to cope with SIDs .. eww eww eww --is |
| 610 |
|
*/ |
| 610 |
– |
|
| 611 |
– |
/* XXX THESE NEED A PREFIX!?!?!? */ |
| 611 |
|
if (!ServerInfo.hub && uplink && IsCapable(uplink, CAP_LL) && |
| 612 |
|
client_p != uplink) |
| 613 |
|
{ |
| 616 |
|
sendto_one(uplink, ":%s UID %s %d %lu %s %s %s %s %s :%s", |
| 617 |
|
source_p->servptr->id, |
| 618 |
|
source_p->name, source_p->hopcount+1, |
| 619 |
< |
(unsigned long)source_p->tsinfo, |
| 619 |
> |
(unsigned long)source_p->tsinfo, |
| 620 |
|
ubuf, source_p->username, source_p->host, |
| 621 |
< |
((MyClient(source_p) && !IsIPSpoof(source_p)) ? |
| 622 |
< |
source_p->sockhost : "0"), |
| 624 |
< |
source_p->id, source_p->info); |
| 621 |
> |
(MyClient(source_p) && IsIPSpoof(source_p)) ? |
| 622 |
> |
"0" : source_p->sockhost, source_p->id, source_p->info); |
| 623 |
|
} |
| 624 |
|
else |
| 625 |
|
{ |
| 626 |
|
sendto_one(uplink, "NICK %s %d %lu %s %s %s %s :%s", |
| 627 |
|
source_p->name, source_p->hopcount+1, |
| 628 |
< |
(unsigned long)source_p->tsinfo, |
| 628 |
> |
(unsigned long)source_p->tsinfo, |
| 629 |
|
ubuf, source_p->username, source_p->host, |
| 630 |
< |
source_p->servptr->name, |
| 633 |
< |
source_p->info); |
| 630 |
> |
source_p->servptr->name, source_p->info); |
| 631 |
|
} |
| 632 |
|
} |
| 633 |
|
else |
| 643 |
|
sendto_one(server, ":%s UID %s %d %lu %s %s %s %s %s :%s", |
| 644 |
|
source_p->servptr->id, |
| 645 |
|
source_p->name, source_p->hopcount+1, |
| 646 |
< |
(unsigned long)source_p->tsinfo, |
| 646 |
> |
(unsigned long)source_p->tsinfo, |
| 647 |
|
ubuf, source_p->username, source_p->host, |
| 648 |
< |
((MyClient(source_p)&&!IsIPSpoof(source_p))?source_p->sockhost:"0"), |
| 649 |
< |
source_p->id, source_p->info); |
| 648 |
> |
(MyClient(source_p) && IsIPSpoof(source_p)) ? |
| 649 |
> |
"0" : source_p->sockhost, source_p->id, source_p->info); |
| 650 |
|
else |
| 651 |
|
sendto_one(server, "NICK %s %d %lu %s %s %s %s :%s", |
| 652 |
|
source_p->name, source_p->hopcount+1, |
| 653 |
< |
(unsigned long)source_p->tsinfo, |
| 653 |
> |
(unsigned long)source_p->tsinfo, |
| 654 |
|
ubuf, source_p->username, source_p->host, |
| 655 |
< |
source_p->servptr->name, |
| 659 |
< |
source_p->info); |
| 655 |
> |
source_p->servptr->name, source_p->info); |
| 656 |
|
} |
| 657 |
|
} |
| 658 |
|
} |
| 673 |
|
|
| 674 |
|
assert(p != NULL); |
| 675 |
|
|
| 676 |
< |
if (('.' == *p) || (':' == *p)) |
| 677 |
< |
return (0); |
| 676 |
> |
if ('.' == *p || ':' == *p) |
| 677 |
> |
return 0; |
| 678 |
|
|
| 679 |
|
while (*p) |
| 680 |
|
{ |
| 681 |
|
if (!IsHostChar(*p)) |
| 682 |
< |
return (0); |
| 682 |
> |
return 0; |
| 683 |
|
p++; |
| 684 |
|
} |
| 685 |
|
|
| 686 |
< |
return (1); |
| 686 |
> |
return 1; |
| 687 |
|
} |
| 688 |
|
|
| 689 |
|
/* valid_username() |
| 713 |
|
* or "-hi-@somehost", "h-----@somehost" would still be accepted. |
| 714 |
|
*/ |
| 715 |
|
if (!IsAlNum(*p)) |
| 716 |
< |
return (0); |
| 716 |
> |
return 0; |
| 717 |
|
|
| 718 |
|
while (*++p) |
| 719 |
|
{ |
| 722 |
|
dots++; |
| 723 |
|
|
| 724 |
|
if (dots > ConfigFileEntry.dots_in_ident) |
| 725 |
< |
return (0); |
| 725 |
> |
return 0; |
| 726 |
|
if (!IsUserChar(p[1])) |
| 727 |
< |
return (0); |
| 727 |
> |
return 0; |
| 728 |
|
} |
| 729 |
|
else if (!IsUserChar(*p)) |
| 730 |
< |
return (0); |
| 730 |
> |
return 0; |
| 731 |
|
} |
| 732 |
|
|
| 733 |
< |
return (1); |
| 733 |
> |
return 1; |
| 734 |
|
} |
| 735 |
|
|
| 736 |
|
/* report_and_set_user_flags() |
| 829 |
|
return; |
| 830 |
|
} |
| 831 |
|
|
| 832 |
< |
source_p->flags |= FLAGS_GOTUSER; |
| 832 |
> |
source_p->localClient->registration &= ~REG_NEED_USER; |
| 833 |
|
|
| 834 |
|
/* |
| 835 |
|
* don't take the clients word for it, ever |
| 846 |
|
strlcpy(source_p->username, username, sizeof(source_p->username)); |
| 847 |
|
} |
| 848 |
|
|
| 849 |
< |
if (source_p->name[0]) |
| 854 |
< |
{ |
| 849 |
> |
if (!source_p->localClient->registration) |
| 850 |
|
/* NICK already received, now I have USER... */ |
| 851 |
|
register_local_user(client_p, source_p, source_p->name, username); |
| 857 |
– |
} |
| 852 |
|
} |
| 853 |
|
|
| 854 |
|
/* change_simple_umode() |
| 859 |
|
static void * |
| 860 |
|
change_simple_umode(va_list args) |
| 861 |
|
{ |
| 862 |
+ |
struct Client *client_p; |
| 863 |
|
struct Client *source_p; |
| 864 |
|
int what; |
| 865 |
|
unsigned int flag; |
| 866 |
|
|
| 867 |
< |
va_arg(args, struct Client *); |
| 867 |
> |
client_p = va_arg(args, struct Client *); |
| 868 |
|
source_p = va_arg(args, struct Client *); |
| 869 |
|
what = va_arg(args, int); |
| 870 |
|
flag = va_arg(args, unsigned int); |
| 892 |
|
char **p, *m, buf[IRCD_BUFSIZE]; |
| 893 |
|
struct Client *target_p; |
| 894 |
|
int what = MODE_ADD, badflag = 0, i; |
| 895 |
< |
#if 0 |
| 896 |
< |
/* already covered by m_mode */ |
| 897 |
< |
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 |
| 895 |
> |
|
| 896 |
> |
assert(!(parc < 2)); |
| 897 |
> |
|
| 898 |
|
if ((target_p = find_person(client_p, parv[1])) == NULL) |
| 899 |
|
{ |
| 900 |
|
if (MyConnect(source_p)) |
| 903 |
|
return; |
| 904 |
|
} |
| 905 |
|
|
| 917 |
– |
/* Dont know why these were commented out.. |
| 918 |
– |
* put them back using new sendto() funcs |
| 919 |
– |
*/ |
| 906 |
|
if (IsServer(source_p)) |
| 907 |
|
{ |
| 908 |
|
sendto_realops_flags(UMODE_ALL, L_ADMIN, "*** Mode for User %s from %s", |
| 1003 |
|
badflag = 1; |
| 1004 |
|
} |
| 1005 |
|
else |
| 1006 |
< |
execute_callback(umode_cb, client_p, source_p, what, flag); |
| 1006 |
> |
execute_callback(umode_cb, client_p, source_p, what, flag); |
| 1007 |
|
} |
| 1008 |
|
else |
| 1009 |
|
{ |
| 1040 |
|
if ((setflags & UMODE_INVISIBLE) && !IsInvisible(source_p)) |
| 1041 |
|
--Count.invisi; |
| 1042 |
|
|
| 1043 |
< |
/* compare new flags with old flags and send string which |
| 1043 |
> |
/* |
| 1044 |
> |
* compare new flags with old flags and send string which |
| 1045 |
|
* will cause servers to update correctly. |
| 1046 |
|
*/ |
| 1047 |
|
send_umode_out(client_p, source_p, setflags); |
| 1060 |
|
unsigned int flag; |
| 1061 |
|
char *m = umode_buf; |
| 1062 |
|
|
| 1063 |
< |
/* build a string in umode_buf to represent the change in the user's |
| 1063 |
> |
/* |
| 1064 |
> |
* build a string in umode_buf to represent the change in the user's |
| 1065 |
|
* mode between the new (source_p->umodes) and 'old'. |
| 1066 |
|
*/ |
| 1067 |
|
for (i = 0; i < 128; i++) |
| 1100 |
|
*m = '\0'; |
| 1101 |
|
|
| 1102 |
|
if (*umode_buf && client_p) |
| 1103 |
< |
sendto_one(client_p, ":%s MODE %s :%s", |
| 1104 |
< |
source_p->name, source_p->name, umode_buf); |
| 1103 |
> |
sendto_one(client_p, ":%s!%s@%s MODE %s :%s", |
| 1104 |
> |
source_p->name, source_p->username, |
| 1105 |
> |
source_p->host, source_p->name, umode_buf); |
| 1106 |
|
} |
| 1107 |
|
|
| 1108 |
|
/* send_umode_out() |
| 1115 |
|
send_umode_out(struct Client *client_p, struct Client *source_p, |
| 1116 |
|
unsigned int old) |
| 1117 |
|
{ |
| 1118 |
< |
char buf[IRCD_BUFSIZE]; |
| 1118 |
> |
char buf[IRCD_BUFSIZE] = { '\0' }; |
| 1119 |
|
dlink_node *ptr = NULL; |
| 1120 |
|
|
| 1121 |
|
send_umode(NULL, source_p, old, IsOperHiddenAdmin(source_p) ? |
| 1122 |
|
SEND_UMODES & ~UMODE_ADMIN : SEND_UMODES, buf); |
| 1123 |
|
|
| 1124 |
< |
if (*buf) |
| 1124 |
> |
if (buf[0]) |
| 1125 |
|
{ |
| 1126 |
|
DLINK_FOREACH(ptr, serv_list.head) |
| 1127 |
|
{ |
| 1168 |
|
sendto_one(source_p, form_str(RPL_WELCOME), me.name, source_p->name, |
| 1169 |
|
ServerInfo.network_name, source_p->name); |
| 1170 |
|
sendto_one(source_p, form_str(RPL_YOURHOST), me.name, source_p->name, |
| 1171 |
< |
get_listener_name(source_p->localClient->listener), ircd_version); |
| 1171 |
> |
get_listener_name(source_p->localClient->listener), ircd_version); |
| 1172 |
|
sendto_one(source_p, form_str(RPL_CREATED), |
| 1173 |
< |
me.name, source_p->name, built_date); |
| 1173 |
> |
me.name, source_p->name, built_date); |
| 1174 |
|
sendto_one(source_p, form_str(RPL_MYINFO), |
| 1175 |
|
me.name, source_p->name, me.name, ircd_version, umode_buffer); |
| 1176 |
|
show_isupport(source_p); |
| 1209 |
|
static int |
| 1210 |
|
check_xline(struct Client *source_p) |
| 1211 |
|
{ |
| 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 |
– |
{ |
| 1212 |
|
struct ConfItem *conf = NULL; |
| 1213 |
|
const char *reason = NULL; |
| 1214 |
|
|
| 1215 |
< |
if ((conf = find_matching_name_conf(RXLINE_TYPE, source_p->info, NULL, NULL, 0))) |
| 1215 |
> |
if ((conf = find_matching_name_conf(XLINE_TYPE, source_p->info, NULL, NULL, 0)) || |
| 1216 |
> |
(conf = find_matching_name_conf(RXLINE_TYPE, source_p->info, NULL, NULL, 0))) |
| 1217 |
|
{ |
| 1218 |
|
struct MatchItem *reg = map_to_conf(conf); |
| 1219 |
|
|
| 1225 |
|
reason = "No Reason"; |
| 1226 |
|
|
| 1227 |
|
sendto_realops_flags(UMODE_REJ, L_ALL, |
| 1228 |
< |
"X-line (REGEX) Rejecting [%s] [%s], user %s [%s]", |
| 1228 |
> |
"X-line Rejecting [%s] [%s], user %s [%s]", |
| 1229 |
|
source_p->info, reason, |
| 1230 |
|
get_client_name(source_p, HIDE_IP), |
| 1231 |
|
source_p->sockhost); |
| 1232 |
|
|
| 1233 |
|
ServerStats->is_ref++; |
| 1234 |
< |
exit_client(source_p, &me, "Bad user info"); |
| 1234 |
> |
if (REJECT_HOLD_TIME > 0) |
| 1235 |
> |
{ |
| 1236 |
> |
sendto_one(source_p, ":%s NOTICE %s :Bad user info", |
| 1237 |
> |
me.name, source_p->name); |
| 1238 |
> |
source_p->localClient->reject_delay = CurrentTime + REJECT_HOLD_TIME; |
| 1239 |
> |
SetCaptured(source_p); |
| 1240 |
> |
} |
| 1241 |
> |
else |
| 1242 |
> |
exit_client(source_p, &me, "Bad user info"); |
| 1243 |
|
return 1; |
| 1244 |
|
} |
| 1245 |
|
|
| 1259 |
|
{ |
| 1260 |
|
unsigned int old = source_p->umodes; |
| 1261 |
|
const char *operprivs = ""; |
| 1262 |
< |
struct AccessItem *oconf; |
| 1262 |
> |
const struct AccessItem *oconf = NULL; |
| 1263 |
|
|
| 1264 |
+ |
assert(source_p->localClient->confs.head); |
| 1265 |
+ |
oconf = map_to_conf((source_p->localClient->confs.head)->data); |
| 1266 |
+ |
|
| 1267 |
+ |
++Count.oper; |
| 1268 |
|
SetOper(source_p); |
| 1269 |
|
|
| 1270 |
< |
if (ConfigFileEntry.oper_umodes) |
| 1270 |
> |
if (oconf->modes) |
| 1271 |
> |
source_p->umodes |= oconf->modes; |
| 1272 |
> |
else if (ConfigFileEntry.oper_umodes) |
| 1273 |
|
source_p->umodes |= ConfigFileEntry.oper_umodes; |
| 1274 |
|
else |
| 1275 |
|
source_p->umodes |= (UMODE_SERVNOTICE|UMODE_OPERWALL| |
| 1276 |
< |
UMODE_WALLOP|UMODE_LOCOPS); |
| 1313 |
< |
|
| 1314 |
< |
Count.oper++; |
| 1276 |
> |
UMODE_WALLOP|UMODE_LOCOPS); |
| 1277 |
|
|
| 1278 |
|
assert(dlinkFind(&oper_list, source_p) == NULL); |
| 1279 |
|
dlinkAdd(source_p, make_dlink_node(), &oper_list); |
| 1280 |
|
|
| 1319 |
– |
assert(source_p->localClient->confs.head); |
| 1320 |
– |
oconf = map_to_conf((source_p->localClient->confs.head)->data); |
| 1281 |
|
operprivs = oper_privs_as_string(oconf->port); |
| 1282 |
|
|
| 1283 |
|
SetOFlag(source_p, oconf->port); |
| 1296 |
|
send_message_file(source_p, &ConfigFileEntry.opermotd); |
| 1297 |
|
} |
| 1298 |
|
|
| 1299 |
< |
/* |
| 1300 |
< |
* Quick and dirty UID code for new proposed SID on EFnet |
| 1301 |
< |
* |
| 1302 |
< |
*/ |
| 1299 |
> |
static char new_uid[TOTALSIDUID + 1]; /* allow for \0 */ |
| 1300 |
> |
|
| 1301 |
> |
int |
| 1302 |
> |
valid_sid(const char *sid) |
| 1303 |
> |
{ |
| 1304 |
|
|
| 1305 |
< |
static char new_uid[TOTALSIDUID+1]; /* allow for \0 */ |
| 1306 |
< |
static void add_one_to_uid(int i); |
| 1305 |
> |
if (strlen(sid) == IRC_MAXSID) |
| 1306 |
> |
if (IsDigit(*sid)) |
| 1307 |
> |
if (IsAlNum(*(sid + 1)) && IsAlNum(*(sid + 2))) |
| 1308 |
> |
return 1; |
| 1309 |
> |
|
| 1310 |
> |
return 0; |
| 1311 |
> |
} |
| 1312 |
|
|
| 1313 |
|
/* |
| 1314 |
|
* init_uid() |
| 1328 |
|
|
| 1329 |
|
if (ServerInfo.sid != NULL) |
| 1330 |
|
{ |
| 1331 |
< |
memcpy(new_uid, ServerInfo.sid, IRCD_MIN(strlen(ServerInfo.sid), |
| 1332 |
< |
IRC_MAXSID)); |
| 1333 |
< |
memcpy(&me.id, ServerInfo.sid, IRCD_MIN(strlen(ServerInfo.sid), |
| 1368 |
< |
IRC_MAXSID)); |
| 1331 |
> |
strlcpy(new_uid, ServerInfo.sid, sizeof(new_uid)); |
| 1332 |
> |
strlcpy(me.id, ServerInfo.sid, sizeof(me.id)); |
| 1333 |
> |
|
| 1334 |
|
hash_add_id(&me); |
| 1335 |
|
} |
| 1336 |
|
|
| 1338 |
|
if (new_uid[i] == '\0') |
| 1339 |
|
new_uid[i] = 'A'; |
| 1340 |
|
|
| 1341 |
< |
/* XXX if IRC_MAXUID != 6, this will have to be rewritten */ |
| 1341 |
> |
/* NOTE: if IRC_MAXUID != 6, this will have to be rewritten */ |
| 1342 |
|
/* Yes nenolod, I have known it was off by one ever since I wrote it |
| 1343 |
|
* But *JUST* for you, though, it really doesn't look as *pretty* |
| 1344 |
|
* -Dianora |
| 1345 |
|
*/ |
| 1346 |
< |
memcpy(new_uid+IRC_MAXSID, "AAAAA@", IRC_MAXUID); |
| 1346 |
> |
memcpy(new_uid + IRC_MAXSID, "AAAAA@", IRC_MAXUID); |
| 1347 |
|
|
| 1348 |
|
entering_umode_cb = register_callback("entering_umode", NULL); |
| 1349 |
|
umode_cb = register_callback("changing_umode", change_simple_umode); |
| 1351 |
|
} |
| 1352 |
|
|
| 1353 |
|
/* |
| 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); |
| 1400 |
– |
} |
| 1401 |
– |
|
| 1402 |
– |
/* |
| 1354 |
|
* add_one_to_uid |
| 1355 |
|
* |
| 1356 |
|
* inputs - index number into new_uid |
| 1361 |
|
static void |
| 1362 |
|
add_one_to_uid(int i) |
| 1363 |
|
{ |
| 1364 |
< |
if (i != IRC_MAXSID) /* Not reached server SID portion yet? */ |
| 1364 |
> |
if (i != IRC_MAXSID) /* Not reached server SID portion yet? */ |
| 1365 |
|
{ |
| 1366 |
|
if (new_uid[i] == 'Z') |
| 1367 |
|
new_uid[i] = '0'; |
| 1370 |
|
new_uid[i] = 'A'; |
| 1371 |
|
add_one_to_uid(i-1); |
| 1372 |
|
} |
| 1373 |
< |
else new_uid[i] = new_uid[i] + 1; |
| 1373 |
> |
else |
| 1374 |
> |
++new_uid[i]; |
| 1375 |
|
} |
| 1376 |
|
else |
| 1377 |
|
{ |
| 1378 |
< |
/* XXX if IRC_MAXUID != 6, this will have to be rewritten */ |
| 1378 |
> |
/* NOTE: if IRC_MAXUID != 6, this will have to be rewritten */ |
| 1379 |
|
if (new_uid[i] == 'Z') |
| 1380 |
< |
memcpy(new_uid+IRC_MAXSID, "AAAAAA", IRC_MAXUID); |
| 1380 |
> |
memcpy(new_uid + IRC_MAXSID, "AAAAAA", IRC_MAXUID); |
| 1381 |
|
else |
| 1382 |
< |
new_uid[i] = new_uid[i] + 1; |
| 1382 |
> |
++new_uid[i]; |
| 1383 |
|
} |
| 1384 |
|
} |
| 1385 |
|
|
| 1386 |
|
/* |
| 1387 |
+ |
* uid_get |
| 1388 |
+ |
* |
| 1389 |
+ |
* inputs - struct Client * |
| 1390 |
+ |
* output - new UID is returned to caller |
| 1391 |
+ |
* side effects - new_uid is incremented by one. |
| 1392 |
+ |
*/ |
| 1393 |
+ |
static void * |
| 1394 |
+ |
uid_get(va_list args) |
| 1395 |
+ |
{ |
| 1396 |
+ |
add_one_to_uid(TOTALSIDUID - 1); /* index from 0 */ |
| 1397 |
+ |
return new_uid; |
| 1398 |
+ |
} |
| 1399 |
+ |
|
| 1400 |
+ |
/* |
| 1401 |
|
* init_isupport() |
| 1402 |
|
* |
| 1403 |
|
* input - NONE |
| 1539 |
|
if (++tokens == (MAXPARA-2) || len >= (sizeof(isupportbuffer)-reserve)) |
| 1540 |
|
{ /* arbritrary for now */ |
| 1541 |
|
if (*--p == ' ') |
| 1542 |
< |
*p = '\0'; |
| 1542 |
> |
*p = '\0'; |
| 1543 |
|
|
| 1544 |
|
addto_MessageLine(isupportFile, isupportbuffer); |
| 1545 |
|
p = isupportbuffer; |