| 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 |
| 725 |
|
conf->name, PingFreq(classitem), |
| 726 |
|
ConFreq(classitem), |
| 727 |
|
MaxTotal(classitem), MaxSendq(classitem), |
| 728 |
< |
CurrUserCount(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))) |
| 830 |
– |
{ |
| 833 |
|
ilog(L_INFO, "Access denied: %s[%s]", |
| 834 |
|
source_p->name, source_p->sockhost); |
| 833 |
– |
} |
| 835 |
|
|
| 836 |
|
switch (i) |
| 837 |
|
{ |
| 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); |
| 1325 |
|
case OPER_TYPE: |
| 1326 |
|
case SERVER_TYPE: |
| 1327 |
|
aconf = map_to_conf(conf); |
| 1328 |
+ |
|
| 1329 |
+ |
/* Please, no ioccc entries - Dianora */ |
| 1330 |
+ |
if (aconf->clients > 0) |
| 1331 |
+ |
--aconf->clients; |
| 1332 |
+ |
if (aconf->clients == 0 && IsConfIllegal(aconf)) |
| 1333 |
+ |
delete_conf_item(conf); |
| 1334 |
+ |
|
| 1335 |
|
if ((aclass_conf = ClassPtr(aconf)) != NULL) |
| 1336 |
|
{ |
| 1337 |
|
aclass = map_to_conf(aclass_conf); |
| 1338 |
|
|
| 1339 |
|
if (conf->type == CLIENT_TYPE) |
| 1340 |
|
remove_from_cidr_check(&client_p->localClient->ip, aclass); |
| 1341 |
< |
|
| 1342 |
< |
if (CurrUserCount(aclass) > 0) |
| 1343 |
< |
aclass->curr_user_count--; |
| 1336 |
< |
if (MaxTotal(aclass) < 0 && CurrUserCount(aclass) <= 0) |
| 1341 |
> |
if (aclass->curr_user_count > 0) |
| 1342 |
> |
--aclass->curr_user_count; |
| 1343 |
> |
if (aclass->active == 0 && aclass->curr_user_count <= 0) |
| 1344 |
|
delete_conf_item(aclass_conf); |
| 1345 |
|
} |
| 1346 |
|
|
| 1340 |
– |
/* Please, no ioccc entries - Dianora */ |
| 1341 |
– |
if (aconf->clients > 0) |
| 1342 |
– |
--aconf->clients; |
| 1343 |
– |
if (aconf->clients == 0 && IsConfIllegal(aconf)) |
| 1344 |
– |
delete_conf_item(conf); |
| 1347 |
|
break; |
| 1348 |
|
|
| 1349 |
|
case LEAF_TYPE: |
| 2569 |
|
/* XXX This is less than pretty */ |
| 2570 |
|
if (conf->type == SERVER_TYPE) |
| 2571 |
|
{ |
| 2572 |
< |
aconf = (struct AccessItem *)map_to_conf(conf); |
| 2572 |
> |
aconf = map_to_conf(conf); |
| 2573 |
> |
|
| 2574 |
|
if (aconf->clients != 0) |
| 2575 |
|
{ |
| 2576 |
|
SetConfIllegal(aconf); |
| 2583 |
|
} |
| 2584 |
|
else if (conf->type == OPER_TYPE) |
| 2585 |
|
{ |
| 2586 |
< |
aconf = (struct AccessItem *)map_to_conf(conf); |
| 2586 |
> |
aconf = map_to_conf(conf); |
| 2587 |
> |
|
| 2588 |
|
if (aconf->clients != 0) |
| 2589 |
|
{ |
| 2590 |
|
SetConfIllegal(aconf); |
| 2597 |
|
} |
| 2598 |
|
else if (conf->type == CLIENT_TYPE) |
| 2599 |
|
{ |
| 2600 |
< |
aconf = (struct AccessItem *)map_to_conf(conf); |
| 2600 |
> |
aconf = map_to_conf(conf); |
| 2601 |
> |
|
| 2602 |
|
if (aconf->clients != 0) |
| 2603 |
|
{ |
| 2604 |
|
SetConfIllegal(aconf); |
| 2623 |
|
{ |
| 2624 |
|
if ((conf->type == LEAF_TYPE) || (conf->type == HUB_TYPE)) |
| 2625 |
|
{ |
| 2626 |
< |
match_item = (struct MatchItem *)map_to_conf(conf); |
| 2627 |
< |
if ((match_item->ref_count <= 0)) |
| 2626 |
> |
match_item = map_to_conf(conf); |
| 2627 |
> |
if (match_item->ref_count <= 0) |
| 2628 |
|
delete_conf_item(conf); |
| 2629 |
|
else |
| 2630 |
|
{ |
| 2638 |
|
} |
| 2639 |
|
} |
| 2640 |
|
|
| 2641 |
< |
/* don't delete the class table, rather mark all entries |
| 2641 |
> |
/* |
| 2642 |
> |
* don't delete the class table, rather mark all entries |
| 2643 |
|
* for deletion. The table is cleaned up by check_class. - avalon |
| 2644 |
|
*/ |
| 2645 |
|
DLINK_FOREACH(ptr, class_items.head) |
| 2646 |
|
{ |
| 2647 |
< |
conf = ptr->data; |
| 2648 |
< |
cltmp = (struct ClassItem *)map_to_conf(conf); |
| 2647 |
> |
cltmp = map_to_conf(ptr->data); |
| 2648 |
> |
|
| 2649 |
|
if (ptr != class_items.tail) /* never mark the "default" class */ |
| 2650 |
< |
MaxTotal(cltmp) = -1; |
| 2650 |
> |
cltmp->active = 0; |
| 2651 |
|
} |
| 2652 |
|
|
| 2653 |
|
clear_out_address_conf(); |
| 2897 |
|
struct ConfItem *conf; |
| 2898 |
|
|
| 2899 |
|
if ((conf = find_exact_name_conf(CLASS_TYPE, classname, NULL, NULL)) != NULL) |
| 2900 |
< |
return(conf); |
| 2900 |
> |
return conf; |
| 2901 |
|
|
| 2902 |
|
return class_default; |
| 2903 |
|
} |
| 2911 |
|
void |
| 2912 |
|
check_class(void) |
| 2913 |
|
{ |
| 2914 |
< |
dlink_node *ptr; |
| 2909 |
< |
dlink_node *next_ptr; |
| 2910 |
< |
struct ConfItem *conf; |
| 2911 |
< |
struct ClassItem *aclass; |
| 2914 |
> |
dlink_node *ptr = NULL, *next_ptr = NULL; |
| 2915 |
|
|
| 2916 |
|
DLINK_FOREACH_SAFE(ptr, next_ptr, class_items.head) |
| 2917 |
|
{ |
| 2918 |
< |
conf = ptr->data; |
| 2916 |
< |
aclass = (struct ClassItem *)map_to_conf(conf); |
| 2918 |
> |
struct ClassItem *aclass = map_to_conf(ptr->data); |
| 2919 |
|
|
| 2920 |
< |
if (MaxTotal(aclass) < 0) |
| 2920 |
> |
if (!aclass->active) |
| 2921 |
|
{ |
| 2922 |
|
destroy_cidr_class(aclass); |
| 2923 |
< |
if (CurrUserCount(aclass) > 0) |
| 2924 |
< |
dlinkDelete(&conf->node, &class_items); |
| 2925 |
< |
else |
| 2924 |
< |
delete_conf_item(conf); |
| 2923 |
> |
|
| 2924 |
> |
if (!CurrUserCount(aclass)) |
| 2925 |
> |
delete_conf_item(ptr->data); |
| 2926 |
|
} |
| 2927 |
|
} |
| 2928 |
|
} |
| 2939 |
|
struct ClassItem *aclass; |
| 2940 |
|
|
| 2941 |
|
class_default = make_conf_item(CLASS_TYPE); |
| 2942 |
< |
aclass = (struct ClassItem *)map_to_conf(class_default); |
| 2942 |
> |
|
| 2943 |
> |
aclass = map_to_conf(class_default); |
| 2944 |
> |
aclass->active = 1; |
| 2945 |
|
DupString(class_default->name, "default"); |
| 2946 |
|
ConFreq(aclass) = DEFAULT_CONNECTFREQUENCY; |
| 2947 |
|
PingFreq(aclass) = DEFAULT_PINGFREQUENCY; |
| 3000 |
|
void |
| 3001 |
|
conf_add_class_to_conf(struct ConfItem *conf, const char *class_name) |
| 3002 |
|
{ |
| 3003 |
< |
struct AccessItem *aconf; |
| 3004 |
< |
struct ClassItem *aclass; |
| 3002 |
< |
|
| 3003 |
< |
aconf = (struct AccessItem *)map_to_conf(conf); |
| 3003 |
> |
struct AccessItem *aconf = map_to_conf(conf); |
| 3004 |
> |
struct ClassItem *class = NULL; |
| 3005 |
|
|
| 3006 |
|
if (class_name == NULL) |
| 3007 |
|
{ |
| 3008 |
|
aconf->class_ptr = class_default; |
| 3009 |
+ |
|
| 3010 |
|
if (conf->type == CLIENT_TYPE) |
| 3011 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 3012 |
|
"Warning *** Defaulting to default class for %s@%s", |
| 3017 |
|
conf->name); |
| 3018 |
|
} |
| 3019 |
|
else |
| 3018 |
– |
{ |
| 3020 |
|
aconf->class_ptr = find_class(class_name); |
| 3020 |
– |
} |
| 3021 |
|
|
| 3022 |
< |
if (aconf->class_ptr == NULL) |
| 3022 |
> |
if (aconf->class_ptr) |
| 3023 |
> |
class = map_to_conf(aconf->class_ptr); |
| 3024 |
> |
|
| 3025 |
> |
if (aconf->class_ptr == NULL || !class->active) |
| 3026 |
|
{ |
| 3027 |
|
if (conf->type == CLIENT_TYPE) |
| 3028 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 3034 |
|
conf->name); |
| 3035 |
|
aconf->class_ptr = class_default; |
| 3036 |
|
} |
| 3034 |
– |
else |
| 3035 |
– |
{ |
| 3036 |
– |
aclass = (struct ClassItem *)map_to_conf(aconf->class_ptr); |
| 3037 |
– |
if (MaxTotal(aclass) < 0) |
| 3038 |
– |
{ |
| 3039 |
– |
aconf->class_ptr = class_default; |
| 3040 |
– |
} |
| 3041 |
– |
} |
| 3037 |
|
} |
| 3038 |
|
|
| 3044 |
– |
#define MAXCONFLINKS 150 |
| 3045 |
– |
|
| 3039 |
|
/* conf_add_server() |
| 3040 |
|
* |
| 3041 |
|
* inputs - pointer to config item |
| 3914 |
|
static void |
| 3915 |
|
destroy_cidr_list(dlink_list *list) |
| 3916 |
|
{ |
| 3917 |
< |
dlink_node *ptr = NULL; |
| 3925 |
< |
dlink_node *next_ptr = NULL; |
| 3926 |
< |
struct CidrItem *cidr; |
| 3917 |
> |
dlink_node *ptr = NULL, *next_ptr = NULL; |
| 3918 |
|
|
| 3919 |
|
DLINK_FOREACH_SAFE(ptr, next_ptr, list->head) |
| 3920 |
|
{ |
| 3930 |
– |
cidr = ptr->data; |
| 3921 |
|
dlinkDelete(ptr, list); |
| 3922 |
< |
MyFree(cidr); |
| 3922 |
> |
MyFree(ptr->data); |
| 3923 |
|
} |
| 3924 |
|
} |
| 3925 |
|
|