#!/bin/bash
# net/tool/openldap - ``openldap`` Support

set -e


######
# Native Dependencies

net_tool_openldap_server_packages=( slapd )


######
# OpenLDAP Settings

net_tool_openldap_config_check() {
	lib_setting_arrays ldapadd_opts ldapmodify_opts ldapsearch_opts
}


######
# OpenLDAP Functions

openldap_run() {
	local cmd="ldap$1"
	shift

	local -a opts=(
			-xw "$ldap_passwd"
			-D "$ldap_admin,$ldap_base_dn"
		)
	if $logging; then
		tee -a ldap.log | run $cmd "${opts[@]}" "$@"
	else
		run $cmd "${opts[@]}" "$@"
	fi
}

openldap_add() {
	local -a opts=( "${ldapadd_opts[@]}" )
	openldap_run add "${opts[@]}" "$@"
}

openldap_modify() {
	local -a opts=( "${ldapmodify_opts[@]}" )
	openldap_run modify "${opts[@]}" "$@"
}

openldap_search() {
	local -a opts=( "${ldapsearch_opts[@]}" )
	openldap_run search "${opts[@]}" -b $ldap_base_dn "$@"
}

View the Developer Guide Index

View the Reference Manual Index


Generated on Sat Jul 8 19:43:28 PDT 2017 by mcsh d14 v0.22.0.