New config option: set smtp_advertise_starttls to nonzero to advertise STARTTLS in...
[citadel.git] / citadel / server / config.c
index 670e6e224b30a73a72fa82eac83b9d9fcd40dcf7..7932ca81da570bd39034602cbf6e0340c6556485 100644 (file)
@@ -1,6 +1,6 @@
 // Read and write the system configuration database
 //
-// Copyright (c) 1987-2022 by the citadel.org team
+// Copyright (c) 1987-2024 by the citadel.org team
 //
 // This program is open source software.  Use, duplication, or disclosure
 // is subject to the terms of the GNU General Public License, version 3.
@@ -10,7 +10,6 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <netdb.h>
-#include <crypt.h>
 #include <sys/utsname.h>
 #include <libcitadel.h>
 #include <assert.h>
@@ -187,7 +186,6 @@ void migrate_legacy_config(struct legacy_config *lconfig) {
        CtdlSetConfigInt(       "c_imaps_port"          ,       lconfig->c_imaps_port           );
        CtdlSetConfigInt(       "c_pop3s_port"          ,       lconfig->c_pop3s_port           );
        CtdlSetConfigInt(       "c_smtps_port"          ,       lconfig->c_smtps_port           );
-       CtdlSetConfigInt(       "c_auto_cull"           ,       lconfig->c_auto_cull            );
        CtdlSetConfigInt(       "c_allow_spoofing"      ,       lconfig->c_allow_spoofing       );
        CtdlSetConfigInt(       "c_journal_email"       ,       lconfig->c_journal_email        );
        CtdlSetConfigInt(       "c_journal_pubmsgs"     ,       lconfig->c_journal_pubmsgs      );
@@ -313,7 +311,6 @@ void CtdlSetConfigStr(char *key, char *value) {
        Put(ctdlconfig, key, key_len, strdup(value), NULL);
 
        // Also write it to the config database
-
        int dbv_size = key_len + value_len + 2;
        char *dbv = malloc(dbv_size);
        strcpy(dbv, key);
@@ -362,7 +359,7 @@ void CtdlDelConfig(char *key) {
 // Fetch a system config value.  Caller does *not* own the returned value and may not alter it.
 char *CtdlGetConfigStr(char *key) {
        char *value = NULL;
-       struct cdbdata *cdb;
+       struct cdbdata cdb;
        int key_len = strlen(key);
 
        if (IsEmptyStr(key)) return(NULL);
@@ -374,13 +371,12 @@ char *CtdlGetConfigStr(char *key) {
 
        // Then look in the database.
        cdb = cdb_fetch(CDB_CONFIG, key, key_len);
-       if (cdb == NULL) {      // nope, not there either.
+       if (cdb.ptr == NULL) {                          // nope, not there either.
                return(NULL);
        }
 
        // Got it.  Save it in memory for the next fetch.
-       value = strdup(cdb->ptr + key_len + 1);         // The key was stored there too; skip past it
-       cdb_free(cdb);
+       value = strdup(cdb.ptr + key_len + 1);          // The key was stored there too; skip past it
        Put(ctdlconfig, key, key_len, value, NULL);
        return value;
 }
@@ -442,7 +438,7 @@ char *CtdlGetSysConfig(char *sysconfname) {
        else {
                msg = CtdlFetchMessage(msgnum, 1);
                if (msg != NULL) {
-                       conf = strdup(msg->cm_fields[eMesageText]);
+                       conf = strdup(msg->cm_fields[eMessageText]);
                        CM_Free(msg);
                }
                else {