697 |
|
void |
698 |
|
free_exited_clients(void) |
699 |
|
{ |
700 |
< |
dlink_node *ptr, *next; |
701 |
< |
struct Client *target_p; |
700 |
> |
dlink_node *ptr = NULL, *next = NULL; |
701 |
|
|
702 |
|
DLINK_FOREACH_SAFE(ptr, next, dead_list.head) |
703 |
|
{ |
704 |
< |
target_p = ptr->data; |
706 |
< |
|
707 |
< |
if (ptr->data == NULL) |
708 |
< |
{ |
709 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
710 |
< |
"Warning: null client on dead_list!"); |
711 |
< |
dlinkDelete(ptr, &dead_list); |
712 |
< |
free_dlink_node(ptr); |
713 |
< |
continue; |
714 |
< |
} |
715 |
< |
|
716 |
< |
free_client(target_p); |
704 |
> |
free_client(ptr->data); |
705 |
|
dlinkDelete(ptr, &dead_list); |
706 |
|
free_dlink_node(ptr); |
707 |
|
} |
749 |
|
DLINK_FOREACH_SAFE(lp, next_lp, source_p->channel.head) |
750 |
|
remove_user_from_channel(lp->data); |
751 |
|
|
764 |
– |
/* Clean up allow lists */ |
765 |
– |
del_all_accepts(source_p); |
752 |
|
add_history(source_p, 0); |
753 |
|
off_history(source_p); |
754 |
|
|
764 |
|
/* Clean up invitefield */ |
765 |
|
DLINK_FOREACH_SAFE(lp, next_lp, source_p->localClient->invited.head) |
766 |
|
del_invite(lp->data, source_p); |
767 |
+ |
|
768 |
+ |
del_all_accepts(source_p); |
769 |
|
} |
770 |
|
} |
771 |
|
|
986 |
|
} |
987 |
|
|
988 |
|
if (IsServer(source_p)) |
1001 |
– |
{ |
989 |
|
Count.myserver--; |
1003 |
– |
if (ServerInfo.hub) |
1004 |
– |
remove_lazylink_flags(source_p->localClient->serverMask); |
1005 |
– |
else |
1006 |
– |
uplink = NULL; |
1007 |
– |
} |
990 |
|
} |
991 |
|
|
992 |
|
log_user_exit(source_p); |
1026 |
|
assert(source_p->serv != NULL && source_p->servptr != NULL); |
1027 |
|
|
1028 |
|
if (ConfigServerHide.hide_servers) |
1029 |
< |
/* set netsplit message to "*.net *.split" to still show |
1029 |
> |
/* |
1030 |
> |
* Set netsplit message to "*.net *.split" to still show |
1031 |
|
* that its a split, but hide the servers splitting |
1032 |
|
*/ |
1033 |
|
strcpy(splitstr, "*.net *.split"); |
1052 |
|
} |
1053 |
|
else if (IsClient(source_p) && !IsKilled(source_p)) |
1054 |
|
{ |
1055 |
< |
sendto_server(from->from, source_p, NULL, CAP_TS6, NOCAPS, NOFLAGS, |
1055 |
> |
sendto_server(from->from, NULL, CAP_TS6, NOCAPS, |
1056 |
|
":%s QUIT :%s", ID(source_p), comment); |
1057 |
< |
sendto_server(from->from, source_p, NULL, NOCAPS, CAP_TS6, NOFLAGS, |
1057 |
> |
sendto_server(from->from, NULL, NOCAPS, CAP_TS6, |
1058 |
|
":%s QUIT :%s", source_p->name, comment); |
1059 |
|
} |
1060 |
|
|
1191 |
|
|
1192 |
|
/* |
1193 |
|
* accept processing, this adds a form of "caller ID" to ircd |
1194 |
< |
* |
1194 |
> |
* |
1195 |
|
* If a client puts themselves into "caller ID only" mode, |
1196 |
< |
* only clients that match a client pointer they have put on |
1196 |
> |
* only clients that match a client pointer they have put on |
1197 |
|
* the accept list will be allowed to message them. |
1198 |
|
* |
1199 |
< |
* [ source.on_allow_list ] -> [ target1 ] -> [ target2 ] |
1217 |
< |
* |
1218 |
< |
* [target.allow_list] -> [ source1 ] -> [source2 ] |
1219 |
< |
* |
1220 |
< |
* i.e. a target will have a link list of source pointers it will allow |
1221 |
< |
* each source client then has a back pointer pointing back |
1222 |
< |
* to the client that has it on its accept list. |
1223 |
< |
* This allows for exit_one_client to remove these now bogus entries |
1224 |
< |
* from any client having an accept on them. |
1199 |
> |
* Diane Bruce, "Dianora" db@db.net |
1200 |
|
*/ |
1201 |
|
|
1202 |
< |
/* accept_message() |
1203 |
< |
* |
1229 |
< |
* inputs - pointer to source client |
1230 |
< |
* - pointer to target client |
1231 |
< |
* output - 1 if accept this message 0 if not |
1232 |
< |
* side effects - See if source is on target's allow list |
1233 |
< |
*/ |
1234 |
< |
int |
1235 |
< |
accept_message(struct Client *source, struct Client *target) |
1202 |
> |
void |
1203 |
> |
del_accept(struct split_nuh_item *accept_p, struct Client *client_p) |
1204 |
|
{ |
1205 |
< |
dlink_node *ptr; |
1205 |
> |
dlinkDelete(&accept_p->node, &client_p->localClient->acceptlist); |
1206 |
|
|
1207 |
< |
DLINK_FOREACH(ptr, target->allow_list.head) |
1208 |
< |
{ |
1209 |
< |
struct Client *target_p = ptr->data; |
1207 |
> |
MyFree(accept_p->nickptr); |
1208 |
> |
MyFree(accept_p->userptr); |
1209 |
> |
MyFree(accept_p->hostptr); |
1210 |
> |
MyFree(accept_p); |
1211 |
> |
} |
1212 |
|
|
1213 |
< |
if (source == target_p) |
1214 |
< |
return (1); |
1215 |
< |
} |
1213 |
> |
struct split_nuh_item * |
1214 |
> |
find_accept(const char *nick, const char *user, |
1215 |
> |
const char *host, struct Client *client_p, int do_match) |
1216 |
> |
{ |
1217 |
> |
dlink_node *ptr = NULL; |
1218 |
> |
/* XXX We wouldn't need that if match() would return 0 on match */ |
1219 |
> |
int (*cmpfunc)(const char *, const char *) = do_match ? match : irccmp; |
1220 |
|
|
1221 |
< |
if (IsSoftCallerId(target)) |
1221 |
> |
DLINK_FOREACH(ptr, client_p->localClient->acceptlist.head) |
1222 |
|
{ |
1223 |
< |
DLINK_FOREACH(ptr, target->channel.head) |
1224 |
< |
if (IsMember(source, ((struct Membership *)ptr->data)->chptr)) |
1225 |
< |
return (1); |
1223 |
> |
struct split_nuh_item *accept_p = ptr->data; |
1224 |
> |
|
1225 |
> |
if (cmpfunc(accept_p->nickptr, nick) == do_match && |
1226 |
> |
cmpfunc(accept_p->userptr, user) == do_match && |
1227 |
> |
cmpfunc(accept_p->hostptr, host) == do_match) |
1228 |
> |
return accept_p; |
1229 |
|
} |
1230 |
|
|
1231 |
< |
return (0); |
1231 |
> |
return NULL; |
1232 |
|
} |
1233 |
|
|
1234 |
< |
/* del_from_accept() |
1258 |
< |
* |
1259 |
< |
* inputs - pointer to source client |
1260 |
< |
* - pointer to target client |
1261 |
< |
* output - NONE |
1262 |
< |
* side effects - Delete's source pointer to targets allow list |
1234 |
> |
/* accept_message() |
1235 |
|
* |
1236 |
< |
* Walk through the target's accept list, remove if source is found, |
1237 |
< |
* Then walk through the source's on_accept_list remove target if found. |
1236 |
> |
* inputs - pointer to source client |
1237 |
> |
* - pointer to target client |
1238 |
> |
* output - 1 if accept this message 0 if not |
1239 |
> |
* side effects - See if source is on target's allow list |
1240 |
|
*/ |
1241 |
< |
void |
1242 |
< |
del_from_accept(struct Client *source, struct Client *target) |
1241 |
> |
int |
1242 |
> |
accept_message(struct Client *source, |
1243 |
> |
struct Client *target) |
1244 |
|
{ |
1245 |
< |
dlink_node *ptr; |
1271 |
< |
dlink_node *ptr2; |
1272 |
< |
dlink_node *next_ptr; |
1273 |
< |
dlink_node *next_ptr2; |
1274 |
< |
struct Client *target_p; |
1245 |
> |
dlink_node *ptr = NULL; |
1246 |
|
|
1247 |
< |
DLINK_FOREACH_SAFE(ptr, next_ptr, target->allow_list.head) |
1248 |
< |
{ |
1249 |
< |
target_p = ptr->data; |
1279 |
< |
|
1280 |
< |
if (source == target_p) |
1281 |
< |
{ |
1282 |
< |
dlinkDelete(ptr, &target->allow_list); |
1283 |
< |
free_dlink_node(ptr); |
1247 |
> |
if (source == target || find_accept(source->name, source->username, |
1248 |
> |
source->host, target, 1)) |
1249 |
> |
return 1; |
1250 |
|
|
1251 |
< |
DLINK_FOREACH_SAFE(ptr2, next_ptr2, source->on_allow_list.head) |
1252 |
< |
{ |
1253 |
< |
target_p = ptr2->data; |
1251 |
> |
if (IsSoftCallerId(target)) |
1252 |
> |
DLINK_FOREACH(ptr, target->channel.head) |
1253 |
> |
if (IsMember(source, ((struct Membership *)ptr->data)->chptr)) |
1254 |
> |
return 1; |
1255 |
|
|
1256 |
< |
if (target == target_p) |
1290 |
< |
{ |
1291 |
< |
dlinkDelete(ptr2, &source->on_allow_list); |
1292 |
< |
free_dlink_node(ptr2); |
1293 |
< |
} |
1294 |
< |
} |
1295 |
< |
} |
1296 |
< |
} |
1256 |
> |
return 0; |
1257 |
|
} |
1258 |
|
|
1259 |
|
/* del_all_accepts() |
1260 |
|
* |
1261 |
< |
* inputs - pointer to exiting client |
1262 |
< |
* output - NONE |
1263 |
< |
* side effects - Walk through given clients allow_list and on_allow_list |
1304 |
< |
* remove all references to this client |
1261 |
> |
* inputs - pointer to exiting client |
1262 |
> |
* output - NONE |
1263 |
> |
* side effects - Walk through given clients acceptlist and remove all entries |
1264 |
|
*/ |
1265 |
|
void |
1266 |
|
del_all_accepts(struct Client *client_p) |
1267 |
|
{ |
1268 |
< |
dlink_node *ptr, *next_ptr; |
1310 |
< |
|
1311 |
< |
DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->allow_list.head) |
1312 |
< |
del_from_accept(ptr->data, client_p); |
1313 |
< |
|
1314 |
< |
DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->on_allow_list.head) |
1315 |
< |
del_from_accept(client_p, ptr->data); |
1316 |
< |
} |
1317 |
< |
|
1318 |
< |
/* del_all_their_accepts() |
1319 |
< |
* |
1320 |
< |
* inputs - pointer to exiting client |
1321 |
< |
* output - NONE |
1322 |
< |
* side effects - Walk through given clients on_allow_list |
1323 |
< |
* remove all references to this client, |
1324 |
< |
* allow this client to keep their own allow_list |
1325 |
< |
*/ |
1326 |
< |
void |
1327 |
< |
del_all_their_accepts(struct Client *client_p) |
1328 |
< |
{ |
1329 |
< |
dlink_node *ptr, *next_ptr; |
1268 |
> |
dlink_node *ptr = NULL, *next_ptr = NULL; |
1269 |
|
|
1270 |
< |
DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->on_allow_list.head) |
1271 |
< |
del_from_accept(client_p, ptr->data); |
1270 |
> |
DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->localClient->acceptlist.head) |
1271 |
> |
del_accept(ptr->data, client_p); |
1272 |
|
} |
1273 |
|
|
1274 |
|
/* set_initial_nick() |
1301 |
|
/* fd_desc is long enough */ |
1302 |
|
fd_note(&client_p->localClient->fd, "Nick: %s", nick); |
1303 |
|
|
1365 |
– |
/* They have the nick they want now.. */ |
1366 |
– |
client_p->llname[0] = '\0'; |
1367 |
– |
|
1304 |
|
if (!source_p->localClient->registration) |
1305 |
|
{ |
1306 |
|
strlcpy(buf, source_p->username, sizeof(buf)); |
1330 |
|
{ |
1331 |
|
int samenick = 0; |
1332 |
|
|
1333 |
+ |
assert(source_p->name[0] && !EmptyString(nick)); |
1334 |
+ |
|
1335 |
|
/* |
1336 |
< |
** Client just changing his/her nick. If he/she is |
1337 |
< |
** on a channel, send note of change to all clients |
1338 |
< |
** on that channel. Propagate notice to other servers. |
1339 |
< |
*/ |
1336 |
> |
* Client just changing his/her nick. If he/she is |
1337 |
> |
* on a channel, send note of change to all clients |
1338 |
> |
* on that channel. Propagate notice to other servers. |
1339 |
> |
*/ |
1340 |
|
if ((source_p->localClient->last_nick_change + |
1341 |
|
ConfigFileEntry.max_nick_time) < CurrentTime) |
1342 |
|
source_p->localClient->number_of_nick_changes = 0; |
1353 |
|
|
1354 |
|
if (!samenick) |
1355 |
|
{ |
1418 |
– |
/* |
1419 |
– |
* Make sure everyone that has this client on its accept list |
1420 |
– |
* loses that reference. |
1421 |
– |
*/ |
1422 |
– |
del_all_their_accepts(source_p); |
1356 |
|
source_p->tsinfo = CurrentTime; |
1357 |
|
clear_ban_cache_client(source_p); |
1358 |
+ |
watch_check_hash(source_p, RPL_LOGOFF); |
1359 |
|
} |
1360 |
|
|
1361 |
|
/* XXX - the format of this notice should eventually be changed |
1368 |
|
source_p->host, nick); |
1369 |
|
add_history(source_p, 1); |
1370 |
|
|
1371 |
< |
/* |
1438 |
< |
* Only hubs care about lazy link nicks not being sent on yet |
1439 |
< |
* lazylink leafs/leafs always send their nicks up to hub, |
1440 |
< |
* hence must always propagate nick changes. |
1441 |
< |
* hubs might not propagate a nick change, if the leaf |
1442 |
< |
* does not know about that client yet. |
1443 |
< |
*/ |
1444 |
< |
sendto_server(client_p, source_p, NULL, CAP_TS6, NOCAPS, NOFLAGS, |
1371 |
> |
sendto_server(client_p, NULL, CAP_TS6, NOCAPS, |
1372 |
|
":%s NICK %s :%lu", |
1373 |
|
ID(source_p), nick, (unsigned long)source_p->tsinfo); |
1374 |
< |
sendto_server(client_p, source_p, NULL, NOCAPS, CAP_TS6, NOFLAGS, |
1374 |
> |
sendto_server(client_p, NULL, NOCAPS, CAP_TS6, |
1375 |
|
":%s NICK %s :%lu", |
1376 |
|
source_p->name, nick, (unsigned long)source_p->tsinfo); |
1377 |
+ |
|
1378 |
+ |
hash_del_client(source_p); |
1379 |
+ |
strcpy(source_p->name, nick); |
1380 |
+ |
hash_add_client(source_p); |
1381 |
+ |
|
1382 |
+ |
if (!samenick) |
1383 |
+ |
watch_check_hash(source_p, RPL_LOGON); |
1384 |
+ |
|
1385 |
+ |
/* fd_desc is long enough */ |
1386 |
+ |
fd_note(&client_p->localClient->fd, "Nick: %s", nick); |
1387 |
|
} |
1388 |
|
else |
1452 |
– |
{ |
1389 |
|
sendto_one(source_p, form_str(ERR_NICKTOOFAST), |
1390 |
|
me.name, source_p->name, source_p->name, |
1391 |
|
nick, ConfigFileEntry.max_nick_time); |
1456 |
– |
return; |
1457 |
– |
} |
1458 |
– |
|
1459 |
– |
/* Finally, add to hash */ |
1460 |
– |
if (source_p->name[0]) |
1461 |
– |
hash_del_client(source_p); |
1462 |
– |
|
1463 |
– |
if (!samenick) |
1464 |
– |
{ |
1465 |
– |
clear_ban_cache_client(source_p); |
1466 |
– |
watch_check_hash(source_p, RPL_LOGOFF); |
1467 |
– |
} |
1468 |
– |
|
1469 |
– |
strcpy(source_p->name, nick); |
1470 |
– |
hash_add_client(source_p); |
1471 |
– |
|
1472 |
– |
if (!samenick) |
1473 |
– |
watch_check_hash(source_p, RPL_LOGON); |
1474 |
– |
|
1475 |
– |
/* fd_desc is long enough */ |
1476 |
– |
fd_note(&client_p->localClient->fd, "Nick: %s", nick); |
1392 |
|
} |