| 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> |
| 44 |
|
#include "packet.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()", |
| 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, ServerInfo.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 |
|
} |