]> arthur.barton.de Git - ngircd.git/blobdiff - src/ngircd/conf.c
Correctly detect when SSL subsystem must be initialized
[ngircd.git] / src / ngircd / conf.c
index bea4d619a8c967f8a0e6ae18de8a767000da7af8..758ee743e98b9e8c45e7f7db71784f396abbc91e 100644 (file)
@@ -108,6 +108,28 @@ ConfSSL_Init(void)
        array_free(&Conf_SSLOptions.ListenPorts);
 }
 
+/**
+ * Check if the current configuration uses/requires SSL.
+ *
+ * @returns true if SSL is used and should be initialized.
+ */
+GLOBAL bool
+Conf_SSLInUse(void)
+{
+       int i;
+
+       /* SSL listen ports configured? */
+       if (array_bytes(&Conf_SSLOptions.ListenPorts))
+               return true;
+
+       for (i = 0; i < MAX_SERVERS; i++) {
+               if (Conf_Server[i].port > 0
+                   && Conf_Server[i].SSLConnect)
+                       return true;
+       }
+       return false;
+}
+
 /**
  * Make sure that a configured file is readable.
  *