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 */ |
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 |
|
{ |
302 |
|
if (!IsPingSent(source_p) && |
417 |
|
|
418 |
|
assert(source_p == client_p); |
419 |
|
|
420 |
< |
/* end of valid user name check */ |
420 |
< |
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; |
529 |
|
strlcpy(source_p->info, realname, sizeof(source_p->info)); |
530 |
|
strlcpy(source_p->username, username, sizeof(source_p->username)); |
531 |
|
|
518 |
– |
/* Increment our total user count here */ |
519 |
– |
if (++Count.total > Count.max_tot) |
520 |
– |
Count.max_tot = Count.total; |
521 |
– |
|
522 |
– |
source_p->from->serv->dep_users++; |
523 |
– |
|
532 |
|
/* |
533 |
|
* coming from another server, take the servers word for it |
534 |
|
*/ |
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); |
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 |
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); |
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, |
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 |
|
{ |
1233 |
|
static int |
1234 |
|
check_xline(struct Client *source_p) |
1235 |
|
{ |
1236 |
< |
struct ConfItem *conf; |
1237 |
< |
struct MatchItem *xconf; |
1211 |
< |
const char *reason; |
1236 |
> |
struct ConfItem *conf = NULL; |
1237 |
> |
const char *reason = NULL; |
1238 |
|
|
1239 |
< |
if ((conf = find_matching_name_conf(XLINE_TYPE, source_p->info, |
1240 |
< |
NULL, NULL, 0)) != NULL) |
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 |
< |
xconf = map_to_conf(conf); |
1243 |
< |
xconf->count++; |
1242 |
> |
struct MatchItem *reg = map_to_conf(conf); |
1243 |
> |
|
1244 |
> |
++reg->count; |
1245 |
|
|
1246 |
< |
if (xconf->reason != NULL) |
1247 |
< |
reason = xconf->reason; |
1246 |
> |
if (reg->reason != NULL) |
1247 |
> |
reason = reg->reason; |
1248 |
|
else |
1249 |
|
reason = "No Reason"; |
1250 |
|
|
1254 |
|
get_client_name(source_p, HIDE_IP), |
1255 |
|
source_p->sockhost); |
1256 |
|
|
1257 |
< |
ServerStats->is_ref++; |
1257 |
> |
ServerStats->is_ref++; |
1258 |
|
if (REJECT_HOLD_TIME > 0) |
1259 |
|
{ |
1260 |
|
sendto_one(source_p, ":%s NOTICE %s :Bad user info", |
1270 |
|
return 0; |
1271 |
|
} |
1272 |
|
|
1246 |
– |
static int |
1247 |
– |
check_regexp_xline(struct Client *source_p) |
1248 |
– |
{ |
1249 |
– |
struct ConfItem *conf = NULL; |
1250 |
– |
const char *reason = NULL; |
1251 |
– |
|
1252 |
– |
if ((conf = find_matching_name_conf(RXLINE_TYPE, source_p->info, NULL, NULL, 0))) |
1253 |
– |
{ |
1254 |
– |
struct MatchItem *reg = map_to_conf(conf); |
1255 |
– |
|
1256 |
– |
++reg->count; |
1257 |
– |
|
1258 |
– |
if (reg->reason != NULL) |
1259 |
– |
reason = reg->reason; |
1260 |
– |
else |
1261 |
– |
reason = "No Reason"; |
1262 |
– |
|
1263 |
– |
sendto_realops_flags(UMODE_REJ, L_ALL, |
1264 |
– |
"X-line (REGEX) Rejecting [%s] [%s], user %s [%s]", |
1265 |
– |
source_p->info, reason, |
1266 |
– |
get_client_name(source_p, HIDE_IP), |
1267 |
– |
source_p->sockhost); |
1268 |
– |
|
1269 |
– |
ServerStats->is_ref++; |
1270 |
– |
exit_client(source_p, &me, "Bad user info"); |
1271 |
– |
return 1; |
1272 |
– |
} |
1273 |
– |
|
1274 |
– |
return 0; |
1275 |
– |
} |
1276 |
– |
|
1273 |
|
/* oper_up() |
1274 |
|
* |
1275 |
|
* inputs - pointer to given client to oper |
1320 |
|
send_message_file(source_p, &ConfigFileEntry.opermotd); |
1321 |
|
} |
1322 |
|
|
1323 |
< |
/* |
1328 |
< |
* Quick and dirty UID code for new proposed SID on EFnet |
1329 |
< |
* |
1330 |
< |
*/ |
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), |
1356 |
< |
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 |
|
/* |
1377 |
– |
* uid_get |
1378 |
– |
* |
1379 |
– |
* inputs - struct Client * |
1380 |
– |
* output - new UID is returned to caller |
1381 |
– |
* side effects - new_uid is incremented by one. |
1382 |
– |
*/ |
1383 |
– |
static void * |
1384 |
– |
uid_get(va_list args) |
1385 |
– |
{ |
1386 |
– |
add_one_to_uid(TOTALSIDUID-1); /* index from 0 */ |
1387 |
– |
return ((void *) new_uid); |
1388 |
– |
} |
1389 |
– |
|
1390 |
– |
/* |
1378 |
|
* add_one_to_uid |
1379 |
|
* |
1380 |
|
* inputs - index number into new_uid |
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); |