summaryrefslogtreecommitdiffstats
path: root/src/providers/ldap/sdap_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/providers/ldap/sdap_utils.c')
-rw-r--r--src/providers/ldap/sdap_utils.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/providers/ldap/sdap_utils.c b/src/providers/ldap/sdap_utils.c
index 194f4a133..d1e886d4c 100644
--- a/src/providers/ldap/sdap_utils.c
+++ b/src/providers/ldap/sdap_utils.c
@@ -140,3 +140,21 @@ done:
talloc_free(tmp_ctx);
return ret;
}
+
+errno_t deref_string_to_val(const char *str, int *val)
+{
+ if (strcasecmp(str, "never") == 0) {
+ *val = LDAP_DEREF_NEVER;
+ } else if (strcasecmp(str, "searching") == 0) {
+ *val = LDAP_DEREF_SEARCHING;
+ } else if (strcasecmp(str, "finding") == 0) {
+ *val = LDAP_DEREF_FINDING;
+ } else if (strcasecmp(str, "always") == 0) {
+ *val = LDAP_DEREF_ALWAYS;
+ } else {
+ DEBUG(SSSDBG_CRIT_FAILURE, "Illegal deref option [%s].\n", str);
+ return EINVAL;
+ }
+
+ return EOK;
+}