cleanup
authorArt Cancro <ajc@citadel.org>
Thu, 22 Aug 2019 03:08:24 +0000 (23:08 -0400)
committerArt Cancro <ajc@citadel.org>
Thu, 22 Aug 2019 03:08:24 +0000 (23:08 -0400)
citadel/modules/upgrade/serv_upgrade.c
citadel/user_ops.c

index 59089d295fbfbfd738b801ab8bcde093fadb2748..846a693e5ca2b2ebbc19022b2cc721535c96037c 100644 (file)
 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);
@@ -89,18 +82,10 @@ void fix_sys_user_name(void)
                }
        }
 
-       /* 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));
        }
 }
 
@@ -587,14 +572,13 @@ CTDL_MODULE_UPGRADE(upgrade)
        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";
 }
index f8c74445d9a89bd3ed4068042bb511fe6b85fd1c..0a74759ae9ba3653a99e70c8029f6a23ecc29569 100644 (file)
@@ -54,8 +54,7 @@ long cutusername(char *username) {
 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; 
        }
@@ -178,10 +177,8 @@ int rename_user(char *oldname, char *newname) {
                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 {
@@ -209,7 +206,6 @@ int GenerateRelationshipIndex(char *IndexBuf,
                              long RoomGen,
                              long UserID)
 {
-
        struct {
                long iRoomID;
                long iRoomGen;
@@ -247,10 +243,7 @@ void put_visit(visit *newvisit)
 /*
  * 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.
         */
@@ -265,10 +258,7 @@ void CtdlSetRelationship(visit *newvisit,
 /*
  * 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;