]> code.citadel.org Git - citadel.git/blobdiff - citadel/control.c
* Buffered output needs to be flushed in several places. Added calls to
[citadel.git] / citadel / control.c
index 207291faf45be9bf7a4f91c01c658b04d2a3ea71..86f907cde9aa3f0f65d811781f7d50a52a679065 100644 (file)
@@ -80,7 +80,7 @@ void get_control(void)
                }
        }
        if (control_fp == NULL) {
-               lprintf(1, "ERROR opening citadel.control: %s\n",
+               lprintf(CTDL_ALERT, "ERROR opening citadel.control: %s\n",
                        strerror(errno));
                return;
        }
@@ -194,20 +194,28 @@ void cmd_conf(char *argbuf)
                cprintf("%d\n", config.c_imap_port);
                cprintf("%ld\n", config.c_net_freq);
                cprintf("%d\n", config.c_disable_newu);
-               cprintf("%d\n", config.c_aide_mailboxes);
+               cprintf("1\n"); /* no longer in use */
                cprintf("%d\n", config.c_purge_hour);
 #ifdef HAVE_LDAP
                cprintf("%s\n", config.c_ldap_host);
                cprintf("%d\n", config.c_ldap_port);
+               cprintf("%s\n", config.c_ldap_base_dn);
+               cprintf("%s\n", config.c_ldap_bind_dn);
+               cprintf("%s\n", config.c_ldap_bind_pw);
 #else
                cprintf("\n");
                cprintf("0\n");
+               cprintf("\n");
+               cprintf("\n");
+               cprintf("\n");
 #endif
+               cprintf("%s\n", config.c_ip_addr);
                cprintf("000\n");
        }
 
        else if (!strcasecmp(cmd, "SET")) {
                cprintf("%d Send configuration...\n", SEND_LISTING);
+               flush_output();
                a = 0;
                while (client_gets(buf), strcmp(buf, "000")) {
                        switch (a) {
@@ -273,8 +281,8 @@ void cmd_conf(char *argbuf)
                                break;
                        case 14:
                                config.c_maxsessions = atoi(buf);
-                               if (config.c_maxsessions < 1)
-                                       config.c_maxsessions = 1;
+                               if (config.c_maxsessions < 0)
+                                       config.c_maxsessions = 0;
                                break;
                        case 15:
                                /* placeholder -- field no longer in use */
@@ -332,9 +340,7 @@ void cmd_conf(char *argbuf)
                                        config.c_disable_newu = 1;
                                break;
                        case 30:
-                               config.c_aide_mailboxes = atoi(buf);
-                               if (config.c_aide_mailboxes != 0)
-                                       config.c_aide_mailboxes = 1;
+                               /* no longer in use */
                                break;
                        case 31:
                                if ((config.c_purge_hour >= 0)
@@ -350,7 +356,22 @@ void cmd_conf(char *argbuf)
                        case 33:
                                config.c_ldap_port = atoi(buf);
                                break;
+                       case 34:
+                               safestrncpy(config.c_ldap_base_dn, buf,
+                                           sizeof config.c_ldap_base_dn);
+                               break;
+                       case 35:
+                               safestrncpy(config.c_ldap_bind_dn, buf,
+                                           sizeof config.c_ldap_bind_dn);
+                               break;
+                       case 36:
+                               safestrncpy(config.c_ldap_bind_pw, buf,
+                                           sizeof config.c_ldap_bind_pw);
+                               break;
 #endif
+                       case 37:
+                               safestrncpy(config.c_ip_addr, buf,
+                                               sizeof config.c_ip_addr);
                        }
                        ++a;
                }
@@ -373,7 +394,7 @@ void cmd_conf(char *argbuf)
                        if (confptr[strlen(confptr) - 1] != 10)
                                client_write("\n", 1);
                        cprintf("000\n");
-                       phree(confptr);
+                       free(confptr);
                } else {
                        cprintf("%d No such configuration.\n",
                                ERROR + ILLEGAL_VALUE);
@@ -383,10 +404,11 @@ void cmd_conf(char *argbuf)
        else if (!strcasecmp(cmd, "PUTSYS")) {
                extract(confname, argbuf, 1);
                cprintf("%d %s\n", SEND_LISTING, confname);
+               flush_output();
                confptr = CtdlReadMessageBody("000",
                                config.c_maxmsglen, NULL, 0);
                CtdlPutSysConfig(confname, confptr);
-               phree(confptr);
+               free(confptr);
        }
 
        else {