From 6c188d847dfcd2778d134d5a0f80ecbce53e7b57 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Thu, 18 Mar 2010 17:24:00 -0400 Subject: Check if control is supported before using it. --- src/providers/ldap/sdap.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/providers/ldap/sdap.c') diff --git a/src/providers/ldap/sdap.c b/src/providers/ldap/sdap.c index cfcaff09..4d911c45 100644 --- a/src/providers/ldap/sdap.c +++ b/src/providers/ldap/sdap.c @@ -432,3 +432,21 @@ int build_attrs_from_map(TALLOC_CTX *memctx, return EOK; } +int sdap_control_create(struct sdap_handle *sh, const char *oid, int iscritical, + struct berval *value, int dupval, LDAPControl **ctrlp) +{ + int ret; + + if (sdap_is_control_supported(sh, oid)) { + ret = sss_ldap_control_create(oid, iscritical, value, dupval, ctrlp); + if (ret != LDAP_SUCCESS) { + DEBUG(1, ("sss_ldap_control_create failed [%d][%s].\n", + ret, ldap_err2string(ret))); + } + } else { + DEBUG(3, ("Server does not support the requested control [%s].\n", oid)); + ret = LDAP_NOT_SUPPORTED; + } + + return ret; +} -- cgit