Skip to contentSkip to conversation

xfs_quota: allow create limit when user or group names beginning with digits

PATCH In review Zorro Lang 2 participants 3 messages Dec 2, 2015 – Feb 12, 2016

lore
Share & tools
lore

Zorro Lang

author
#0 lore raw

PATCH 1/1 xfs_quota: allow create limit when user or group names beginning with digits

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.

---

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(-)
libxcmd/input.c +2 -2
index c505ab3..5a7dce3 100644
@@ -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;
Signature · 6 lines
1.9.3

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v1 1/1
#1 lore raw

I had to re-read the strtoul manpage (3 times) but yes, this looks right to me.

(technically it should probably check for overflow etc but I suppose that is outside the scope of this fix)

An xfstest would be good for this, although (as we discussed on IRC) I'm not sure if it is OK for xfstests to add users & groups - no other test does that today...

Quoted 44 lines · Zorro Lang

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.

---

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(-)
libxcmd/input.c +1 -1
index c505ab3..5a7dce3 100644
@@ -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;

libxcmd/input.c gid_from_string( · line 393

Quoted 8 lines
libxcmd/input.c +1 -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;

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

#2 lore raw

Hi Dave, I think this one got missed. Can you pick it up for next time?

Thanks,
-Eric

Quoted 58 lines · Eric Sandeen

I had to re-read the strtoul manpage (3 times) but yes, this looks right to me.

(technically it should probably check for overflow etc but I suppose that is outside the scope of this fix)

An xfstest would be good for this, although (as we discussed on IRC) I'm not sure if it is OK for xfstests to add users & groups - no other test does that today...

Quoted 45 lines · Zorro Lang

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.

---

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(-)
libxcmd/input.c +1 -1
index c505ab3..5a7dce3 100644
@@ -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;
 
Quoted 13 lines

libxcmd/input.c gid_from_string( · line 393

Quoted 7 lines
libxcmd/input.c +1 -1
 	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;

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

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