public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Zorro Lang <zlang@redhat.com>
To: xfs@oss.sgi.com
Cc: sandeen@redhat.com, Zorro Lang <zlang@redhat.com>, rjohnston@sgi.com
Subject: [PATCH] xfs_quota: allow create limit when user or group names beginning with digits
Date: Wed,  2 Dec 2015 17:02:35 +0800	[thread overview]
Message-ID: <1449046955-8350-1-git-send-email-zlang@redhat.com> (raw)

A normal user or group name allow beginning with digits, but xfs_quota can't
create a limit for that user or group. The reason is 'strtoul' function only
translate digits at the beginning.

There's a commit fd537fc50eeade63bbd2a66105f39d04a011a7f5, it try to fix
"xfsprogs: xfs_quota allow user or group names beginning with digits". But
it doesn't effect 'limit .... 12345678-user' command.

Signed-off-by: Zorro Lang <zlang@redhat.com>
---

Hi Eric,

This problem from a bug of ours, I have left message to you, please
help to check my simple patch. Thanks very much.

Hi Rich,

I don't understand why you fix commit fd537fc50eeade63bbd2a66105f39d04a011a7f5,
but didn't fix this. Or is this a feature, not a bug?

I'm not so familiar with xfsprogs code, so if I'm wrong, please tell me;)

Thanks,
Zorro

 libxcmd/input.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libxcmd/input.c b/libxcmd/input.c
index c505ab3..5a7dce3 100644
--- a/libxcmd/input.c
+++ b/libxcmd/input.c
@@ -366,7 +366,7 @@ uid_from_string(
 	char		*sp;
 
 	uid_long = strtoul(user, &sp, 10);
-	if (sp != user) {
+	if (sp != user && *sp == '\0') {
 		if ((uid_long == ULONG_MAX && errno == ERANGE)
 				|| (uid_long > (uid_t)-1))
 			return -1;
@@ -387,7 +387,7 @@ gid_from_string(
 	char		*sp;
 
 	gid_long = strtoul(group, &sp, 10);
-	if (sp != group) {
+	if (sp != group && *sp == '\0') {
 		if ((gid_long == ULONG_MAX && errno == ERANGE)
 				|| (gid_long > (gid_t)-1))
 			return -1;
-- 
1.9.3

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

             reply	other threads:[~2015-12-02  9:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-02  9:02 Zorro Lang [this message]
2015-12-03  4:05 ` [PATCH] xfs_quota: allow create limit when user or group names beginning with digits Eric Sandeen
2016-02-12 17:05   ` Eric Sandeen
  -- strict thread matches above, loose matches on Subject: below --
2016-04-02 15:59 Zorro Lang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449046955-8350-1-git-send-email-zlang@redhat.com \
    --to=zlang@redhat.com \
    --cc=rjohnston@sgi.com \
    --cc=sandeen@redhat.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox