int oldver = 0;
/*
- * Fix up the name for Citadel user 0 and try to remove any extra users with number 0
+ * Try to remove any extra users with number 0
*/
void fix_sys_user_name(void)
{
struct ctdluser usbuf;
char usernamekey[USERNAME_SIZE];
- /** If we have a user called Citadel rename them to SYS_Citadel */
- if (CtdlGetUser(&usbuf, "Citadel") == 0)
- {
- rename_user("Citadel", "SYS_Citadel");
- }
-
- while (CtdlGetUserByNumber(&usbuf, 0) == 0)
- {
+ while (CtdlGetUserByNumber(&usbuf, 0) == 0) {
/* delete user with number 0 and no name */
if (IsEmptyStr(usbuf.fullname)) {
cdb_delete(CDB_USERS, "", 0);
}
}
- /* Make sure user SYS_* is user 0 */
- while (CtdlGetUserByNumber(&usbuf, -1) == 0)
- {
- if (strncmp(usbuf.fullname, "SYS_", 4))
- { /* Delete any user 0 that doesn't start with SYS_ */
- makeuserkey(usernamekey, usbuf.fullname, cutusername(usbuf.fullname));
- cdb_delete(CDB_USERS, usernamekey, strlen(usernamekey));
- }
- else {
- usbuf.usernum = 0;
- CtdlPutUser(&usbuf);
- }
+ /* Delete any "user 0" accounts */
+ while (CtdlGetUserByNumber(&usbuf, -1) == 0) {
+ makeuserkey(usernamekey, usbuf.fullname, cutusername(usbuf.fullname));
+ cdb_delete(CDB_USERS, usernamekey, strlen(usernamekey));
}
}
return "upgrade";
}
+
CTDL_MODULE_INIT(upgrade)
{
- if(!threading)
- {
- move_inet_addrs_from_vcards_to_user_records();
+ if (!threading) {
post_startup_upgrades();
}
-
+
/* return our module name for the log */
return "upgrade";
}
void makeuserkey(char *key, const char *username, long len) {
int i;
- if (len >= USERNAME_SIZE)
- {
+ if (len >= USERNAME_SIZE) {
syslog(LOG_INFO, "Username too long: %s", username);
len = USERNAME_SIZE - 1;
}
if (CtdlGetUser(&usbuf, oldname) != 0) {
retcode = RENAMEUSER_NOT_FOUND;
}
-
else { /* Sanity checks succeeded. Now rename the user. */
- if (usbuf.usernum == 0)
- {
+ if (usbuf.usernum == 0) {
syslog(LOG_DEBUG, "user_ops: can not rename user \"Citadel\".");
retcode = RENAMEUSER_NOT_FOUND;
} else {
long RoomGen,
long UserID)
{
-
struct {
long iRoomID;
long iRoomGen;
/*
* Define a relationship between a user and a room
*/
-void CtdlSetRelationship(visit *newvisit,
- struct ctdluser *rel_user,
- struct ctdlroom *rel_room)
-{
+void CtdlSetRelationship(visit *newvisit, struct ctdluser *rel_user, struct ctdlroom *rel_room) {
/* We don't use these in Citadel because they're implicit by the
* index, but they must be present if the database is exported.
*/
/*
* Locate a relationship between a user and a room
*/
-void CtdlGetRelationship(visit *vbuf,
- struct ctdluser *rel_user,
- struct ctdlroom *rel_room)
-{
+void CtdlGetRelationship(visit *vbuf, struct ctdluser *rel_user, struct ctdlroom *rel_room) {
char IndexBuf[32];
int IndexLen;
struct cdbdata *cdbvisit;