40 |
|
#include "irc_res.h" |
41 |
|
#include "restart.h" |
42 |
|
#include "s_auth.h" |
43 |
< |
#include "s_conf.h" |
44 |
< |
#include "s_log.h" |
43 |
> |
#include "conf.h" |
44 |
> |
#include "log.h" |
45 |
|
#include "s_serv.h" |
46 |
|
#include "send.h" |
47 |
|
#include "memory.h" |
129 |
|
{ |
130 |
|
who = (who) ? who : ""; |
131 |
|
|
132 |
< |
sendto_realops_flags(UMODE_DEBUG, level, text, who, strerror(error)); |
133 |
< |
log_oper_action(LOG_IOERR_TYPE, NULL, "%s %s %s\n", who, text, strerror(error)); |
134 |
< |
ilog(L_ERROR, text, who, strerror(error)); |
132 |
> |
sendto_realops_flags(UMODE_DEBUG, level, SEND_NOTICE, |
133 |
> |
text, who, strerror(error)); |
134 |
> |
ilog(LOG_TYPE_IRCD, text, who, strerror(error)); |
135 |
|
} |
136 |
|
|
137 |
|
/* |
177 |
|
void |
178 |
|
close_connection(struct Client *client_p) |
179 |
|
{ |
180 |
< |
struct ConfItem *conf; |
181 |
< |
struct AccessItem *aconf; |
182 |
< |
struct ClassItem *aclass; |
180 |
> |
dlink_node *ptr = NULL; |
181 |
|
|
182 |
< |
assert(NULL != client_p); |
182 |
> |
assert(client_p); |
183 |
|
|
184 |
|
if (!IsDead(client_p)) |
185 |
|
{ |
206 |
|
ServerStats.is_sbr += client_p->localClient->recv.bytes; |
207 |
|
ServerStats.is_sti += CurrentTime - client_p->localClient->firsttime; |
208 |
|
|
209 |
< |
/* XXX Does this even make any sense at all anymore? |
212 |
< |
* scheduling a 'quick' reconnect could cause a pile of |
213 |
< |
* nick collides under TSora protocol... -db |
214 |
< |
*/ |
215 |
< |
/* |
216 |
< |
* If the connection has been up for a long amount of time, schedule |
217 |
< |
* a 'quick' reconnect, else reset the next-connect cycle. |
218 |
< |
*/ |
219 |
< |
if ((conf = find_conf_exact(SERVER_TYPE, client_p->name, |
220 |
< |
client_p->username, client_p->host))) |
209 |
> |
DLINK_FOREACH(ptr, server_items.head) |
210 |
|
{ |
211 |
+ |
struct MaskItem *conf = ptr->data; |
212 |
+ |
|
213 |
+ |
if (irccmp(conf->name, client_p->name)) |
214 |
+ |
continue; |
215 |
+ |
|
216 |
|
/* |
217 |
< |
* Reschedule a faster reconnect, if this was a automatically |
218 |
< |
* connected configuration entry. (Note that if we have had |
225 |
< |
* a rehash in between, the status has been changed to |
226 |
< |
* CONF_ILLEGAL). But only do this if it was a "good" link. |
217 |
> |
* Reset next-connect cycle of all connect{} blocks that match |
218 |
> |
* this servername. |
219 |
|
*/ |
220 |
< |
aconf = map_to_conf(conf); |
229 |
< |
aclass = map_to_conf(aconf->class_ptr); |
230 |
< |
aconf->hold = time(NULL); |
231 |
< |
aconf->hold += (aconf->hold - client_p->localClient->since > HANGONGOODLINK) ? |
232 |
< |
HANGONRETRYDELAY : ConFreq(aclass); |
220 |
> |
conf->until = CurrentTime + conf->class->con_freq; |
221 |
|
} |
222 |
|
} |
223 |
|
else |
235 |
|
if (client_p->localClient->fd.flags.open) |
236 |
|
fd_close(&client_p->localClient->fd); |
237 |
|
|
250 |
– |
if (HasServlink(client_p)) |
251 |
– |
{ |
252 |
– |
if (client_p->localClient->ctrlfd.flags.open) |
253 |
– |
fd_close(&client_p->localClient->ctrlfd); |
254 |
– |
} |
255 |
– |
|
238 |
|
dbuf_clear(&client_p->localClient->buf_sendq); |
239 |
|
dbuf_clear(&client_p->localClient->buf_recvq); |
240 |
|
|
241 |
|
MyFree(client_p->localClient->passwd); |
242 |
< |
detach_conf(client_p, CONF_TYPE); |
242 |
> |
detach_conf(client_p, CONF_CLIENT|CONF_OPER|CONF_SERVER); |
243 |
|
client_p->from = NULL; /* ...this should catch them! >:) --msa */ |
244 |
|
} |
245 |
|
|
271 |
|
return; |
272 |
|
} |
273 |
|
|
274 |
< |
execute_callback(auth_cb, client_p); |
274 |
> |
start_auth(client_p); |
275 |
|
} |
276 |
|
#endif |
277 |
|
|
302 |
|
sizeof(new_client->sockhost), NULL, 0, NI_NUMERICHOST); |
303 |
|
new_client->localClient->aftype = new_client->localClient->ip.ss.ss_family; |
304 |
|
|
305 |
+ |
#ifdef HAVE_LIBGEOIP |
306 |
+ |
/* XXX IPV6 SUPPORT XXX */ |
307 |
+ |
if (irn->ss.ss_family == AF_INET && geoip_ctx) |
308 |
+ |
{ |
309 |
+ |
const struct sockaddr_in *v4 = (const struct sockaddr_in *)&new_client->localClient->ip; |
310 |
+ |
new_client->localClient->country_id = GeoIP_id_by_ipnum(geoip_ctx, (unsigned long)ntohl(v4->sin_addr.s_addr)); |
311 |
+ |
} |
312 |
+ |
#endif |
313 |
+ |
|
314 |
|
if (new_client->sockhost[0] == ':' && new_client->sockhost[1] == ':') |
315 |
|
{ |
316 |
|
strlcpy(new_client->host, "0", sizeof(new_client->host)); |
329 |
|
{ |
330 |
|
if ((new_client->localClient->fd.ssl = SSL_new(ServerInfo.server_ctx)) == NULL) |
331 |
|
{ |
332 |
< |
ilog(L_CRIT, "SSL_new() ERROR! -- %s", |
332 |
> |
ilog(LOG_TYPE_IRCD, "SSL_new() ERROR! -- %s", |
333 |
|
ERR_error_string(ERR_get_error(), NULL)); |
334 |
|
|
335 |
|
SetDead(new_client); |
342 |
|
} |
343 |
|
else |
344 |
|
#endif |
345 |
< |
execute_callback(auth_cb, new_client); |
345 |
> |
start_auth(new_client); |
346 |
|
} |
347 |
|
|
348 |
|
/* |