87 |
|
extern char conffilebuf[IRCD_BUFSIZE]; |
88 |
|
extern char yytext[]; |
89 |
|
extern int yyparse(); /* defined in y.tab.c */ |
90 |
< |
unsigned int scount = 0; /* used by yyparse(), etc */ |
91 |
< |
int ypass = 1; /* used by yyparse() */ |
90 |
> |
int ypass = 1; /* used by yyparse() */ |
91 |
|
|
92 |
|
/* internally defined functions */ |
93 |
|
static void lookup_confhost(struct ConfItem *); |
337 |
|
break; |
338 |
|
|
339 |
|
case CLASS_TYPE: |
340 |
< |
conf = (struct ConfItem *)MyMalloc(sizeof(struct ConfItem) + |
341 |
< |
sizeof(struct ClassItem)); |
340 |
> |
conf = MyMalloc(sizeof(struct ConfItem) + |
341 |
> |
sizeof(struct ClassItem)); |
342 |
|
dlinkAdd(conf, &conf->node, &class_items); |
343 |
< |
aclass = (struct ClassItem *)map_to_conf(conf); |
344 |
< |
ConFreq(aclass) = DEFAULT_CONNECTFREQUENCY; |
343 |
> |
|
344 |
> |
aclass = map_to_conf(conf); |
345 |
> |
aclass->active = 1; |
346 |
> |
ConFreq(aclass) = DEFAULT_CONNECTFREQUENCY; |
347 |
|
PingFreq(aclass) = DEFAULT_PINGFREQUENCY; |
348 |
|
MaxTotal(aclass) = MAXIMUM_LINKS_DEFAULT; |
349 |
|
MaxSendq(aclass) = DEFAULT_SENDQ; |
350 |
< |
CurrUserCount(aclass) = 0; |
350 |
> |
|
351 |
|
break; |
352 |
|
|
353 |
|
default: |
358 |
|
/* XXX Yes, this will core if default is hit. I want it to for now - db */ |
359 |
|
conf->type = type; |
360 |
|
|
361 |
< |
return(conf); |
361 |
> |
return conf; |
362 |
|
} |
363 |
|
|
364 |
|
void |
365 |
|
delete_conf_item(struct ConfItem *conf) |
366 |
|
{ |
367 |
+ |
dlink_node *m = NULL; |
368 |
|
struct MatchItem *match_item; |
369 |
|
struct AccessItem *aconf; |
370 |
|
ConfType type = conf->type; |
511 |
|
MyFree(match_item->reason); |
512 |
|
MyFree(match_item->oper_reason); |
513 |
|
dlinkDelete(&conf->node, &nresv_items); |
514 |
+ |
|
515 |
+ |
if (conf->flags & CONF_FLAGS_TEMPORARY) |
516 |
+ |
if ((m = dlinkFindDelete(&temporary_resv, conf)) != NULL) |
517 |
+ |
free_dlink_node(m); |
518 |
+ |
|
519 |
|
MyFree(conf); |
520 |
|
break; |
521 |
|
|
533 |
|
break; |
534 |
|
|
535 |
|
case CRESV_TYPE: |
536 |
+ |
if (conf->flags & CONF_FLAGS_TEMPORARY) |
537 |
+ |
if ((m = dlinkFindDelete(&temporary_resv, conf)) != NULL) |
538 |
+ |
free_dlink_node(m); |
539 |
+ |
|
540 |
|
MyFree(conf); |
541 |
|
break; |
542 |
|
|
587 |
|
struct ClassItem *classitem = NULL; |
588 |
|
char buf[12]; |
589 |
|
char *p = NULL; |
590 |
+ |
const char *pfx = NULL; |
591 |
|
|
592 |
|
switch (type) |
593 |
|
{ |
644 |
|
break; |
645 |
|
|
646 |
|
case RKLINE_TYPE: |
647 |
< |
p = temp ? "Rk" : "RK"; |
647 |
> |
pfx = temp ? "kR" : "KR"; |
648 |
|
|
649 |
|
DLINK_FOREACH(ptr, rkconf_items.head) |
650 |
|
{ |
654 |
|
continue; |
655 |
|
|
656 |
|
sendto_one(source_p, form_str(RPL_STATSKLINE), me.name, |
657 |
< |
source_p->name, p, aconf->host, aconf->user, |
657 |
> |
source_p->name, pfx, aconf->host, aconf->user, |
658 |
|
aconf->reason, aconf->oper_reason ? aconf->oper_reason : ""); |
659 |
|
} |
660 |
|
break; |
724 |
|
me.name, source_p->name, 'Y', |
725 |
|
conf->name, PingFreq(classitem), |
726 |
|
ConFreq(classitem), |
727 |
< |
MaxTotal(classitem), MaxSendq(classitem)); |
727 |
> |
MaxTotal(classitem), MaxSendq(classitem), |
728 |
> |
CurrUserCount(classitem), |
729 |
> |
classitem->active ? "active" : "disabled"); |
730 |
|
} |
731 |
|
break; |
732 |
|
|
761 |
|
|
762 |
|
*p = '\0'; |
763 |
|
|
764 |
< |
/* Allow admins to see actual ips |
765 |
< |
* unless hide_server_ips is enabled |
764 |
> |
/* |
765 |
> |
* Allow admins to see actual ips unless hide_server_ips is enabled |
766 |
|
*/ |
767 |
|
if (!ConfigServerHide.hide_server_ips && IsAdmin(source_p)) |
768 |
|
sendto_one(source_p, form_str(RPL_STATSCLINE), |
830 |
|
|
831 |
|
/* I'm already in big trouble if source_p->localClient is NULL -db */ |
832 |
|
if ((i = verify_access(source_p, username))) |
819 |
– |
{ |
833 |
|
ilog(L_INFO, "Access denied: %s[%s]", |
834 |
|
source_p->name, source_p->sockhost); |
822 |
– |
} |
835 |
|
|
836 |
|
switch (i) |
837 |
|
{ |
826 |
– |
case IRCD_SOCKET_ERROR: |
827 |
– |
exit_client(source_p, &me, "Socket Error"); |
828 |
– |
break; |
829 |
– |
|
838 |
|
case TOO_MANY: |
839 |
|
sendto_realops_flags(UMODE_FULL, L_ALL, |
840 |
|
"Too many on IP for %s (%s).", |
883 |
|
* capture reject code here or rely on the connecting too fast code. |
884 |
|
* - Dianora |
885 |
|
*/ |
886 |
< |
if(REJECT_HOLD_TIME > 0) |
886 |
> |
if (REJECT_HOLD_TIME > 0) |
887 |
|
{ |
888 |
|
sendto_one(source_p, ":%s NOTICE %s :You are not authorized to use this server", |
889 |
|
me.name, source_p->name); |
1024 |
|
ip_found->count++; |
1025 |
|
SetIpHash(client_p); |
1026 |
|
|
1027 |
< |
aconf = (struct AccessItem *)map_to_conf(conf); |
1027 |
> |
aconf = map_to_conf(conf); |
1028 |
|
if (aconf->class_ptr == NULL) |
1029 |
|
return NOT_AUTHORIZED; /* If class is missing, this is best */ |
1030 |
|
|
1031 |
< |
aclass = (struct ClassItem *)map_to_conf(aconf->class_ptr); |
1031 |
> |
aclass = map_to_conf(aconf->class_ptr); |
1032 |
|
|
1033 |
|
count_user_host(client_p->username, client_p->host, |
1034 |
|
&global, &local, &ident); |
1039 |
|
*/ |
1040 |
|
if (MaxTotal(aclass) != 0 && CurrUserCount(aclass) >= MaxTotal(aclass)) |
1041 |
|
a_limit_reached = 1; |
1042 |
< |
else if (MaxPerIp(aclass) != 0 && ip_found->count >= MaxPerIp(aclass)) |
1042 |
> |
else if (MaxPerIp(aclass) != 0 && ip_found->count > MaxPerIp(aclass)) |
1043 |
|
a_limit_reached = 1; |
1044 |
|
else if (MaxLocal(aclass) != 0 && local >= MaxLocal(aclass)) |
1045 |
|
a_limit_reached = 1; |
1052 |
|
if (a_limit_reached) |
1053 |
|
{ |
1054 |
|
if (!IsConfExemptLimits(aconf)) |
1055 |
< |
return TOO_MANY; /* Already at maximum allowed */ |
1055 |
> |
return TOO_MANY; /* Already at maximum allowed */ |
1056 |
|
|
1057 |
|
sendto_one(client_p, |
1058 |
|
":%s NOTICE %s :*** Your connection class is full, " |
1324 |
|
case CLIENT_TYPE: |
1325 |
|
case OPER_TYPE: |
1326 |
|
case SERVER_TYPE: |
1327 |
< |
aconf = (struct AccessItem *)map_to_conf(conf); |
1327 |
> |
aconf = map_to_conf(conf); |
1328 |
> |
|
1329 |
> |
assert(aconf->clients > 0); |
1330 |
> |
|
1331 |
|
if ((aclass_conf = ClassPtr(aconf)) != NULL) |
1332 |
|
{ |
1333 |
< |
aclass = (struct ClassItem *)map_to_conf(aclass_conf); |
1333 |
> |
aclass = map_to_conf(aclass_conf); |
1334 |
> |
|
1335 |
> |
assert(aclass->curr_user_count > 0); |
1336 |
|
|
1337 |
|
if (conf->type == CLIENT_TYPE) |
1338 |
|
remove_from_cidr_check(&client_p->localClient->ip, aclass); |
1339 |
< |
|
1327 |
< |
if (CurrUserCount(aclass) > 0) |
1328 |
< |
aclass->curr_user_count--; |
1329 |
< |
if (MaxTotal(aclass) < 0 && CurrUserCount(aclass) <= 0) |
1339 |
> |
if (--aclass->curr_user_count == 0 && aclass->active == 0) |
1340 |
|
delete_conf_item(aclass_conf); |
1341 |
|
} |
1342 |
|
|
1343 |
< |
/* Please, no ioccc entries - Dianora */ |
1334 |
< |
if (aconf->clients > 0) |
1335 |
< |
--aconf->clients; |
1336 |
< |
if (aconf->clients == 0 && IsConfIllegal(aconf)) |
1343 |
> |
if (--aconf->clients == 0 && IsConfIllegal(aconf)) |
1344 |
|
delete_conf_item(conf); |
1345 |
+ |
|
1346 |
|
break; |
1347 |
+ |
|
1348 |
|
case LEAF_TYPE: |
1349 |
|
case HUB_TYPE: |
1350 |
< |
match_item = (struct MatchItem *)map_to_conf(conf); |
1350 |
> |
match_item = map_to_conf(conf); |
1351 |
|
if (match_item->ref_count == 0 && match_item->illegal) |
1352 |
|
delete_conf_item(conf); |
1353 |
|
break; |
1376 |
|
int |
1377 |
|
attach_conf(struct Client *client_p, struct ConfItem *conf) |
1378 |
|
{ |
1370 |
– |
struct AccessItem *aconf; |
1371 |
– |
struct MatchItem *match_item; |
1372 |
– |
|
1379 |
|
if (dlinkFind(&client_p->localClient->confs, conf) != NULL) |
1380 |
|
return 1; |
1381 |
|
|
1383 |
|
conf->type == SERVER_TYPE || |
1384 |
|
conf->type == OPER_TYPE) |
1385 |
|
{ |
1386 |
< |
aconf = (struct AccessItem *)map_to_conf(conf); |
1386 |
> |
struct AccessItem *aconf = map_to_conf(conf); |
1387 |
> |
struct ClassItem *aclass = map_to_conf(aconf->class_ptr); |
1388 |
|
|
1389 |
|
if (IsConfIllegal(aconf)) |
1390 |
|
return NOT_AUTHORIZED; |
1391 |
|
|
1392 |
|
if (conf->type == CLIENT_TYPE) |
1386 |
– |
{ |
1387 |
– |
struct ClassItem *aclass; |
1388 |
– |
aclass = (struct ClassItem *)map_to_conf(aconf->class_ptr); |
1389 |
– |
|
1393 |
|
if (cidr_limit_reached(IsConfExemptLimits(aconf), |
1394 |
|
&client_p->localClient->ip, aclass)) |
1395 |
< |
return TOO_MANY; /* Already at maximum allowed */ |
1393 |
< |
|
1394 |
< |
CurrUserCount(aclass)++; |
1395 |
< |
} |
1395 |
> |
return TOO_MANY; /* Already at maximum allowed */ |
1396 |
|
|
1397 |
+ |
CurrUserCount(aclass)++; |
1398 |
|
aconf->clients++; |
1399 |
|
} |
1400 |
|
else if (conf->type == HUB_TYPE || conf->type == LEAF_TYPE) |
1401 |
|
{ |
1402 |
< |
match_item = (struct MatchItem *)map_to_conf(conf); |
1402 |
> |
struct MatchItem *match_item = map_to_conf(conf); |
1403 |
|
match_item->ref_count++; |
1404 |
|
} |
1405 |
|
|
1433 |
|
DLINK_FOREACH(ptr, server_items.head) |
1434 |
|
{ |
1435 |
|
conf = ptr->data; |
1436 |
< |
aconf = (struct AccessItem *)map_to_conf(conf); |
1436 |
> |
aconf = map_to_conf(conf); |
1437 |
|
|
1438 |
|
if (match(conf->name, name) == 0 || match(aconf->host, host) == 0) |
1439 |
|
continue; |
1854 |
|
ConfigLoggingEntry.ioerrlog[0] = '\0'; |
1855 |
|
ConfigLoggingEntry.failed_operlog[0] = '\0'; |
1856 |
|
|
1857 |
+ |
ConfigChannel.disable_fake_channels = NO; |
1858 |
|
ConfigChannel.restrict_channels = NO; |
1859 |
|
ConfigChannel.disable_local_channels = NO; |
1860 |
|
ConfigChannel.use_invex = YES; |
1925 |
|
ConfigFileEntry.max_targets = MAX_TARGETS_DEFAULT; |
1926 |
|
ConfigFileEntry.client_flood = CLIENT_FLOOD_DEFAULT; |
1927 |
|
ConfigFileEntry.oper_only_umodes = UMODE_DEBUG; /* XXX */ |
1928 |
< |
ConfigFileEntry.oper_umodes = UMODE_LOCOPS | UMODE_SERVNOTICE | |
1928 |
> |
ConfigFileEntry.oper_umodes = UMODE_BOTS | UMODE_LOCOPS | UMODE_SERVNOTICE | |
1929 |
|
UMODE_OPERWALL | UMODE_WALLOP; /* XXX */ |
1930 |
|
DupString(ConfigFileEntry.servlink_path, SLPATH); |
1931 |
|
#ifdef HAVE_LIBCRYPTO |
1956 |
|
static void |
1957 |
|
read_conf(FBFILE *file) |
1958 |
|
{ |
1959 |
< |
scount = lineno = 0; |
1959 |
> |
lineno = 0; |
1960 |
|
|
1961 |
|
set_default_conf(); /* Set default values prior to conf parsing */ |
1962 |
|
ypass = 1; |
2268 |
|
} |
2269 |
|
} |
2270 |
|
|
2271 |
+ |
dlinkDelete(ptr, tklist); |
2272 |
|
delete_one_address_conf(aconf->host, aconf); |
2270 |
– |
dlinkDelete(ptr, tklist); |
2273 |
|
} |
2274 |
|
} |
2275 |
|
else if (conf->type == XLINE_TYPE || |
2568 |
|
/* XXX This is less than pretty */ |
2569 |
|
if (conf->type == SERVER_TYPE) |
2570 |
|
{ |
2571 |
< |
aconf = (struct AccessItem *)map_to_conf(conf); |
2571 |
> |
aconf = map_to_conf(conf); |
2572 |
> |
|
2573 |
|
if (aconf->clients != 0) |
2574 |
|
{ |
2575 |
|
SetConfIllegal(aconf); |
2582 |
|
} |
2583 |
|
else if (conf->type == OPER_TYPE) |
2584 |
|
{ |
2585 |
< |
aconf = (struct AccessItem *)map_to_conf(conf); |
2585 |
> |
aconf = map_to_conf(conf); |
2586 |
> |
|
2587 |
|
if (aconf->clients != 0) |
2588 |
|
{ |
2589 |
|
SetConfIllegal(aconf); |
2596 |
|
} |
2597 |
|
else if (conf->type == CLIENT_TYPE) |
2598 |
|
{ |
2599 |
< |
aconf = (struct AccessItem *)map_to_conf(conf); |
2599 |
> |
aconf = map_to_conf(conf); |
2600 |
> |
|
2601 |
|
if (aconf->clients != 0) |
2602 |
|
{ |
2603 |
|
SetConfIllegal(aconf); |
2622 |
|
{ |
2623 |
|
if ((conf->type == LEAF_TYPE) || (conf->type == HUB_TYPE)) |
2624 |
|
{ |
2625 |
< |
match_item = (struct MatchItem *)map_to_conf(conf); |
2626 |
< |
if ((match_item->ref_count <= 0)) |
2625 |
> |
match_item = map_to_conf(conf); |
2626 |
> |
if (match_item->ref_count <= 0) |
2627 |
|
delete_conf_item(conf); |
2628 |
|
else |
2629 |
|
{ |
2637 |
|
} |
2638 |
|
} |
2639 |
|
|
2640 |
< |
/* don't delete the class table, rather mark all entries |
2640 |
> |
/* |
2641 |
> |
* don't delete the class table, rather mark all entries |
2642 |
|
* for deletion. The table is cleaned up by check_class. - avalon |
2643 |
|
*/ |
2644 |
|
DLINK_FOREACH(ptr, class_items.head) |
2645 |
|
{ |
2646 |
< |
conf = ptr->data; |
2647 |
< |
cltmp = (struct ClassItem *)map_to_conf(conf); |
2646 |
> |
cltmp = map_to_conf(ptr->data); |
2647 |
> |
|
2648 |
|
if (ptr != class_items.tail) /* never mark the "default" class */ |
2649 |
< |
MaxTotal(cltmp) = -1; |
2649 |
> |
cltmp->active = 0; |
2650 |
|
} |
2651 |
|
|
2652 |
|
clear_out_address_conf(); |
2896 |
|
struct ConfItem *conf; |
2897 |
|
|
2898 |
|
if ((conf = find_exact_name_conf(CLASS_TYPE, classname, NULL, NULL)) != NULL) |
2899 |
< |
return(conf); |
2899 |
> |
return conf; |
2900 |
|
|
2901 |
|
return class_default; |
2902 |
|
} |
2910 |
|
void |
2911 |
|
check_class(void) |
2912 |
|
{ |
2913 |
< |
dlink_node *ptr; |
2908 |
< |
dlink_node *next_ptr; |
2909 |
< |
struct ConfItem *conf; |
2910 |
< |
struct ClassItem *aclass; |
2913 |
> |
dlink_node *ptr = NULL, *next_ptr = NULL; |
2914 |
|
|
2915 |
|
DLINK_FOREACH_SAFE(ptr, next_ptr, class_items.head) |
2916 |
|
{ |
2917 |
< |
conf = ptr->data; |
2915 |
< |
aclass = (struct ClassItem *)map_to_conf(conf); |
2917 |
> |
struct ClassItem *aclass = map_to_conf(ptr->data); |
2918 |
|
|
2919 |
< |
if (MaxTotal(aclass) < 0) |
2919 |
> |
if (!aclass->active) |
2920 |
|
{ |
2921 |
|
destroy_cidr_class(aclass); |
2922 |
< |
if (CurrUserCount(aclass) > 0) |
2923 |
< |
dlinkDelete(&conf->node, &class_items); |
2924 |
< |
else |
2923 |
< |
delete_conf_item(conf); |
2922 |
> |
|
2923 |
> |
if (!CurrUserCount(aclass)) |
2924 |
> |
delete_conf_item(ptr->data); |
2925 |
|
} |
2926 |
|
} |
2927 |
|
} |
2938 |
|
struct ClassItem *aclass; |
2939 |
|
|
2940 |
|
class_default = make_conf_item(CLASS_TYPE); |
2941 |
< |
aclass = (struct ClassItem *)map_to_conf(class_default); |
2941 |
> |
|
2942 |
> |
aclass = map_to_conf(class_default); |
2943 |
> |
aclass->active = 1; |
2944 |
|
DupString(class_default->name, "default"); |
2945 |
|
ConFreq(aclass) = DEFAULT_CONNECTFREQUENCY; |
2946 |
|
PingFreq(aclass) = DEFAULT_PINGFREQUENCY; |
2999 |
|
void |
3000 |
|
conf_add_class_to_conf(struct ConfItem *conf, const char *class_name) |
3001 |
|
{ |
3002 |
< |
struct AccessItem *aconf; |
3003 |
< |
struct ClassItem *aclass; |
3001 |
< |
|
3002 |
< |
aconf = (struct AccessItem *)map_to_conf(conf); |
3002 |
> |
struct AccessItem *aconf = map_to_conf(conf); |
3003 |
> |
struct ClassItem *class = NULL; |
3004 |
|
|
3005 |
|
if (class_name == NULL) |
3006 |
|
{ |
3007 |
|
aconf->class_ptr = class_default; |
3008 |
+ |
|
3009 |
|
if (conf->type == CLIENT_TYPE) |
3010 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, |
3011 |
|
"Warning *** Defaulting to default class for %s@%s", |
3016 |
|
conf->name); |
3017 |
|
} |
3018 |
|
else |
3017 |
– |
{ |
3019 |
|
aconf->class_ptr = find_class(class_name); |
3019 |
– |
} |
3020 |
|
|
3021 |
< |
if (aconf->class_ptr == NULL) |
3021 |
> |
if (aconf->class_ptr) |
3022 |
> |
class = map_to_conf(aconf->class_ptr); |
3023 |
> |
|
3024 |
> |
if (aconf->class_ptr == NULL || !class->active) |
3025 |
|
{ |
3026 |
|
if (conf->type == CLIENT_TYPE) |
3027 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, |
3033 |
|
conf->name); |
3034 |
|
aconf->class_ptr = class_default; |
3035 |
|
} |
3033 |
– |
else |
3034 |
– |
{ |
3035 |
– |
aclass = (struct ClassItem *)map_to_conf(aconf->class_ptr); |
3036 |
– |
if (MaxTotal(aclass) < 0) |
3037 |
– |
{ |
3038 |
– |
aconf->class_ptr = class_default; |
3039 |
– |
} |
3040 |
– |
} |
3036 |
|
} |
3037 |
|
|
3043 |
– |
#define MAXCONFLINKS 150 |
3044 |
– |
|
3038 |
|
/* conf_add_server() |
3039 |
|
* |
3040 |
|
* inputs - pointer to config item |
3043 |
|
* side effects - Add a connect block |
3044 |
|
*/ |
3045 |
|
int |
3046 |
< |
conf_add_server(struct ConfItem *conf, unsigned int lcount, const char *class_name) |
3046 |
> |
conf_add_server(struct ConfItem *conf, const char *class_name) |
3047 |
|
{ |
3048 |
|
struct AccessItem *aconf; |
3049 |
< |
char *orig_host; |
3049 |
> |
struct split_nuh_item nuh; |
3050 |
> |
char conf_user[USERLEN + 1]; |
3051 |
> |
char conf_host[HOSTLEN + 1]; |
3052 |
|
|
3053 |
|
aconf = map_to_conf(conf); |
3054 |
|
|
3055 |
|
conf_add_class_to_conf(conf, class_name); |
3056 |
|
|
3057 |
< |
if (lcount > MAXCONFLINKS || !aconf->host || !conf->name) |
3057 |
> |
if (!aconf->host || !conf->name) |
3058 |
|
{ |
3059 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, "Bad connect block"); |
3060 |
|
ilog(L_WARN, "Bad connect block"); |
3069 |
|
return -1; |
3070 |
|
} |
3071 |
|
|
3072 |
< |
orig_host = aconf->host; |
3073 |
< |
split_nuh(orig_host, NULL, &aconf->user, &aconf->host); |
3074 |
< |
MyFree(orig_host); |
3072 |
> |
nuh.nuhmask = aconf->host; |
3073 |
> |
nuh.nickptr = NULL; |
3074 |
> |
nuh.userptr = conf_user; |
3075 |
> |
nuh.hostptr = conf_host; |
3076 |
> |
|
3077 |
> |
nuh.nicksize = 0; |
3078 |
> |
nuh.usersize = sizeof(conf_user); |
3079 |
> |
nuh.hostsize = sizeof(conf_host); |
3080 |
> |
|
3081 |
> |
split_nuh(&nuh); |
3082 |
> |
|
3083 |
> |
MyFree(aconf->host); |
3084 |
> |
aconf->host = NULL; |
3085 |
> |
|
3086 |
> |
DupString(aconf->user, conf_user); /* somehow username checking for servers |
3087 |
> |
got lost in H6/7, will have to be re-added */ |
3088 |
> |
DupString(aconf->host, conf_host); |
3089 |
> |
|
3090 |
|
lookup_confhost(conf); |
3091 |
|
|
3092 |
|
return 0; |
3446 |
|
{ |
3447 |
|
/* Explicit user@host mask given */ |
3448 |
|
|
3449 |
< |
if(hostp != NULL) /* I'm a little user@host */ |
3449 |
> |
if (hostp != NULL) /* I'm a little user@host */ |
3450 |
|
{ |
3451 |
|
*(hostp++) = '\0'; /* short and squat */ |
3452 |
|
if (*user_host_or_nick) |
3577 |
|
*/ |
3578 |
|
void |
3579 |
|
cluster_a_line(struct Client *source_p, const char *command, |
3580 |
< |
int capab, int cluster_type, const char *pattern, ...) |
3580 |
> |
int capab, int cluster_type, const char *pattern, ...) |
3581 |
|
{ |
3582 |
|
va_list args; |
3583 |
|
char buffer[IRCD_BUFSIZE]; |
3584 |
< |
struct ConfItem *conf; |
3575 |
< |
dlink_node *ptr; |
3584 |
> |
const dlink_node *ptr = NULL; |
3585 |
|
|
3586 |
|
va_start(args, pattern); |
3587 |
|
vsnprintf(buffer, sizeof(buffer), pattern, args); |
3589 |
|
|
3590 |
|
DLINK_FOREACH(ptr, cluster_items.head) |
3591 |
|
{ |
3592 |
< |
conf = ptr->data; |
3592 |
> |
const struct ConfItem *conf = ptr->data; |
3593 |
|
|
3594 |
|
if (conf->flags & cluster_type) |
3586 |
– |
{ |
3595 |
|
sendto_match_servs(source_p, conf->name, CAP_CLUSTER|capab, |
3596 |
|
"%s %s %s", command, conf->name, buffer); |
3589 |
– |
} |
3597 |
|
} |
3598 |
|
} |
3599 |
|
|
3625 |
|
* @ * * * |
3626 |
|
* ! * * * |
3627 |
|
*/ |
3621 |
– |
|
3628 |
|
void |
3629 |
< |
split_nuh(char *mask, char **nick, char **user, char **host) |
3629 |
> |
split_nuh(struct split_nuh_item *const iptr) |
3630 |
|
{ |
3631 |
|
char *p = NULL, *q = NULL; |
3632 |
|
|
3633 |
< |
if ((p = strchr(mask, '!')) != NULL) |
3633 |
> |
if (iptr->nickptr) |
3634 |
> |
strlcpy(iptr->nickptr, "*", iptr->nicksize); |
3635 |
> |
if (iptr->userptr) |
3636 |
> |
strlcpy(iptr->userptr, "*", iptr->usersize); |
3637 |
> |
if (iptr->hostptr) |
3638 |
> |
strlcpy(iptr->hostptr, "*", iptr->hostsize); |
3639 |
> |
|
3640 |
> |
if ((p = strchr(iptr->nuhmask, '!'))) |
3641 |
|
{ |
3642 |
|
*p = '\0'; |
3630 |
– |
if (nick != NULL) |
3631 |
– |
{ |
3632 |
– |
if (*mask != '\0') |
3633 |
– |
*nick = xstrldup(mask, NICKLEN); |
3634 |
– |
else |
3635 |
– |
DupString(*nick, "*"); |
3636 |
– |
} |
3643 |
|
|
3644 |
< |
if ((q = strchr(++p, '@')) != NULL) |
3645 |
< |
{ |
3646 |
< |
*q = '\0'; |
3644 |
> |
if (iptr->nickptr && *iptr->nuhmask != '\0') |
3645 |
> |
strlcpy(iptr->nickptr, iptr->nuhmask, iptr->nicksize); |
3646 |
> |
|
3647 |
> |
if ((q = strchr(++p, '@'))) { |
3648 |
> |
*q++ = '\0'; |
3649 |
|
|
3650 |
|
if (*p != '\0') |
3651 |
< |
*user = xstrldup(p, USERLEN+1); |
3644 |
< |
else |
3645 |
< |
DupString(*user, "*"); |
3651 |
> |
strlcpy(iptr->userptr, p, iptr->usersize); |
3652 |
|
|
3653 |
< |
if (*++q != '\0') |
3654 |
< |
*host = xstrldup(q, HOSTLEN+1); |
3649 |
< |
else |
3650 |
< |
DupString(*host, "*"); |
3653 |
> |
if (*q != '\0') |
3654 |
> |
strlcpy(iptr->hostptr, q, iptr->hostsize); |
3655 |
|
} |
3656 |
|
else |
3657 |
|
{ |
3658 |
|
if (*p != '\0') |
3659 |
< |
*user = xstrldup(p, USERLEN+1); |
3656 |
< |
else |
3657 |
< |
DupString(*user, "*"); |
3658 |
< |
|
3659 |
< |
DupString(*host, "*"); |
3659 |
> |
strlcpy(iptr->userptr, p, iptr->usersize); |
3660 |
|
} |
3661 |
|
} |
3662 |
< |
else /* No ! found so lets look for a user@host */ |
3662 |
> |
else |
3663 |
|
{ |
3664 |
< |
if ((p = strchr(mask, '@')) != NULL) /* if found a @ */ |
3664 |
> |
/* No ! found so lets look for a user@host */ |
3665 |
> |
if ((p = strchr(iptr->nuhmask, '@'))) |
3666 |
|
{ |
3667 |
< |
if (nick != NULL) |
3668 |
< |
DupString(*nick, "*"); |
3668 |
< |
*p = '\0'; |
3667 |
> |
/* if found a @ */ |
3668 |
> |
*p++ = '\0'; |
3669 |
|
|
3670 |
< |
if (*mask != '\0') |
3671 |
< |
*user = xstrldup(mask, USERLEN+1); |
3672 |
< |
else |
3673 |
< |
DupString(*user, "*"); |
3670 |
> |
if (*iptr->nuhmask != '\0') |
3671 |
> |
strlcpy(iptr->userptr, iptr->nuhmask, iptr->usersize); |
3672 |
|
|
3673 |
< |
if (*++p != '\0') |
3674 |
< |
*host = xstrldup(p, HOSTLEN+1); |
3677 |
< |
else |
3678 |
< |
DupString(*host, "*"); |
3673 |
> |
if (*p != '\0') |
3674 |
> |
strlcpy(iptr->hostptr, p, iptr->hostsize); |
3675 |
|
} |
3676 |
< |
else /* no @ found */ |
3676 |
> |
else |
3677 |
|
{ |
3678 |
< |
if (nick != NULL) |
3679 |
< |
{ |
3680 |
< |
if (strpbrk(mask, ".:")) |
3685 |
< |
{ |
3686 |
< |
DupString(*nick, "*"); |
3687 |
< |
*host = xstrldup(mask, HOSTLEN+1); |
3688 |
< |
} |
3689 |
< |
else |
3690 |
< |
{ |
3691 |
< |
*nick = xstrldup(mask, NICKLEN); |
3692 |
< |
DupString(*host, "*"); |
3693 |
< |
} |
3694 |
< |
|
3695 |
< |
DupString(*user, "*"); |
3696 |
< |
} |
3678 |
> |
/* no @ found */ |
3679 |
> |
if (!iptr->nickptr || strpbrk(iptr->nuhmask, ".:")) |
3680 |
> |
strlcpy(iptr->hostptr, iptr->nuhmask, iptr->hostsize); |
3681 |
|
else |
3682 |
< |
{ |
3699 |
< |
DupString(*user, "*"); |
3700 |
< |
*host = xstrldup(mask, HOSTLEN+1); |
3701 |
< |
} |
3682 |
> |
strlcpy(iptr->nickptr, iptr->nuhmask, iptr->nicksize); |
3683 |
|
} |
3684 |
|
} |
3685 |
|
} |
3706 |
|
{ |
3707 |
|
if (flags & mask) |
3708 |
|
*p++ = bit_table[i]; |
3709 |
< |
else if(lowerit) |
3709 |
> |
else if (lowerit) |
3710 |
|
*p++ = ToLower(bit_table[i]); |
3711 |
|
} |
3712 |
|
*p = '\0'; |
3913 |
|
static void |
3914 |
|
destroy_cidr_list(dlink_list *list) |
3915 |
|
{ |
3916 |
< |
dlink_node *ptr = NULL; |
3936 |
< |
dlink_node *next_ptr = NULL; |
3937 |
< |
struct CidrItem *cidr; |
3916 |
> |
dlink_node *ptr = NULL, *next_ptr = NULL; |
3917 |
|
|
3918 |
|
DLINK_FOREACH_SAFE(ptr, next_ptr, list->head) |
3919 |
|
{ |
3941 |
– |
cidr = ptr->data; |
3920 |
|
dlinkDelete(ptr, list); |
3921 |
< |
MyFree(cidr); |
3921 |
> |
MyFree(ptr->data); |
3922 |
|
} |
3923 |
|
} |
3924 |
|
|