summaryrefslogtreecommitdiffstats
path: root/src/providers/ldap/ldap_common.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-10-07 18:02:04 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-10-25 22:04:11 +0200
commit9dd62f094fb4c1bfb04128de1c3ec20933603046 (patch)
treeeded847415955a60fbad0a712c896f0671c85dee /src/providers/ldap/ldap_common.c
parente37cbdd9be139b9949024c94ae21c12b36a6c180 (diff)
downloadsssd-9dd62f094fb4c1bfb04128de1c3ec20933603046.tar.gz
sssd-9dd62f094fb4c1bfb04128de1c3ec20933603046.tar.xz
sssd-9dd62f094fb4c1bfb04128de1c3ec20933603046.zip
AD: Use the ad_access_filter if it's set
Related: https://fedorahosted.org/sssd/ticket/2082 Currently the AD access control only checks if an account has been expired. This patch amends the logic so that if ad_access_filter is set, it is used automatically.
Diffstat (limited to 'src/providers/ldap/ldap_common.c')
-rw-r--r--src/providers/ldap/ldap_common.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c
index 89786fa49..d4d171de1 100644
--- a/src/providers/ldap/ldap_common.c
+++ b/src/providers/ldap/ldap_common.c
@@ -1745,6 +1745,25 @@ char *sdap_get_id_specific_filter(TALLOC_CTX *mem_ctx,
return filter; /* NULL or not */
}
+char *sdap_get_access_filter(TALLOC_CTX *mem_ctx,
+ const char *base_filter)
+{
+ char *filter = NULL;
+
+ if (base_filter == NULL) return NULL;
+
+ if (base_filter[0] == '(') {
+ /* This filter is wrapped in parentheses.
+ * Pass it as-is to the openldap libraries.
+ */
+ filter = talloc_strdup(mem_ctx, base_filter);
+ } else {
+ filter = talloc_asprintf(mem_ctx, "(%s)", base_filter);
+ }
+
+ return filter;
+}
+
errno_t
sdap_attrs_get_sid_str(TALLOC_CTX *mem_ctx,
struct sdap_idmap_ctx *idmap_ctx,