Skip to content

Commit

Permalink
tls: remove some warnings (#567)
Browse files Browse the repository at this point in the history
* tls: remove some warnings

* tls: update return codes
  • Loading branch information
alfredh authored Oct 9, 2022
1 parent 562528b commit 7d639d2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
3 changes: 0 additions & 3 deletions src/tls/openssl/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,11 @@ int tls_add_cafile_path(struct tls *tls, const char *cafile,
return EINVAL;

if (capath && !fs_isdir(capath)) {
DEBUG_WARNING("capath is not a directory\n");
return ENOTDIR;
}

/* Load the CAs we trust */
if (!(SSL_CTX_load_verify_locations(tls->ctx, cafile, capath))) {
if (str_isset(cafile))
DEBUG_WARNING("Can't read CA file: %s\n", cafile);

ERR_clear_error();
return ENOENT;
Expand Down
5 changes: 1 addition & 4 deletions src/tls/openssl/tls_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,15 +337,12 @@ int tls_conn_change_cert(struct tls_conn *tc, const char *file)
r = SSL_use_certificate_file(tc->ssl, file, SSL_FILETYPE_PEM);
#endif
if (r <= 0) {
DEBUG_WARNING("change cert: "
"cant't read certificate file: %s\n", file);
ERR_clear_error();
return EINVAL;
return ENOENT;
}

r = SSL_use_PrivateKey_file(tc->ssl, file, SSL_FILETYPE_PEM);
if (r <= 0) {
DEBUG_WARNING("change cert: key missmatch in %s\n", file);
ERR_clear_error();
return EKEYREJECTED;
}
Expand Down

0 comments on commit 7d639d2

Please sign in to comment.