Skip to contentSkip to conversation

libnfsidmap: nss_gss_princ_to_ids() and nss_gss_princ_to_grouplist() must strip the realm

PATCH In review Scott Mayhew 2 participants 2 messages Feb 7, 2017 – Feb 8, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libnfsidmap: nss_gss_princ_to_ids() and nss_gss_princ_to_grouplist() must strip the realm

nss_gss_princ_to_ids() and nss_gss_princ_to_grouplist() were hard-coded to call nss_getpwnam with the 'dostrip' arg set to 0, which is the opposite of what they should have had. Note: there's no point making the decision to strip or not to strip configurable in these two functions. Ideally both of these functions should be taking a gss_name_t instead of a char * for the principal, calling gss_localname() on that, and passing the result to nss_getpwnam... but that would require changes in both rpc.svcgssd and libgssglue (both of which have been deprecated for a while).

Fixes 4db1bb1 (libnfsidmap: add options to aid id mapping in multi domain environments)
---
 nss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
nss.c +2 -2
index 67e657a..82799ce 100644
@@ -415,7 +415,7 @@ static int nss_gss_princ_to_ids(char *secname, char *princ,
 		return -ENOENT;
 	}
 	/* XXX: this should call something like getgssauthnam instead? */
-	pw = nss_getpwnam(princ, NULL, &err, 0);
+	pw = nss_getpwnam(princ, NULL, &err, 1);
 	if (pw == NULL) {
 		err = -ENOENT;
 		goto out;
@@ -438,7 +438,7 @@ int nss_gss_princ_to_grouplist(char *secname, char *princ,
 		goto out;
 	/* XXX: not quite right?  Need to know default realm? */
 	/* XXX: this should call something like getgssauthnam instead? */
-	pw = nss_getpwnam(princ, NULL, &ret, 0);
+	pw = nss_getpwnam(princ, NULL, &ret, 1);
 	if (pw == NULL) {
 		ret = -ENOENT;
 		goto out;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 10 lines · Scott Mayhew

nss_gss_princ_to_ids() and nss_gss_princ_to_grouplist() were hard-coded to call nss_getpwnam with the 'dostrip' arg set to 0, which is the opposite of what they should have had. Note: there's no point making the decision to strip or not to strip configurable in these two functions. Ideally both of these functions should be taking a gss_name_t instead of a char * for the principal, calling gss_localname() on that, and passing the result to nss_getpwnam... but that would require changes in both rpc.svcgssd and libgssglue (both of which have been deprecated for a while).

Quoted 2 lines
Fixes 4db1bb1 (libnfsidmap: add options to aid id mapping in multi domain environments)

Committed...

steved.

Quoted 26 lines
---
 nss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
nss.c +2 -2
index 67e657a..82799ce 100644
@@ -415,7 +415,7 @@ static int nss_gss_princ_to_ids(char *secname, char *princ,
 		return -ENOENT;
 	}
 	/* XXX: this should call something like getgssauthnam instead? */
-	pw = nss_getpwnam(princ, NULL, &err, 0);
+	pw = nss_getpwnam(princ, NULL, &err, 1);
 	if (pw == NULL) {
 		err = -ENOENT;
 		goto out;
@@ -438,7 +438,7 @@ int nss_gss_princ_to_grouplist(char *secname, char *princ,
 		goto out;
 	/* XXX: not quite right?  Need to know default realm? */
 	/* XXX: this should call something like getgssauthnam instead? */
-	pw = nss_getpwnam(princ, NULL, &ret, 0);
+	pw = nss_getpwnam(princ, NULL, &ret, 1);
 	if (pw == NULL) {
 		ret = -ENOENT;
 		goto out;