aboutsummaryrefslogtreecommitdiff
path: root/lib/60-ldap
diff options
context:
space:
mode:
authorCullum Smith <cullum@sacredheartsc.com>2024-09-24 22:35:45 -0400
committerCullum Smith <cullum@sacredheartsc.com>2024-09-24 22:35:45 -0400
commit6e00c9e8137aae1fb8dd568a62d9fb5fc4a277cb (patch)
tree9279f7a330affbb5da6a1f147739b8dfd92d4a19 /lib/60-ldap
parentd9c18b3fcb9b036b6cdf69397828b59ab4c53091 (diff)
downloadinfrastructure-6e00c9e8137aae1fb8dd568a62d9fb5fc4a277cb.tar.gz
finish up idm_server hostclass
Diffstat (limited to 'lib/60-ldap')
-rw-r--r--lib/60-ldap12
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
+}