Commit Diff


commit - ef3327d372c159bd2a395d6854843982a5e9c54d
commit + 2fce881d969402642cffff1ee336a37dd404b212
blob - ae9595f99c9b75d366504dc5e25b83f18eeb634d
blob + 8995adbe4f4e8f8344597833c1d6e7627b4d76dc
--- src/ngircd/conn-ssl.c
+++ src/ngircd/conn-ssl.c
@@ -670,12 +670,20 @@ bool
 ConnSSL_GetCipherInfo(CONNECTION *c, char *buf, size_t len)
 {
 #ifdef HAVE_LIBSSL
+	char *nl;
+
 	SSL *ssl;
 	assert(c != NULL);
 	assert(len >= 128);
 	ssl = c->ssl_state.ssl;
-	if (!ssl) return false;
-	return SSL_CIPHER_description(SSL_get_current_cipher(ssl), buf, len) != NULL;
+	if (!ssl)
+		return false;
+	*buf = 0;
+	SSL_CIPHER_description(SSL_get_current_cipher(ssl), buf, len);
+	nl = strchr(buf, '\n');
+	if (nl)
+		*nl = 0;
+	return true;
 #endif
 #ifdef HAVE_LIBGNUTLS
 	assert(c != NULL);
@@ -692,7 +700,7 @@ ConnSSL_GetCipherInfo(CONNECTION *c, char *buf, size_t
 		name_proto = gnutls_protocol_get_name(gnutls_protocol_get_version(sess));
 		name_keyexchange = gnutls_kx_get_name(gnutls_kx_get(sess));
 
-		return snprintf(buf, len, "%s-%s%15s Kx=%s      Enc=%s(%u) Mac=%s\n",
+		return snprintf(buf, len, "%s-%s%15s Kx=%s      Enc=%s(%u) Mac=%s",
 			name_cipher, name_mac, name_proto, name_keyexchange, name_cipher, keysize, name_mac) > 0;
 	}
 	return false;