summaryrefslogtreecommitdiff
path: root/src/backend/libpq/be-secure.c
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2009-01-28 15:06:51 +0000
committerMagnus Hagander <magnus@hagander.net>2009-01-28 15:06:51 +0000
commit5ecd9dc75a3dd9c2154be94250361878896fc43c (patch)
tree7b01a22753b431199e4fa73aa38b4f33d6aec37f /src/backend/libpq/be-secure.c
parent473b40d23e5e1699672c3d7f21e36b8da5d355a5 (diff)
Go over all OpenSSL return values and make sure we compare them
to the documented API value. The previous code got it right as it's implemented, but accepted too much/too little compared to the API documentation. Per comment from Zdenek Kotala.
Diffstat (limited to 'src/backend/libpq/be-secure.c')
-rw-r--r--src/backend/libpq/be-secure.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/libpq/be-secure.c b/src/backend/libpq/be-secure.c
index 09019c3f0ff..541ab91f39a 100644
--- a/src/backend/libpq/be-secure.c
+++ b/src/backend/libpq/be-secure.c
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.56.4.3 2007/05/18 01:20:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.56.4.4 2009/01/28 15:06:50 mha Exp $
*
* Since the server static private key ($DataDir/server.key)
* will normally be stored unencrypted so that the database
@@ -715,7 +715,7 @@ initialize_SSL(void)
* Load and verify certificate and private key
*/
snprintf(fnbuf, sizeof(fnbuf), "%s/server.crt", DataDir);
- if (!SSL_CTX_use_certificate_file(SSL_context, fnbuf, SSL_FILETYPE_PEM))
+ if (SSL_CTX_use_certificate_file(SSL_context, fnbuf, SSL_FILETYPE_PEM) != 1)
ereport(FATAL,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("could not load server certificate file \"%s\": %s",
@@ -746,12 +746,12 @@ initialize_SSL(void)
errdetail("File must be owned by the database user and must have no permissions for \"group\" or \"other\".")));
#endif
- if (!SSL_CTX_use_PrivateKey_file(SSL_context, fnbuf, SSL_FILETYPE_PEM))
+ if (SSL_CTX_use_PrivateKey_file(SSL_context, fnbuf, SSL_FILETYPE_PEM) != 1)
ereport(FATAL,
(errmsg("could not load private key file \"%s\": %s",
fnbuf, SSLerrmessage())));
- if (!SSL_CTX_check_private_key(SSL_context))
+ if (SSL_CTX_check_private_key(SSL_context) != 1)
ereport(FATAL,
(errmsg("check of private key failed: %s",
SSLerrmessage())));
@@ -769,7 +769,7 @@ initialize_SSL(void)
* Require and check client certificates only if we have a root.crt file.
*/
snprintf(fnbuf, sizeof(fnbuf), "%s/root.crt", DataDir);
- if (!SSL_CTX_load_verify_locations(SSL_context, fnbuf, NULL))
+ if (SSL_CTX_load_verify_locations(SSL_context, fnbuf, NULL) != 1)
{
/* Not fatal - we do not require client certificates */
ereport(LOG,