$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
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
/*
* 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
* 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
#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);
}
+/*
+ * 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.
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();
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);
}
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);
}
#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;
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)) {
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;
}