diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/60-ldap | 12 |
1 files changed, 12 insertions, 0 deletions
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 +} |