#!/bin/sh -efu

if [ -z "${__included_cl_config-}" ]; then
__included_cl_config=1

. shell-config

cl_slapd_config() {

		SLAPD_CONF="/etc/openldap/sldap.conf"
		[ "$#" -ge 1 ] && SLAPD_CONF="$1"
		base="$(shell_config_get "$SLAPD_CONF" suffix ' ')" 
		binddn="$(shell_config_get "$SLAPD_CONF" rootdn ' ')" 
		bindpw="$(shell_config_get "$SLAPD_CONF" rootpw ' ')" 
		[ -n "$bindpw" ] && bindpw="-w $bindpw" || bindpw="-W"
		export base binddn bindpw
}

local_getent_group()
{
	local group="$1"
	if [ -n "$group" ]; then
		grep -v "^#" /etc/group | grep "^$group:"
	else
		grep -v "^#" /etc/group
	fi
}

local_getent_passwd()
{
	local user="$1"
	if [ -n "$user" ]; then
		grep -v "^#" /etc/passwd | grep "^$user:"
	else
		grep -v "^#" /etc/passwd
	fi
}
fi #__included_cl_config
