diff options
author | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2015-05-19 02:22:55 +0000 |
---|---|---|
committer | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2015-05-19 02:22:55 +0000 |
commit | 72b9a3131af06ce49232e5ed693fa58fc1f3ab9e (patch) | |
tree | 0c87579155d936f89462487d836a14b466e9d26c /cups/tlscheck.c | |
parent | 79a373262641162b3d88362352fc5b41385aad18 (diff) | |
download | cups-72b9a3131af06ce49232e5ed693fa58fc1f3ab9e.tar.gz |
Add TLS version.
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12636 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'cups/tlscheck.c')
-rw-r--r-- | cups/tlscheck.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/cups/tlscheck.c b/cups/tlscheck.c index b3cd5a595..05411cc5e 100644 --- a/cups/tlscheck.c +++ b/cups/tlscheck.c @@ -34,6 +34,7 @@ main(int argc, /* I - Number of command-line arguments */ const char *server = argv[1]; /* Hostname from command-line */ int port = 631; /* Port number */ const char *cipherName = "UNKNOWN";/* Cipher suite name */ + int tlsVersion = 0; /* TLS version number */ if (argc < 2 || argc > 3) @@ -55,6 +56,7 @@ main(int argc, /* I - Number of command-line arguments */ } #ifdef __APPLE__ + SSLProtocol protocol; SSLCipherSuite cipher; char unknownCipherName[256]; int paramsNeeded = 0; @@ -62,6 +64,32 @@ main(int argc, /* I - Number of command-line arguments */ size_t paramsLen; OSStatus err; + if ((err = SSLGetNegotiatedProtocolVersion(http->tls, &protocol)) != noErr) + { + printf("%s: ERROR (No protocol version - %d)\n", server, (int)err); + httpClose(http); + return (1); + } + + switch (protocol) + { + default : + tlsVersion = 0; + break; + case kSSLProtocol3 : + tlsVersion = 30; + break; + case kTLSProtocol1 : + tlsVersion = 10; + break; + case kTLSProtocol11 : + tlsVersion = 11; + break; + case kTLSProtocol12 : + tlsVersion = 12; + break; + } + if ((err = SSLGetNegotiatedCipher(http->tls, &cipher)) != noErr) { printf("%s: ERROR (No cipher suite - %d)\n", server, (int)err); @@ -411,7 +439,7 @@ main(int argc, /* I - Number of command-line arguments */ } #endif /* __APPLE__ */ - printf("%s: OK (%s)\n", server, cipherName); + printf("%s: OK (%d.%d, %s)\n", server, tlsVersion / 10, tlsVersion % 10, cipherName); httpClose(http); |