From 6e00c9e8137aae1fb8dd568a62d9fb5fc4a277cb Mon Sep 17 00:00:00 2001 From: Cullum Smith Date: Tue, 24 Sep 2024 22:35:45 -0400 Subject: finish up idm_server hostclass --- lib/60-ldap | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib') diff --git a/lib/60-ldap b/lib/60-ldap index bc5bcff..37c0c0a 100644 --- a/lib/60-ldap +++ b/lib/60-ldap @@ -24,6 +24,12 @@ ldap_delete(){ ldapdelete -Q "$@" } +ldap_search(){ + # Perform an LDAP search + # $1..$N = same as ldapsearch. + ldapsearch -QLLL "$@" +} + ldap_add_attribute(){ # Add a single attribute value to an object if it's not already present. # $1 = DN @@ -54,3 +60,9 @@ ldap_rdn_value(){ # $1 = DN echo "$1" | sed -E 's/^[^=]+=([^,]+),.*$/\1/' } + +ldap_dn_exists(){ + # Return 0 if DN exists, else 1. + # $1 = DN + ldap_search -s base -b "$1" dn > /dev/null 2>&1 +} -- cgit v1.2.3