summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2013-08-31 14:15:09 +0200
committerAlexander Barton <alex@barton.de>2013-08-31 14:15:24 +0200
commit04b947cdc3ad1f3370aae2ba2e7308587bea0dda (patch)
treea02a17b5bada9a2ee629a27ba6f65621b93fc791
parentbe2e611680834cf469c31ff0a230f1bf6d55c554 (diff)
downloadngircd-04b947cdc3ad1f3370aae2ba2e7308587bea0dda.tar.gz
ngircd-04b947cdc3ad1f3370aae2ba2e7308587bea0dda.zip
Show connection flag "s" (SSL) in RPL_TRACE{LINK|SERVER}
Now you can check if a server-to-server link is SSL-encrypted or not
using the IRC "TRACE" command.

Idea by Götz Hoffart, thanks!
-rw-r--r--src/ngircd/irc.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/ngircd/irc.c b/src/ngircd/irc.c
index d1e1d41a..968bcea6 100644
--- a/src/ngircd/irc.c
+++ b/src/ngircd/irc.c
@@ -450,6 +450,12 @@ Help(CLIENT *Client, const char *Topic)
 	return CONNECTED;
 }
 
+/**
+ * Get pointer to a static string representing the connection "options".
+ *
+ * @param Idx Connection index.
+ * @return Pointer to static (global) string buffer.
+ */
 static char *
 #ifdef ZLIB
 Option_String(CONN_ID Idx)
@@ -460,16 +466,22 @@ Option_String(UNUSED CONN_ID Idx)
 	static char option_txt[8];
 #ifdef ZLIB
 	UINT16 options;
-
-	options = Conn_Options(Idx);
 #endif
 
+	assert(Idx != NONE);
+
+	options = Conn_Options(Idx);
 	strcpy(option_txt, "F");	/* No idea what this means, but the
 					 * original ircd sends it ... */
+#ifdef SSL_SUPPORT
+	if(options & CONN_SSL)		/* SSL encrypted link */
+		strlcat(option_txt, "s", sizeof(option_txt));
+#endif
 #ifdef ZLIB
-	if(options & CONN_ZIP)		/* zlib compression supported. */
-		strcat(option_txt, "z");
+	if(options & CONN_ZIP)		/* zlib compression enabled */
+		strlcat(option_txt, "z", sizeof(option_txt));
 #endif
+	LogDebug(" *** %d: %d = %s", Idx, options, option_txt);
 
 	return option_txt;
 } /* Option_String */