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 |
|
|
95 |
|
0, /* @ */ |
96 |
|
0, /* A */ |
97 |
|
0, /* B */ |
98 |
< |
0, /* C */ |
98 |
> |
UMODE_CCONN_FULL, /* C */ |
99 |
|
UMODE_DEAF, /* D */ |
100 |
|
0, /* E */ |
101 |
|
0, /* F */ |
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 |
|
|
445 |
|
"255.255.255.255" : ipaddr, get_client_class(source_p), |
446 |
|
source_p->info); |
447 |
|
|
448 |
+ |
sendto_realops_flags(UMODE_CCONN_FULL, L_ALL, |
449 |
+ |
"CLICONN %s %s %s %s %s %s %s 0 %s", |
450 |
+ |
nick, source_p->username, source_p->host, |
451 |
+ |
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
452 |
+ |
"255.255.255.255" : ipaddr, |
453 |
+ |
get_client_class(source_p), |
454 |
+ |
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
455 |
+ |
"<hidden>" : source_p->client_host, |
456 |
+ |
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
457 |
+ |
"<hidden>" : source_p->client_server, |
458 |
+ |
source_p->info); |
459 |
+ |
|
460 |
+ |
|
461 |
|
/* If they have died in send_* don't do anything. */ |
462 |
|
if (IsDead(source_p)) |
463 |
|
return; |
464 |
|
|
465 |
|
if (ConfigFileEntry.invisible_on_connect) |
466 |
+ |
{ |
467 |
|
source_p->umodes |= UMODE_INVISIBLE; |
468 |
< |
Count.invisi++; |
468 |
> |
Count.invisi++; |
469 |
> |
} |
470 |
|
|
471 |
|
if ((++Count.local) > Count.max_loc) |
472 |
|
{ |
517 |
|
*/ |
518 |
|
void |
519 |
|
register_remote_user(struct Client *client_p, struct Client *source_p, |
520 |
< |
const char *username, const char *host, const char *server, |
521 |
< |
const char *realname) |
520 |
> |
const char *username, const char *host, const char *server, |
521 |
> |
const char *realname) |
522 |
|
{ |
523 |
< |
struct Client *target_p; |
523 |
> |
struct Client *target_p = NULL; |
524 |
|
|
525 |
|
assert(source_p != NULL); |
526 |
|
assert(source_p->username != username); |
529 |
|
strlcpy(source_p->info, realname, sizeof(source_p->info)); |
530 |
|
strlcpy(source_p->username, username, sizeof(source_p->username)); |
531 |
|
|
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 |
– |
|
532 |
|
/* |
533 |
|
* coming from another server, take the servers word for it |
534 |
|
*/ |
546 |
|
source_p->host, source_p->from->name); |
547 |
|
kill_client(client_p, source_p, "%s (Server doesn't exist)", me.name); |
548 |
|
|
540 |
– |
/* XXX */ |
549 |
|
SetKilled(source_p); |
550 |
|
exit_client(source_p, &me, "Ghosted Client"); |
551 |
|
return; |
566 |
|
return; |
567 |
|
} |
568 |
|
|
569 |
+ |
/* Increment our total user count here */ |
570 |
+ |
if (++Count.total > Count.max_tot) |
571 |
+ |
Count.max_tot = Count.total; |
572 |
+ |
|
573 |
+ |
++source_p->from->serv->dep_users; |
574 |
+ |
|
575 |
|
SetClient(source_p); |
576 |
|
dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->users); |
577 |
|
add_user_host(source_p->username, source_p->host, 1); |
592 |
|
static void |
593 |
|
introduce_client(struct Client *client_p, struct Client *source_p) |
594 |
|
{ |
595 |
< |
dlink_node *server_node; |
595 |
> |
dlink_node *server_node = NULL; |
596 |
|
static char ubuf[12]; |
597 |
|
|
598 |
|
if (MyClient(source_p)) |
621 |
|
* -davidt |
622 |
|
* rewritten to cope with SIDs .. eww eww eww --is |
623 |
|
*/ |
610 |
– |
|
611 |
– |
/* XXX THESE NEED A PREFIX!?!?!? */ |
624 |
|
if (!ServerInfo.hub && uplink && IsCapable(uplink, CAP_LL) && |
625 |
|
client_p != uplink) |
626 |
|
{ |
629 |
|
sendto_one(uplink, ":%s UID %s %d %lu %s %s %s %s %s :%s", |
630 |
|
source_p->servptr->id, |
631 |
|
source_p->name, source_p->hopcount+1, |
632 |
< |
(unsigned long)source_p->tsinfo, |
632 |
> |
(unsigned long)source_p->tsinfo, |
633 |
|
ubuf, source_p->username, source_p->host, |
634 |
< |
((MyClient(source_p) && !IsIPSpoof(source_p)) ? |
635 |
< |
source_p->sockhost : "0"), |
624 |
< |
source_p->id, source_p->info); |
634 |
> |
(MyClient(source_p) && IsIPSpoof(source_p)) ? |
635 |
> |
"0" : source_p->sockhost, source_p->id, source_p->info); |
636 |
|
} |
637 |
|
else |
638 |
|
{ |
639 |
|
sendto_one(uplink, "NICK %s %d %lu %s %s %s %s :%s", |
640 |
|
source_p->name, source_p->hopcount+1, |
641 |
< |
(unsigned long)source_p->tsinfo, |
641 |
> |
(unsigned long)source_p->tsinfo, |
642 |
|
ubuf, source_p->username, source_p->host, |
643 |
< |
source_p->servptr->name, |
633 |
< |
source_p->info); |
643 |
> |
source_p->servptr->name, source_p->info); |
644 |
|
} |
645 |
|
} |
646 |
|
else |
656 |
|
sendto_one(server, ":%s UID %s %d %lu %s %s %s %s %s :%s", |
657 |
|
source_p->servptr->id, |
658 |
|
source_p->name, source_p->hopcount+1, |
659 |
< |
(unsigned long)source_p->tsinfo, |
659 |
> |
(unsigned long)source_p->tsinfo, |
660 |
|
ubuf, source_p->username, source_p->host, |
661 |
< |
((MyClient(source_p)&&!IsIPSpoof(source_p))?source_p->sockhost:"0"), |
662 |
< |
source_p->id, source_p->info); |
661 |
> |
(MyClient(source_p) && IsIPSpoof(source_p)) ? |
662 |
> |
"0" : source_p->sockhost, source_p->id, source_p->info); |
663 |
|
else |
664 |
|
sendto_one(server, "NICK %s %d %lu %s %s %s %s :%s", |
665 |
|
source_p->name, source_p->hopcount+1, |
666 |
< |
(unsigned long)source_p->tsinfo, |
666 |
> |
(unsigned long)source_p->tsinfo, |
667 |
|
ubuf, source_p->username, source_p->host, |
668 |
< |
source_p->servptr->name, |
659 |
< |
source_p->info); |
668 |
> |
source_p->servptr->name, source_p->info); |
669 |
|
} |
670 |
|
} |
671 |
|
} |
686 |
|
|
687 |
|
assert(p != NULL); |
688 |
|
|
689 |
< |
if (('.' == *p) || (':' == *p)) |
690 |
< |
return (0); |
689 |
> |
if ('.' == *p || ':' == *p) |
690 |
> |
return 0; |
691 |
|
|
692 |
|
while (*p) |
693 |
|
{ |
694 |
|
if (!IsHostChar(*p)) |
695 |
< |
return (0); |
695 |
> |
return 0; |
696 |
|
p++; |
697 |
|
} |
698 |
|
|
699 |
< |
return (1); |
699 |
> |
return 1; |
700 |
|
} |
701 |
|
|
702 |
|
/* valid_username() |
726 |
|
* or "-hi-@somehost", "h-----@somehost" would still be accepted. |
727 |
|
*/ |
728 |
|
if (!IsAlNum(*p)) |
729 |
< |
return (0); |
729 |
> |
return 0; |
730 |
|
|
731 |
|
while (*++p) |
732 |
|
{ |
735 |
|
dots++; |
736 |
|
|
737 |
|
if (dots > ConfigFileEntry.dots_in_ident) |
738 |
< |
return (0); |
738 |
> |
return 0; |
739 |
|
if (!IsUserChar(p[1])) |
740 |
< |
return (0); |
740 |
> |
return 0; |
741 |
|
} |
742 |
|
else if (!IsUserChar(*p)) |
743 |
< |
return (0); |
743 |
> |
return 0; |
744 |
|
} |
745 |
|
|
746 |
< |
return (1); |
746 |
> |
return 1; |
747 |
|
} |
748 |
|
|
749 |
|
/* report_and_set_user_flags() |
842 |
|
return; |
843 |
|
} |
844 |
|
|
845 |
< |
source_p->flags |= FLAGS_GOTUSER; |
845 |
> |
source_p->localClient->registration &= ~REG_NEED_USER; |
846 |
|
|
847 |
|
/* |
848 |
|
* don't take the clients word for it, ever |
851 |
|
|
852 |
|
strlcpy(source_p->info, realname, sizeof(source_p->info)); |
853 |
|
|
854 |
+ |
/* stash for later */ |
855 |
+ |
strlcpy(source_p->client_host, host, sizeof(source_p->client_host)); |
856 |
+ |
strlcpy(source_p->client_server, server, sizeof(source_p->client_server)); |
857 |
+ |
|
858 |
|
if (!IsGotId(source_p)) |
859 |
|
{ |
860 |
|
/* save the username in the client |
863 |
|
strlcpy(source_p->username, username, sizeof(source_p->username)); |
864 |
|
} |
865 |
|
|
866 |
< |
if (source_p->name[0]) |
854 |
< |
{ |
866 |
> |
if (!source_p->localClient->registration) |
867 |
|
/* NICK already received, now I have USER... */ |
868 |
|
register_local_user(client_p, source_p, source_p->name, username); |
857 |
– |
} |
869 |
|
} |
870 |
|
|
871 |
|
/* change_simple_umode() |
876 |
|
static void * |
877 |
|
change_simple_umode(va_list args) |
878 |
|
{ |
879 |
+ |
struct Client *client_p; |
880 |
|
struct Client *source_p; |
881 |
|
int what; |
882 |
|
unsigned int flag; |
883 |
|
|
884 |
< |
va_arg(args, struct Client *); |
884 |
> |
client_p = va_arg(args, struct Client *); |
885 |
|
source_p = va_arg(args, struct Client *); |
886 |
|
what = va_arg(args, int); |
887 |
|
flag = va_arg(args, unsigned int); |
909 |
|
char **p, *m, buf[IRCD_BUFSIZE]; |
910 |
|
struct Client *target_p; |
911 |
|
int what = MODE_ADD, badflag = 0, i; |
912 |
< |
#if 0 |
913 |
< |
/* already covered by m_mode */ |
914 |
< |
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 |
912 |
> |
|
913 |
> |
assert(!(parc < 2)); |
914 |
> |
|
915 |
|
if ((target_p = find_person(client_p, parv[1])) == NULL) |
916 |
|
{ |
917 |
|
if (MyConnect(source_p)) |
920 |
|
return; |
921 |
|
} |
922 |
|
|
917 |
– |
/* Dont know why these were commented out.. |
918 |
– |
* put them back using new sendto() funcs |
919 |
– |
*/ |
923 |
|
if (IsServer(source_p)) |
924 |
|
{ |
925 |
|
sendto_realops_flags(UMODE_ALL, L_ADMIN, "*** Mode for User %s from %s", |
1020 |
|
badflag = 1; |
1021 |
|
} |
1022 |
|
else |
1023 |
< |
execute_callback(umode_cb, client_p, source_p, what, flag); |
1023 |
> |
execute_callback(umode_cb, client_p, source_p, what, flag); |
1024 |
|
} |
1025 |
|
else |
1026 |
|
{ |
1057 |
|
if ((setflags & UMODE_INVISIBLE) && !IsInvisible(source_p)) |
1058 |
|
--Count.invisi; |
1059 |
|
|
1060 |
< |
/* compare new flags with old flags and send string which |
1060 |
> |
/* |
1061 |
> |
* compare new flags with old flags and send string which |
1062 |
|
* will cause servers to update correctly. |
1063 |
|
*/ |
1064 |
|
send_umode_out(client_p, source_p, setflags); |
1067 |
|
/* send_umode() |
1068 |
|
* send the MODE string for user (user) to connection client_p |
1069 |
|
* -avalon |
1070 |
+ |
* |
1071 |
+ |
* inputs - client_p |
1072 |
+ |
* - source_p |
1073 |
+ |
* - int old |
1074 |
+ |
* - sendmask mask of modes to send |
1075 |
+ |
* - suplied umode_buf |
1076 |
+ |
* output - NONE |
1077 |
|
*/ |
1078 |
|
void |
1079 |
|
send_umode(struct Client *client_p, struct Client *source_p, |
1084 |
|
unsigned int flag; |
1085 |
|
char *m = umode_buf; |
1086 |
|
|
1087 |
< |
/* build a string in umode_buf to represent the change in the user's |
1087 |
> |
/* |
1088 |
> |
* build a string in umode_buf to represent the change in the user's |
1089 |
|
* mode between the new (source_p->umodes) and 'old'. |
1090 |
|
*/ |
1091 |
|
for (i = 0; i < 128; i++) |
1124 |
|
*m = '\0'; |
1125 |
|
|
1126 |
|
if (*umode_buf && client_p) |
1127 |
< |
sendto_one(client_p, ":%s MODE %s :%s", |
1128 |
< |
source_p->name, source_p->name, umode_buf); |
1127 |
> |
sendto_one(client_p, ":%s!%s@%s MODE %s :%s", |
1128 |
> |
source_p->name, source_p->username, |
1129 |
> |
source_p->host, source_p->name, umode_buf); |
1130 |
|
} |
1131 |
|
|
1132 |
|
/* send_umode_out() |
1139 |
|
send_umode_out(struct Client *client_p, struct Client *source_p, |
1140 |
|
unsigned int old) |
1141 |
|
{ |
1142 |
< |
char buf[IRCD_BUFSIZE]; |
1142 |
> |
char buf[IRCD_BUFSIZE] = { '\0' }; |
1143 |
|
dlink_node *ptr = NULL; |
1144 |
|
|
1145 |
|
send_umode(NULL, source_p, old, IsOperHiddenAdmin(source_p) ? |
1146 |
|
SEND_UMODES & ~UMODE_ADMIN : SEND_UMODES, buf); |
1147 |
|
|
1148 |
< |
if (*buf) |
1148 |
> |
if (buf[0]) |
1149 |
|
{ |
1150 |
|
DLINK_FOREACH(ptr, serv_list.head) |
1151 |
|
{ |
1192 |
|
sendto_one(source_p, form_str(RPL_WELCOME), me.name, source_p->name, |
1193 |
|
ServerInfo.network_name, source_p->name); |
1194 |
|
sendto_one(source_p, form_str(RPL_YOURHOST), me.name, source_p->name, |
1195 |
< |
get_listener_name(source_p->localClient->listener), ircd_version); |
1195 |
> |
get_listener_name(source_p->localClient->listener), ircd_version); |
1196 |
|
sendto_one(source_p, form_str(RPL_CREATED), |
1197 |
< |
me.name, source_p->name, built_date); |
1197 |
> |
me.name, source_p->name, built_date); |
1198 |
|
sendto_one(source_p, form_str(RPL_MYINFO), |
1199 |
|
me.name, source_p->name, me.name, ircd_version, umode_buffer); |
1200 |
|
show_isupport(source_p); |
1233 |
|
static int |
1234 |
|
check_xline(struct Client *source_p) |
1235 |
|
{ |
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 |
– |
{ |
1236 |
|
struct ConfItem *conf = NULL; |
1237 |
|
const char *reason = NULL; |
1238 |
|
|
1239 |
< |
if ((conf = find_matching_name_conf(RXLINE_TYPE, source_p->info, NULL, NULL, 0))) |
1239 |
> |
if ((conf = find_matching_name_conf(XLINE_TYPE, source_p->info, NULL, NULL, 0)) || |
1240 |
> |
(conf = find_matching_name_conf(RXLINE_TYPE, source_p->info, NULL, NULL, 0))) |
1241 |
|
{ |
1242 |
|
struct MatchItem *reg = map_to_conf(conf); |
1243 |
|
|
1249 |
|
reason = "No Reason"; |
1250 |
|
|
1251 |
|
sendto_realops_flags(UMODE_REJ, L_ALL, |
1252 |
< |
"X-line (REGEX) Rejecting [%s] [%s], user %s [%s]", |
1252 |
> |
"X-line Rejecting [%s] [%s], user %s [%s]", |
1253 |
|
source_p->info, reason, |
1254 |
|
get_client_name(source_p, HIDE_IP), |
1255 |
|
source_p->sockhost); |
1256 |
|
|
1257 |
|
ServerStats->is_ref++; |
1258 |
< |
exit_client(source_p, &me, "Bad user info"); |
1258 |
> |
if (REJECT_HOLD_TIME > 0) |
1259 |
> |
{ |
1260 |
> |
sendto_one(source_p, ":%s NOTICE %s :Bad user info", |
1261 |
> |
me.name, source_p->name); |
1262 |
> |
source_p->localClient->reject_delay = CurrentTime + REJECT_HOLD_TIME; |
1263 |
> |
SetCaptured(source_p); |
1264 |
> |
} |
1265 |
> |
else |
1266 |
> |
exit_client(source_p, &me, "Bad user info"); |
1267 |
|
return 1; |
1268 |
|
} |
1269 |
|
|
1283 |
|
{ |
1284 |
|
unsigned int old = source_p->umodes; |
1285 |
|
const char *operprivs = ""; |
1286 |
< |
struct AccessItem *oconf; |
1286 |
> |
const struct AccessItem *oconf = NULL; |
1287 |
> |
|
1288 |
> |
assert(source_p->localClient->confs.head); |
1289 |
> |
oconf = map_to_conf((source_p->localClient->confs.head)->data); |
1290 |
|
|
1291 |
+ |
++Count.oper; |
1292 |
|
SetOper(source_p); |
1293 |
|
|
1294 |
< |
if (ConfigFileEntry.oper_umodes) |
1294 |
> |
if (oconf->modes) |
1295 |
> |
source_p->umodes |= oconf->modes; |
1296 |
> |
else if (ConfigFileEntry.oper_umodes) |
1297 |
|
source_p->umodes |= ConfigFileEntry.oper_umodes; |
1298 |
|
else |
1299 |
|
source_p->umodes |= (UMODE_SERVNOTICE|UMODE_OPERWALL| |
1300 |
< |
UMODE_WALLOP|UMODE_LOCOPS); |
1313 |
< |
|
1314 |
< |
Count.oper++; |
1300 |
> |
UMODE_WALLOP|UMODE_LOCOPS); |
1301 |
|
|
1302 |
|
assert(dlinkFind(&oper_list, source_p) == NULL); |
1303 |
|
dlinkAdd(source_p, make_dlink_node(), &oper_list); |
1304 |
|
|
1319 |
– |
assert(source_p->localClient->confs.head); |
1320 |
– |
oconf = map_to_conf((source_p->localClient->confs.head)->data); |
1305 |
|
operprivs = oper_privs_as_string(oconf->port); |
1306 |
|
|
1307 |
|
SetOFlag(source_p, oconf->port); |
1320 |
|
send_message_file(source_p, &ConfigFileEntry.opermotd); |
1321 |
|
} |
1322 |
|
|
1323 |
< |
/* |
1340 |
< |
* Quick and dirty UID code for new proposed SID on EFnet |
1341 |
< |
* |
1342 |
< |
*/ |
1323 |
> |
static char new_uid[TOTALSIDUID + 1]; /* allow for \0 */ |
1324 |
|
|
1325 |
< |
static char new_uid[TOTALSIDUID+1]; /* allow for \0 */ |
1326 |
< |
static void add_one_to_uid(int i); |
1325 |
> |
int |
1326 |
> |
valid_sid(const char *sid) |
1327 |
> |
{ |
1328 |
> |
|
1329 |
> |
if (strlen(sid) == IRC_MAXSID) |
1330 |
> |
if (IsDigit(*sid)) |
1331 |
> |
if (IsAlNum(*(sid + 1)) && IsAlNum(*(sid + 2))) |
1332 |
> |
return 1; |
1333 |
> |
|
1334 |
> |
return 0; |
1335 |
> |
} |
1336 |
|
|
1337 |
|
/* |
1338 |
|
* init_uid() |
1352 |
|
|
1353 |
|
if (ServerInfo.sid != NULL) |
1354 |
|
{ |
1355 |
< |
memcpy(new_uid, ServerInfo.sid, IRCD_MIN(strlen(ServerInfo.sid), |
1356 |
< |
IRC_MAXSID)); |
1357 |
< |
memcpy(&me.id, ServerInfo.sid, IRCD_MIN(strlen(ServerInfo.sid), |
1368 |
< |
IRC_MAXSID)); |
1355 |
> |
strlcpy(new_uid, ServerInfo.sid, sizeof(new_uid)); |
1356 |
> |
strlcpy(me.id, ServerInfo.sid, sizeof(me.id)); |
1357 |
> |
|
1358 |
|
hash_add_id(&me); |
1359 |
|
} |
1360 |
|
|
1362 |
|
if (new_uid[i] == '\0') |
1363 |
|
new_uid[i] = 'A'; |
1364 |
|
|
1365 |
< |
/* XXX if IRC_MAXUID != 6, this will have to be rewritten */ |
1365 |
> |
/* NOTE: if IRC_MAXUID != 6, this will have to be rewritten */ |
1366 |
|
/* Yes nenolod, I have known it was off by one ever since I wrote it |
1367 |
|
* But *JUST* for you, though, it really doesn't look as *pretty* |
1368 |
|
* -Dianora |
1369 |
|
*/ |
1370 |
< |
memcpy(new_uid+IRC_MAXSID, "AAAAA@", IRC_MAXUID); |
1370 |
> |
memcpy(new_uid + IRC_MAXSID, "AAAAA@", IRC_MAXUID); |
1371 |
|
|
1372 |
|
entering_umode_cb = register_callback("entering_umode", NULL); |
1373 |
|
umode_cb = register_callback("changing_umode", change_simple_umode); |
1375 |
|
} |
1376 |
|
|
1377 |
|
/* |
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 |
– |
/* |
1378 |
|
* add_one_to_uid |
1379 |
|
* |
1380 |
|
* inputs - index number into new_uid |
1385 |
|
static void |
1386 |
|
add_one_to_uid(int i) |
1387 |
|
{ |
1388 |
< |
if (i != IRC_MAXSID) /* Not reached server SID portion yet? */ |
1388 |
> |
if (i != IRC_MAXSID) /* Not reached server SID portion yet? */ |
1389 |
|
{ |
1390 |
|
if (new_uid[i] == 'Z') |
1391 |
|
new_uid[i] = '0'; |
1394 |
|
new_uid[i] = 'A'; |
1395 |
|
add_one_to_uid(i-1); |
1396 |
|
} |
1397 |
< |
else new_uid[i] = new_uid[i] + 1; |
1397 |
> |
else |
1398 |
> |
++new_uid[i]; |
1399 |
|
} |
1400 |
|
else |
1401 |
|
{ |
1402 |
< |
/* XXX if IRC_MAXUID != 6, this will have to be rewritten */ |
1402 |
> |
/* NOTE: if IRC_MAXUID != 6, this will have to be rewritten */ |
1403 |
|
if (new_uid[i] == 'Z') |
1404 |
< |
memcpy(new_uid+IRC_MAXSID, "AAAAAA", IRC_MAXUID); |
1404 |
> |
memcpy(new_uid + IRC_MAXSID, "AAAAAA", IRC_MAXUID); |
1405 |
|
else |
1406 |
< |
new_uid[i] = new_uid[i] + 1; |
1406 |
> |
++new_uid[i]; |
1407 |
|
} |
1408 |
|
} |
1409 |
|
|
1410 |
|
/* |
1411 |
+ |
* uid_get |
1412 |
+ |
* |
1413 |
+ |
* inputs - struct Client * |
1414 |
+ |
* output - new UID is returned to caller |
1415 |
+ |
* side effects - new_uid is incremented by one. |
1416 |
+ |
*/ |
1417 |
+ |
static void * |
1418 |
+ |
uid_get(va_list args) |
1419 |
+ |
{ |
1420 |
+ |
add_one_to_uid(TOTALSIDUID - 1); /* index from 0 */ |
1421 |
+ |
return new_uid; |
1422 |
+ |
} |
1423 |
+ |
|
1424 |
+ |
/* |
1425 |
|
* init_isupport() |
1426 |
|
* |
1427 |
|
* input - NONE |
1435 |
|
|
1436 |
|
add_isupport("CALLERID", NULL, -1); |
1437 |
|
add_isupport("CASEMAPPING", CASEMAP, -1); |
1438 |
+ |
add_isupport("DEAF", "D", -1); |
1439 |
|
add_isupport("KICKLEN", NULL, KICKLEN); |
1440 |
|
add_isupport("MODES", NULL, MAXMODEPARAMS); |
1441 |
|
add_isupport("NICKLEN", NULL, NICKLEN-1); |
1564 |
|
if (++tokens == (MAXPARA-2) || len >= (sizeof(isupportbuffer)-reserve)) |
1565 |
|
{ /* arbritrary for now */ |
1566 |
|
if (*--p == ' ') |
1567 |
< |
*p = '\0'; |
1567 |
> |
*p = '\0'; |
1568 |
|
|
1569 |
|
addto_MessageLine(isupportFile, isupportbuffer); |
1570 |
|
p = isupportbuffer; |