Closed (duplicate)
Project:
Drupal core
Version:
x.y.z
Component:
user.module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Nov 2005 at 18:47 UTC
Updated:
21 Dec 2005 at 20:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
Cvbge commentedI think arg(1) can be a string, e.g. 1.5, in that case it's != 1 but when processed by printf's %d it gets changed to 1.
Comment #2
m3avrck commentedGood catch Cvbge, I've updated the patch accordingly. Should be locked down now :-)
Comment #3
m3avrck commentedComment #4
dries commentedCan't you compare with $account->uid?
Comment #5
m3avrck commentedDries very good catch, didn't see that variable before ;-) Updated patch, very clean now.
Comment #6
Tobias Maier commentedshouldnt be there a message which gets shown in this case which tells the user "You cant delete this user because it is the first user (he has special and unique rights)"
Comment #7
sangamreddi commentedIt's good and fine but there should be a message "You can't delete this user" or others shoudn't be able to edit UID 1 account. If it's editable someone else can change the username and password of UID 1.
Comment #8
killes@www.drop.org commentedI actually disagree with the purpose of the patch. It might make sense to delete user No. 1 in some setups.
Comment #9
m3avrck commentedYes true, if someone has user_access() to admin users then of course they could change the username/password. The reason for this patch is that I accidently deleted by uid=1 testing something and this really screwed up things. Had to do some database hacks so I could get back into the site.
I'm not sure about *not* being able to delete uid=1, although in some cases I could see why, overall, I don't think you should be able to delete this account. And maybe, as others have suggested, this account should *only* be editable if uid=1 is logged in, stating a message to anyone with admin users access that they can't edit this account, perhaps? If so I can roll a patch to do this. Like to hear some more thoughts as the uid=1 account should really be protected much more IMO.
Comment #10
m3avrck commentedTo follow up, maybe only uid=1 can delete the uid=1 account, in which case, this would satisify killes hesitation. Still wouldn't solve my problem from before, *grin*, but at least this would lock down the account from accidently granting user admin access to malicious users, who could delete uid=1 or change username/password, etc.
Thoughts?
Comment #11
m3avrck commentedAlso, to even further help this issue out, I accidentally blocked uid=1 because I had an error in my forms API code so I'm assuming the code thought I injected some code and blocked my account. Shouldn't a patch also prevent the blocking of uid=1 as well? Thoughts on that too?
Comment #12
jadwigo commentedRemoving uid=1 while logged on als uid=1 is a very bad idea, ever accidentaly removed the user you are logged on as? You could make a workaround for all the errors you will get, but I think that it is not worth it in this case.
If you need to remove uid=1 you probably know your way around in a database and could do it manually.
Comment #13
drewish commentedI'm in the camp of, if you need to delete uid 1, do it by adjusting the database directly. If you really need to do it, you'll be able to figure out how.
Comment #14
m3avrck commentedOk here's a new patch with a few changes. uid=1 cannot be deleted at all and a message is shown to avoid any confusion with the user. Additionally, only uid=1 can edit the uid=1 profile, e.g., uid=1 must be logged in to change the password/username, hence preventing any malicious users with access to user profiles from locking uid=1 out. Appropriate message is displayed too in this case.
This patch really tightens up the uid=1 account, preventing possible accidents and malicious behavior.
Comment #15
m3avrck commentedComment #16
m3avrck commentedMoving this patch to main delete user problem patch: http://drupal.org/node/36716