X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils%2Fgssd%2Fgssd_proc.c;h=788ecf1d7551a765eb904f17985f7ecdfe6bcc8b;hb=c5ea2fbc9ab9d142aa867da594a66f4097df03d1;hp=1e7ebaed67d85ba03c38f95ba53c9dc5e96aa5cc;hpb=f1bfe0916c04d93de7a4fae5315fff6e4ccac23f;p=nfs-utils.git diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c index 1e7ebae..788ecf1 100644 --- a/utils/gssd/gssd_proc.c +++ b/utils/gssd/gssd_proc.c @@ -372,15 +372,18 @@ do_downcall(int k5_fd, uid_t uid, struct authgss_private_data *pd, printerr(1, "doing downcall\n"); - if (WRITE_BYTES(&p, end, uid)) return -1; + if (WRITE_BYTES(&p, end, uid)) goto out_err; /* Not setting any timeout for now: */ - if (WRITE_BYTES(&p, end, timeout)) return -1; - if (WRITE_BYTES(&p, end, pd->pd_seq_win)) return -1; - if (write_buffer(&p, end, &pd->pd_ctx_hndl)) return -1; - if (write_buffer(&p, end, context_token)) return -1; + if (WRITE_BYTES(&p, end, timeout)) goto out_err; + if (WRITE_BYTES(&p, end, pd->pd_seq_win)) goto out_err; + if (write_buffer(&p, end, &pd->pd_ctx_hndl)) goto out_err; + if (write_buffer(&p, end, context_token)) goto out_err; - if (write(k5_fd, buf, p - buf) < p - buf) return -1; + if (write(k5_fd, buf, p - buf) < p - buf) goto out_err; return 0; +out_err: + printerr(0, "Failed to write downcall!\n"); + return -1; } static int @@ -393,15 +396,17 @@ do_error_downcall(int k5_fd, uid_t uid, int err) printerr(1, "doing error downcall\n"); - if (WRITE_BYTES(&p, end, uid)) return -1; - if (WRITE_BYTES(&p, end, timeout)) return -1; + if (WRITE_BYTES(&p, end, uid)) goto out_err; + if (WRITE_BYTES(&p, end, timeout)) goto out_err; /* use seq_win = 0 to indicate an error: */ - if (WRITE_BYTES(&p, end, zero)) return -1; - if (WRITE_BYTES(&p, end, err)) return -1; + if (WRITE_BYTES(&p, end, zero)) goto out_err; + if (WRITE_BYTES(&p, end, err)) goto out_err; - if (write(k5_fd, buf, p - buf) < p - buf) return -1; + if (write(k5_fd, buf, p - buf) < p - buf) goto out_err; return 0; - +out_err: + printerr(0, "Failed to write error downcall!\n"); + return -1; } /* @@ -499,6 +504,10 @@ int create_auth_rpc_client(struct clnt_info *clp, retval = 0; out_fail: + if ((save_uid != -1) && (seteuid(save_uid) != 0)) { + printerr(0, "WARNING: Failed to restore euid" + " to uid %d (in error path)\n", save_uid); + } if (sec.cred != GSS_C_NO_CREDENTIAL) gss_release_cred(&min_stat, &sec.cred); if (rpc_clnt) clnt_destroy(rpc_clnt);