Skip to contentSkip to conversation

Bug#705483: xfsprogs: xfs_quota misinterprets usernames with leading digits

DISCUSSION James Carter 2 participants 5 messages Apr 15, 2013 – Apr 23, 2013

lore
Share & tools
lore
#0 lore raw

Subject: xfsprogs: xfs_quota misinterprets usernames with leading digits
Package: xfsprogs
Version: 3.1.4
Severity: normal

*** Please type your report below this line ***

xfs_quota interprets usernames with leading digits as a numeric UID so, for example:

# xfs_quota -c 'quota -h -u 2000ad' /store
Disk quotas for User test (2000)
Filesystem   Blocks  Quota  Limit Warn/Time    Mounted on
/dev/sdb1       12K     1G     1G  00 [------] /store

This is returning quota information for the user "test" (UID 2000), rather than the user "2000ad".

-- System Information:
Debian Release: 6.0.7
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-0.bpo.4-amd64 (SMP w/12 CPU cores)
Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=UTF-8) (ignored: LC_ALL set to en_GB.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages xfsprogs depends on:

ii  libblkid1                     2.17.2-9   block device id library
ii  libc6                         2.11.3-4   Embedded GNU C Library: Shared lib
ii  libreadline5                  5.2-7      GNU readline and history libraries
ii  libuuid1                      2.17.2-9   Universally Unique ID library

xfsprogs recommends no packages.

Versions of packages xfsprogs suggests:

pn  acl <none>     (no description available)
pn  attr <none>     (no description available)
pn  quota <none>     (no description available)
pn  xfsdump <none>     (no description available)

-- no debconf information

Signature · 8 lines
James Carter                                           Bytemark Hosting
                                             http://www.bytemark.co.uk/
                                              tel: +44 (0) 1904 890 890

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#1 lore raw
Quoted 10 lines · James Carter

Subject: xfsprogs: xfs_quota misinterprets usernames with leading digits
Package: xfsprogs
Version: 3.1.4
Severity: normal

*** Please type your report below this line ***

xfs_quota interprets usernames with leading digits as a numeric UID so, for example:

Quoted 8 lines
# xfs_quota -c 'quota -h -u 2000ad' /store
Disk quotas for User test (2000)
Filesystem   Blocks  Quota  Limit Warn/Time    Mounted on
/dev/sdb1       12K     1G     1G  00 [------] /store

This is returning quota information for the user "test" (UID 2000), rather than the user "2000ad".

I don't think this is a bug, username must begin with a character (unless you created the user using NIS or adduser --force-badname).

# Default from /etc/adduser.conf

# check user and group names also against this regular expression.
#NAME_REGEX="^[a-z][-a-z0-9_]*\$"

From adduser man page:

--force-badname
By default, user and group names are checked against the
config‐
urable regular expression NAME_REGEX (or
NAME_REGEX_SYSTEM if
--system is specified) specified in the configuration
file. This
option forces adduser and addgroup to apply only a weak
check
for validity of the name.

Thanks
--Rich

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
Quoted 2 lines · Rich Johnston

I don't think this is a bug, username must begin with a character (unless you created the user using NIS or adduser --force-badname).

My understanding that this is a recommendation rather than a requirement. useradd(8) has the following to say:

On Debian, the only constraints are that usernames must neither
start
with a dash ('-') nor contain a colon (':') or a whitespace
(space: '
', end of line: '\n', tabulation: '\t', etc.). Note that using a
slash
('/') may break the default algorithm for the definition of the
user's
home directory.

In any case, I'd still consider it a bug that trailing non-numeric characters were just silently ignored.

Signature · 8 lines
James Carter                                           Bytemark Hosting
                                             http://www.bytemark.co.uk/
                                              tel: +44 (0) 1904 890 890

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#3 lore raw
Quoted 18 lines · James Carter
Quoted 3 lines · Rich Johnston

I don't think this is a bug, username must begin with a character (unless you created the user using NIS or adduser --force-badname).

My understanding that this is a recommendation rather than a requirement. useradd(8) has the following to say:

On Debian, the only constraints are that usernames must neither
start
with a dash ('-') nor contain a colon (':') or a whitespace
(space: '
', end of line: '\n', tabulation: '\t', etc.). Note that using a
slash
('/') may break the default algorithm for the definition of the
user's
home directory.

Quoted 3 lines

In any case, I'd still consider it a bug that trailing non-numeric characters were just silently ignored.

Interesting I was not aware of the Debian difference. My understanding was that usernames with leading digits would have trouble with other utilities on other versions of Unix and flavors of Linux as they would interpret the username as numeric UID. I was able to create a user with leading digits and trailing alpha characters using vipw. Because chown works using this username, we will look into fixing this bug. Thanks for pointing it out.

--Rich

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by Eric Sandeen Reviewed-by Chandra Seetharaman
#4 lore raw
In reply to James Carter

James,

The following commit will resolve the issue.

Thanks
--Rich

commit fd537fc50eeade63bbd2a66105f39d04a011a7f5

Author: Rich Johnston <[email protected]>
Date:   Mon Apr 22 17:32:05 2013 +0000

xfsprogs: xfs_quota allow user or group names beginning with digits

xfs_quota does not properly parse users or groups that begin with a
number.
Only call atoi when user or group consists of digits only.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs