diff options
author | Valentin Vidic <Valentin.Vidic@CARNet.hr> | 2016-02-15 15:28:41 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-10-17 23:05:36 +0100 |
commit | b2e54eb834e2d5a79d03f12a818d68f82c0e3d13 (patch) | |
tree | b277fac53e14c5b156c45239ad1d92fc39016265 /apps/s_client.c | |
parent | 6215f27a83c6b9089a217dd6deab1665e0ced516 (diff) |
Add Postgres support to -starttls
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'apps/s_client.c')
-rw-r--r-- | apps/s_client.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/apps/s_client.c b/apps/s_client.c index 0442aecf96..c2a00f539d 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -739,7 +739,8 @@ typedef enum PROTOCOL_choice { PROTO_XMPP, PROTO_XMPP_SERVER, PROTO_CONNECT, - PROTO_IRC + PROTO_IRC, + PROTO_POSTGRES } PROTOCOL_CHOICE; static const OPT_PAIR services[] = { @@ -751,6 +752,7 @@ static const OPT_PAIR services[] = { {"xmpp-server", PROTO_XMPP_SERVER}, {"telnet", PROTO_TELNET}, {"irc", PROTO_IRC}, + {"postgres", PROTO_POSTGRES}, {NULL, 0} }; @@ -2084,6 +2086,25 @@ int s_client_main(int argc, char **argv) goto shut; } } + break; + case PROTO_POSTGRES: + { + static const unsigned char ssl_request[] = { + /* Length SSLRequest */ + 0, 0, 0, 8, 4, 210, 22, 47 + }; + int bytes; + + /* Send SSLRequest packet */ + BIO_write(sbio, ssl_request, 8); + (void)BIO_flush(sbio); + + /* Reply will be a single S if SSL is enabled */ + bytes = BIO_read(sbio, sbuf, BUFSIZZ); + if (bytes != 1 || sbuf[0] != 'S') + goto shut; + } + break; } for (;;) { |