[SSSD] [PATCH] LDAP: Prevent from using uninitialized sdap_options

Lukas Slebodnik lslebodn at redhat.com
Wed Nov 13 07:56:18 UTC 2013


ehlo,

previously, variable "struct sdap_options *opts" was part of bectx
When ldap_get_options failed in time of ldap backend initialisation
sdap_options(ctx->opts) remained NULL.

After refactoring dcb44c39dda9699cdd6488fd116a51ced0687de3
"LDAP: sdap_id_ctx might contain several connections"
talloc_free can be called with uninitialised sdap_options opts
if initial call to ldap_get_options fail.

I didn't change done section because talloc_free can be safely
call with NULL pointer.

Simple patch is attached.

LS
-------------- next part --------------
>From 54cf99782a3d99f0dca608edb884e6f38dd43685 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Wed, 13 Nov 2013 08:32:23 +0100
Subject: [PATCH] LDAP: Prevent from using uninitialized sdap_options

ldap_get_options can fail in time of ldap back end initialisation
and then sssd try to release uninitialised sdap_options.

Resolves:
https://fedorahosted.org/sssd/ticket/2147
---
 src/providers/ldap/ldap_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/providers/ldap/ldap_init.c b/src/providers/ldap/ldap_init.c
index 17874b1325d3e5bf2eded62c6f022364b84a5c2a..15615b2891f2e3104c11e8610c081adcd1d1ee8e 100644
--- a/src/providers/ldap/ldap_init.c
+++ b/src/providers/ldap/ldap_init.c
@@ -94,7 +94,7 @@ int sssm_ldap_id_init(struct be_ctx *bectx,
     const char *dns_service_name;
     const char *sasl_mech;
     struct sdap_service *sdap_service;
-    struct sdap_options *opts;
+    struct sdap_options *opts = NULL;
     int ret;
 
     /* If we're already set up, just return that */
-- 
1.8.3.1



More information about the sssd-devel mailing list