[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] userspec: help fix GNU ‘id’ incompatibility
From: |
Paul Eggert |
Subject: |
[PATCH] userspec: help fix GNU ‘id’ incompatibility |
Date: |
Fri, 4 Feb 2022 14:28:39 -0800 |
* lib/userspec.c (parse_with_separator):
Don’t set *username to a numeric string that is not a user name,
and similarly for *groupname. Needed to fix Bug#53631.
---
ChangeLog | 7 +++++++
lib/userspec.c | 2 ++
2 files changed, 9 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index a202950bd9..5445802ea2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-02-04 Paul Eggert <eggert@cs.ucla.edu>
+
+ userspec: help fix GNU ‘id’ incompatibility
+ * lib/userspec.c (parse_with_separator):
+ Don’t set *username to a numeric string that is not a user name,
+ and similarly for *groupname. Needed to fix Bug#53631.
+
2022-01-30 Pádraig Brady <P@draigBrady.com>
argmatch: add variants that only match full argument
diff --git a/lib/userspec.c b/lib/userspec.c
index 99ac93bb53..f05ccbe635 100644
--- a/lib/userspec.c
+++ b/lib/userspec.c
@@ -161,6 +161,7 @@ parse_with_separator (char const *spec, char const
*separator,
pwd = (*u == '+' ? NULL : getpwnam (u));
if (pwd == NULL)
{
+ username = NULL;
bool use_login_group = (separator != NULL && g == NULL);
if (use_login_group)
{
@@ -202,6 +203,7 @@ parse_with_separator (char const *spec, char const
*separator,
grp = (*g == '+' ? NULL : getgrnam (g));
if (grp == NULL)
{
+ groupname = NULL;
unsigned long int tmp;
if (xstrtoul (g, NULL, 10, &tmp, "") == LONGINT_OK
&& tmp <= MAXGID && (gid_t) tmp != (gid_t) -1)
--
2.34.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] userspec: help fix GNU ‘id’ incompatibility,
Paul Eggert <=