X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fgssd%2Fsvcgssd_proc.c;h=4037159b2ede2f737d0229728c15425ff9acdbd3;hp=b3a6ae8cda53d351e2a236867094564e9df89b33;hb=8fd9fad1ea4b25b8962d70133f476650ef0637b0;hpb=660809fe7e597520d17deab9225f1b371c08d65c diff --git a/utils/gssd/svcgssd_proc.c b/utils/gssd/svcgssd_proc.c index b3a6ae8..4037159 100644 --- a/utils/gssd/svcgssd_proc.c +++ b/utils/gssd/svcgssd_proc.c @@ -72,6 +72,7 @@ do_svc_downcall(gss_buffer_desc *out_handle, struct svc_cred *cred, FILE *f; int i; char *fname = NULL; + int err; printerr(1, "doing downcall\n"); if ((fname = mech2file(mech)) == NULL) @@ -93,9 +94,9 @@ do_svc_downcall(gss_buffer_desc *out_handle, struct svc_cred *cred, qword_printint(f, cred->cr_groups[i]); qword_print(f, fname); qword_printhex(f, context_token->value, context_token->length); - qword_eol(f); + err = qword_eol(f); fclose(f); - return 0; + return err; out_err: printerr(0, "WARNING: downcall failed\n"); return -1; @@ -140,7 +141,7 @@ send_response(FILE *f, gss_buffer_desc *in_handle, gss_buffer_desc *in_token, return -1; } *bp = '\0'; - printerr(1, "writing message: %s", buf); + printerr(3, "writing message: %s", buf); if (write(g, buf, bp - buf) == -1) { printerr(0, "WARNING: failed to write message\n"); close(g); @@ -220,8 +221,23 @@ 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 there was no mapping, we send down the value -1 + * to indicate that the anonuid/anongid for the export + * should be used. + */ + if (res == -ENOENT) { + cred->cr_uid = -1; + cred->cr_gid = -1; + cred->cr_ngroups = 0; + 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;