On Mon, May 02, 2011 at 04:54:55PM +0200, Sumit Bose wrote:
> Hi,
> 
> this patch fixes an issue which was introduced by using talloc_move()
> insttead of talloc_steal().
> 
> bye,
> Sumit

and now with only the relevant changes ...

bye,
Sumit
From bac611c098c7e5b6624ad71c43cff6a02c054479 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sb...@redhat.com>
Date: Mon, 2 May 2011 14:54:20 +0200
Subject: [PATCH] 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 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/providers/krb5/krb5_renew_tgt.c 
b/src/providers/krb5/krb5_renew_tgt.c
index cf50666..c848afb 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"));
-- 
1.7.4.2

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to