]> code.citadel.org Git - citadel.git/commitdiff
* .ASG command: made better use of memory to avoid crashes
authorArt Cancro <ajc@citadel.org>
Wed, 27 Apr 2005 19:22:58 +0000 (19:22 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 27 Apr 2005 19:22:58 +0000 (19:22 +0000)
citadel/ChangeLog
citadel/routines2.c

index 86b7279a722c30f15b1096a5dcb3d6995fc1be19..f62b4184141f9e0be51a9bef8faae18765dc7326 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 645.12  2005/04/27 19:22:57  ajc
+ * .ASG command: made better use of memory to avoid crashes
+
  Revision 645.11  2005/04/23 04:38:26  ajc
  * Substantially improved the appearance of mailing list digests.
    Superfluous RFC822 headers no longer appear, and all messages are
@@ -6630,3 +6633,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
+
index 3d356289462cbc78696b625b2866802c3e3d0f82..1f62c18889aef39d06ab4956b9f5c08c82e24a94 100644 (file)
@@ -647,13 +647,14 @@ void do_system_configuration(CtdlIPC *ipc)
 #define NUM_CONFIGS 42
 
        char buf[SIZ];
-       char sc[NUM_CONFIGS][SIZ];
+       char sc[NUM_CONFIGS][256];
        char *resp = NULL;
        struct ExpirePolicy *site_expirepolicy = NULL;
        struct ExpirePolicy *mbx_expirepolicy = NULL;
        int a;
        int logpages = 0;
        int r;                  /* IPC response code */
+       int server_configs = 0;
 
        /* Clear out the config buffers */
        memset(&sc[0][0], 0, sizeof(sc));
@@ -661,14 +662,11 @@ void do_system_configuration(CtdlIPC *ipc)
        /* Fetch the current config */
        r = CtdlIPCGetSystemConfig(ipc, &resp, buf);
        if (r / 100 == 1) {
-               a = 0;
-               while (strlen(resp)) {
-                       extract_token(buf, resp, 0, '\n', sizeof buf);
-                       remove_token(resp, 0, '\n');
+               server_configs = num_tokens(resp, '\n');
+               for (a=0; a<server_configs; ++a) {
                        if (a < NUM_CONFIGS) {
-                               strcpy(&sc[a][0], buf);
+                               extract_token(&sc[a][0], resp, a, '\n', sizeof sc[a]);
                        }
-                       ++a;
                }
        }
        if (resp) free(resp);
@@ -692,28 +690,28 @@ void do_system_configuration(CtdlIPC *ipc)
        /* Security parameters */
 
        snprintf(sc[7], sizeof sc[7], "%d", (boolprompt(
-                                   "Require registration for new users",
-                                                   atoi(&sc[7][0]))));
+               "Require registration for new users",
+               atoi(&sc[7][0]))));
        snprintf(sc[29], sizeof sc[29], "%d", (boolprompt(
-             "Disable self-service user account creation",
-                                                    atoi(&sc[29][0]))));
+               "Disable self-service user account creation",
+               atoi(&sc[29][0]))));
        strprompt("Initial access level for new users", &sc[6][0], 1);
        strprompt("Access level required to create rooms", &sc[19][0], 1);
        snprintf(sc[4], sizeof sc[4], "%d", (boolprompt(
-                                                   "Automatically give room aide privs to a user who creates a private room",
-                                                   atoi(&sc[4][0]))));
+               "Automatically give room aide privs to a user who creates a private room",
+               atoi(&sc[4][0]))));
 
        snprintf(sc[8], sizeof sc[8], "%d", (boolprompt(
-                "Automatically move problem user messages to twit room",
-                                                   atoi(&sc[8][0]))));
+               "Automatically move problem user messages to twit room",
+               atoi(&sc[8][0]))));
 
        strprompt("Name of twit room", &sc[9][0], ROOMNAMELEN);
        snprintf(sc[11], sizeof sc[11], "%d", (boolprompt(
-             "Restrict Internet mail to only those with that privilege",
-                                                    atoi(&sc[11][0]))));
+               "Restrict Internet mail to only those with that privilege",
+               atoi(&sc[11][0]))));
        snprintf(sc[26], sizeof sc[26], "%d", (boolprompt(
-             "Allow Aides to Zap (forget) rooms",
-                                                    atoi(&sc[26][0]))));
+               "Allow Aides to Zap (forget) rooms",
+               atoi(&sc[26][0]))));
 
        if (strlen(&sc[18][0]) > 0) logpages = 1;
        else logpages = 0;