Imported Upstream version 1.4.16+git20130902
This commit is contained in:
parent
e76be63abf
commit
e70fb8c051
517 changed files with 44015 additions and 43295 deletions
|
@ -45,6 +45,10 @@ int np_net_ssl_init_with_hostname(int sd, char *host_name) {
|
|||
}
|
||||
|
||||
int np_net_ssl_init_with_hostname_and_version(int sd, char *host_name, int version) {
|
||||
return np_net_ssl_init_with_hostname_version_and_cert(sd, host_name, version, NULL, NULL);
|
||||
}
|
||||
|
||||
int np_net_ssl_init_with_hostname_version_and_cert(int sd, char *host_name, int version, char *cert, char *privkey) {
|
||||
const SSL_METHOD *method = NULL;
|
||||
|
||||
switch (version) {
|
||||
|
@ -80,9 +84,18 @@ int np_net_ssl_init_with_hostname_and_version(int sd, char *host_name, int versi
|
|||
printf("%s\n", _("CRITICAL - Cannot create SSL context."));
|
||||
return STATE_CRITICAL;
|
||||
}
|
||||
if (cert && privkey) {
|
||||
SSL_CTX_use_certificate_file(c, cert, SSL_FILETYPE_PEM);
|
||||
SSL_CTX_use_PrivateKey_file(c, privkey, SSL_FILETYPE_PEM);
|
||||
if (!SSL_CTX_check_private_key(c)) {
|
||||
printf ("%s\n", _("CRITICAL - Private key does not seem to match certificate!\n"));
|
||||
return STATE_CRITICAL;
|
||||
}
|
||||
}
|
||||
#ifdef SSL_OP_NO_TICKET
|
||||
SSL_CTX_set_options(c, SSL_OP_NO_TICKET);
|
||||
#endif
|
||||
SSL_CTX_set_mode(c, SSL_MODE_AUTO_RETRY);
|
||||
if ((s = SSL_new(c)) != NULL) {
|
||||
#ifdef SSL_set_tlsext_host_name
|
||||
if (host_name != NULL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue