summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-10-21 09:04:35 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-11-02 08:45:24 -0400
commitf2b1b79d8acc2f6b401bf280dd34325d09011bdf (patch)
tree6fa8990933815e5282052d5b37d113001893881a
parentd3bdb23bec3432591acb1135a108ee9bdd5f87e0 (diff)
downloadsssd-f2b1b79d8acc2f6b401bf280dd34325d09011bdf.tar.gz
sssd-f2b1b79d8acc2f6b401bf280dd34325d09011bdf.tar.xz
sssd-f2b1b79d8acc2f6b401bf280dd34325d09011bdf.zip
Use LDAPDerefSpec properly
ldap_create_deref_control_value expects an array of LDAPDerefSpec structures with LDAPDerefSpec.derefAttr == NULL as a sentinel. We were passing a single instance of a LDAPDerefSpec structure. https://fedorahosted.org/sssd/ticket/1050
-rw-r--r--src/providers/ldap/sdap_async.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/providers/ldap/sdap_async.c b/src/providers/ldap/sdap_async.c
index 5d7019988..33664f146 100644
--- a/src/providers/ldap/sdap_async.c
+++ b/src/providers/ldap/sdap_async.c
@@ -1371,12 +1371,14 @@ static int sdap_x_deref_create_control(struct sdap_handle *sh,
{
struct berval derefval;
int ret;
- static LDAPDerefSpec ds;
+ struct LDAPDerefSpec ds[2];
- ds.derefAttr = discard_const(deref_attr);
- ds.attributes = discard_const(attrs);
+ ds[0].derefAttr = discard_const(deref_attr);
+ ds[0].attributes = discard_const(attrs);
- ret = ldap_create_deref_control_value(sh->ldap, &ds, &derefval);
+ ds[1].derefAttr = NULL; /* sentinel */
+
+ ret = ldap_create_deref_control_value(sh->ldap, ds, &derefval);
if (ret != LDAP_SUCCESS) {
DEBUG(1, ("sss_ldap_control_create failed: %s\n",
ldap_err2string(ret)));