| 65 |
|
static char *yy_class_name = NULL; |
| 66 |
|
|
| 67 |
|
static dlink_list col_conf_list = { NULL, NULL, 0 }; |
| 68 |
– |
static dlink_list hub_conf_list = { NULL, NULL, 0 }; |
| 69 |
– |
static dlink_list leaf_conf_list = { NULL, NULL, 0 }; |
| 68 |
|
static unsigned int listener_flags = 0; |
| 69 |
|
static unsigned int regex_ban = 0; |
| 70 |
|
static char userbuf[IRCD_BUFSIZE]; |
| 105 |
|
MyFree(item); |
| 106 |
|
} |
| 107 |
|
|
| 110 |
– |
static void |
| 111 |
– |
unhook_hub_leaf_confs(void) |
| 112 |
– |
{ |
| 113 |
– |
dlink_node *ptr; |
| 114 |
– |
dlink_node *next_ptr; |
| 115 |
– |
struct CollectItem *yy_hconf; |
| 116 |
– |
struct CollectItem *yy_lconf; |
| 117 |
– |
|
| 118 |
– |
DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head) |
| 119 |
– |
{ |
| 120 |
– |
yy_hconf = ptr->data; |
| 121 |
– |
dlinkDelete(&yy_hconf->node, &hub_conf_list); |
| 122 |
– |
free_collect_item(yy_hconf); |
| 123 |
– |
} |
| 124 |
– |
|
| 125 |
– |
DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head) |
| 126 |
– |
{ |
| 127 |
– |
yy_lconf = ptr->data; |
| 128 |
– |
dlinkDelete(&yy_lconf->node, &leaf_conf_list); |
| 129 |
– |
free_collect_item(yy_lconf); |
| 130 |
– |
} |
| 131 |
– |
} |
| 132 |
– |
|
| 108 |
|
%} |
| 109 |
|
|
| 110 |
|
%union { |
| 2041 |
|
{ |
| 2042 |
|
if (conf_parser_ctx.pass == 2) |
| 2043 |
|
{ |
| 2044 |
< |
struct CollectItem *yy_hconf=NULL; |
| 2070 |
< |
struct CollectItem *yy_lconf=NULL; |
| 2071 |
< |
dlink_node *ptr = NULL, *next_ptr = NULL; |
| 2072 |
< |
|
| 2073 |
< |
if (yy_aconf->host && |
| 2074 |
< |
yy_aconf->passwd && yy_aconf->spasswd) |
| 2044 |
> |
if (yy_aconf->host && yy_aconf->passwd && yy_aconf->spasswd) |
| 2045 |
|
{ |
| 2046 |
|
if (conf_add_server(yy_conf, class_name) == -1) |
| 2077 |
– |
{ |
| 2047 |
|
delete_conf_item(yy_conf); |
| 2079 |
– |
yy_conf = NULL; |
| 2080 |
– |
yy_aconf = NULL; |
| 2081 |
– |
} |
| 2048 |
|
} |
| 2049 |
|
else |
| 2050 |
|
{ |
| 2085 |
– |
/* Even if yy_conf ->name is NULL |
| 2086 |
– |
* should still unhook any hub/leaf confs still pending |
| 2087 |
– |
*/ |
| 2088 |
– |
unhook_hub_leaf_confs(); |
| 2089 |
– |
|
| 2051 |
|
if (yy_conf->name != NULL) |
| 2052 |
|
{ |
| 2053 |
|
if (yy_aconf->host == NULL) |
| 2056 |
|
yyerror("Ignoring connect block -- missing password"); |
| 2057 |
|
} |
| 2058 |
|
|
| 2098 |
– |
|
| 2059 |
|
/* XXX |
| 2060 |
|
* This fixes a try_connections() core (caused by invalid class_ptr |
| 2061 |
|
* pointers) reported by metalrock. That's an ugly fix, but there |
| 2064 |
|
* a doubly linked list immediately without any sanity checks! -Michael |
| 2065 |
|
*/ |
| 2066 |
|
delete_conf_item(yy_conf); |
| 2107 |
– |
|
| 2108 |
– |
yy_aconf = NULL; |
| 2109 |
– |
yy_conf = NULL; |
| 2067 |
|
} |
| 2068 |
|
|
| 2069 |
< |
/* |
| 2070 |
< |
* yy_conf is still pointing at the server that is having |
| 2071 |
< |
* a connect block built for it. This means, y_aconf->name |
| 2072 |
< |
* points to the actual irc name this server will be known as. |
| 2116 |
< |
* Now this new server has a set or even just one hub_mask (or leaf_mask) |
| 2117 |
< |
* given in the link list at yy_hconf. Fill in the HUB confs |
| 2118 |
< |
* from this link list now. |
| 2119 |
< |
*/ |
| 2120 |
< |
DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head) |
| 2121 |
< |
{ |
| 2122 |
< |
struct ConfItem *new_hub_conf; |
| 2123 |
< |
struct MatchItem *match_item; |
| 2124 |
< |
|
| 2125 |
< |
yy_hconf = ptr->data; |
| 2126 |
< |
|
| 2127 |
< |
/* yy_conf == NULL is a fatal error for this connect block! */ |
| 2128 |
< |
if ((yy_conf != NULL) && (yy_conf->name != NULL)) |
| 2129 |
< |
{ |
| 2130 |
< |
new_hub_conf = make_conf_item(HUB_TYPE); |
| 2131 |
< |
match_item = (struct MatchItem *)map_to_conf(new_hub_conf); |
| 2132 |
< |
DupString(new_hub_conf->name, yy_conf->name); |
| 2133 |
< |
if (yy_hconf->user != NULL) |
| 2134 |
< |
DupString(match_item->user, yy_hconf->user); |
| 2135 |
< |
else |
| 2136 |
< |
DupString(match_item->user, "*"); |
| 2137 |
< |
if (yy_hconf->host != NULL) |
| 2138 |
< |
DupString(match_item->host, yy_hconf->host); |
| 2139 |
< |
else |
| 2140 |
< |
DupString(match_item->host, "*"); |
| 2141 |
< |
} |
| 2142 |
< |
dlinkDelete(&yy_hconf->node, &hub_conf_list); |
| 2143 |
< |
free_collect_item(yy_hconf); |
| 2144 |
< |
} |
| 2145 |
< |
|
| 2146 |
< |
/* Ditto for the LEAF confs */ |
| 2147 |
< |
|
| 2148 |
< |
DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head) |
| 2149 |
< |
{ |
| 2150 |
< |
struct ConfItem *new_leaf_conf; |
| 2151 |
< |
struct MatchItem *match_item; |
| 2152 |
< |
|
| 2153 |
< |
yy_lconf = ptr->data; |
| 2154 |
< |
|
| 2155 |
< |
if ((yy_conf != NULL) && (yy_conf->name != NULL)) |
| 2156 |
< |
{ |
| 2157 |
< |
new_leaf_conf = make_conf_item(LEAF_TYPE); |
| 2158 |
< |
match_item = (struct MatchItem *)map_to_conf(new_leaf_conf); |
| 2159 |
< |
DupString(new_leaf_conf->name, yy_conf->name); |
| 2160 |
< |
if (yy_lconf->user != NULL) |
| 2161 |
< |
DupString(match_item->user, yy_lconf->user); |
| 2162 |
< |
else |
| 2163 |
< |
DupString(match_item->user, "*"); |
| 2164 |
< |
if (yy_lconf->host != NULL) |
| 2165 |
< |
DupString(match_item->host, yy_lconf->host); |
| 2166 |
< |
else |
| 2167 |
< |
DupString(match_item->host, "*"); |
| 2168 |
< |
} |
| 2169 |
< |
dlinkDelete(&yy_lconf->node, &leaf_conf_list); |
| 2170 |
< |
free_collect_item(yy_lconf); |
| 2171 |
< |
} |
| 2172 |
< |
MyFree(class_name); |
| 2173 |
< |
class_name = NULL; |
| 2174 |
< |
yy_conf = NULL; |
| 2175 |
< |
yy_aconf = NULL; |
| 2069 |
> |
MyFree(class_name); |
| 2070 |
> |
class_name = NULL; |
| 2071 |
> |
yy_conf = NULL; |
| 2072 |
> |
yy_aconf = NULL; |
| 2073 |
|
} |
| 2074 |
|
}; |
| 2075 |
|
|
| 2217 |
|
{ |
| 2218 |
|
if (conf_parser_ctx.pass == 2) |
| 2219 |
|
{ |
| 2220 |
< |
struct CollectItem *yy_tmp; |
| 2220 |
> |
char *mask; |
| 2221 |
|
|
| 2222 |
< |
yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem)); |
| 2223 |
< |
DupString(yy_tmp->host, yylval.string); |
| 2327 |
< |
DupString(yy_tmp->user, "*"); |
| 2328 |
< |
dlinkAdd(yy_tmp, &yy_tmp->node, &hub_conf_list); |
| 2222 |
> |
DupString(mask, yylval.string); |
| 2223 |
> |
dlinkAdd(mask, make_dlink_node(), &yy_aconf->hub_list); |
| 2224 |
|
} |
| 2225 |
|
}; |
| 2226 |
|
|
| 2228 |
|
{ |
| 2229 |
|
if (conf_parser_ctx.pass == 2) |
| 2230 |
|
{ |
| 2231 |
< |
struct CollectItem *yy_tmp; |
| 2231 |
> |
char *mask; |
| 2232 |
|
|
| 2233 |
< |
yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem)); |
| 2234 |
< |
DupString(yy_tmp->host, yylval.string); |
| 2340 |
< |
DupString(yy_tmp->user, "*"); |
| 2341 |
< |
dlinkAdd(yy_tmp, &yy_tmp->node, &leaf_conf_list); |
| 2233 |
> |
DupString(mask, yylval.string); |
| 2234 |
> |
dlinkAdd(mask, make_dlink_node(), &yy_aconf->leaf_list); |
| 2235 |
|
} |
| 2236 |
|
}; |
| 2237 |
|
|