Its not a real user but it is stored in the DB and does contain info
like how many messages the system has created.
We call it Citadel.
This make "citadel" an illegal user name.
Now this user has a name we need to make sure the auto purger doesn't
purge it and make sure no one can login by that name.
*/
if (us->usernum < 0L) purge = 1;
*/
if (us->usernum < 0L) purge = 1;
+ /** Don't purge user 0. That user is there for the system */
+ if (us->usernum == 0) purge = 0;
+
/* If the user has no full name entry then we can't purge them
* since the actual purge can't find them.
* This shouldn't happen but does somehow.
/* If the user has no full name entry then we can't purge them
* since the actual purge can't find them.
* This shouldn't happen but does somehow.
const char *CitadelServiceTCP="citadel-TCP";
const char *CitadelServiceTCP="citadel-TCP";
+extern struct CitContext masterCC;
+
+
void go_threading(void);
/*
void go_threading(void);
/*
CtdlLogPrintf(CTDL_INFO, "Acquiring control record\n");
get_control();
CtdlLogPrintf(CTDL_INFO, "Acquiring control record\n");
get_control();
+
+/**
+ * Initialise the user 0 to have a name. It would be nice to do it in InitializeMasterCC
+ * since it is contained within the MasterCC but we can't because the DB isn't available
+ * at that time so we do it seperate.
+ */
+ /** Give user 0 a name and create them if necessary */
+ if (getuser(&masterCC.user, "Citadel"))
+ {
+ getuserbynumber(&masterCC.user, 0);
+ strcpy (masterCC.user.fullname, "Citadel");
+ putuser(&masterCC.user);
+ }
+
/*
* Bind the server to a Unix-domain socket.
*/
/*
* Bind the server to a Unix-domain socket.
*/
/*
* Bind a thread to a context. (It's inline merely to speed things up.)
*/
/*
* Bind a thread to a context. (It's inline merely to speed things up.)
*/
}
else { /* Sanity checks succeeded. Now rename the user. */
}
else { /* Sanity checks succeeded. Now rename the user. */
-
- CtdlLogPrintf(CTDL_DEBUG, "Renaming <%s> to <%s>\n", oldname, newname);
- cdb_delete(CDB_USERS, oldnamekey, strlen(oldnamekey));
- safestrncpy(usbuf.fullname, newname, sizeof usbuf.fullname);
- putuser(&usbuf);
- retcode = RENAMEUSER_OK;
+ if (usbuf.usernum == 0)
+ {
+ CtdlLogPrintf (CTDL_DEBUG, "Can not rename user \"Citadel\".\n");
+ retcode = RENAMEUSER_NOT_FOUND;
+ } else {
+ CtdlLogPrintf(CTDL_DEBUG, "Renaming <%s> to <%s>\n", oldname, newname);
+ cdb_delete(CDB_USERS, oldnamekey, strlen(oldnamekey));
+ safestrncpy(usbuf.fullname, newname, sizeof usbuf.fullname);
+ putuser(&usbuf);
+ retcode = RENAMEUSER_OK;
+ }
}
if (trythisname == NULL) return login_not_found;
}
if (trythisname == NULL) return login_not_found;
+
+ if (!strcasecmp(trythisname, "Citadel"))
+ {
+ CtdlLogPrintf(CTDL_DEBUG, "System user \"Citadel\" is not allowed to log in.\n");
+ return login_not_found;
+ }
/* If a "master user" is defined, handle its authentication if specified */
CC->is_master = 0;
/* If a "master user" is defined, handle its authentication if specified */
CC->is_master = 0;