]> code.citadel.org Git - citadel.git/blobdiff - webcit/siteconfig.c
* All OS-level includes are now included from webcit.h instead of from
[citadel.git] / webcit / siteconfig.c
index 46f64c4094d3148599025aed30032d41ccb98401..104915f62d3d27de338091e7e5327c4dba1bc873 100644 (file)
@@ -6,31 +6,9 @@
  */
 
 
-#include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <limits.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <string.h>
-#include <pwd.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <pthread.h>
-#include <signal.h>
 #include "webcit.h"
 
 
-
-
-
 void display_siteconfig(void)
 {
        char buf[SIZ];
@@ -62,7 +40,7 @@ void display_siteconfig(void)
                wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
                        "<A HREF=\"/display_siteconfig?whichmenu=general\">"
                        "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
-                       "SRC=\"/static/advanced-icon.gif\" ALT=\"&nbsp;\">"
+                       "SRC=\"/static/advanpage2_48x.gif\" ALT=\"&nbsp;\">"
                        "</TD><TD>"
                        "<A HREF=\"/display_siteconfig?whichmenu=general\">"
                        "<B>General</B><br />"
@@ -73,7 +51,7 @@ void display_siteconfig(void)
                wprintf("<TR><TD>"
                        "<A HREF=\"/display_siteconfig?whichmenu=access\">"
                        "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
-                       "SRC=\"/static/advanced-icon.gif\" ALT=\"&nbsp;\">"
+                       "SRC=\"/static/advanpage2_48x.gif\" ALT=\"&nbsp;\">"
                        "</TD><TD>"
                        "<A HREF=\"/display_siteconfig?whichmenu=access\">"
                        "<B>Access</B><br />"
@@ -84,7 +62,7 @@ void display_siteconfig(void)
                wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
                        "<A HREF=\"/display_siteconfig?whichmenu=network\">"
                        "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
-                       "SRC=\"/static/advanced-icon.gif\" ALT=\"&nbsp;\">"
+                       "SRC=\"/static/advanpage2_48x.gif\" ALT=\"&nbsp;\">"
                        "</TD><TD>"
                        "<A HREF=\"/display_siteconfig?whichmenu=network\">"
                        "<B>Network</B><br />"
@@ -95,7 +73,7 @@ void display_siteconfig(void)
                wprintf("<TR><TD>"
                        "<A HREF=\"/display_siteconfig?whichmenu=tuning\">"
                        "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
-                       "SRC=\"/static/advanced-icon.gif\" ALT=\"&nbsp;\">"
+                       "SRC=\"/static/advanpage2_48x.gif\" ALT=\"&nbsp;\">"
                        "</TD><TD>"
                        "<A HREF=\"/display_siteconfig?whichmenu=tuning\">"
                        "<B>Tuning</B><br />"
@@ -106,7 +84,7 @@ void display_siteconfig(void)
                wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
                        "<A HREF=\"/display_siteconfig?whichmenu=ldap\">"
                        "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
-                       "SRC=\"/static/advanced-icon.gif\" ALT=\"&nbsp;\">"
+                       "SRC=\"/static/advanpage2_48x.gif\" ALT=\"&nbsp;\">"
                        "</TD><TD>"
                        "<A HREF=\"/display_siteconfig?whichmenu=ldap\">"
                        "<B>Directory</B><br />"
@@ -117,7 +95,7 @@ void display_siteconfig(void)
                wprintf("<TR><TD>"
                        "<A HREF=\"/display_siteconfig?whichmenu=purger\">"
                        "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
-                       "SRC=\"/static/advanced-icon.gif\" ALT=\"&nbsp;\">"
+                       "SRC=\"/static/advanpage2_48x.gif\" ALT=\"&nbsp;\">"
                        "</TD><TD>"
                        "<A HREF=\"/display_siteconfig?whichmenu=purger\">"
                        "<B>Auto-purger</B><br />"
@@ -474,10 +452,10 @@ void display_siteconfig(void)
                        }
                        break;
                case 31:
-                       /* placeholder -- there is no option 31 */
+                       /* niu */
                        break;
                case 32:
-                       if (!strcasecmp(whichmenu, "tuning")) {
+                       if (!strcasecmp(whichmenu, "purger")) {
                                wprintf("<TR><TD>Hour to run database auto-purge</TD><TD>");
                                wprintf("<SELECT NAME=\"c_purge_hour\" SIZE=\"1\">\n");
                                for (j=0; j<=23; ++j) {
@@ -595,6 +573,46 @@ void display_siteconfig(void)
                                wprintf("<INPUT TYPE=\"hidden\" NAME=\"c_smtps_port\" VALUE=\"%s\">", buf);
                        }
                        break;
+               case 43:
+                       if (!strcasecmp(whichmenu, "general")) {
+                               wprintf("<TR><TD>Enable full text index (warning: resource intensive)</TD><TD>");
+                               wprintf("<INPUT TYPE=\"checkbox\" NAME=\"c_enable_fulltext\" VALUE=\"yes\" %s>", ((atoi(buf) != 0) ? "CHECKED" : ""));
+                               wprintf("</TD></TR>\n");
+                       }
+                       else {
+                               wprintf("<INPUT TYPE=\"hidden\" NAME=\"c_enable_fulltext\" VALUE=\"%s\">", buf);
+                       }
+                       break;
+               case 44:
+                       if (!strcasecmp(whichmenu, "tuning")) {
+                               wprintf("<TR><TD>Automatically delete committed database logs</TD><TD>");
+                               wprintf("<INPUT TYPE=\"checkbox\" NAME=\"c_auto_cull\" VALUE=\"yes\" %s>", ((atoi(buf) != 0) ? "CHECKED" : ""));
+                               wprintf("</TD></TR>\n");
+                       }
+                       else {
+                               wprintf("<INPUT TYPE=\"hidden\" NAME=\"c_auto_cull\" VALUE=\"%s\">", buf);
+                       }
+                       break;
+               case 45:
+                       if (!strcasecmp(whichmenu, "network")) {
+                               wprintf("<TR><TD>Instantly expunge deleted messages in IMAP</TD><TD>");
+                               wprintf("<INPUT TYPE=\"checkbox\" NAME=\"c_instant_expunge\" VALUE=\"yes\" %s>", ((atoi(buf) != 0) ? "CHECKED" : ""));
+                               wprintf("</TD></TR>\n");
+                       }
+                       else {
+                               wprintf("<INPUT TYPE=\"hidden\" NAME=\"c_instant_expunge\" VALUE=\"%s\">", buf);
+                       }
+                       break;
+               case 46:
+                       if (!strcasecmp(whichmenu, "network")) {
+                               wprintf("<TR><TD>Allow unauthenticated SMTP clients to spoof my domains</TD><TD>");
+                               wprintf("<INPUT TYPE=\"checkbox\" NAME=\"c_allow_spoofing\" VALUE=\"yes\" %s>", ((atoi(buf) != 0) ? "CHECKED" : ""));
+                               wprintf("</TD></TR>\n");
+                       }
+                       else {
+                               wprintf("<INPUT TYPE=\"hidden\" NAME=\"c_allow_spoofing\" VALUE=\"%s\">", buf);
+                       }
+                       break;
                }
        }
 
@@ -680,7 +698,7 @@ void siteconfig(void)
        serv_printf("CONF set");
        serv_getln(buf, sizeof buf);
        if (buf[0] != '4') {
-               strcpy(WC->ImportantMessage, &buf[4]);
+               safestrncpy(WC->ImportantMessage, &buf[4], sizeof WC->ImportantMessage);
                display_siteconfig();
                return;
        }
@@ -714,7 +732,7 @@ void siteconfig(void)
        serv_printf("%s", bstr("c_imap_port"));
        serv_printf("%s", bstr("c_net_freq"));
        serv_printf("%s", ((!strcasecmp(bstr("c_disable_newu"), "yes") ? "1" : "0")));
-       serv_printf("1");       /* placeholder -- deprecated */
+       serv_printf("1");
        serv_printf("%s", bstr("c_purge_hour"));
        serv_printf("%s", bstr("c_ldap_host"));
        serv_printf("%s", bstr("c_ldap_port"));
@@ -726,6 +744,10 @@ void siteconfig(void)
        serv_printf("%s", bstr("c_imaps_port"));
        serv_printf("%s", bstr("c_pop3s_port"));
        serv_printf("%s", bstr("c_smtps_port"));
+       serv_printf("%s", ((!strcasecmp(bstr("c_enable_fulltext"), "yes") ? "1" : "0")));
+       serv_printf("%s", ((!strcasecmp(bstr("c_auto_cull"), "yes") ? "1" : "0")));
+       serv_printf("%s", ((!strcasecmp(bstr("c_instant_expunge"), "yes") ? "1" : "0")));
+       serv_printf("%s", ((!strcasecmp(bstr("c_allow_spoofing"), "yes") ? "1" : "0")));
        serv_printf("000");
 
        serv_printf("SPEX site|%d|%d", atoi(bstr("sitepolicy")), atoi(bstr("sitevalue")));
@@ -733,6 +755,7 @@ void siteconfig(void)
        serv_printf("SPEX mailboxes|%d|%d", atoi(bstr("mboxpolicy")), atoi(bstr("mboxvalue")));
        serv_getln(buf, sizeof buf);
 
-       strcpy(WC->ImportantMessage, "System configuration has been updated.");
+       safestrncpy(WC->ImportantMessage, "System configuration has been updated.",
+               sizeof WC->ImportantMessage);
        display_siteconfig();
 }