[SSSD] [PATCH] proxy: Alocate auth tokens in struct authtok_conv

Lukas Slebodnik lslebodn at redhat.com
Wed Aug 14 15:57:46 UTC 2013


On (14/08/13 11:46), Simo Sorce wrote:
>On Wed, 2013-08-14 at 13:50 +0200, Lukas Slebodnik wrote:
>> ehlo,
>> 
>> Struct sss_auth_token became opaque in commit
>> 9acfb09f7969a69f58bd45c856b01700541853ca.
>> All ocasions of "struct sss_auth_token" was replaced with pointer to this
>> structure, but proper initialization of auth_tokens was missing
>> in struct authtok_conv.
>> 
>> Patch is attached.
>
>NACK
>You call free() on a talloced structure.
>You want to call talloc_free() there.
of course
>
>Otherwise LGTM.
>
>Simo.
>

Thank you for review. It was copy&paste problem.
Updated patch is attached.

LS
-------------- next part --------------
>From f50280ab09a3dce72b7ba2a2848bb3620941af12 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Wed, 14 Aug 2013 13:21:31 +0200
Subject: [PATCH] proxy: Alocate auth tokens in struct authtok_conv

Struct sss_auth_token became opaque in commit
9acfb09f7969a69f58bd45c856b01700541853ca.
All ocasions of "struct sss_auth_token" was replaced with pointer to this
struct, but proper initialization of auth_tokens was missing
in struct authtok_conv.

Resolves:
https://fedorahosted.org/sssd/ticket/2046
---
 src/providers/proxy/proxy_child.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/providers/proxy/proxy_child.c b/src/providers/proxy/proxy_child.c
index efdf9120a8ec529283aa3f2c6cacd98d659a6ef7..6f95ede6af78f0286933fc4259dd258ef69f2d37 100644
--- a/src/providers/proxy/proxy_child.c
+++ b/src/providers/proxy/proxy_child.c
@@ -201,6 +201,23 @@ static errno_t call_pam_stack(const char *pam_target, struct pam_data *pd)
         conv.conv=proxy_internal_conv;
     }
     auth_data = talloc_zero(pd, struct authtok_conv);
+    if (auth_data == NULL) {
+        DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_zero failed.\n"));
+        return ENOMEM;
+    }
+    auth_data->authtok = sss_authtok_new(auth_data);
+    if (auth_data->authtok == NULL) {
+        DEBUG(SSSDBG_CRIT_FAILURE, ("sss_authtok_new failed.\n"));
+        ret = ENOMEM;
+        goto fail;
+    }
+    auth_data->newauthtok = sss_authtok_new(auth_data);
+    if (auth_data->newauthtok == NULL) {
+        DEBUG(SSSDBG_CRIT_FAILURE, ("sss_authtok_new failed.\n"));
+        ret = ENOMEM;
+        goto fail;
+    }
+
     conv.appdata_ptr=auth_data;
 
     ret = pam_start(pam_target, pd->user, &conv, &pamh);
@@ -279,6 +296,9 @@ static errno_t call_pam_stack(const char *pam_target, struct pam_data *pd)
     pd->pam_status = pam_status;
 
     return EOK;
+fail:
+    talloc_free(auth_data);
+    return ret;
 }
 
 static int pc_pam_handler(DBusMessage *message, struct sbus_connection *conn)
-- 
1.8.3.1



More information about the sssd-devel mailing list