281 |
|
void |
282 |
|
register_local_user(struct Client *source_p) |
283 |
|
{ |
284 |
+ |
const char *id = NULL; |
285 |
|
const struct AccessItem *aconf = NULL; |
286 |
|
dlink_node *ptr = NULL; |
286 |
– |
dlink_node *m = NULL; |
287 |
|
|
288 |
|
assert(source_p != NULL); |
289 |
|
assert(source_p == source_p->from); |
408 |
|
sendto_realops_flags(UMODE_REJ, L_ALL, "Invalid username: %s (%s@%s)", |
409 |
|
source_p->name, source_p->username, source_p->host); |
410 |
|
++ServerStats.is_ref; |
411 |
< |
ircsprintf(tmpstr2, "Invalid username [%s]", source_p->username); |
411 |
> |
snprintf(tmpstr2, sizeof(tmpstr2), "Invalid username [%s]", |
412 |
> |
source_p->username); |
413 |
|
exit_client(source_p, &me, tmpstr2); |
414 |
|
return; |
415 |
|
} |
417 |
|
if (check_xline(source_p)) |
418 |
|
return; |
419 |
|
|
420 |
< |
if (me.id[0]) |
421 |
< |
{ |
421 |
< |
const char *id = NULL; |
422 |
< |
|
423 |
< |
while (hash_find_id((id = uid_get())) != NULL) |
424 |
< |
; |
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); |
428 |
< |
} |
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]", |
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->client_host, |
441 |
> |
"<hidden>" : source_p->localClient->client_host, |
442 |
|
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
443 |
< |
"<hidden>" : source_p->client_server, |
443 |
> |
"<hidden>" : source_p->localClient->client_server, |
444 |
|
source_p->info); |
445 |
|
|
446 |
|
|
470 |
|
|
471 |
|
source_p->localClient->allow_read = MAX_FLOOD_BURST; |
472 |
|
|
473 |
< |
assert(dlinkFindDelete(&unknown_list, source_p)); |
473 |
> |
assert(dlinkFind(&unknown_list, source_p)); |
474 |
|
|
475 |
< |
if ((m = dlinkFindDelete(&unknown_list, source_p)) != NULL) |
476 |
< |
{ |
481 |
< |
free_dlink_node(m); |
482 |
< |
dlinkAdd(source_p, &source_p->localClient->lclient_node, &local_client_list); |
483 |
< |
} |
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); |
749 |
|
} |
750 |
|
} |
751 |
|
|
759 |
– |
/* do_local_user() |
760 |
– |
* |
761 |
– |
* inputs - |
762 |
– |
* output - NONE |
763 |
– |
* side effects - |
764 |
– |
*/ |
765 |
– |
void |
766 |
– |
do_local_user(struct Client *source_p, |
767 |
– |
const char *username, const char *host, const char *server, |
768 |
– |
const char *realname) |
769 |
– |
{ |
770 |
– |
assert(source_p != NULL); |
771 |
– |
assert(source_p->username != username); |
772 |
– |
assert(IsUnknown(source_p)); |
773 |
– |
|
774 |
– |
source_p->localClient->registration &= ~REG_NEED_USER; |
775 |
– |
|
776 |
– |
/* |
777 |
– |
* don't take the clients word for it, ever |
778 |
– |
*/ |
779 |
– |
source_p->servptr = &me; |
780 |
– |
|
781 |
– |
strlcpy(source_p->info, realname, sizeof(source_p->info)); |
782 |
– |
|
783 |
– |
/* stash for later */ |
784 |
– |
strlcpy(source_p->client_host, host, sizeof(source_p->client_host)); |
785 |
– |
strlcpy(source_p->client_server, server, sizeof(source_p->client_server)); |
786 |
– |
|
787 |
– |
if (!IsGotId(source_p)) |
788 |
– |
strlcpy(source_p->username, username, sizeof(source_p->username)); |
789 |
– |
|
790 |
– |
if (!source_p->localClient->registration) |
791 |
– |
register_local_user(source_p); |
792 |
– |
} |
793 |
– |
|
752 |
|
/* change_simple_umode() |
753 |
|
* |
754 |
|
* this callback can be hooked to allow special handling of |
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); |
911 |
– |
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); |
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), |
1206 |
|
int |
1207 |
|
valid_sid(const char *sid) |
1208 |
|
{ |
1251 |
– |
|
1209 |
|
if (strlen(sid) == IRC_MAXSID) |
1210 |
|
if (IsDigit(*sid)) |
1211 |
|
if (IsAlNum(*(sid + 1)) && IsAlNum(*(sid + 2))) |
1230 |
|
|
1231 |
|
memset(new_uid, 0, sizeof(new_uid)); |
1232 |
|
|
1233 |
< |
if (ServerInfo.sid != NULL) |
1277 |
< |
{ |
1233 |
> |
if (!EmptyString(ServerInfo.sid)) |
1234 |
|
strlcpy(new_uid, ServerInfo.sid, sizeof(new_uid)); |
1279 |
– |
strlcpy(me.id, ServerInfo.sid, sizeof(me.id)); |
1280 |
– |
|
1281 |
– |
hash_add_id(&me); |
1282 |
– |
} |
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 |
|
|