| 25 |
|
*/ |
| 26 |
|
|
| 27 |
|
#include "stdinc.h" |
| 28 |
+ |
#ifdef HAVE_LIBCRYPTO |
| 29 |
+ |
#include "rsa.h" |
| 30 |
+ |
#endif |
| 31 |
|
#include <netinet/in_systm.h> |
| 32 |
|
#include <netinet/ip.h> |
| 33 |
|
#include <netinet/tcp.h> |
| 42 |
|
#include "listener.h" |
| 43 |
|
#include "numeric.h" |
| 44 |
|
#include "packet.h" |
| 45 |
< |
#include "irc_res.h" |
| 45 |
> |
#include "res.h" |
| 46 |
|
#include "restart.h" |
| 47 |
< |
#include "s_auth.h" |
| 47 |
> |
#include "auth.h" |
| 48 |
|
#include "conf.h" |
| 49 |
|
#include "log.h" |
| 50 |
< |
#include "s_serv.h" |
| 50 |
> |
#include "server.h" |
| 51 |
|
#include "send.h" |
| 52 |
|
#include "memory.h" |
| 53 |
< |
#include "s_user.h" |
| 53 |
> |
#include "user.h" |
| 54 |
|
|
| 55 |
|
|
| 56 |
|
static const char *comm_err_str[] = { "Comm OK", "Error during bind()", |
| 73 |
|
int v6; |
| 74 |
|
|
| 75 |
|
if ((v6 = socket(AF_INET6, SOCK_STREAM, 0)) < 0) |
| 76 |
< |
ServerInfo.can_use_v6 = 0; |
| 76 |
> |
ConfigServerInfo.can_use_v6 = 0; |
| 77 |
|
else |
| 78 |
|
{ |
| 79 |
< |
ServerInfo.can_use_v6 = 1; |
| 79 |
> |
ConfigServerInfo.can_use_v6 = 1; |
| 80 |
|
close(v6); |
| 81 |
|
} |
| 82 |
|
#else |
| 83 |
< |
ServerInfo.can_use_v6 = 0; |
| 83 |
> |
ConfigServerInfo.can_use_v6 = 0; |
| 84 |
|
#endif |
| 85 |
|
} |
| 86 |
|
|
| 272 |
|
if ((cert = SSL_get_peer_certificate(client_p->localClient->fd.ssl))) |
| 273 |
|
{ |
| 274 |
|
int res = SSL_get_verify_result(client_p->localClient->fd.ssl); |
| 275 |
< |
char buf[EVP_MAX_MD_SIZE * 2 + 1] = { '\0' }; |
| 276 |
< |
unsigned char md[EVP_MAX_MD_SIZE] = { '\0' }; |
| 275 |
> |
char buf[EVP_MAX_MD_SIZE * 2 + 1] = ""; |
| 276 |
> |
unsigned char md[EVP_MAX_MD_SIZE] = ""; |
| 277 |
|
|
| 278 |
|
if (res == X509_V_OK || res == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN || |
| 279 |
|
res == X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE || |
| 280 |
|
res == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) |
| 281 |
|
{ |
| 282 |
< |
unsigned int i = 0, n = 0; |
| 282 |
> |
unsigned int n = 0; |
| 283 |
|
|
| 284 |
< |
if (X509_digest(cert, EVP_sha256(), md, &n)) |
| 284 |
> |
if (X509_digest(cert, ConfigServerInfo.message_digest_algorithm, md, &n)) |
| 285 |
|
{ |
| 286 |
< |
for (; i < n; ++i) |
| 284 |
< |
snprintf(buf + 2 * i, 3, "%02X", md[i]); |
| 286 |
> |
binary_to_hex(md, buf, n); |
| 287 |
|
client_p->certfp = xstrdup(buf); |
| 288 |
|
} |
| 289 |
|
} |
| 349 |
|
#ifdef HAVE_LIBCRYPTO |
| 350 |
|
if (listener->flags & LISTENER_SSL) |
| 351 |
|
{ |
| 352 |
< |
if ((client_p->localClient->fd.ssl = SSL_new(ServerInfo.server_ctx)) == NULL) |
| 352 |
> |
if ((client_p->localClient->fd.ssl = SSL_new(ConfigServerInfo.server_ctx)) == NULL) |
| 353 |
|
{ |
| 354 |
|
ilog(LOG_TYPE_IRCD, "SSL_new() ERROR! -- %s", |
| 355 |
|
ERR_error_string(ERR_get_error(), NULL)); |