>From de2aabd9f9df4a485e7e18a009c26f9c77a62d87 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Mon, 15 Sep 2014 14:18:17 +0200 Subject: [PATCH] LDAP: Do not clobber return value when multiple controls are returned We loop over the array of returned controls and set 'ret' based on the control value. In case multiple controls were returned, the 'ret' variable might be clobbered with result of a string-to-int conversion. --- src/providers/ldap/sdap_async_connection.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/providers/ldap/sdap_async_connection.c b/src/providers/ldap/sdap_async_connection.c index a1f78c025e03495a2ac4bcc7c5b05ac3a48ddf4f..ca981567f338f6b976efaeaed45df72e143d874b 100644 --- a/src/providers/ldap/sdap_async_connection.c +++ b/src/providers/ldap/sdap_async_connection.c @@ -833,12 +833,13 @@ static void simple_bind_done(struct sdap_op *op, goto done; } state->ppolicy->expire = strtouint32(nval, NULL, 10); - ret = errno; + lret = errno; talloc_zfree(nval); - if (ret != EOK) { + if (lret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, "Couldn't convert control response " - "to an integer [%s].\n", strerror(ret)); + "to an integer [%s].\n", strerror(lret)); + ret = ERR_INTERNAL; goto done; } -- 1.9.3