222 |
|
{ |
223 |
|
if (listing_client_list.head) |
224 |
|
{ |
225 |
< |
dlink_node *ptr = NULL, *ptr_next = NULL; |
226 |
< |
DLINK_FOREACH_SAFE(ptr, ptr_next, listing_client_list.head) |
227 |
< |
safe_list_channels(ptr->data, 0); |
225 |
> |
dlink_node *node = NULL, *node_next = NULL; |
226 |
> |
DLINK_FOREACH_SAFE(node, node_next, listing_client_list.head) |
227 |
> |
safe_list_channels(node->data, 0); |
228 |
|
} |
229 |
|
|
230 |
|
/* Run pending events */ |
321 |
|
|
322 |
|
snprintf(buff, sizeof(buff), "%u\n", pid); |
323 |
|
|
324 |
< |
if ((fputs(buff, fb) == -1)) |
324 |
> |
if (fputs(buff, fb) == -1) |
325 |
|
ilog(LOG_TYPE_IRCD, "Error writing %u to pid file %s (%s)", |
326 |
|
pid, filename, strerror(errno)); |
327 |
|
|
329 |
|
} |
330 |
|
else |
331 |
|
{ |
332 |
< |
ilog(LOG_TYPE_IRCD, "Error opening pid file %s", filename); |
332 |
> |
ilog(LOG_TYPE_IRCD, "Error opening pid file %s (%s)", |
333 |
> |
filename, strerror(errno)); |
334 |
|
} |
335 |
|
} |
336 |
|
|
352 |
|
/* Don't do logging here, since we don't have log() initialised */ |
353 |
|
if ((fb = fopen(filename, "r"))) |
354 |
|
{ |
355 |
< |
if (fgets(buff, 20, fb) == NULL) |
355 |
> |
if (!fgets(buff, 20, fb)) |
356 |
|
{ |
357 |
|
/* log(L_ERROR, "Error reading from pid file %s (%s)", filename, |
358 |
|
* strerror(errno)); |
421 |
|
SSL_load_error_strings(); |
422 |
|
SSLeay_add_ssl_algorithms(); |
423 |
|
|
424 |
< |
if ((ConfigServerInfo.server_ctx = SSL_CTX_new(SSLv23_server_method())) == NULL) |
424 |
> |
if (!(ConfigServerInfo.server_ctx = SSL_CTX_new(SSLv23_server_method()))) |
425 |
|
{ |
426 |
|
const char *s = ERR_lib_error_string(ERR_get_error()); |
427 |
|
|
428 |
|
fprintf(stderr, "ERROR: Could not initialize the SSL Server context -- %s\n", s); |
429 |
< |
ilog(LOG_TYPE_IRCD, "ERROR: Could not initialize the SSL Server context -- %s\n", s); |
429 |
> |
ilog(LOG_TYPE_IRCD, "ERROR: Could not initialize the SSL Server context -- %s", s); |
430 |
|
exit(EXIT_FAILURE); |
431 |
+ |
return; /* Not reached */ |
432 |
|
} |
433 |
|
|
434 |
|
SSL_CTX_set_options(ConfigServerInfo.server_ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TICKET); |
436 |
|
SSL_CTX_set_verify(ConfigServerInfo.server_ctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE, |
437 |
|
always_accept_verify_cb); |
438 |
|
SSL_CTX_set_session_cache_mode(ConfigServerInfo.server_ctx, SSL_SESS_CACHE_OFF); |
439 |
+ |
SSL_CTX_set_cipher_list(ConfigServerInfo.server_ctx, "EECDH+HIGH:EDH+HIGH:HIGH:!aNULL"); |
440 |
|
|
441 |
< |
#if OPENSSL_VERSION_NUMBER >= 0x1000005FL && !defined(OPENSSL_NO_ECDH) |
441 |
> |
#if OPENSSL_VERSION_NUMBER >= 0x009080FFL && !defined(OPENSSL_NO_ECDH) |
442 |
|
{ |
443 |
|
EC_KEY *key = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); |
444 |
|
|
452 |
|
SSL_CTX_set_options(ConfigServerInfo.server_ctx, SSL_OP_SINGLE_ECDH_USE); |
453 |
|
#endif |
454 |
|
|
455 |
< |
if ((ConfigServerInfo.client_ctx = SSL_CTX_new(SSLv23_client_method())) == NULL) |
455 |
> |
if (!(ConfigServerInfo.client_ctx = SSL_CTX_new(SSLv23_client_method()))) |
456 |
|
{ |
457 |
|
const char *s = ERR_lib_error_string(ERR_get_error()); |
458 |
|
|
459 |
|
fprintf(stderr, "ERROR: Could not initialize the SSL Client context -- %s\n", s); |
460 |
< |
ilog(LOG_TYPE_IRCD, "ERROR: Could not initialize the SSL Client context -- %s\n", s); |
460 |
> |
ilog(LOG_TYPE_IRCD, "ERROR: Could not initialize the SSL Client context -- %s", s); |
461 |
|
exit(EXIT_FAILURE); |
462 |
+ |
return; /* Not reached */ |
463 |
|
} |
464 |
|
|
465 |
|
SSL_CTX_set_options(ConfigServerInfo.client_ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TICKET); |
474 |
|
main(int argc, char *argv[]) |
475 |
|
{ |
476 |
|
/* Check to see if the user is running us as root, which is a nono */ |
477 |
< |
if (geteuid() == 0) |
477 |
> |
if (!geteuid()) |
478 |
|
{ |
479 |
|
fprintf(stderr, "ERROR: This server won't run as root/superuser\n"); |
480 |
|
return -1; |
547 |
|
dbuf_init(); |
548 |
|
hash_init(); |
549 |
|
ipcache_init(); |
546 |
– |
init_host_hash(); /* Host-hashtable. */ |
550 |
|
client_init(); |
551 |
|
class_init(); |
552 |
|
whowas_init(); |