]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/conf.c
Correctly detect when SSL subsystem must be initialized
[ngircd-alex.git] / src / ngircd / conf.c
index d5a28bd7bfbe25ab3b8268781236edfe663954f2..929ab05403734b8cd43e851955828072c38a0e33 100644 (file)
@@ -109,6 +109,28 @@ ConfSSL_Init(void)
        array_free(&Conf_SSLOptions.ListenPorts);
 }
 
        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.
  *
 /**
  * Make sure that a configured file is readable.
  *