]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Don't strip the first letter from the cipher description
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sun, 25 Mar 2018 08:46:24 +0000 (09:46 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sun, 25 Mar 2018 08:46:30 +0000 (09:46 +0100)
src/lib/tls/session.c

index 3d1f9eca8596e5ffe7d39f90f9b7467bc157dabe..3bd9e77d9fa9bc54942f5fd5e247acae84edc01e 100644 (file)
@@ -1301,23 +1301,22 @@ int tls_session_handshake(REQUEST *request, tls_session_t *session)
 
                char cipher_desc[256], cipher_desc_clean[256];
                char *p = cipher_desc, *q = cipher_desc_clean;
-               bool space = false;
 
                cipher = SSL_get_current_cipher(session->ssl);
                SSL_CIPHER_description(cipher, cipher_desc, sizeof(cipher_desc));
                /*
                 *      Cleanup the output from OpenSSL
+                *      Seems to print info in a tabular format.
                 */
-               while (*p++ != '\0') {
-                       if (*p == ' ') {
-                               if (space) continue;
-                               space = true;
-                       } else {
-                               space = false;
+               while (*p != '\0') {
+                       if (isspace(*p)) {
+                               *q++ = *p;
+                               while (isspace(*++p));
+                               continue;
                        }
-                       *q++ = *p;
+                       *q++ = *p++;
                }
-               q[0] = '\0';
+               *q = '\0';
 
                RDEBUG2("Cipher suite: %s", cipher_desc_clean);
 #if OPENSSL_VERSION_NUMBER >= 0x10001000L