1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
### This file predefine some ldapscripts variables for Debian boxes.
#
# Copyright (c) 2005 Ganaƫl LAPLANCHE - Linagora
# Copyright (c) 2005-2007 Pierre Habouzit
# Copyright (c) 2009-2012 Alexander GQ Gerasiov
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.
conffile='/etc/nslcd.conf'
getfield() {
local field="$1"
local value
if [ -f "$conffile" ];then
value=$(awk "/^[ \t]*$field/ {sub(/^[ \t]*$field[ \t]*/,\"\"); sub(/[ \t]*(#.*)?\$/, \"\"); print \$0; exit}" "$conffile")
else
value="$2"
fi
echo ${value:-$2}
}
getbase() {
local field="base"
local value
if [ ! -f "$conffile" ];then
value="$2"
else
if [ $# -eq 0 ];then
value=$(awk "/^[ \t]*$field[ \t]+[a-zA-Z0-9]+=/ {sub(/^[ \t]*$field[ \t]*/,\"\"); sub(/[ \t]*(#.*)?\$/, \"\"); print \$0; exit}" "$conffile")
else
local map="$1"
value=$(awk "/^[ \t]*$field[ \t]+$map/ {sub(/^[ \t]*$field[ \t]+$map[ \t]*/,\"\"); sub(/[ \t]*(#.*)?\$/, \"\"); sub(/,$SUFFIX\$/, \"\"); print \$0; exit}" "$conffile")
fi
fi
echo ${value:-$2}
}
# LDAP Configuration
SERVER=$(getfield uri "$(getfield host '')" | awk '{print $1}')
SUFFIX=$(getbase)
USUFFIX=$(getbase passwd 'ou=People')
GSUFFIX=$(getbase group 'ou=Groups')
MSUFFIX=$(getbase hosts 'ou=Hosts')
SASLAUTH=$(getfield sasl_mech)
# User properties
[ -f /etc/adduser.conf ] && . /etc/adduser.conf
USHELL=${DSHELL:-"/bin/bash"}
UHOMES=${DHOME:-"/home"}"/%u"
HOMESKEL=${SKEL:-"/etc/skel"}
HOMEPERMS=${DIR_MODE:-"0755"}
TMPDIR="/tmp"
GCLASS="posixGroup"
|