From 3c7bc53bb9f9fab6899206539bba8f794509f37b Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sat, 28 Jun 2003 05:12:56 +0000 Subject: [PATCH] * 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 --- citadel/ChangeLog | 8 ++++++- citadel/citadel.h | 4 ++-- citadel/citserver.h | 6 ++++- citadel/serv_upgrade.c | 51 ++++++++++++++++++++++++++++++++++++++++++ citadel/setup.c | 18 +++++++-------- citadel/user_ops.c | 13 ++++++----- 6 files changed, 82 insertions(+), 18 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index fb607a6b0..d5d920f8e 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -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 Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/citadel.h b/citadel/citadel.h index 37b5ce430..038a17f6e 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -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 diff --git a/citadel/citserver.h b/citadel/citserver.h index 7e2bc7191..fc8d01495 100644 --- a/citadel/citserver.h +++ b/citadel/citserver.h @@ -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); diff --git a/citadel/serv_upgrade.c b/citadel/serv_upgrade.c index 5c28f0d27..60def57dc 100644 --- a/citadel/serv_upgrade.c +++ b/citadel/serv_upgrade.c @@ -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(); diff --git a/citadel/setup.c b/citadel/setup.c index 93068896b..41e5e6b7c 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -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); } diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 2240a55c2..a631c2cee 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -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; } -- 2.30.2