* ipgm_secret is no longer set during setup. Now it is set at server startup
authorArt Cancro <ajc@citadel.org>
Mon, 14 Jul 2003 03:07:06 +0000 (03:07 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 14 Jul 2003 03:07:06 +0000 (03:07 +0000)
  and automatically changes whenever an IPGM command is executed.
* Upon an IPGM authentication failure, wait 5 seconds before displaying an
  error, then disconnect the session.

citadel/ChangeLog
citadel/citserver.c
citadel/serv_vandelay.c
citadel/server_main.c
citadel/setup.c

index f46dbf7a29ab20bc4292662cd7ce728c1931426e..19cee5f7efe997cd6652d061ec68579c10ced75b 100644 (file)
@@ -1,4 +1,10 @@
  $Log$
+ Revision 607.21  2003/07/14 03:07:05  ajc
+ * ipgm_secret is no longer set during setup.  Now it is set at server startup
+   and automatically changes whenever an IPGM command is executed.
+ * Upon an IPGM authentication failure, wait 5 seconds before displaying an
+   error, then disconnect the session.
+
  Revision 607.20  2003/07/13 04:58:35  ajc
  * Allow connect on unix domain sockets to Citadels in other directories
  * sendcommand now uses unix domain sockets instead of the network
@@ -4853,3 +4859,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 04c37ef63165bcc0bf3965e2659156a4a70d03b5..b07a0d637404c65ace2b454d55ae924acc99166e 100644 (file)
@@ -761,26 +761,32 @@ void cmd_ipgm(char *argbuf)
 {
        int secret;
 
+       secret = extract_int(argbuf, 0);
+
        /* For security reasons, we do NOT allow this command to run
         * over the network.  Local sockets only.
         */
        if (!CC->is_local_socket) {
                sleep(5);
                cprintf("%d Authentication failed.\n",ERROR);
-               return;
        }
-
-       secret = extract_int(argbuf, 0);
-       if (secret == config.c_ipgm_secret) {
+       else if (secret == config.c_ipgm_secret) {
                CC->internal_pgm = 1;
                strcpy(CC->curr_user, "<internal program>");
                CC->cs_flags = CC->cs_flags|CS_STEALTH;
                cprintf("%d Authenticated as an internal program.\n",CIT_OK);
        }
        else {
+               sleep(5);
                cprintf("%d Authentication failed.\n",ERROR);
                lprintf(3, "Warning: ipgm authentication failed.\n");
+               CC->kill_me = 1;
        }
+
+       /* Now change the ipgm secret for the next round. */
+       get_config();
+       config.c_ipgm_secret = rand();
+       put_config();
 }
 
 
index 4b54fe582c16b1fa37b7d93136ac070a8d0574ce..1608804b5c4df90267c729c64712eeff293338f3 100644 (file)
@@ -271,7 +271,6 @@ void artv_do_export(void) {
        cprintf("%d\n", config.c_maxsessions);
        cprintf("%s\n", config.c_net_password);
        cprintf("%d\n", config.c_port_number);
-       cprintf("%d\n", config.c_ipgm_secret);
        cprintf("%d\n", config.c_ep.expire_mode);
        cprintf("%d\n", config.c_ep.expire_value);
        cprintf("%d\n", config.c_userpurge);
@@ -329,7 +328,6 @@ void artv_import_config(void) {
        client_gets(buf);       config.c_maxsessions = atoi(buf);
        client_gets(config.c_net_password);
        client_gets(buf);       config.c_port_number = atoi(buf);
-       client_gets(buf);       config.c_ipgm_secret = atoi(buf);
        client_gets(buf);       config.c_ep.expire_mode = atoi(buf);
        client_gets(buf);       config.c_ep.expire_value = atoi(buf);
        client_gets(buf);       config.c_userpurge = atoi(buf);
index ad2b2b3bb8b9c1ad3beaec28b45efe97fe5b789f..c2d3b46e5dfda90b623c7643f227c2374924a0e8 100644 (file)
@@ -140,10 +140,12 @@ int main(int argc, char **argv)
        init_sysdep();
        openlog("citserver", LOG_PID, LOG_USER);
 
-       /* Load site-specific parameters */
+       /* Load site-specific parameters, and set the ipgm secret */
        lprintf(7, "Loading citadel.config\n");
        get_config();
-
+       srand(getpid());
+       config.c_ipgm_secret = rand();
+       put_config();
 
        /*
         * Do non system dependent startup functions.
index 13609928b6f8eb02820422a5be9ea9e835fe278b..1f480484c353623a787f729aaef65aba75189dcf 100644 (file)
@@ -769,10 +769,6 @@ int main(int argc, char *argv[])
        if (config.c_port_number == 0) {
                config.c_port_number = 504;
        }
-       if (config.c_ipgm_secret == 0) {
-               srand(getpid());
-               config.c_ipgm_secret = rand();
-       }
        if (config.c_sleeping == 0) {
                config.c_sleeping = 900;
        }