summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorBruce Momjian2000-08-30 14:54:24 +0000
committerBruce Momjian2000-08-30 14:54:24 +0000
commit7bc654bb16dc08153060c8ddc1e0f3786026a483 (patch)
tree5b9ae9cc8cb21a2ceb3e0db714a404ee96cfc4b1 /src/bin
parent3498ea830828feb8c5f6cf155a40df012cbc6d64 (diff)
SSL patch from Magnus
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/psql/startup.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index 88ef5865afd..0f36e30ef8c 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -3,7 +3,7 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
- * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.34 2000/07/02 15:21:17 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.35 2000/08/30 14:54:23 momjian Exp $
*/
#include "postgres.h"
@@ -81,6 +81,10 @@ static void
static void
showVersion(void);
+#ifdef USE_SSL
+static void
+ printSSLInfo(void);
+#endif
/*
@@ -263,7 +267,9 @@ main(int argc, char *argv[])
" \\g or terminate with semicolon to execute query\n"
" \\q to quit\n\n", pset.progname);
}
-
+#ifdef USE_SSL
+ printSSLInfo();
+#endif
SetVariable(pset.vars, "PROMPT1", DEFAULT_PROMPT1);
SetVariable(pset.vars, "PROMPT2", DEFAULT_PROMPT2);
SetVariable(pset.vars, "PROMPT3", DEFAULT_PROMPT3);
@@ -639,3 +645,27 @@ showVersion(void)
puts("Read the file COPYRIGHT or use the command \\copyright to see the");
puts("usage and distribution terms.");
}
+
+
+
+/*
+ * printSSLInfo
+ *
+ * Prints information about the current SSL connection, if SSL is in use
+ */
+#ifdef USE_SSL
+static void
+printSSLInfo(void)
+{
+ int sslbits = -1;
+ SSL *ssl;
+
+ ssl = PQgetssl(pset.db);
+ if (!ssl)
+ return; /* no SSL */
+
+ SSL_get_cipher_bits(ssl, &sslbits);
+ printf("SSL enabled connection. Chiper: %s, bits: %i\n\n",
+ SSL_get_cipher(ssl),sslbits);
+}
+#endif