Add some comments to rename_user indicating why the code is bad.
authorDave West <davew@uncensored.citadel.org>
Tue, 3 Nov 2009 12:34:30 +0000 (12:34 +0000)
committerDave West <davew@uncensored.citadel.org>
Tue, 3 Nov 2009 12:34:30 +0000 (12:34 +0000)
It traverses an unlocked context list and it leaves a big hole for
the actual operation to do something unexpected.

citadel/user_ops.c

index 7c9ed32b33630c7cd32926a0ef1a37a9ba0e1eab..6cbef4ff0bf3d7cb5306dc6ea01ff38b23ba6b2b 100644 (file)
@@ -209,6 +209,7 @@ int rename_user(char *oldname, char *newname) {
  * We check that the user is not already logged in because we can't rename them
  * if they are logged in.
  * BUT THEN WE LEAVE A HUGE WINDOW FOR THEM TO LOG IN BEFORE WE LOCK TO RENAME THEM!!!!!
+ * We are also traversing an un-locked context list which is a very bad thing to do.
  */
        for (cptr = ContextList; cptr != NULL; cptr = cptr->next) {
                if (!strcasecmp(cptr->user.fullname, oldname)) {