* Bump internal version number to 6.08
authorArt Cancro <ajc@citadel.org>
Sat, 28 Jun 2003 05:12:56 +0000 (05:12 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 28 Jun 2003 05:12:56 +0000 (05:12 +0000)
* Use (-1) instead of BBSUID as the uid of user records which exist only
  in Citadel and not in the system password database.  serv_upgrade also
  changes this setting for ALL such users, the first time the server is run
  after upgrading to 6.08

citadel/ChangeLog
citadel/citadel.h
citadel/citserver.h
citadel/serv_upgrade.c
citadel/setup.c
citadel/user_ops.c

index fb607a6b08e185ee17983ba43ad13d6b2f06830c..d5d920f8e97bfa3da0e39645797fdbe1fdaf8101 100644 (file)
@@ -1,4 +1,11 @@
  $Log$
+ Revision 607.10  2003/06/28 05:12:56  ajc
+ * Bump internal version number to 6.08
+ * Use (-1) instead of BBSUID as the uid of user records which exist only
+   in Citadel and not in the system password database.  serv_upgrade also
+   changes this setting for ALL such users, the first time the server is run
+   after upgrading to 6.08
+
  Revision 607.9  2003/06/27 22:19:31  error
  * routines2.c: Quick and dirty fix for Mail> becoming new after entering a
    mail message
@@ -4796,4 +4803,3 @@ 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 37b5ce430c2948d4e24a3ccc1c7ec7d20121d72f..038a17f6e1217af939a6942d19c3b1160b3ae0d5 100644 (file)
@@ -32,7 +32,7 @@ extern "C" {
 /*
  * Text description of this software
  */
-#define CITADEL        "Citadel/UX 6.07"
+#define CITADEL        "Citadel/UX 6.08"
 
 /*
  * REV_LEVEL is the current version number (multiplied by 100 to avoid having
@@ -41,7 +41,7 @@ extern "C" {
  * are older than REV_MIN, none of the programs will work until the setup
  * program is run again to bring things up to date.
  */
-#define REV_LEVEL      607             /* This version */
+#define REV_LEVEL      608             /* This version */
 #define REV_MIN                591             /* Oldest compatible version */
 
 #define SERVER_TYPE 0  /* zero for stock Citadel/UX; other developers please
index 7e2bc7191c6e1af3c538f9bb88c0829d45f56cf9..fc8d014959f8f1c4eb9b711e4a59a0438ae63401 100644 (file)
@@ -2,11 +2,15 @@
 
 #include "serv_extensions.h"
 
-/* Simple linked list structure ... used in a bunch of different places. */
+/* Simple linked list structures ... used in a bunch of different places. */
 struct RoomProcList {
         struct RoomProcList *next;
         char name[ROOMNAMELEN];
 };
+struct UserProcList {
+       struct UserProcList *next;
+       char user[64];
+};
 
 void master_startup (void);
 void master_cleanup (void);
index 5c28f0d27f82784a793449b97f376f95b1427bb5..60def57dc07e993733d82876648dadfeda7b9988 100644 (file)
@@ -185,6 +185,56 @@ void bump_mailbox_generation_numbers(void) {
 }
 
 
+/* 
+ * Back end processing function for convert_bbsuid_to_minusone()
+ */
+void cbtm_backend(struct usersupp *usbuf, void *data) {
+       static struct UserProcList *uplist = NULL;
+       struct UserProcList *ptr;
+       struct usersupp us;
+
+       /* Lazy programming here.  Call this function as a ForEachUser backend
+        * in order to queue up the room names, or call it with a null user
+        * to make it do the processing.
+        */
+       if (usbuf != NULL) {
+               ptr = (struct UserProcList *)
+                       mallok(sizeof (struct UserProcList));
+               if (ptr == NULL) return;
+
+               safestrncpy(ptr->user, usbuf->fullname, sizeof ptr->user);
+               ptr->next = uplist;
+               uplist = ptr;
+               return;
+       }
+
+       while (uplist != NULL) {
+
+               if (lgetuser(&us, uplist->user) == 0) {
+                       lprintf(9, "Processing <%s>...\n", uplist->user);
+                       if (us.uid == BBSUID) {
+                               us.uid = (-1);
+                       }
+                       lputuser(&us);
+               }
+
+               ptr = uplist;
+               uplist = uplist->next;
+               phree(ptr);
+       }
+}
+
+/*
+ * quick fix to change all BBSUID users to (-1)
+ */
+void convert_bbsuid_to_minusone(void) {
+       lprintf(5, "Applying uid changes\n");
+       ForEachUser(cbtm_backend, NULL);
+       cbtm_backend(NULL, NULL);
+       return;
+}
+
+
 /*
  * This field was originally used for something else, so when we upgrade
  * we have to initialize it to 0 in case there was trash in that space.
@@ -216,6 +266,7 @@ void check_server_upgrades(void) {
        if (CitControl.version < 555) do_pre555_usersupp_upgrade();
        if (CitControl.version < 591) bump_mailbox_generation_numbers();
        if (CitControl.version < 606) initialize_c_rfc822_strict_from();
+       if (CitControl.version < 608) convert_bbsuid_to_minusone();
 
        CitControl.version = REV_LEVEL;
        put_control();
index 93068896b32d7bce9fe6dc527fccf69b1f770fb4..41e5e6b7c9f74b840c4830396d245623c13e43ef 100644 (file)
@@ -686,8 +686,8 @@ int main(int argc, char *argv[])
        uname(&my_utsname);
 
        /* See if we need to shut down the Citadel service. */
-       for (a=0; a<=5; ++a) {
-               progress("Shutting down the Citadel service...", a, 5);
+       for (a=0; a<=3; ++a) {
+               progress("Shutting down the Citadel service...", a, 3);
                if (a == 0) shutdown_service();
                sleep(1);
        }
@@ -895,23 +895,23 @@ NEW_INST:
        else
                gid = pw->pw_gid;
 
-       progress("Setting file permissions", 0, 5);
+       progress("Setting file permissions", 0, 4);
        chown(".", config.c_bbsuid, gid);
-       progress("Setting file permissions", 1, 5);
+       progress("Setting file permissions", 1, 4);
        chown("citadel.config", config.c_bbsuid, gid);
-       progress("Setting file permissions", 2, 5);
+       progress("Setting file permissions", 2, 4);
        snprintf(aaa, sizeof aaa,
                "find . | grep -v chkpwd | xargs chown %ld:%ld 2>/dev/null",
                (long)config.c_bbsuid, (long)gid);
        system(aaa);
-       progress("Setting file permissions", 3, 5);
+       progress("Setting file permissions", 3, 4);
        chmod("citadel.config", S_IRUSR | S_IWUSR);
-       progress("Setting file permissions", 4, 5);
+       progress("Setting file permissions", 4, 4);
 
        /* See if we can start the Citadel service. */
        if (strlen(init_entry) > 0) {
-               for (a=0; a<=5; ++a) {
-                       progress("Starting the Citadel service...", a, 5);
+               for (a=0; a<=3; ++a) {
+                       progress("Starting the Citadel service...", a, 3);
                        if (a == 0) start_the_service();
                        sleep(1);
                }
index 2240a55c2dc675d0ba5fc65afab349ab67ed8ab1..a631c2cee2bb525c547206444b6089a294a036fa 100644 (file)
@@ -594,11 +594,15 @@ int CtdlTryPassword(char *password)
 
 
 #ifdef ENABLE_AUTOLOGIN
-       if (CC->usersupp.uid == BBSUID) {
+       /* A uid of BBSUID or -1 indicates that this user exists only in
+        * Citadel, not in the underlying operating system.
+        */
+       if ( (CC->usersupp.uid == BBSUID) || (CC->usersupp.uid == (-1)) ) {
                strproc(password);
                strproc(CC->usersupp.password);
                code = strcasecmp(CC->usersupp.password, password);
        }
+       /* Any other uid means we have to check the system password database */
        else {
                if (validpw(CC->usersupp.uid, password)) {
                        code = 0;
@@ -741,10 +745,10 @@ int create_user(char *newusername, int become_user)
                extract_token(username, p->pw_gecos, 0, ',');
                uid = p->pw_uid;
        } else {
-               uid = BBSUID;
+               uid = (-1);
        }
 #else
-       uid = BBSUID;
+       uid = (-1);
 #endif
 
        if (!getuser(&usbuf, username)) {
@@ -882,8 +886,7 @@ void cmd_setp(char *new_pw)
        if (CtdlAccessCheck(ac_logged_in)) {
                return;
        }
-
-       if (CC->usersupp.uid != BBSUID) {
+       if ( (CC->usersupp.uid != BBSUID) && (CC->usersupp.uid != (-1)) ) {
                cprintf("%d Not allowed.  Use the 'passwd' command.\n", ERROR);
                return;
        }