From 0f26d4060418fea4d2aa5de433ee6b0505e750fd Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Mon, 2 May 2011 14:54:20 +0200 Subject: Return pam data to the renewal item if renewal fails A previous patch changed a talloc_steal() into a talloc_move(). Now it is not enough to change the parent memory context with talloc_steal to give back the data, but it has to be assigned back too. Additionally this patch uses the missing pam data as an indication that a renewal request for this data is currently running. --- src/providers/krb5/krb5_renew_tgt.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/providers/krb5/krb5_renew_tgt.c b/src/providers/krb5/krb5_renew_tgt.c index cf50666ff..c848afbcf 100644 --- a/src/providers/krb5/krb5_renew_tgt.c +++ b/src/providers/krb5/krb5_renew_tgt.c @@ -72,7 +72,8 @@ static void renew_tgt(struct tevent_context *ev, struct tevent_timer *te, DEBUG(1, ("krb5_auth_send failed.\n")); /* Give back the pam data to the renewal item to be able to retry at the next * time the renewals re run. */ - talloc_steal(auth_data->renew_data, auth_data->pd); + auth_data->renew_data->pd = talloc_steal(auth_data->renew_data, + auth_data->pd); talloc_free(auth_data); return; } @@ -95,7 +96,8 @@ static void renew_tgt_done(struct tevent_req *req) DEBUG(1, ("krb5_auth request failed.\n")); if (auth_data->renew_data != NULL) { DEBUG(5, ("Giving back pam data.\n")); - talloc_steal(auth_data->renew_data, auth_data->pd); + auth_data->renew_data->pd = talloc_steal(auth_data->renew_data, + auth_data->pd); } } else { switch (pam_status) { @@ -130,7 +132,8 @@ static void renew_tgt_done(struct tevent_req *req) auth_data->pd->user)); if (auth_data->renew_data != NULL) { DEBUG(5, ("Giving back pam data.\n")); - talloc_steal(auth_data->renew_data, auth_data->pd); + auth_data->renew_data->pd = talloc_steal(auth_data->renew_data, + auth_data->pd); } break; default: @@ -169,7 +172,9 @@ static errno_t renew_all_tgts(struct renew_tgt_ctx *renew_tgt_ctx) renew_data = talloc_get_type(entries[c].value.ptr, struct renew_data); DEBUG(9, ("Checking [%s] for renewal at [%.24s].\n", renew_data->ccfile, ctime(&renew_data->start_renew_at))); - if (renew_data->start_renew_at < now) { + /* If renew_data->pd == NULL a renewal request for this data is + * currently running so we skip it. */ + if (renew_data->start_renew_at < now && renew_data->pd != NULL) { auth_data = talloc_zero(renew_tgt_ctx, struct auth_data); if (auth_data == NULL) { DEBUG(1, ("talloc_zero failed.\n")); -- cgit