Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37562313
en ru br
Репозитории ALT
S:0.3.4-alt1
5.1: 0.1-alt1
www.altlinux.org/Changes

Группа :: Система/Основа
Пакет: alterator-openldap-functions

 Главная   Изменения   Спек   Патчи   Исходники   Загрузить   Gear   Bugs and FR  Repocop 

alterator-openldap-functions-0.1/000075500000000000000000000000001117603573600171645ustar00rootroot00000000000000alterator-openldap-functions-0.1/alterator-openldap-functions000064400000000000000000000065441117603573600247230ustar00rootroot00000000000000#!/bin/sh -efu

# please comment here about this library

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

. shell-config
. shell-error
. shell-quote
. shell-signal

# delimeters
rdelim='[[:space:]]\+'
wdelim=' '

# config files
SLAPD_CONF="/etc/openldap/slapd.conf"
PAMLDAP_CONF="/etc/pam_ldap.conf"

# blank samba sid
SID="S-1-0-0"

# min max uid gid
uid_min="5000"
gid_min="5000"
uid_max="9000"
gid_max="9000"

# mail spool dir
ENABLE_HOMEDIR=
ENABLE_SPOOL=
SPOOL="/var/spool/mail"

##############################################################################
# read config functions
##############################################################################

#reading some config file $1 for $2 variable and removing " from its value

read_config()
{
[ -e "$1" ] || fatal "read_config: '$1' file not found"
shell_config_get "$1" "$2" "$rdelim"|tr -d '"'
}

read_dn_conf()
{
read_config "$DN_CONF" "$1"
}

read_slapd_conf()
{
read_config "$SLAPD_CONF" "$1"
}

read_pamldap_conf()
{
read_config "$PAMLDAP_CONF" "$1"
}

##############################################################################



##############################################################################
# host_2_dn dn_2_host
##############################################################################

# host.domain.com => dc=host,dc=domain,dc=com
host_2_dn()
{
echo "$1"|sed '
s/^/dc=/
s/\./,dc=/g'
}

# dc=host,dc=domain,dc=com => host.domain.com
dn_2_host()
{
echo "$1"|sed '
s/^dc=//
s/,dc=/\./g'
}

##############################################################################



##############################################################################
# slapd functions
##############################################################################

# return
# 0 if all right
# 1 if pidfile exists but daemon died
# 3 if daemon stoped
slapd_daemon_status()
{
[ -e "/etc/init.d/slapd" ] || fatal "slapd_daemon_status: /etc/init.d/slapd doesn't exist"
/etc/init.d/slapd status >/dev/null 2>&1
return $?
}

##############################################################################



##############################################################################
# base_rootdn_rootpw functions
##############################################################################

base_rootdn_rootpw() {

[ -z "$DN_CONF" ] && fatal "base_rootdn_rootpw: DN_CONF not set"

base="$(read_dn_conf suffix)"
rootdn="$(read_dn_conf rootdn)"
rootpw="$(read_dn_conf rootpw)"

[ -z "$base" ] && fatal "base_rootdn_rootpw: basedn not set in conf '$DN_CONF'"
[ -z "$rootdn" ] && fatal "base_rootdn_rootpw: rootdn not set in conf '$DN_CONF'"
[ -z "$rootpw" ] && fatal "base_rootdn_rootpw: rootpw not set in conf '$DN_CONF'"

rootpw="-w $rootpw"

export base rootdn rootpw
}

##############################################################################



##############################################################################
# helper functions
##############################################################################

get_sid()
{
local sid="$(net getlocalsid | cut -f2 -d':'| sed -e "s/[[:blank:]]//g" 2>/dev/null)"
[ -n "$sid" ] && SID="$sid"
}

##############################################################################
fi #__included_alterator_openldap_functions
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin