misc/149972: usermod -u <non-numeric> should error

Jan Schaumann jschauma at netmeister.org
Wed Aug 25 20:00:17 UTC 2010


>Number:         149972
>Category:       misc
>Synopsis:       usermod -u <non-numeric> should error
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 25 20:00:16 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Jan Schaumann
>Release:        
>Organization:
>Environment:
>Description:
pw usermod -d /home/bob -u bob -m

yields

drwxr-xr-x  2 root  wheel  512 Aug 25 12:43 /home/bob

Ie, the home directory is owned by root.

This makes (some) sense once you realize that "-u" is supposed to take a number:

-u uid        Specify the user/account numeric id.

So I'm guessing that in this case pw(8) determined that there is no UID "bob", and hence created the directory as being owned by root.

Now to make the whole story short, I think that if the argument to "-u" is supposed to be numeric, then pw(8) should error out if it is not actually numeric.
>How-To-Repeat:
pw usermod -d /home/bob -u bob -m
>Fix:
some sort of atoi checking in src/usr.sbin/pw/pw_user.c

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list