23 |
|
*/ |
24 |
|
|
25 |
|
#include "stdinc.h" |
26 |
< |
#include "tools.h" |
26 |
> |
#include "list.h" |
27 |
|
#include "client.h" |
28 |
|
#include "channel_mode.h" |
29 |
|
#include "common.h" |
33 |
|
#include "irc_string.h" |
34 |
|
#include "sprintf_irc.h" |
35 |
|
#include "ircd.h" |
36 |
– |
#include "list.h" |
36 |
|
#include "s_gline.h" |
37 |
|
#include "numeric.h" |
38 |
|
#include "packet.h" |
52 |
|
#include "listener.h" |
53 |
|
#include "irc_res.h" |
54 |
|
#include "userhost.h" |
55 |
+ |
#include "watch.h" |
56 |
|
|
57 |
|
dlink_list listing_client_list = { NULL, NULL, 0 }; |
58 |
|
/* Pointer to beginning of Client list */ |
122 |
|
client_p->since = client_p->lasttime = client_p->firsttime = CurrentTime; |
123 |
|
|
124 |
|
client_p->localClient = BlockHeapAlloc(lclient_heap); |
125 |
+ |
client_p->localClient->registration = REG_INIT; |
126 |
|
/* as good a place as any... */ |
127 |
|
dlinkAdd(client_p, make_dlink_node(), &unknown_list); |
128 |
|
} |
149 |
|
assert(client_p != NULL); |
150 |
|
assert(client_p != &me); |
151 |
|
assert(client_p->hnext == client_p); |
151 |
– |
assert(client_p->invited.head == NULL); |
152 |
|
assert(client_p->channel.head == NULL); |
153 |
– |
assert(dlink_list_length(&client_p->invited) == 0); |
153 |
|
assert(dlink_list_length(&client_p->channel) == 0); |
154 |
|
|
155 |
|
MyFree(client_p->away); |
157 |
|
|
158 |
|
if (MyConnect(client_p)) |
159 |
|
{ |
160 |
+ |
assert(client_p->localClient->invited.head == NULL); |
161 |
+ |
assert(dlink_list_length(&client_p->localClient->invited) == 0); |
162 |
|
assert(IsClosing(client_p) && IsDead(client_p)); |
163 |
|
|
164 |
|
MyFree(client_p->localClient->response); |
317 |
|
ilog(L_NOTICE, "No response from %s, closing link", |
318 |
|
get_client_name(client_p, HIDE_IP)); |
319 |
|
} |
320 |
+ |
|
321 |
|
ircsprintf(scratch, "Ping timeout: %d seconds", |
322 |
|
(int)(CurrentTime - client_p->lasttime)); |
321 |
– |
|
323 |
|
exit_client(client_p, &me, scratch); |
324 |
|
} |
325 |
|
else if (!IsPingWarning(client_p) && pingwarn > 0 && |
363 |
|
if (client_p->localClient->reject_delay > 0) |
364 |
|
{ |
365 |
|
if (client_p->localClient->reject_delay <= CurrentTime) |
366 |
< |
exit_client(client_p, &me, "Rejected"); |
366 |
> |
exit_client(client_p, &me, "Rejected"); |
367 |
|
continue; |
368 |
|
} |
369 |
|
|
370 |
< |
/* Check UNKNOWN connections - if they have been in this state |
370 |
> |
/* |
371 |
> |
* Check UNKNOWN connections - if they have been in this state |
372 |
|
* for > 30s, close them. |
373 |
|
*/ |
374 |
< |
if (client_p->firsttime ? ((CurrentTime - client_p->firsttime) > 30) : 0) |
375 |
< |
exit_client(client_p, &me, "Connection timed out"); |
374 |
> |
if (IsAuthFinished(client_p) && (CurrentTime - client_p->firsttime) > 30) |
375 |
> |
exit_client(client_p, &me, "Registration timed out"); |
376 |
|
} |
377 |
|
} |
378 |
|
|
696 |
|
void |
697 |
|
free_exited_clients(void) |
698 |
|
{ |
699 |
< |
dlink_node *ptr, *next; |
698 |
< |
struct Client *target_p; |
699 |
> |
dlink_node *ptr = NULL, *next = NULL; |
700 |
|
|
701 |
|
DLINK_FOREACH_SAFE(ptr, next, dead_list.head) |
702 |
|
{ |
703 |
< |
target_p = ptr->data; |
703 |
< |
|
704 |
< |
if (ptr->data == NULL) |
705 |
< |
{ |
706 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
707 |
< |
"Warning: null client on dead_list!"); |
708 |
< |
dlinkDelete(ptr, &dead_list); |
709 |
< |
free_dlink_node(ptr); |
710 |
< |
continue; |
711 |
< |
} |
712 |
< |
|
713 |
< |
free_client(target_p); |
703 |
> |
free_client(ptr->data); |
704 |
|
dlinkDelete(ptr, &dead_list); |
705 |
|
free_dlink_node(ptr); |
706 |
|
} |
721 |
|
|
722 |
|
if (IsServer(source_p)) |
723 |
|
{ |
724 |
< |
dlinkDelete(&source_p->lnode, &source_p->servptr->serv->servers); |
724 |
> |
dlinkDelete(&source_p->lnode, &source_p->servptr->serv->server_list); |
725 |
|
|
726 |
|
if ((lp = dlinkFindDelete(&global_serv_list, source_p)) != NULL) |
727 |
|
free_dlink_node(lp); |
738 |
– |
|
739 |
– |
if (!MyConnect(source_p)) |
740 |
– |
{ |
741 |
– |
source_p->from->serv->dep_servers--; |
742 |
– |
assert(source_p->from->serv->dep_servers > 0); |
743 |
– |
} |
728 |
|
} |
729 |
|
else if (IsClient(source_p)) |
730 |
|
{ |
731 |
|
if (source_p->servptr->serv != NULL) |
732 |
< |
dlinkDelete(&source_p->lnode, &source_p->servptr->serv->users); |
732 |
> |
dlinkDelete(&source_p->lnode, &source_p->servptr->serv->client_list); |
733 |
|
|
734 |
|
/* If a person is on a channel, send a QUIT notice |
735 |
|
** to every client (person) on the same channel (so |
742 |
|
DLINK_FOREACH_SAFE(lp, next_lp, source_p->channel.head) |
743 |
|
remove_user_from_channel(lp->data); |
744 |
|
|
761 |
– |
/* Clean up invitefield */ |
762 |
– |
DLINK_FOREACH_SAFE(lp, next_lp, source_p->invited.head) |
763 |
– |
del_invite(lp->data, source_p); |
764 |
– |
|
765 |
– |
/* Clean up allow lists */ |
766 |
– |
del_all_accepts(source_p); |
745 |
|
add_history(source_p, 0); |
746 |
|
off_history(source_p); |
747 |
|
|
748 |
< |
if (!MyConnect(source_p)) |
748 |
> |
watch_check_hash(source_p, RPL_LOGOFF); |
749 |
> |
|
750 |
> |
if (MyConnect(source_p)) |
751 |
|
{ |
752 |
< |
source_p->from->serv->dep_users--; |
753 |
< |
assert(source_p->from->serv->dep_users >= 0); |
752 |
> |
/* Clean up invitefield */ |
753 |
> |
DLINK_FOREACH_SAFE(lp, next_lp, source_p->localClient->invited.head) |
754 |
> |
del_invite(lp->data, source_p); |
755 |
> |
|
756 |
> |
del_all_accepts(source_p); |
757 |
|
} |
758 |
|
} |
759 |
|
|
810 |
|
* hidden behind fakename. If so, send out the QUITs -adx |
811 |
|
*/ |
812 |
|
if (hidden || !IsCapable(to, CAP_QS)) |
813 |
< |
DLINK_FOREACH_SAFE(ptr, next, source_p->serv->users.head) |
813 |
> |
DLINK_FOREACH_SAFE(ptr, next, source_p->serv->client_list.head) |
814 |
|
{ |
815 |
|
target_p = ptr->data; |
816 |
|
sendto_one(to, ":%s QUIT :%s", target_p->name, splitstr); |
817 |
|
} |
818 |
|
|
819 |
< |
DLINK_FOREACH_SAFE(ptr, next, source_p->serv->servers.head) |
819 |
> |
DLINK_FOREACH_SAFE(ptr, next, source_p->serv->server_list.head) |
820 |
|
recurse_send_quits(original_source_p, ptr->data, from, to, |
821 |
|
comment, splitstr, myname); |
822 |
|
|
840 |
|
{ |
841 |
|
dlink_node *ptr, *next; |
842 |
|
|
843 |
< |
DLINK_FOREACH_SAFE(ptr, next, source_p->serv->users.head) |
843 |
> |
DLINK_FOREACH_SAFE(ptr, next, source_p->serv->client_list.head) |
844 |
|
exit_one_client(ptr->data, quitmsg); |
845 |
|
|
846 |
< |
DLINK_FOREACH_SAFE(ptr, next, source_p->serv->servers.head) |
846 |
> |
DLINK_FOREACH_SAFE(ptr, next, source_p->serv->server_list.head) |
847 |
|
{ |
848 |
|
recurse_remove_clients(ptr->data, quitmsg); |
849 |
|
exit_one_client(ptr->data, quitmsg); |
850 |
|
} |
868 |
– |
|
869 |
– |
assert(source_p->serv->dep_servers == 1); |
870 |
– |
assert(source_p->serv->dep_users == 0); |
851 |
|
} |
852 |
|
|
853 |
|
/* |
915 |
|
if (IsIpHash(source_p)) |
916 |
|
remove_one_ip(&source_p->localClient->ip); |
917 |
|
|
918 |
< |
delete_auth(source_p); |
918 |
> |
if (source_p->localClient->auth) |
919 |
> |
{ |
920 |
> |
delete_auth(source_p->localClient->auth); |
921 |
> |
source_p->localClient->auth = NULL; |
922 |
> |
} |
923 |
|
|
924 |
|
/* This source_p could have status of one of STAT_UNKNOWN, STAT_CONNECTING |
925 |
|
* STAT_HANDSHAKE or STAT_UNKNOWN |
946 |
|
if (source_p->localClient->list_task != NULL) |
947 |
|
free_list_task(source_p->localClient->list_task, source_p); |
948 |
|
|
949 |
+ |
watch_del_watch_list(source_p); |
950 |
|
sendto_realops_flags(UMODE_CCONN, L_ALL, "Client exiting: %s (%s@%s) [%s] [%s]", |
951 |
|
source_p->name, source_p->username, source_p->host, comment, |
952 |
|
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
953 |
|
"255.255.255.255" : source_p->sockhost); |
954 |
+ |
sendto_realops_flags(UMODE_CCONN_FULL, L_ALL, "CLIEXIT: %s %s %s %s 0 %s", |
955 |
+ |
source_p->name, |
956 |
+ |
source_p->username, |
957 |
+ |
source_p->host, |
958 |
+ |
|
959 |
+ |
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
960 |
+ |
"255.255.255.255" : source_p->sockhost, |
961 |
+ |
comment); |
962 |
|
} |
963 |
|
|
964 |
|
/* As soon as a client is known to be a server of some sort |
975 |
|
} |
976 |
|
|
977 |
|
if (IsServer(source_p)) |
985 |
– |
{ |
978 |
|
Count.myserver--; |
987 |
– |
if (ServerInfo.hub) |
988 |
– |
remove_lazylink_flags(source_p->localClient->serverMask); |
989 |
– |
else |
990 |
– |
uplink = NULL; |
991 |
– |
} |
979 |
|
} |
980 |
|
|
981 |
|
log_user_exit(source_p); |
1015 |
|
assert(source_p->serv != NULL && source_p->servptr != NULL); |
1016 |
|
|
1017 |
|
if (ConfigServerHide.hide_servers) |
1018 |
< |
/* set netsplit message to "*.net *.split" to still show |
1018 |
> |
/* |
1019 |
> |
* Set netsplit message to "*.net *.split" to still show |
1020 |
|
* that its a split, but hide the servers splitting |
1021 |
|
*/ |
1022 |
|
strcpy(splitstr, "*.net *.split"); |
1041 |
|
} |
1042 |
|
else if (IsClient(source_p) && !IsKilled(source_p)) |
1043 |
|
{ |
1044 |
< |
sendto_server(NULL, source_p, NULL, CAP_TS6, NOCAPS, NOFLAGS, |
1044 |
> |
sendto_server(from->from, NULL, CAP_TS6, NOCAPS, |
1045 |
|
":%s QUIT :%s", ID(source_p), comment); |
1046 |
< |
sendto_server(NULL, source_p, NULL, NOCAPS, CAP_TS6, NOFLAGS, |
1046 |
> |
sendto_server(from->from, NULL, NOCAPS, CAP_TS6, |
1047 |
|
":%s QUIT :%s", source_p->name, comment); |
1048 |
|
} |
1049 |
|
|
1121 |
|
} |
1122 |
|
else |
1123 |
|
{ |
1124 |
< |
report_error(L_ADMIN, "Lost connection to %s: %d", |
1124 |
> |
report_error(L_ADMIN, "Lost connection to %s: %s", |
1125 |
|
get_client_name(client_p, SHOW_IP), current_error); |
1126 |
< |
report_error(L_OPER, "Lost connection to %s: %d", |
1126 |
> |
report_error(L_OPER, "Lost connection to %s: %s", |
1127 |
|
get_client_name(client_p, MASK_IP), current_error); |
1128 |
|
} |
1129 |
|
|
1180 |
|
|
1181 |
|
/* |
1182 |
|
* accept processing, this adds a form of "caller ID" to ircd |
1183 |
< |
* |
1183 |
> |
* |
1184 |
|
* If a client puts themselves into "caller ID only" mode, |
1185 |
< |
* only clients that match a client pointer they have put on |
1185 |
> |
* only clients that match a client pointer they have put on |
1186 |
|
* the accept list will be allowed to message them. |
1187 |
|
* |
1188 |
< |
* [ source.on_allow_list ] -> [ target1 ] -> [ target2 ] |
1201 |
< |
* |
1202 |
< |
* [target.allow_list] -> [ source1 ] -> [source2 ] |
1203 |
< |
* |
1204 |
< |
* i.e. a target will have a link list of source pointers it will allow |
1205 |
< |
* each source client then has a back pointer pointing back |
1206 |
< |
* to the client that has it on its accept list. |
1207 |
< |
* This allows for exit_one_client to remove these now bogus entries |
1208 |
< |
* from any client having an accept on them. |
1188 |
> |
* Diane Bruce, "Dianora" db@db.net |
1189 |
|
*/ |
1190 |
|
|
1191 |
< |
/* accept_message() |
1192 |
< |
* |
1213 |
< |
* inputs - pointer to source client |
1214 |
< |
* - pointer to target client |
1215 |
< |
* output - 1 if accept this message 0 if not |
1216 |
< |
* side effects - See if source is on target's allow list |
1217 |
< |
*/ |
1218 |
< |
int |
1219 |
< |
accept_message(struct Client *source, struct Client *target) |
1191 |
> |
void |
1192 |
> |
del_accept(struct split_nuh_item *accept_p, struct Client *client_p) |
1193 |
|
{ |
1194 |
< |
dlink_node *ptr; |
1194 |
> |
dlinkDelete(&accept_p->node, &client_p->localClient->acceptlist); |
1195 |
|
|
1196 |
< |
DLINK_FOREACH(ptr, target->allow_list.head) |
1197 |
< |
{ |
1198 |
< |
struct Client *target_p = ptr->data; |
1199 |
< |
|
1227 |
< |
if (source == target_p) |
1228 |
< |
return (1); |
1229 |
< |
} |
1230 |
< |
|
1231 |
< |
if (IsSoftCallerId(target)) |
1232 |
< |
{ |
1233 |
< |
DLINK_FOREACH(ptr, target->channel.head) |
1234 |
< |
if (IsMember(source, ptr->data)) |
1235 |
< |
return (1); |
1236 |
< |
} |
1237 |
< |
|
1238 |
< |
return (0); |
1196 |
> |
MyFree(accept_p->nickptr); |
1197 |
> |
MyFree(accept_p->userptr); |
1198 |
> |
MyFree(accept_p->hostptr); |
1199 |
> |
MyFree(accept_p); |
1200 |
|
} |
1201 |
|
|
1202 |
< |
/* del_from_accept() |
1203 |
< |
* |
1204 |
< |
* inputs - pointer to source client |
1244 |
< |
* - pointer to target client |
1245 |
< |
* output - NONE |
1246 |
< |
* side effects - Delete's source pointer to targets allow list |
1247 |
< |
* |
1248 |
< |
* Walk through the target's accept list, remove if source is found, |
1249 |
< |
* Then walk through the source's on_accept_list remove target if found. |
1250 |
< |
*/ |
1251 |
< |
void |
1252 |
< |
del_from_accept(struct Client *source, struct Client *target) |
1202 |
> |
struct split_nuh_item * |
1203 |
> |
find_accept(const char *nick, const char *user, |
1204 |
> |
const char *host, struct Client *client_p, int do_match) |
1205 |
|
{ |
1206 |
< |
dlink_node *ptr; |
1207 |
< |
dlink_node *ptr2; |
1208 |
< |
dlink_node *next_ptr; |
1257 |
< |
dlink_node *next_ptr2; |
1258 |
< |
struct Client *target_p; |
1206 |
> |
dlink_node *ptr = NULL; |
1207 |
> |
/* XXX We wouldn't need that if match() would return 0 on match */ |
1208 |
> |
int (*cmpfunc)(const char *, const char *) = do_match ? match : irccmp; |
1209 |
|
|
1210 |
< |
DLINK_FOREACH_SAFE(ptr, next_ptr, target->allow_list.head) |
1210 |
> |
DLINK_FOREACH(ptr, client_p->localClient->acceptlist.head) |
1211 |
|
{ |
1212 |
< |
target_p = ptr->data; |
1263 |
< |
|
1264 |
< |
if (source == target_p) |
1265 |
< |
{ |
1266 |
< |
dlinkDelete(ptr, &target->allow_list); |
1267 |
< |
free_dlink_node(ptr); |
1212 |
> |
struct split_nuh_item *accept_p = ptr->data; |
1213 |
|
|
1214 |
< |
DLINK_FOREACH_SAFE(ptr2, next_ptr2, source->on_allow_list.head) |
1215 |
< |
{ |
1216 |
< |
target_p = ptr2->data; |
1217 |
< |
|
1273 |
< |
if (target == target_p) |
1274 |
< |
{ |
1275 |
< |
dlinkDelete(ptr2, &source->on_allow_list); |
1276 |
< |
free_dlink_node(ptr2); |
1277 |
< |
} |
1278 |
< |
} |
1279 |
< |
} |
1214 |
> |
if (cmpfunc(accept_p->nickptr, nick) == do_match && |
1215 |
> |
cmpfunc(accept_p->userptr, user) == do_match && |
1216 |
> |
cmpfunc(accept_p->hostptr, host) == do_match) |
1217 |
> |
return accept_p; |
1218 |
|
} |
1219 |
+ |
|
1220 |
+ |
return NULL; |
1221 |
|
} |
1222 |
|
|
1223 |
< |
/* del_all_accepts() |
1223 |
> |
/* accept_message() |
1224 |
|
* |
1225 |
< |
* inputs - pointer to exiting client |
1226 |
< |
* output - NONE |
1227 |
< |
* side effects - Walk through given clients allow_list and on_allow_list |
1228 |
< |
* remove all references to this client |
1225 |
> |
* inputs - pointer to source client |
1226 |
> |
* - pointer to target client |
1227 |
> |
* output - 1 if accept this message 0 if not |
1228 |
> |
* side effects - See if source is on target's allow list |
1229 |
|
*/ |
1230 |
< |
void |
1231 |
< |
del_all_accepts(struct Client *client_p) |
1230 |
> |
int |
1231 |
> |
accept_message(struct Client *source, |
1232 |
> |
struct Client *target) |
1233 |
|
{ |
1234 |
< |
dlink_node *ptr, *next_ptr; |
1234 |
> |
dlink_node *ptr = NULL; |
1235 |
|
|
1236 |
< |
DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->allow_list.head) |
1237 |
< |
del_from_accept(ptr->data, client_p); |
1236 |
> |
if (source == target || find_accept(source->name, source->username, |
1237 |
> |
source->host, target, 1)) |
1238 |
> |
return 1; |
1239 |
|
|
1240 |
< |
DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->on_allow_list.head) |
1241 |
< |
del_from_accept(client_p, ptr->data); |
1242 |
< |
} |
1243 |
< |
|
1302 |
< |
/* del_all_their_accepts() |
1303 |
< |
* |
1304 |
< |
* inputs - pointer to exiting client |
1305 |
< |
* output - NONE |
1306 |
< |
* side effects - Walk through given clients on_allow_list |
1307 |
< |
* remove all references to this client, |
1308 |
< |
* allow this client to keep their own allow_list |
1309 |
< |
*/ |
1310 |
< |
void |
1311 |
< |
del_all_their_accepts(struct Client *client_p) |
1312 |
< |
{ |
1313 |
< |
dlink_node *ptr, *next_ptr; |
1240 |
> |
if (IsSoftCallerId(target)) |
1241 |
> |
DLINK_FOREACH(ptr, target->channel.head) |
1242 |
> |
if (IsMember(source, ((struct Membership *)ptr->data)->chptr)) |
1243 |
> |
return 1; |
1244 |
|
|
1245 |
< |
DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->on_allow_list.head) |
1316 |
< |
del_from_accept(client_p, ptr->data); |
1245 |
> |
return 0; |
1246 |
|
} |
1247 |
|
|
1248 |
< |
/* set_initial_nick() |
1320 |
< |
* |
1321 |
< |
* inputs |
1322 |
< |
* output |
1323 |
< |
* side effects - |
1248 |
> |
/* del_all_accepts() |
1249 |
|
* |
1250 |
< |
* This function is only called to set up an initially registering |
1251 |
< |
* client. |
1250 |
> |
* inputs - pointer to exiting client |
1251 |
> |
* output - NONE |
1252 |
> |
* side effects - Walk through given clients acceptlist and remove all entries |
1253 |
|
*/ |
1254 |
|
void |
1255 |
< |
set_initial_nick(struct Client *client_p, struct Client *source_p, |
1330 |
< |
const char *nick) |
1255 |
> |
del_all_accepts(struct Client *client_p) |
1256 |
|
{ |
1257 |
< |
char buf[USERLEN + 1]; |
1333 |
< |
|
1334 |
< |
/* Client setting NICK the first time */ |
1335 |
< |
|
1336 |
< |
/* This had to be copied here to avoid problems.. */ |
1337 |
< |
source_p->tsinfo = CurrentTime; |
1338 |
< |
|
1339 |
< |
if (source_p->name[0]) |
1340 |
< |
hash_del_client(source_p); |
1257 |
> |
dlink_node *ptr = NULL, *next_ptr = NULL; |
1258 |
|
|
1259 |
< |
strlcpy(source_p->name, nick, sizeof(source_p->name)); |
1260 |
< |
hash_add_client(source_p); |
1344 |
< |
|
1345 |
< |
/* fd_desc is long enough */ |
1346 |
< |
fd_note(&client_p->localClient->fd, "Nick: %s", nick); |
1347 |
< |
|
1348 |
< |
/* They have the nick they want now.. */ |
1349 |
< |
client_p->llname[0] = '\0'; |
1350 |
< |
|
1351 |
< |
if (source_p->flags & FLAGS_GOTUSER) |
1352 |
< |
{ |
1353 |
< |
strlcpy(buf, source_p->username, sizeof(buf)); |
1354 |
< |
|
1355 |
< |
/* |
1356 |
< |
* USER already received, now we have NICK. |
1357 |
< |
* *NOTE* For servers "NICK" *must* precede the |
1358 |
< |
* user message (giving USER before NICK is possible |
1359 |
< |
* only for local client connection!). register_user |
1360 |
< |
* may reject the client and call exit_client for it |
1361 |
< |
* --must test this and exit m_nick too!!! |
1362 |
< |
*/ |
1363 |
< |
register_local_user(client_p, source_p, nick, buf); |
1364 |
< |
} |
1259 |
> |
DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->localClient->acceptlist.head) |
1260 |
> |
del_accept(ptr->data, client_p); |
1261 |
|
} |
1262 |
|
|
1263 |
|
/* change_local_nick() |
1271 |
|
void |
1272 |
|
change_local_nick(struct Client *client_p, struct Client *source_p, const char *nick) |
1273 |
|
{ |
1274 |
+ |
int samenick = 0; |
1275 |
+ |
|
1276 |
+ |
assert(source_p->name[0] && !EmptyString(nick)); |
1277 |
+ |
|
1278 |
|
/* |
1279 |
< |
** Client just changing his/her nick. If he/she is |
1280 |
< |
** on a channel, send note of change to all clients |
1281 |
< |
** on that channel. Propagate notice to other servers. |
1282 |
< |
*/ |
1279 |
> |
* Client just changing his/her nick. If he/she is |
1280 |
> |
* on a channel, send note of change to all clients |
1281 |
> |
* on that channel. Propagate notice to other servers. |
1282 |
> |
*/ |
1283 |
|
if ((source_p->localClient->last_nick_change + |
1284 |
|
ConfigFileEntry.max_nick_time) < CurrentTime) |
1285 |
|
source_p->localClient->number_of_nick_changes = 0; |
1292 |
|
!ConfigFileEntry.anti_nick_flood || |
1293 |
|
(IsOper(source_p) && ConfigFileEntry.no_oper_flood)) |
1294 |
|
{ |
1295 |
< |
if (irccmp(source_p->name, nick)) |
1295 |
> |
samenick = !irccmp(source_p->name, nick); |
1296 |
> |
|
1297 |
> |
if (!samenick) |
1298 |
> |
{ |
1299 |
|
source_p->tsinfo = CurrentTime; |
1300 |
+ |
clear_ban_cache_client(source_p); |
1301 |
+ |
watch_check_hash(source_p, RPL_LOGOFF); |
1302 |
+ |
} |
1303 |
|
|
1304 |
|
/* XXX - the format of this notice should eventually be changed |
1305 |
|
* to either %s[%s@%s], or even better would be get_client_name() -bill |
1309 |
|
sendto_common_channels_local(source_p, 1, ":%s!%s@%s NICK :%s", |
1310 |
|
source_p->name, source_p->username, |
1311 |
|
source_p->host, nick); |
1406 |
– |
|
1312 |
|
add_history(source_p, 1); |
1313 |
< |
|
1314 |
< |
/* Only hubs care about lazy link nicks not being sent on yet |
1410 |
< |
* lazylink leafs/leafs always send their nicks up to hub, |
1411 |
< |
* hence must always propagate nick changes. |
1412 |
< |
* hubs might not propagate a nick change, if the leaf |
1413 |
< |
* does not know about that client yet. |
1414 |
< |
*/ |
1415 |
< |
sendto_server(client_p, source_p, NULL, CAP_TS6, NOCAPS, NOFLAGS, |
1313 |
> |
|
1314 |
> |
sendto_server(client_p, NULL, CAP_TS6, NOCAPS, |
1315 |
|
":%s NICK %s :%lu", |
1316 |
|
ID(source_p), nick, (unsigned long)source_p->tsinfo); |
1317 |
< |
sendto_server(client_p, source_p, NULL, NOCAPS, CAP_TS6, NOFLAGS, |
1317 |
> |
sendto_server(client_p, NULL, NOCAPS, CAP_TS6, |
1318 |
|
":%s NICK %s :%lu", |
1319 |
|
source_p->name, nick, (unsigned long)source_p->tsinfo); |
1320 |
+ |
|
1321 |
+ |
hash_del_client(source_p); |
1322 |
+ |
strcpy(source_p->name, nick); |
1323 |
+ |
hash_add_client(source_p); |
1324 |
+ |
|
1325 |
+ |
if (!samenick) |
1326 |
+ |
watch_check_hash(source_p, RPL_LOGON); |
1327 |
+ |
|
1328 |
+ |
/* fd_desc is long enough */ |
1329 |
+ |
fd_note(&client_p->localClient->fd, "Nick: %s", nick); |
1330 |
|
} |
1331 |
|
else |
1423 |
– |
{ |
1332 |
|
sendto_one(source_p, form_str(ERR_NICKTOOFAST), |
1333 |
|
me.name, source_p->name, source_p->name, |
1334 |
|
nick, ConfigFileEntry.max_nick_time); |
1427 |
– |
return; |
1428 |
– |
} |
1429 |
– |
|
1430 |
– |
/* Finally, add to hash */ |
1431 |
– |
if (source_p->name[0]) |
1432 |
– |
hash_del_client(source_p); |
1433 |
– |
|
1434 |
– |
strcpy(source_p->name, nick); |
1435 |
– |
hash_add_client(source_p); |
1436 |
– |
|
1437 |
– |
/* Make sure everyone that has this client on its accept list |
1438 |
– |
* loses that reference. |
1439 |
– |
*/ |
1440 |
– |
del_all_their_accepts(source_p); |
1441 |
– |
|
1442 |
– |
/* fd_desc is long enough */ |
1443 |
– |
fd_note(&client_p->localClient->fd, "Nick: %s", nick); |
1335 |
|
} |