]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Handle mapping failure from get_ids.
authorkwc@citi.umich.edu <kwc@citi.umich.edu>
Mon, 3 Jul 2006 22:34:43 +0000 (18:34 -0400)
committerNeil Brown <neilb@suse.de>
Tue, 4 Jul 2006 00:27:15 +0000 (10:27 +1000)
Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
Temporary patch to do default mapping if we get an error while trying to
map a gss principal to the appropriate uid/gid.  This currently returns
hardcoded values.  This may be correct, or we may need to try and figure
out the correct values to match the anonuid/anongid for the export.

utils/gssd/svcgssd_proc.c

index 2251d9ab84a1feee03b7a4a8bd88f62262fbd157..4ab4b2e48a261c01f797ae7687559963e5ce3c10 100644 (file)
@@ -220,8 +220,21 @@ get_ids(gss_name_t client_name, gss_OID mech, struct svc_cred *cred)
        nfs4_init_name_mapping(NULL); /* XXX: should only do this once */
        res = nfs4_gss_princ_to_ids(secname, sname, &uid, &gid);
        if (res < 0) {
-               printerr(0, "WARNING: get_ids: unable to map "
-                       "name '%s' to a uid\n", sname);
+               /*
+                * -ENOENT means there was no mapping, any other error
+                * value means there was an error trying to do the
+                * mapping.
+                */
+               if (res == -ENOENT) {
+                       cred->cr_uid = -2;      /* XXX */
+                       cred->cr_gid = -2;      /* XXX */
+                       cred->cr_groups[0] = -2;/* XXX */
+                       cred->cr_ngroups = 1;
+                       res = 0;
+                       goto out_free;
+               }
+               printerr(0, "WARNING: get_ids: failed to map name '%s' "
+                       "to uid/gid: %s\n", sname, strerror(-res));
                goto out_free;
        }
        cred->cr_uid = uid;