#!/bin/bash
#
# Univention Admin Modules
#  CLI test script
#
# Copyright 2004-2014 Univention GmbH
#
# http://www.univention.de/
#
# All rights reserved.
#
# The source code of this program is made available
# under the terms of the GNU Affero General Public License version 3
# (GNU AGPL V3) as published by the Free Software Foundation.
#
# Binary versions of this program provided by Univention to you as
# well as other copyrighted, protected or trademarked materials like
# Logos, graphics, fonts, specific documentations and configurations,
# cryptographic keys etc. are subject to a license agreement between
# you and Univention and not subject to the GNU AGPL V3.
#
# In the case you use this program under the terms of the GNU AGPL V3,
# the program is provided 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public
# License with the Debian GNU/Linux or Univention distribution in file
# /usr/share/common-licenses/AGPL-3; if not, see
# <http://www.gnu.org/licenses/>.
eval "$(univention-config-registry shell)"


describe () {
	echo usage:
	echo 'testscript OPTIONS'
	echo
	echo OPTIONS:
	echo "-c	continue after errors"
	echo "-l	do object listing"
	echo "-u	do user tests"
	echo "-x	do extended tests that involve"
	echo "      schema changes "
	echo "      WARNING: May take a LONG time!"
	echo "-o	do container tests"
	echo "-g	do group test"
	echo "-n	do network and computer tests"
	echo "-p	do policy tests"
	echo "-s	do setting tests"
	echo "-r	do share test"
	echo "-b    do mail tests"
	echo "-m	do locking tests"
	echo "-t    do recursive tests"
	echo "-a	do all tests except listing and locking"
	echo "-A    do all tests including listing and locking"
	echo "-v	verbose"
	echo "-d    no cleanup before test"
	echo "-w    cleanup only"
	echo
	echo 'New behaviour: before the first test, the system is'
	echo 'automatically cleaned of stale locks and leftovers'
	echo 'from previous tests.'
	echo "If you don't want this, use the -d option."
	echo "If you want to clean up after a test without"
	echo "performing a new one use -w."
	echo "Locking tests ar not part of -a anymore. You can use"
	echo "-A instead, or specify the individual tests manually"
	exit 1
}
errcheckdone=false
#defaults
export errorlog=./error.log
stay=""
dolist=""
douser=""
docontainers=""
dogroup=""
dohosts=""
dolocking=""
dosettings=""
dopolicies=""
doshare=""
verbose=""
cleanup="1"
if [ -z "$1" ]
then
	describe
fi
while [ -n "$1" ]
do
	case $1 in
		"-t")
		dorecursive="1"
		;;
		"-c")
		stay="1"
		;;
		"-d")
		cleanup=""
		;;
		"-l")
		dolist="1"
		;;	
		"-u")
		douser="1"
		;;	
		"-x")
		doextended="1"
		;;
		"-o")
		docontainers="1"
		;;
		"-g")
		dogroup="1"
		;;
		"-n")
		dohosts="1"
		;;
		"-p")
		dopolicies="1"
		;;
		"-s")
		dosettings="1"
		;;
		"-b")
		domail="1"
		;;
		"-m")
		dolocking="1"
		;;
		"-a")
		dosettings="1"
		dopolicies="1"
		dohosts="1"
		dogroup="1"
		#dolocking="1"
		docontainers="1"
		doshare="1"
		douser="1"
		domail="1"
		dorecursive="1"
		;;
		"-A")
		dosettings="1"
		dopolicies="1"
		dohosts="1"
		dogroup="1"
		dolocking="1"
		docontainers="1"
		dolist="1"
		doshare="1"
		douser="1"
	    domail="1"
		dorecursive="1"
		;;
		"-v")
		verbose="1"
		;;
		"-r")
		doshare="1"
		;;
		"-w")
		;;
		*)
		describe 
		;;  
	esac
	shift 1
done
ERRLINE=0
firstrun="1"
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" >>"$errorlog"
echo "% started `date`												%" >>"$errorlog"
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" >>"$errorlog"

cleanup() {
	echo "cleaning up..."
	echo "cleaning up..." >>"$errorlog"
	olist[1]="uid=foobar,cn=users,$ldap_base"
	olist[2]="cn=töstcn,$ldap_base"
	olist[3]="ou=töstou,$ldap_base"
	olist[5]="cn=testnetwork,$ldap_base"
	olist[6]="cn=testgroup,cn=groups,$ldap_base"
	olist[7]="cn=testdhcpservice,cn=dhcp,$ldap_base"
	olist[8]="zoneName=dnstestzone,cn=dns,$ldap_base"
	olist[9]="zoneName=1.168.19.in-addr.arpa,cn=dns,$ldap_base"
	olist[10]="cn=testipmanagedclient,cn=computers,$ldap_base"
	olist[11]="cn=testthinclient,cn=computers,$ldap_base"
	olist[12]="cn=testwinclient,cn=computers,$ldap_base"
	olist[13]="cn=testmemserver,cn=computers,$ldap_base"
	olist[14]="cn=testclient,cn=computers,$ldap_base"
	olist[15]="cn=testdconmaster,cn=computers,$ldap_base"
	olist[16]="cn=testdconback,cn=computers,$ldap_base"
	olist[17]="cn=testdconslave,cn=computers,$ldap_base"
	olist[18]="cn=myshare,cn=shares,$ldap_base"
	olist[19]="cn=testdesktoppolicy,cn=policies,$ldap_base"
	olist[20]="cn=testpolicydhcpdns,cn=policies,$ldap_base"
	olist[21]="cn=testpolicydhcpdnsupdate,cn=policies,$ldap_base"
	olist[22]="cn=testpolicydhcpleasetime,cn=policies,$ldap_base"
	olist[23]="cn=testpolicydhcpnetbios,cn=policies,$ldap_base"
	olist[24]="cn=testpolicydhcprouting,cn=policies,$ldap_base"
	olist[25]="cn=testpolicydhcpscope,cn=policies,$ldap_base"
	olist[26]="cn=testpolicydhcpstatements,cn=policies,$ldap_base"
	olist[27]="cn=testpolicypwhistory,cn=policies,$ldap_base"
	olist[28]="cn=testpolicysound,cn=policies,$ldap_base"
	olist[29]="cn=testpolicythinclient,cn=policies,$ldap_base"
	olist[30]="cn=testpolicywindowsinstallation,cn=policies,$ldap_base"
	olist[31]="cn=testpolicyxfree,cn=policies,$ldap_base"
	olist[32]="cn=testdhcpservice2,cn=dhcp,$ldap_base"
	olist[33]="zoneName=dnstestzone2,cn=dns,$ldap_base"
	olist[34]="zoneName=2.168.19.in-addr.arpa,cn=dns,$ldap_base"
	olist[35]="cn=testnetwork2,$ldap_base"
	olist[36]="cn=testolbaccess,cn=custom attributes,cn=univention,$ldap_base"
	olist[37]="cn=testprinter,cn=shares,$ldap_base"
	olist[38]="cn=testprintermodels,cn=univention,$ldap_base"
	olist[39]="cn=testfiliale,cn=custom attributes,cn=univention,$ldap_base"
	olist[40]="cn=testinternetAccount,cn=custom attributes,cn=univention,$ldap_base"
	olist[41]="cn=testou,cn=custom attributes,cn=univention,$ldap_base"
	olist[42]="cn=testpctyp,cn=custom attributes,cn=univention,$ldap_base"
	olist[43]="uid=foobar2,cn=users,$ldap_base"
	olist[44]="uid=u1,$ldap_base"
	olist[45]="uid=u2,$ldap_base"
	olist[46]="uid=u3,$ldap_base"
	olist[47]="cn=t,cn=groups,$ldap_base"
	olist[48]="cn=testgroup,$ldap_base"
	olist[49]="cn=testmaildomain,$ldap_base"
	olist[50]="cn=testmaildomambo,$ldap_base"
	olist[51]="cn=testmailfolder@$domainname,$ldap_base"
	olist[52]="cn=testmailinglist,$ldap_base"
	olist[53]="cn=testadmincontainerpolicy,$ldap_base"
	olist[54]="cn=testadminuserpolicy,$ldap_base"
	olist[55]="cn=testautostartpolicy,$ldap_base"
	olist[56]="cn=testclientdevicespolicy,$ldap_base"
	olist[57]="cn=testmanagedclientpackagespolicy,$ldap_base"
	olist[58]="cn=testdhcpbootpolicy,$ldap_base"
	olist[59]="cn=testldapserverpolicy,$ldap_base"
	olist[60]="cn=testmailquotapolicy,$ldap_base"
	olist[61]="cn=testmaintenancepolicy,$ldap_base"
	olist[62]="cn=testmasterpackagespolicy,$ldap_base"
	olist[63]="cn=testmemberpackagespolicy,$ldap_base"
	olist[64]="cn=testmobileclientpackagespolicy,$ldap_base"
	olist[65]="cn=testslavepackagespolicy,$ldap_base"
	olist[66]="cn=testprintquotapolicy,$ldap_base"
	olist[67]="cn=testprintserverpolicy,$ldap_base"
	olist[68]="cn=testpwhistorypolicy,$ldap_base"
	olist[69]="cn=testreleasepolicy,$ldap_base"
	olist[70]="cn=testrepositoryserverpolicy,$ldap_base"
	olist[71]="cn=testrepositorysyncpolicy,$ldap_base"
	olist[72]="cn=testshareuserquotapolicy,$ldap_base"
	olist[73]="uid=foobar,cn=groups,$ldap_base"
	olist[74]="cn=testpackagessetting,$ldap_base"
	olist[75]="cn=testprinterurisetting,$ldap_base"
	olist[76]="cn=testsambaconfigsetting,$ldap_base"
	olist[77]="sambaDomainName=testsambadomainsetting,$ldap_base"
	olist[78]="cn=testservicesetting,$ldap_base"

	
	for i in `seq 1 78 `;
	do
		if ldapdelete -x -r -D "cn=admin,$ldap_base" -w "`cat /etc/ldap.secret`" "${olist[${i}]}" 2>/dev/null >/dev/null 
		then
			echo "there were leftovers in ${olist[${i}]}"
		fi
	done

	ldapsearch -x  -b "cn=computers,$ldap_base" -s ONE "(&(cn=test*)(objectClass=univentionHost))" cn |grep "^cn: "| sed 's/^cn: //'| 
	{
		while read x
		do
			echo "there were leftovers in cn=$x,cn=computers,cn=$ldap_base " 
			ldapdelete -x -D "cn=admin,$ldap_base" -w "`cat /etc/ldap.secret`" "cn=$x,cn=computers,$ldap_base" #2>/dev/null >/dev/null
		done
	}

	ldapdelete -x -D "cn=admin,$ldap_base" -w "`cat /etc/ldap.secret`" -r "cn=moveme,$ldap_base" 2>/dev/null >/dev/null
	ldapdelete -x -D "cn=admin,$ldap_base" -w "`cat /etc/ldap.secret`" -r "cn=there,$ldap_base" 2>/dev/null >/dev/null


	ldapsearch -x -LLL  -D "cn=admin,$ldap_base" -w "`cat /etc/ldap.secret`" "(objectClass=lock)"|grep "^dn: " |sed 's/^dn: //' | cut -d"," -f "1,2,3"| sed "s/\(.\)$/\1,cn=univention,$ldap_base/" |{ 
		while read x 
		do
			echo "there were leftovers in $x"						 
			ldapdelete -x -D "cn=admin,$ldap_base" -w "`cat /etc/ldap.secret`" "$x" #2>/dev/null >/dev/null
		done 
	}
	if test -e /etc/ldap/slapd.conf.testbackup
	then
		mv /etc/ldap/slapd.conf.testbackup /etc/ldap/slapd.conf
	fi

	echo "cleanup done"
	echo "cleanup done" >>"$errorlog"
}
############################################################################
############################################################################
# check LDAP
############################################################################
############################################################################
errcheck () {
	if [ -z "$firstrun" ]
	then
		if [ -n "$iscorrect" ]
		then
			echo -e "\t\t\tOK"
		else
			echo -e "\t\t\tERROR"
			doexit $1
		fi
	else
		firstrun=""
	fi
	errcheckdone=true
}
doprint ()
{
	errcheck $1
	firstrun=1
	echo
	echo $2
}
doexit () { 
	if [ -z "$stay" ]
	then
		echo -e "ERR at $1" 
		echo -e "ERR at $1 ">>"${errorlog}" 
		exit 1
	else
		echo -e "ERR at $1" 
		echo -e "ERR at $1 ">>"${errorlog}" 
	fi
}

# 	(dn-delta,scope,filter,name,att)
ckthere () {
	result_dn=`ldapsearch -x -D "cn=admin,$ldap_base" -w \`cat /etc/ldap.secret\` -b "$1,$ldap_base" -s "$2" -LLL \
	"$3" 2>/dev/null | grep "^dn:"`

	if [ -z "$result_dn" ]; then
		iscorrect=""
		echo "E $4 : $5 at $6" >>"${errorlog}"
		ERRLINE=$6
		doexit $6
	fi
}

cknthere () {
	result_dn=`ldapsearch -x -D "cn=admin,$ldap_base" -w \`cat /etc/ldap.secret\` -b "$1,$ldap_base" -s $2 -LLL \
	"$3" 2>/dev/null | grep "^dn:"`

	if [ -n "$result_dn" ]; then
		iscorrect=""
		echo "E $4 : $5 at $6" >>"${errorlog}"
		doexit $6
	fi
}

helpcheck () {
	y=""
	x=`ldapsearch -LLL -x -b "$1,$ldap_base" "(objectClass=*)" -s BASE  "$2" 2>/dev/null`
	echo $x|sed "s/$2: /\n/g"|grep -v '^dn: '| { 
		while read y
		do  if [ "$y" = "$3" ]
			then
				echo  "mooh"
			fi
		done
	}
}

getvalue () {
	ret=`ldapsearch -LLL -x -b "$1,$ldap_base" "(objectClass=*)" -s BASE "$2" 2>/dev/null |grep "^$2:" |sed "s/$2: //"`
	echo $ret	
}

ckeq () {
	if [ "`helpcheck $@`" != "mooh" ]
	then
		iscorrect=""
		echo -e "\nE: checking \"$1,$ldap_base\": $2 at $4" >>"${errorlog}"
		doexit $4
	fi
}

ckneq () {
	if [ "`helpcheck $@`" = "mooh" ]
	then
		iscorrect=""
		echo -e "\nE: checking \"$1,$ldap_base\": $2 at $4" >>"${errorlog}"
		doexit $4
	fi
}


module_list () {
	univention-admin $1 list 1>/dev/null 2>>"${errorlog}"
	if [ "$3" != "silent" ]
	then
		echo "listing $1"
	fi
	echo "listing $1" >>"${errorlog}"
	if [ $? = 1 ]; then
		echo "E: $1 list"
		echo "E: $1 list" >>"${errorlog}"
		doexit $2
	fi
}
clearlocks () {
ldapsearch -x -LLL  -D "cn=admin,$ldap_base" -w "`cat /etc/ldap.secret`" "(objectClass=lock)"|grep "^dn: " |sed 's/^dn: //' | cut -d"," -f "1,2,3"| sed "s/\(.\)$/\1,cn=univention,$ldap_base/" |{ 
			while read x 
			do
				echo "there were leftovers in $x"						 
				ldapdelete -x -D "cn=admin,$ldap_base" -w "`cat /etc/ldap.secret`" "$x" #2>/dev/null >/dev/null
			done 
		}
	}
checklockshelper () {
	ldapsearch -x -LLL  -D "cn=admin,$ldap_base" -w "`cat /etc/ldap.secret`" "(objectClass=lock)"|grep "^dn: " |sed 's/^dn: //' | cut -d"," -f "1,2,3"| sed "s/\(.\)$/\1,cn=univention,$ldap_base/"
}
checklocks () {
	echo -e "\nchecking locks:">>"${errorlog}"
	ret=`checklockshelper`
	if [ -n "$ret" ]; then
		echo LOCK LEFT in \"$ret\" >>"${errorlog}"
		echo LOCK LEFT in \"$ret\"
		clearlocks
		doexit $1
	fi
}

module_list_superordinate () {
	echo "listing $1"
	echo "listing $1" >>"${errorlog}"
	for dn in `univention-admin $1 list | grep "DN: " | sed -e 's|DN: ||'`; do
		echo -e "\tlisting $2"
		echo -e "\tlisting $2" >>"${errorlog}"
		univention-admin $2 list --superordinate "$dn" 1>/dev/null 2>>"${errorlog}"
		if [ $? = 1 ]; then
			echo "E: $2 list (superordinate=$dn)"
			echo "E: $2 list (superordinate=$dn)" >>"${errorlog}"
			doexit $3
		fi
	done
}
adminwrap(){
	if [ ! $errcheckdone ]
	then
		errcheck $1
	fi
	errcheckdone=false
	line=$1
	shift 1
	echo -n -e "\n\ttrying to $2 $1"
	echo -n -e "\n\ttrying to $2 $1" >>"${errorlog}"
	if [ -n "$verbose" ]
	then
		echo >>"${errorlog}"
		echo univention-admin "$@" >>"${errorlog}"
		echo >>"${errorlog}"
	fi
	if eval univention-admin "$@" >>"${errorlog}" 2>>"${errorlog}"
	then
		echo -e "\t\tOK"
		echo -e "\t\tOK" >>"${errorlog}"

	else
		echo -e "\t\tERR"
		echo -e "\t\tERR" >>"${errorlog}"
		doexit $line
	fi
	iscorrect="1"
	echo -n -e "\tverifying"
}

adminfailwrap(){
	errcheck $1
	line=$1
	shift 1
	echo -n -e "\n\ttrying to (ought to fail) $2 $1"
	echo -n -e "\n\ttrying to (ought to fail) $2 $1" >>"${errorlog}"
	if [ -n "$verbose" ]
	then
		echo >>"${errorlog}"
		echo univention-admin "$@" >>"${errorlog}"
		echo >>"${errorlog}"
	fi
	if eval univention-admin "$@" >>"${errorlog}" 2>>"${errorlog}"
	then
		echo -e "\t\tERR"
		echo -e "\t\tERR" >>"${errorlog}"
		doexit $line
	else
		echo -e "\tfailed->OK"
		echo -e "\tfailed->OK" >>"${errorlog}"
	fi
	iscorrect="1"
	echo -n -e "\tverifying"
}
if [ -n "$cleanup" ]
then
	cleanup
fi

if [ -n "$dolist" ]
then
	module_list container/dc $LINENO
	module_list container/cn $LINENO
	module_list container/ou $LINENO
	module_list users/user $LINENO
	module_list users/root $LINENO
	module_list groups/group $LINENO
	module_list computers/domaincontroller_master $LINENO
	module_list computers/domaincontroller_backup $LINENO
	module_list computers/domaincontroller_slave $LINENO
	module_list computers/memberserver $LINENO
	module_list computers/windows $LINENO
	module_list computers/managedclient $LINENO
	module_list computers/thinclient $LINENO
	module_list shares/share $LINENO
	module_list dns/forward_zone $LINENO
	module_list dns/reverse_zone $LINENO
	module_list_superordinate dns/forward_zone dns/alias $LINENO
	module_list_superordinate dns/forward_zone dns/host_record $LINENO
	module_list_superordinate dns/forward_zone dns/srv_record $LINENO
	module_list_superordinate dns/forward_zone dns/zone_mx_record $LINENO
	module_list_superordinate dns/forward_zone dns/zone_txt_record $LINENO
	module_list_superordinate dns/reverse_zone dns/ptr_record $LINENO
	module_list dhcp/service $LINENO
	module_list_superordinate dhcp/service dhcp/host $LINENO
	module_list_superordinate dhcp/service dhcp/pool $LINENO
	module_list_superordinate dhcp/service dhcp/server $LINENO
	module_list_superordinate dhcp/service dhcp/subnet $LINENO
	module_list settings/cn $LINENO
	module_list settings/customattribute $LINENO
	module_list settings/default $LINENO
	module_list settings/directory $LINENO
	module_list settings/license $LINENO
	module_list settings/settings $LINENO
	module_list policies/desktop $LINENO
	module_list policies/dhcp_boot $LINENO
	module_list policies/dhcp_dns $LINENO
	module_list policies/dhcp_dnsupdate $LINENO
	module_list policies/dhcp_leasetime $LINENO
	module_list policies/dhcp_netbios $LINENO
	module_list policies/dhcp_routing $LINENO
	module_list policies/dhcp_scope $LINENO
	module_list policies/dhcp_statements $LINENO
	#module_list policies/policy $LINENO
	module_list policies/pwhistory $LINENO
	module_list policies/sound $LINENO
	module_list policies/thinclient $LINENO
	module_list policies/xfree $LINENO
fi
iscorrect="1"
endnum=1
if [ -n "$doextended" ]
then
	cat << EOF >/etc/ldap/schema/testolb.schema
attributetype ( 1.3.6.1.4.1.10176.2.899.939 NAME 'testfilialbereich'
	DESC 'testFilialbereich'        
	EQUALITY caseIgnoreMatch        
	SUBSTR caseIgnoreSubstringsMatch        
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} )

objectclass (	1.3.6.1.4.1.10176.1.899.939 NAME 'testfiliale'
	DESC 'testFilialbereich'         
	SUP top AUXILIARY        
	MAY ( testfilialbereich ) )

attributetype ( 1.3.6.1.4.1.10176.2.898.939 
	NAME 'testisInternetAccount'        
	DESC 'testInternet Account'        
	EQUALITY caseIgnoreMatch        
	SUBSTR caseIgnoreSubstringsMatch        
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} SINGLE-VALUE)

objectclass (	1.3.6.1.4.1.10176.1.898.939 
	NAME 'testinternetAccount'        
	DESC 'Internet Account'         
	SUP top AUXILIARY        
	MAY ( testisInternetAccount ) )

attributetype (1.3.6.1.4.1.9465.1.3.939
	NAME 'testpctyp'
	DESC 'testpctyp'
	EQUALITY caseIgnoreMatch
	SUBSTR caseIgnoreSubstringsMatch
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} )

objectclass     ( 1.3.6.1.4.1.9465.2.3.939
	NAME 'testolbPC'
	DESC 'testOLB PC'
	SUP top AUXILIARY
	MAY ( testpctyp ))
EOF
cat << EOF >/etc/ldap/schema/testolbperson.schema

attributetype (	1.3.6.1.4.1.9465.1.1.939
	NAME 'testolbID'
	EQUALITY caseIgnoreMatch
	SUBSTR caseIgnoreSubstringsMatch
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )


	# olbPerson
objectclass (	1.3.6.1.4.1.9465.2.1.939
	NAME 'testolbPerson'
	DESC 'testMitarbeiter OLB'
	SUP organizationalPerson
	STRUCTURAL
	MAY ( testolbID )
	)

	#
	# OLB Berechtigungsprüfung
	#
attributetype (	1.3.6.1.4.1.9465.1.2.939
	NAME 'testolbaccess'
	DESC 'testolbaccess'
	EQUALITY caseIgnoreMatch
	SUBSTR caseIgnoreSubstringsMatch
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} )

objectclass (	1.3.6.1.4.1.9465.2.2.939
	NAME 'testolbPermission'
	DESC 'testOLB Berechtigungen'
	SUP top AUXILIARY
	MAY ( testolbaccess ))
EOF

	if test -e /etc/ldap/slapd.conf.testbackup
	then
		echo "Backup of slapd.conf allready exists!"
		doexit $LINENO
	fi
	cp /etc/ldap/slapd.conf /etc/ldap/slapd.conf.testbackup
	echo '/^schemacheck		on
Oinclude			/etc/ldap/schema/testolb.schema
include			/etc/ldap/schema/testolbperson.schema
:wq' | vim /etc/ldap/slapd.conf >/dev/null 2>/dev/null
	/etc/init.d/slapd restart

	adminwrap $LINENO settings/customattribute create --set module=users/user --set objectClass=testfiliale --set syntax=string --set ldapMapping=testfilialbereich --set shortDescription=\"testFilial bereich\" --set longDescription=testFilialbereich --set name=testfiliale --set multivalue=1 --position \"cn=custom attributes,cn=univention,$ldap_base\"

	adminwrap $LINENO settings/customattribute create --append module=users/user --append module=computers/windows --set objectClass=testinternetAccount --set syntax=boolean --set ldapMapping=testisInternetAccount --set shortDescription=testisInternet --set longDescription\"testInternet user und Computer\" --set name=testinternetAccount --set multivalue=0 --position \"cn=custom attributes,cn=univention,$ldap_base\"

	adminwrap $LINENO settings/customattribute create --set module=users/user --set objectClass=testolbPermission --set syntax=string --set ldapMapping=testolbaccess --set shortDescription=testOLBACCESS --set longDescription=ÖLBtestaccess --set name=testolbaccess --set multivalue=1  --position \"cn=custom attributes,cn=univention,$ldap_base\"

	adminwrap $LINENO settings/customattribute create --set module=users/user --set objectClass=organizationalPerson --set syntax=string --set ldapMapping=ou --set shortDescription=testou --set longDescription=\"testOrganisationseinheit\" --set name=testou --position \"cn=custom attributes,cn=univention,$ldap_base\"
	
	adminwrap $LINENO settings/customattribute create --set module=computers/windows --set objectClass=testolbPc --set syntax=string --set ldapMapping=testpctyp --set shortDescription=testpctyp --set longDescription=\"TESTPCTYP\" --set name=testpctyp --position \"cn=custom attributes,cn=univention,$ldap_base\" --set multivalue=0
	endnum=511

fi

if [ -n "$douser" ]
then
	adminwrap $LINENO policies/pwhistory modify --dn \"cn=default-settings,cn=pwhistory,cn=users,cn=policies,$ldap_base\" --set expiryInterval="7"
	if [ -n "$doextended" ]
	then # test for bug #1594
		adminwrap $LINENO users/user create --position \"cn=users,$ldap_base\" $optionstring --set username=foobar --set lastname=Bar --set description=Testuser --set password=babudabidu --customattribute \"testFilial bereich\"=whereever
		adminwrap $LINENO users/user create --position \"cn=users,$ldap_base\" $optionstring --set username=foobar2 --set lastname=Bar --set description=Testuser --set password=babudabidu --customattribute \"testFilial bereich\"=whereever
		ckthere "uid=foobar2,cn=users" "base" "(testfilialbereich=whereever)" "foobar" "extended attribute testuser" $LINENO
		adminwrap $LINENO users/user remove --dn \"uid=foobar,cn=users,$ldap_base\"
		adminwrap $LINENO users/user remove --dn \"uid=foobar2,cn=users,$ldap_base\"
		cknthere "uid=foobar,cn=users" "BASE" "(objectClass=*)" "foobar" "existence" $LINENO
		cknthere "uid=foobar2,cn=users" "BASE" "(objectClass=*)" "foobar2" "existence" $LINENO
	fi
for i in `seq 1 $endnum`;do
	if [ $(( $i%8 )) -eq 0 ]	# this cuts out all cases, where no option is given which 
	then						# are equivalent to those that have all options anyway 
		continue				# but would not be handled correctly by the script
	fi

	############################################################################
	############################################################################
	# users/user
	############################################################################
	############################################################################

	############################################################################
	# create user object
	############################################################################

	if [ "0" -eq $(( i%2 )) ]
	then posixopt=""
	else posixopt="1"
	fi
	if [ "0" -eq $(( (i/2)%2 )) ]
	then personopt=""
	else personopt="1"
	fi
	if [ "0" -eq $(( (i/4)%2 )) ]
	then sambaopt=""
	else sambaopt="1"
	fi
	if [ "0" -eq $(( (i/8)%2 )) ]
	then kerberosopt=""
	else kerberosopt="1"
	fi
	if [ "0" -eq $(( (i/16)%2 )) ]
	then 
		customattopt=""
		customattsettings=""
	else 
		customattopt="1"
		customattsettings=" --customattribute \"testFilial bereich\"=bremen "
	fi
	if [ "0" -eq $(( (i/32)%2 )) ]
	then 
		customatt2opt=""
		customattsettings2=""
	else 
		customatt2opt="1"
		customattsettings2=" --customattribute testou=whatever "
	fi
	if [ "0" -eq $(( (i/64)%2 )) ]
	then 
		customatt3opt=""
		customattsettings3=""
	else 
		customatt3opt="1"
		customattsettings3=" --customattribute testisInternet=1 --customattribute testOLBACCESS=gogogo "
	fi
	if [ "0" -eq $(( (i/128)%2 )) -o "$customatt3opt" = "1" ]	# prevent setting testisInternet twice
	then 
		customatt4opt=""
		customattsettings4=""
	else 
		customatt4opt="1"
		customattsettings4=" --customattribute testisInternet=0 "
	fi
	if [ "0" -eq $(( (i/256)%2 )) ]
	then
		mailopt=""
	else
		mailopt="1"
	fi
	
	if [ "1" -eq "$endnum" ]
	then
		posixopt="1"
		personopt="1"
		sambaopt="1"
		kerberosopt="1"
	fi
	pskopt=""
	posixsettings=""
	sambasettings=""
	personsettings=""
	kerberossettings=""
	psksettings=""
	optionstring=""
	mailsettings=""
	if [ -n "$posixopt"		]
	then
		optionstring="$optionstring --option posix"
	fi
	if [ -n "$personopt"	]
	then
		optionstring="$optionstring --option person"
	fi	
	if [ -n "$sambaopt"		]
	then
		optionstring="$optionstring --option samba"
	fi
	if [ -n "$kerberosopt"	]
	then
		optionstring="$optionstring --option kerberos"
	fi
	if [ -n "$mailopt" ]
	then
		optionstring="$optionstring --option mail"
	fi

	if [ -z "$personopt" -a  -n "$customatt2opt" ]
	then
		continue # objectclass organizationalPerson is needed for ou
	fi
	#	mobileTelephoneNumber (person)   Mobile telephone number
	#	homeTelephoneNumber (person)     Home telephone number
	#	employeeType (person)            Employee type
	#	pagerTelephoneNumber (person)    Pager telephone number
	#	homePostalAdress (person)        Home postal adress
	#	roomNumber (person)              Room number
	#	secretary (person)               secretary
	#	employeeNumber (person)          Employee number
	#	pwdChangeNextLogin (posix,samba,kerberos) Change Passowrd on next login
	#	gidNumber (posix,samba)          Group ID
	#	passwordexpiry (posix,samba,kerberos) Password Expiration Date

	if [ -n "$sambaopt" ]
	then
		sambasettings="--set sambahome=\"//Master/home\" --set scriptpath=\"Master/script\" --set homedrive=\"Master/foo\" --set profilepath=\"//Master/foobar\" --set sambaLogonHours=011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 --set disabled=1" 
		pskopt="1"
	fi

	if [ -n "$personopt" ]
	then
		personsettings="--set street=\"Herrstr. 5\" --set postcode=\"28355\" --set title=\"Dr.\" --set organisation=\"Univention\" --set city=\"Bremen\" --append phone=\"(+44)421-3424324322\" --append phone=\"2421/3424324322\" --append e-mail=\"foobar@nomail.com\" --append e-mail=\"foobar@$domainname\" --set firstname=\"Foo\" --append mobileTelephoneNumber=\"007\" --append mobileTelephoneNumber=\"207\" --set employeeType=\"paperboy\" --append pagerTelephoneNumber=\"008\" --append pagerTelephoneNumber=\"208\" --append homeTelephoneNumber=\"009\" --append homeTelephoneNumber=\"209\" --append homePostalAddress=\"somewhere\" --append homePostalAddress=\"somewhere2\" --set roomNumber=\"345\" --set secretary=\"uid=Administrator,cn=users,$ldap_base\" --set employeeNumber=\"13\""
		#pskopt="1"
	fi

	if [ -n "$posixopt" ]

	then
		posixsettings="--set unixhome=\"/home/foobar\" --set shell=\"/bin/ksh\" --set primaryGroup=\"cn=Domain Guests,cn=groups,$ldap_base\" --set groups=\"cn=Domain Users,cn=groups,$ldap_base\" --set groups=\"cn=Domain Admins,cn=groups,$ldap_base\" --set overridePWHistory=0"
		pskopt="1"

		#name (*)                         Name
		#emptyAttributes                  Empty Attributes
		#prohibitedObjectClasses          Prohibited ObjectClasses
		#requiredObjectClasses            Required ObjectClasses
		#length                           History length
		#expiryInterval                   Expiry Interval
		#fixedAttributes                  Fixed Attributes

	fi

	if [ -n "$kerberosopt" ]
	then
		kerberossettings=''
		pskopt="1"
	fi

	if [ -n "$mailopt" ]
	then
		mailsettings="--set mailPrimaryAddress=\"foobar@nomail.com\" --set mailAlternativeAddress=\"barfooze@nomail.com\" --set mailGlobalSpamFolder=1"
		#	mailPrimaryAddress		 common mail address
		#	mailAlternativeAddress		 further mail addresses
		#	mailGlobalSpamFolder		 Folder for spam mails
	fi

	if [ -n "$pskopt" ]
	then
		psksettings="--set password=\"foobarbazü\" --set disabled=\"1\" --set userexpiry=\"22.02.15\""

	fi
	
	user_dn="uid=foobar,cn=users,$ldap_base"
	adminwrap $LINENO users/user create --position \"cn=users,$ldap_base\" $optionstring --set username=foobar --set lastname=Bar --set description=Testuser $sambasettings $personsettings $posixsettings $psksettings $kerberossettings $customattsettings $customattsettings2 $customattsettings3 $customattsettings4 $mailsettings



	if [ -n "$customattopt" ]
	then
		ckthere "uid=foobar,cn=users" "base" "(testfilialbereich=bremen)" "foobar" "extended attribute testFilial bereich" $LINENO
	fi


	if [ -n "$customatt2opt" ]
	then
		ckthere "uid=foobar,cn=users" "base" "(ou=whatever)" "foobar" "extended attribute testou" $LINENO
	fi

	if [ -n "$customatt3opt" ]
	then
		ckthere "uid=foobar,cn=users" "base" "(testOLBACCESS=gogogo)" "foobar" "extended attribute testOLBACCESS" $LINENO
		ckthere "uid=foobar,cn=users" "base" "(testisInternetAccount=1)" "foobar" "extended attribute is internet" $LINENO
	fi

	if [ -n "$customatt4opt" ]
	then
		ckthere "uid=foobar,cn=users" "base" "(testisInternetAccount=0)" "foobar" "extended attribute is internet" $LINENO
	fi

	if [ -n "$kerberosopt" ]
	then
		ckthere "cn=users" "ONE" "(& (uid=foobar) (objectClass=top) (objectClass=univentionPWHistory)  (objectClass=krb5Principal) (objectClass=krb5KDCEntry))" "foobar" "objectClass" $LINENO
	fi


	if [ -n "$sambaopt" ]
	then
		ckthere "cn=users" "ONE" "(& (uid=foobar) (objectClass=top) (objectClass=univentionPWHistory) (objectClass=sambaSamAccount) )" "foobar" "objectClass" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(sambaHomePath=//Master/home)" "foobar" "sambahome" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(sambaHomeDrive=Master/foo)" "foobar" "homedrive" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(sambaProfilePath=//Master/foobar)" "foobar" "profile path" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(sambaLogonScript=Master/script)" "foobar" "scriptpath" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(sambaLogonHours=feffffffffffffffffffffffffffffffffffffffff)" "foobar" "logon hours" $LINENO
		result_dn=`ldapsearch -x -D "cn=admin,$ldap_base" -w \`cat /etc/ldap.secret\` -b "uid=foobar,cn=users,$ldap_base" -s BASE -LLL \
		'(uid=*)' 2>/dev/null| grep "sambaAcctFlags: "|grep D` 
		if [ -z "$result_dn" ]; then
			iscorrect=""
			echo "foobar: Sambauser not disabled while should be" >>"${errorlog}"
		fi
	else
		module_list users/user $LINENO silent
	fi

	if [ -n "$personopt" ]
	then
		ckthere "cn=users" "ONE" "(& (uid=foobar) (objectClass=top) (objectClass=organizationalPerson) (objectClass=inetOrgPerson) (objectClass=person) )" "foobar" "objectClass" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(o=Univention)" "foobar" "organization" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(postalCode=28355)" "foobar" "postcode" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(mail=foobar@$domainname)" "foobar" "email" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(mail=foobar@nomail.com)" "foobar" "email" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(street=Herrstr. 5)" "foobar" "street" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(telephoneNumber=\(+44\)421-3424324322)" "foobar" "phone" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(telephoneNumber=2421/3424324322)" "foobar" "phone" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(l=Bremen)" "foobar" "city" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(mobileTelephoneNumber=007)" "foobar" "mobile telephone number" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(mobileTelephoneNumber=207)" "foobar" "mobile telephone number" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(homeTelephoneNumber=009)" "foobar" "home telephone number" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(homeTelephoneNumber=209)" "foobar" "home telephone number" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(pagerTelephoneNumber=008)" "foobar" "pager telephone number" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(pagerTelephoneNumber=208)" "foobar" "pager telephone number" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(employeeType=paperboy)" "foobar" "employee type" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(employeeNumber=13)" "foobar" "employee number" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(roomNumber=345)" "foobar" "roomNumber" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(secretary=uid=Administrator,cn=users,$ldap_base)" "foobar" "secretary" $LINENO
		ckeq "uid=foobar,cn=users" "homePostalAddress" "somewhere" $LINENO
		ckeq "uid=foobar,cn=users" "homePostalAddress" "somewhere2" $LINENO
	fi


	if [ -n "$posixopt" ]
	then
		let shadowMaxDays=7
		ckthere "cn=users" "ONE" "(& (uid=foobar) (objectClass=top) (objectClass=posixAccount) (objectClass=shadowAccount) )" "foobar" "objectClass" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(homeDirectory=/home/foobar)" "foobar" "unixhome" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(loginShell=/bin/ksh)" "foobar" "shell" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(shadowExpire=16488)" "foobar" "shadow expire" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(shadowMax=$shadowMaxDays)" "foobar" "passwordexpiry" $LINENO

		############################################################################
		# disabled
		############################################################################
		result_dn=`ldapsearch -x -D "uid=foobar,cn=users,$ldap_base" -w "foobarbaz" -b "uid=foobar,cn=users,$ldap_base" -s BASE -LLL \
		'(uid=*)' 2>/dev/null| grep "dn: "` 
		if [ -n "$result_dn" ]; then
			iscorrect=""
			echo "foobar: Unixuser not disabled while should be" >>"${errorlog}"
		fi
		ckthere "cn=groups" "ONE" "(&(cn=Domain Users)(uniqueMember=$user_dn))" "foobar" "groups:Domain Users" $LINENO
		ckthere "cn=groups" "ONE" "(&(cn=Domain Admins)(uniqueMember=$user_dn))" "foobar" "groups:Domain Admins" $LINENO
		cknthere "cn=groups" "ONE" "(&(uniqueMember=$user_dn)(cn!=Domain Users)(cn!=Domain Admins))" "foobar" "extra group membership" $LINENO
	fi

	if [ -n "$mailopt" ]
	then
		ckthere "uid=foobar,cn=users" "BASE" "(mailPrimaryAddress=foobar@nomail.com)" "foobar" "primemail" $LINENO
                ckthere "uid=foobar,cn=users" "BASE" "(mailAlternativeAddress=barfooze@nomail.com)" "foobar" "altmail" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(mailGlobalSpamFolder=1)" "foobar" "spamfolder" $LINENO
	fi
	if [ -n "$dolocking" ]
	then
		checklocks $LINENO
	
		adminfailwrap $LINENO users/user create --position \"$ldap_base\" $optionstring --set username=foobar --set lastname=Bar --set description=Testuser $sambasettings $personsettings $posixsettings $psksettings $kerberossettings $customattsettings $customattsettings2 $customattsettings3 $customattsettings4 $mailsettings
		checklocks $LINENO
		uidnumber=`getvalue "uid=foobar,cn=users" uidNumber`
		if [ -n "$uidnumber" ];then
		adminfailwrap $LINENO users/user create --position \"$ldap_base\" $optionstring --set uidNumber=$uidnumber --set username=moobar --set lastname=Bar --set description=Testuser $sambasettings $personsettings $posixsettings $psksettings $kerberossettings $customattsettings $customattsettings2 $customattsettings3 $customattsettings4 $mailsettings
		checklocks $LINENO
	fi
	fi

	#######################################################################################################################
	# Modify users/user	
	#######################################################################################################################
	pskopt=""
	posixsettings=""
	sambasettings=""
	personsettings=""
	kerberossettings=""
	psksettings=""
	optionstring=""
	mailsettings=""
	if [ -n "$posixopt"		]
	then
		optionstring="$optionstring --option posix"
	fi
	if [ -n "$personopt"	]
	then
		optionstring="$optionstring --option person"
	fi	
	if [ -n "$sambaopt"		]
	then
		optionstring="$optionstring --option samba"
	fi
	if [ -n "$kerberosopt"	]
	then
		optionstring="$optionstring --option kerberos"
	fi
        if [ -n "$mailopt" ]
	then
	         optionstring="$optionstring --option mail"
	fi
					
	if [ "0" -eq $(( (i/16)%2 )) ]
	then 
		customattopt=""
		customattsettings=""
	else 
		customattopt="1"
		customattsettings=" --customattribute \"testFilial bereich\"=bonn "
	fi
	if [ "0" -eq $(( (i/32)%2 )) ]
	then 
		customatt2opt=""
		customattsettings2=""
	else 
		customatt2opt="1"
		customattsettings2=" --customattribute testou=whereever "
	fi
	if [ "0" -eq $(( (i/64)%2 )) ]
	then 
		customatt3opt=""
		customattsettings3=""
	else 
		customatt3opt="1"
		customattsettings3=" --customattribute testOLBACCESS=stop --customattribute testisInternet=0 "
	fi
	if [ "0" -eq $(( (i/128)%2 )) -o "$customatt3opt" = "1" ]	# prevent setting testisInternet twice
	then 
		customatt4opt=""
		customattsettings4=""
	else 
		customatt4opt="1"
		customattsettings4=" --customattribute testisInternet=1 "
	fi
        if [ "0" -eq $(( (i/256)%2 )) ]
        then
                mailopt=""
        else
                mailopt="1"
        fi

	if [ -n "$sambaopt" ]
	then
		sambasettings=" --set sambahome=\"//Master/homies\" --set scriptpath=\"Master/scripties\" --set homedrive=\"Master/fooies\" --set profilepath=\"//Master/foobaries\" --set sambaLogonHours=111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 "
		pskopt="1"
	fi

	if [ -n "$personopt" ]
	then
		personsettings=" --set street=\"moohstr. 5\" --set postcode=\"55555\" --set title=\"mooh\" --set organisation=\"kuhnivention\" --set city=\"Kuheim\" --append phone=\"05555555555\" --remove phone=\"(+44)421-3424324322\" --remove e-mail=\"foobar@$domainname\" --append e-mail=\"mooh@$domainname\" --set firstname=\"Mooh\" --append mobileTelephoneNumber=\"008\" --remove mobileTelephoneNumber=\"007\" --set employeeType=\"bo\" --append pagerTelephoneNumber=\"009\" --remove pagerTelephoneNumber=\"008\" --append homeTelephoneNumber=\"010\" --remove homeTelephoneNumber=\"009\" --append homePostalAddress=\"somewhere3\" --remove homePostalAddress=\"somewhere\" --set roomNumber=\"456\" --set secretary=\"uid=foobar,cn=users,$ldap_base\" --set employeeNumber=\"14\" "
		pskopt="1"
	fi

	if [ -n "$posixopt" ]
	then
		posixsettings=" --set unixhome=\"/home/foobari\" --set shell=\"/bin/kshi\" --set primaryGroup=\"cn=Domain Guests,cn=groups,$ldap_base\" --set groups=\"cn=Users,cn=groups,$ldap_base\" --set overridePWHistory=1 " 
		pskopt="1"
	fi

	if [ -n "$kerberosopt" ]
	then
		kerberossettings=
		pskopt="1"
	fi

        if [ -n "$mailopt" ]
        then
                mailsettings="--set mailPrimaryAddress=\"foo_bar@nomail.com\" --set mailAlternativeAddress=\"bar_fooze@nomail.com\" --set mailGlobalSpamFolder=0"
        fi
											
	if [ -n "$pskopt" ]
	then
		psksettings=" --set password=\"foobarbaüz\" --set disabled=\"1\" --set userexpiry=\"22.02.15\""

	fi


	userpass="barfoolatz"
	adminwrap $LINENO users/user modify --dn \"uid=foobar,cn=users,$ldap_base\" $optionstring --set lastname=Bar --set description=Testuser $sambasettings $personsettings $posixsettings $psksettings $kerberossettings $customattsettings $customattsettings2 $customattsettings3 $customattsettings4 $mailsettings

	adminwrap $LINENO users/user move --dn \"uid=foobar,cn=users,$ldap_base\" --position \"cn=groups,$ldap_base\"	
	ckthere "uid=foobar,cn=groups" "BASE" "(objectClass=*)" "foobar" "existence" $LINENO
	adminwrap $LINENO users/user move --dn \"uid=foobar,cn=groups,$ldap_base\" --position \"cn=users,$ldap_base\"
	if [ -n "$customattopt" ]
	then
		ckthere "uid=foobar,cn=users" "base" "(testfilialbereich=bonn)" "foobar" "extended attribute testFilial bereich" $LINENO
	fi


	if [ -n "$customatt2opt" ]
	then
		ckthere "uid=foobar,cn=users" "base" "(ou=whereever)" "foobar" "extended attribute testou" $LINENO
	fi

	if [ -n "$customatt3opt" ]
	then
		ckthere "uid=foobar,cn=users" "base" "(testOLBACCESS=stop)" "foobar" "extended attribute testOLBACCESS" $LINENO
		ckthere "uid=foobar,cn=users" "base" "(testisInternetAccount=0)" "foobar" "extended attribute is internet" $LINENO
	fi

	if [ -n "$customatt4opt" ]
	then
		ckthere "uid=foobar,cn=users" "base" "(testisInternetAccount=1)" "foobar" "extended attribute is internet" $LINENO
	fi

	if [ -n "$posixopt" ]
	then
		ckthere "uid=foobar,cn=users" "BASE" "(homeDirectory=/home/foobari)" "foobar" "unixhome" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(loginShell=/bin/kshi)" "foobar" "shell" $LINENO
		ckthere "cn=groups" "ONE" "(&(cn=Domain Guests)(uniqueMember=$user_dn))" "foobar" "groups:Domain Users" $LINENO
		ckthere "cn=groups" "ONE" "(&(cn=Users)(uniqueMember=$user_dn))" "foobar" "groups:Domain Admins" $LINENO
		cknthere "cn=groups" "ONE" "(&(uniqueMember=$user_dn)(cn!=Domain Guests)(cn!=Users))" "foobar" "extra group membership" $LINENO

	fi
	if [ -n "$sambaopt" ]
	then
		ckthere "uid=foobar,cn=users" "BASE" '(sambaHomePath=//Master/homies)' "foobar" "sambahome" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" '(sambaHomeDrive=Master/fooies)' "foobar" "homedrive" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" '(sambaProfilePath=//master/foobaries)' "foobar" "profilepath" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" '(sambaLogonScript=Master/scripties)' "foobar" "scriptpath" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(sambaLogonHours=ffffffffffffffffffffffffffffffffffffffffff)" "foobar" "logon hours" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "sambaAcctFlags=[UD         ]" "foobar" "samba acctflags" $LINENO
	fi

	if [ -n "$posixopt" ]
	then
		ckthere "uid=foobar,cn=users" "BASE" "(shadowExpire=16488)" "foobar" "userexpiry" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(shadowMax=$shadowMaxDays)" "foobar" "passwordexpiry" $LINENO
		############################################################################
		# disabled
		############################################################################
		result_dn=`ldapsearch -x -D "uid=foobar,cn=users,$ldap_base" -w "foobarbaz" -b "uid=foobar,cn=users,$ldap_base" -s BASE -LLL \
		'(uid=*)' 2>/dev/null| grep "dn: "` 
		if [ -n "$result_dn" ]; then
			iscorrect=""
			echo "foobar: Unixuser not disabled while should be" >>"${errorlog}"
		fi
	fi

	if [ -n "$sambaopt" ]
	then
		result_dn=`ldapsearch -x -D "cn=admin,$ldap_base" -w \`cat /etc/ldap.secret\` -b "uid=foobar,cn=users,$ldap_base" -s BASE -LLL \
		'(uid=*)' 2>/dev/null| grep "sambaAcctFlags: "|grep D` 
		if [ -z "$result_dn" ]; then
			iscorrect=""
			echo "foobar: Sambauser not disabled while should be" >>"${errorlog}"
		fi
	fi

	if [ -n "$personopt" ]
	then
		ckthere "uid=foobar,cn=users" "BASE" "(o=kuhnivention)" "foobar" "organization" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(postalCode=55555)" "foobar" "postal code" $LINENO
		cknthere "uid=foobar,cn=users" "BASE" "(mail=foobar@$domainname)" "foobar" "mail" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(mail=mooh@$domainname)" "foobar" "mail" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(mail=foobar@nomail.com)" "foobar" "mail" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(street=moohstr. 5)" "foobar" "street" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(telephoneNumber=05555555555)" "foobar" "phone" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(telephoneNumber=2421/3424324322)" "foobar" "phone" $LINENO
		cknthere "uid=foobar,cn=users" "BASE" "(telephoneNumber=0421-3424324322)" "foobar" "phone" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(l=Kuheim)" "foobar" "city" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(mobileTelephoneNumber=008)" "foobar" "mobile telephone number" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(mobileTelephoneNumber=207)" "foobar" "mobile telephone number" $LINENO
		cknthere "uid=foobar,cn=users" "BASE" "(mobileTelephoneNumber=007)" "foobar" "mobile telephone number" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(homeTelephoneNumber=010)" "foobar" "home telephone number" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(homeTelephoneNumber=209)" "foobar" "home telephone number" $LINENO
		cknthere "uid=foobar,cn=users" "BASE" "(homeTelephoneNumber=009)" "foobar" "home telephone number" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(pagerTelephoneNumber=208)" "foobar" "pager telephone number" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(pagerTelephoneNumber=009)" "foobar" "pager telephone number" $LINENO
		cknthere "uid=foobar,cn=users" "BASE" "(pagerTelephoneNumber=008)" "foobar" "pager telephone number" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(employeeType=bo)" "foobar" "employee type" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(employeeNumber=14)" "foobar" "employee number" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(roomNumber=456)" "foobar" "roomNumber" $LINENO
		ckthere "uid=foobar,cn=users" "BASE" "(secretary=uid=foobar,cn=users,$ldap_base)" "foobar" "secretary" $LINENO
		ckneq "uid=foobar,cn=users" "homePostalAddress" "somewhere" $LINENO
		ckeq "uid=foobar,cn=users" "homePostalAddress" "somewhere2" $LINENO
		ckeq "uid=foobar,cn=users" "homePostalAddress" "somewhere3" $LINENO
	fi

        if [ -n "$mailopt" ]
        then
                ckthere "uid=foobar,cn=users" "BASE" "(mailPrimaryAddress=foo_bar@nomail.com)" "foobar" "primemail" $LINENO
                ckthere "uid=foobar,cn=users" "BASE" "(mailAlternativeAddress=bar_fooze@nomail.com)" "foobar" "altmail" $LINENO
                ckthere "uid=foobar,cn=users" "BASE" "(mailGlobalSpamFolder=0)" "foobar" "spamfolder" $LINENO
        fi

	adminwrap $LINENO users/user remove --dn \"uid=foobar,cn=users,$ldap_base\"
	cknthere "uid=foobar,cn=users" "BASE" "(objectClass=*)" "foobar" "existence" $LINENO
	cknthere "cn=groups" "ONE" "(uniqueMember=$user_dn)" "foobar" "group membership" $LINENO


	# TODO Kerberos specific data has to be checked
done
	adminwrap $LINENO users/user create --set username="foobar" --position="\"cn=users,$ldap_base\"" --set lastname="baba" --set password=mumubaba --set sambaRID=11
	
	sambaSID=`getvalue "uid=foobar,cn=users" "sambaSID"`
	sambaRID=`echo $sambaSID| sed 's/.*-//g'`
	if [ "$sambaRID" -ne 11 ]
	then
		echo "ERROR: sambaSID does not contain correct sambaRID"
		doexit $LINENO
	fi
	adminwrap $LINENO users/user remove --dn \"uid=foobar,cn=users,$ldap_base\"
fi



############################################################################
############################################################################
# containers cn and ou
############################################################################
############################################################################



if [ -n "$docontainers" ]
then
	for ct in "cn" "ou" ; do
	############################################################################
	# create container
	############################################################################

	adminwrap $LINENO container/$ct create 	--set dnsPath=0 \
	--set groupPath=0 \
	--set policyPath=0 \
	--set dhcpPath=0 \
	--set licensePath=0 \
	--set name=töst$ct \
	--set userPath=0 \
	--set computerPath=0 \
	--set description=\"funny CoNtainer\" \
	--position \"$ldap_base\"
	cknthere "cn=default containers,cn=univention" "BASE" "(univentionDnsObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "dns path" $LINENO
	cknthere "cn=default containers,cn=univention" "BASE" "(univentionGroupsObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "group path" $LINENO
	cknthere "cn=default containers,cn=univention" "BASE" "(univentionLicenseObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "license path" $LINENO
	cknthere "cn=default containers,cn=univention" "BASE" "(univentionPolicyObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "policy path" $LINENO
	cknthere "cn=default containers,cn=univention" "BASE" "(univentionUsersObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "user path" $LINENO
	cknthere "cn=default containers,cn=univention" "BASE" "(univentionComputersObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "computer path" $LINENO
	cknthere "cn=default containers,cn=univention" "BASE" "(univentionDhcpObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "dhcp path" $LINENO
	ckthere "$ct=t\C3\B6st$ct" "BASE" "(description=funny CoNtainer)" "t\C3\B6st$ct" "description" $LINENO
	

	############################################################################
	# modify container
	############################################################################

	adminwrap $LINENO container/$ct modify 	--set dnsPath=1 \
	--set groupPath=1 \
	--set policyPath=1 \
	--set dhcpPath=1 \
	--set licensePath=1 \
	--set userPath=1 \
	--set computerPath=1 \
	--set description=\"unfunny CoNtainer\" \
	--dn \"$ct=töst$ct,$ldap_base\"

	ckthere "cn=default containers,cn=univention" "BASE" "(univentionDnsObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "dns path" $LINENO
	ckthere "cn=default containers,cn=univention" "BASE" "(univentionGroupsObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "group path" $LINENO
	ckthere "cn=default containers,cn=univention" "BASE" "(univentionLicenseObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "license path" $LINENO
	ckthere "cn=default containers,cn=univention" "BASE" "(univentionPolicyObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "policy path" $LINENO
	ckthere "cn=default containers,cn=univention" "BASE" "(univentionUsersObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "user path" $LINENO
	ckthere "cn=default containers,cn=univention" "BASE" "(univentionComputersObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "computer path" $LINENO
	ckthere "cn=default containers,cn=univention" "BASE" "(univentionDhcpObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "dhcp path" $LINENO
	ckthere "$ct=t\C3\B6st$ct" "BASE" "(description=unfunny CoNtainer)" "t\C3\B6st$ct" "description" $LINENO

	###########################################################################
	# remove container
	###########################################################################
	adminwrap $LINENO container/$ct remove --dn \"$ct=töst$ct,$ldap_base\" 

	cknthere "$ct=t\C3\B6st$ct" "BASE" "objectClass=*" "t\C3\B6st$ct" "removal" $LINENO
	cknthere "cn=default containers,cn=univention" "BASE" "(univentionDnsObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "dns path" $LINENO
	cknthere "cn=default containers,cn=univention" "BASE" "(univentionGroupsObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "group path" $LINENO
	cknthere "cn=default containers,cn=univention" "BASE" "(univentionLicenseObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "license path" $LINENO
	cknthere "cn=default containers,cn=univention" "BASE" "(univentionPolicyObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "policy path" $LINENO
	cknthere "cn=default containers,cn=univention" "BASE" "(univentionUsersObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "user path" $LINENO
	cknthere "cn=default containers,cn=univention" "BASE" "(univentionComputersObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "computer path" $LINENO
	cknthere "cn=default containers,cn=univention" "BASE" "(univentionDhcpObject=$ct=t\C3\B6st$ct,$ldap_base)" "t\C3\B6st$ct" "dhcp path" $LINENO
done

fi

if [ -n "$dogroup" ]
then
	############################################################################
	############################################################################
	# groups/group
	############################################################################
	############################################################################



	for i in `seq 1 3`; do
		univention-admin users/user create --set unixhome="/home/u$i" --set username="u$i" --set lastname="l$i" --set password="mumpolaglori" >/dev/null 2>/dev/null
	done
	############################################################################
	# create groups/group
	############################################################################
	adminwrap $LINENO groups/group create 	--position \"cn=groups,$ldap_base\" \
	--set name="testgroup" \
	--set description="bla" \
	--set sambaGroupType="2" \
	--append users=\"uid=u1,$ldap_base\" \
	--append users=\"uid=u2,$ldap_base\"
	
	adminwrap $LINENO groups/group create 	--position \"cn=groups,$ldap_base\" \
	--set name="t" \
	--set description="bla" \
	--set sambaRID="11" \
	--append users=\"uid=u1,$ldap_base\" \
	--append users=\"uid=u2,$ldap_base\"

	ckthere "cn=t,cn=groups" "BASE" "(objectClass=*)" "one letter group" "existence" $LINENO
	
	sambaSID=`getvalue "cn=t,cn=groups" "sambaSID"`
	sambaRID=`echo $sambaSID| sed 's/.*-//g'`
	if [ "$sambaRID" -ne 11 ]
	then
		echo "ERROR: sambaSID does not contain correct sambaRID"
		doexit $LINENO
	fi
	ckthere "cn=testgroup,cn=groups" "BASE" "(description=bla)" "testgroup" "description" $LINENO
	ckthere "cn=testgroup,cn=groups" "BASE" "(uniqueMember=uid=u1,$ldap_base)" "testgroup" "members" $LINENO
	ckthere "cn=testgroup,cn=groups" "BASE" "(uniqueMember=uid=u2,$ldap_base)" "testgroup" "members" $LINENO
	ckthere "cn=testgroup,cn=groups" "BASE" "(sambaGroupType=2)" "testgroup" "sambaGroupType" $LINENO

	if [ -n "$dolocking" ]
	then
		checklocks $LINENO
		adminfailwrap $LINENO groups/group create --set name="testgroup"
		checklocks $LINENO
		gidnumber=`getvalue "cn=testgroup,cn=groups" gidNumber`	
		adminfailwrap $LINENO groups/group create --set name="mootestgroup" --set gidNumber=$gidnumber
		checklocks $LINENO
	fi

	############################################################################
	# modify groups/group
	############################################################################
	adminwrap $LINENO groups/group modify 	--dn \"cn=testgroup,cn=groups,$ldap_base\" \
	--set description="blubb" \
	--set sambaGroupType=3 \
	--remove users=\"uid=u1,$ldap_base\" \
	--append users=\"uid=u3,$ldap_base\" 

	adminwrap $LINENO groups/group move     --dn \"cn=testgroup,cn=groups,$ldap_base\" --position \"$ldap_base\"
	ckthere "cn=testgroup" "BASE" "(description=blubb)" "testgroup" "description" $LINENO
	cknthere "cn=testgroup" "BASE" "(uniqueMember=uid=u1,$ldap_base)" "testgroup" "members" $LINENO
	ckthere "cn=testgroup" "BASE" "(uniqueMember=uid=u2,$ldap_base)" "testgroup" "members" $LINENO
	ckthere "cn=testgroup" "BASE" "(uniqueMember=uid=u3,$ldap_base)" "testgroup" "members" $LINENO
	ckthere "cn=testgroup" "BASE" "(sambaGroupType=3)" "testgroup" "sambaGroupType" $LINENO
	
	if [ -n "$dolocking" ]
	then
		checklocks $LINENO
		adminfailwrap $LINENO groups/group create --set name="testgroup"
		checklocks $LINENO
		gidnumber=`getvalue "cn=testgroup" gidNumber`	
		adminfailwrap $LINENO groups/group create --set name="mootestgroup" --set gidNumber=$gidnumber
		checklocks $LINENO
	fi

	############################################################################
	# remove groups/group
	############################################################################
	univention-admin users/user modify --dn uid=u2,$ldap_base --set primaryGroup="cn=testgroup,$ldap_base" >/dev/null 2>/dev/null
	adminfailwrap $LINENO groups/group remove --dn \"cn=testgroup,$ldap_base\" 
	univention-admin users/user modify --dn uid=u2,$ldap_base --set primaryGroup="cn=Domain Users,cn=groups,$ldap_base" >/dev/null 2>/dev/null
	adminwrap $LINENO groups/group remove --dn \"cn=testgroup,$ldap_base\" 

	adminwrap $LINENO groups/group remove 	--dn \"cn=t,cn=groups,$ldap_base\"
	cknthere "cn=testgroup,cn=groups" "BASE" "(objectClass=*)" "testgroup" "existence" $LINENO
	for i in `seq 1 3`; do
		univention-admin users/user remove --dn "uid=u$i,$ldap_base" >/dev/null 2>/dev/null
	done
fi

if [ -n "$domail" ]
then
	
	############################################################################
	# create mail/domain
	############################################################################
	adminwrap $LINENO mail/domain create --set name=testmaildomambo
	checklocks $LINENO
	############################################################################
	# modify mail/domain
	############################################################################
	adminwrap $LINENO mail/domain modify --dn \"cn=testmaildomambo,$ldap_base\" --set name=testmaildomain
	checklocks $LINENO
	
	############################################################################
	# create mail/folder
	############################################################################
	adminwrap $LINENO mail/folder create \
	--set name=testmailfolder \
		--set mailDomain=$domainname \
		--set kolabHomeServer=nohost.$domainname \
		--set cyrus-userquota=2 \
		--set userNamespace=FALSE\
		--set sharedFolderUserACL=\"Administrator@$domainname read\" \
		--set sharedFolderGroupACL=\"Domain Admins all\"

		ckthere "cn=testmailfolder@$domainname" "BASE" "(objectClass=univentionKolabSharedFolder)" "mail/folder" "existence" $LINENO
		ckthere "cn=testmailfolder@$domainname" "BASE" "(kolabHomeServer=nohost.$domainname)" "mail/folder" "kolabHomeServer" $LINENO
		ckthere "cn=testmailfolder@$domainname" "BASE" "(acl=Administrator@$domainname read)" "mail/folder" "sharedFolderUserACL" $LINENO
		ckthere "cn=testmailfolder@$domainname" "BASE" "(acl=Domain Admins all)" "mail/folder" "sharedFolderGroupACL" $LINENO
		ckthere "cn=testmailfolder@$domainname" "BASE" "(cyrus-userquota=2)" "mail/folder" "cyrus-userquota" $LINENO
		ckthere "cn=testmailfolder@$domainname" "BASE" "(univentionKolabUserNamespace=FALSE)" "mail/folder" "userNamespace" $LINENO
	
	############################################################################
	# modify mail/folder
	############################################################################
	adminwrap $LINENO mail/folder modify \
	--dn \"cn=testmailfolder@$domainname,$ldap_base\" \
	--set kolabHomeServer=onehost.$domainname \
		--set cyrus-userquota=4 \
		--set sharedFolderUserACL=\"nobody@$domainname read\" \
		--append sharedFolderGroupACL=\"Domain Users all\"

		ckthere "cn=testmailfolder@$domainname" "BASE" "(objectClass=univentionKolabSharedFolder)" "mail/folder" "existence" $LINENO
		ckthere "cn=testmailfolder@$domainname" "BASE" "(kolabHomeServer=onehost.$domainname)" "mail/folder" "kolabHomeServer" $LINENO
		ckthere "cn=testmailfolder@$domainname" "BASE" "(acl=nobody@$domainname read)" "mail/folder" "sharedFolderUserACL" $LINENO
		ckthere "cn=testmailfolder@$domainname" "BASE" "(acl=Domain Users all)" "mail/folder" "sharedFolderGroupACL" $LINENO
		ckthere "cn=testmailfolder@$domainname" "BASE" "(acl=Domain Admins all)" "mail/folder" "sharedFolderGroupACL" $LINENO
		ckthere "cn=testmailfolder@$domainname" "BASE" "(cyrus-userquota=4)" "mail/folder" "cyrus-userquota" $LINENO
		ckthere "cn=testmailfolder@$domainname" "BASE" "(univentionKolabUserNamespace=FALSE)" "mail/folder" "userNamespace" $LINENO
	
	############################################################################
	# remove mail/folder
	############################################################################
	adminwrap $LINENO mail/folder remove --dn \"cn=testmailfolder@$domainname,$ldap_base\"
	cknthere "cn=testmailfolder@$domainname" "BASE" "(objectClass=*)" "mail/folder" "existence" $LINENO
	
	
	############################################################################
	# create mail/lists
	############################################################################
	adminwrap $LINENO mail/lists create \
		--set name=testmailinglist \
		--set description=useless \
		--set mailAddress=devnull@$domainname \
		--append members=nobody@$domainname \
		--append members=nogroup@$domainname
		
		ckthere "cn=testmailinglist" "BASE" "(description=useless)" "mail/lists" "description" $LINENO
		ckthere "cn=testmailinglist" "BASE" "(mailPrimaryAddress=devnull@$domainname)" "mail/lists" "mailAddress" $LINENO
		ckthere "cn=testmailinglist" "BASE" "(univentionKolabMember=nobody@$domainname)" "mail/lists" "members" $LINENO
		ckthere "cn=testmailinglist" "BASE" "(univentionKolabMember=nogroup@$domainname)" "mail/lists" "members" $LINENO
	############################################################################
	# remove mail/folder
	############################################################################
	adminwrap $LINENO mail/lists modify \
		--dn \"cn=testmailinglist,$ldap_base\" \
		--set description=ornot \
		--set mailAddress=devzero@$domainname \
		--remove members=nobody@$domainname \
		--append members=nogroup@$domainname \
		--append members=mooh@$domainname
		
		ckthere "cn=testmailinglist" "BASE" "(description=ornot)" "mail/lists" "description" $LINENO
		ckthere "cn=testmailinglist" "BASE" "(mailPrimaryAddress=devzero@$domainname)" "mail/lists" "mailAddress" $LINENO
		cknthere "cn=testmailinglist" "BASE" "(univentionKolabMember=nobody@$domainname)" "mail/lists" "members" $LINENO
		ckthere "cn=testmailinglist" "BASE" "(univentionKolabMember=nogroup@$domainname)" "mail/lists" "members" $LINENO
		ckthere "cn=testmailinglist" "BASE" "(univentionKolabMember=mooh@$domainname)" "mail/lists" "members" $LINENO
	############################################################################
	# remove mail/folder
	############################################################################
	adminwrap $LINENO mail/lists remove --dn \"cn=testmailinglist,$ldap_base\"
	cknthere "cn=testmailinglist" "BASE" "(objectClass=*)" "mail/lists" "existence" $LINENO
			
	############################################################################
	# remove mail/domain
	############################################################################
	adminwrap $LINENO mail/domain remove --dn \"cn=testmaildomain,$ldap_base\"
	cknthere "cn=testmaildomain" "BASE" "(objectClass=*)" "testmaildomain" "existence" $LINENO
	cknthere "cn=testmaildomambo" "BASE" "(objectClass=*)" "testmaildomain" "existence" $LINENO

fi


if [ -n "$dohosts" ]
then
	###########################################################################
	###########################################################################
	# dhcp/service
	###########################################################################
	###########################################################################


	###########################################################################
	# create dhcp/service
	###########################################################################
	adminwrap $LINENO dhcp/service create 	--position \"cn=dhcp,$ldap_base\" --set service="testdhcpservice" 

	univention-admin dhcp/service create 	--position "cn=dhcp,$ldap_base" --set service="testdhcpservice2" 2>>"${errorlog}" >>"${errorlog}"

	###########################################################################
	# create dhcp/server
	###########################################################################
	adminwrap $LINENO dhcp/server create  	--superordinate \"cn=testdhcpservice,cn=dhcp,$ldap_base\" --set server="testdhcpserver" 

	###########################################################################
	# create dhcp/subnet
	###########################################################################
	adminwrap $LINENO dhcp/subnet create  	--superordinate \"cn=testdhcpservice,cn=dhcp,$ldap_base\" --set subnet="19.168.1.0" --set subnetmask="255.255.255.0" --append range=\"19.168.1.100 19.168.1.150\" --append range=\"19.168.1.151 19.168.1.200\" 

	ckthere "cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "BASE" "(dhcpNetMask=24)" "testdhcpsubnet" "subnetmask" $LINENO
	ckthere "cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "BASE" "(dhcpRange=19.168.1.100 19.168.1.150)" "testdhcpsubnet" "range" $LINENO
	ckthere "cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "BASE" "(dhcpRange=19.168.1.151 19.168.1.200)" "testdhcpsubnet" "range" $LINENO

	adminwrap $LINENO dhcp/shared create --superordinate \"cn=testdhcpservice,cn=dhcp,$ldap_base\" --set name=strange
	ckthere "cn=strange,cn=testdhcpservice,cn=dhcp" base "(cn=strange)" testdhcpshared existence $LINENO
	#adminwrap $LINENO dhcp/sharedsubnet create --superordinate \"cn=testdhcpservice,cn=dhcp,$ldap_base\" --set name=charm



	###########################################################################
	# create dhcp/pool
	###########################################################################
	adminwrap $LINENO dhcp/pool create --superordinate \"cn=19.168.1.0,cn=testdhcpservice,cn=dhcp,$ldap_base\"\
	--set name="dhcptestpool"\
	--set all_clients="allow"\
	--append range=\"19.168.0.110 19.168.0.120\"\
	--append range=\"19.168.0.111 19.168.0.120\"\
	--set failover_peer="192.168.0.99"\
	--set dynamic_bootp_clients="deny"\
	--set known_clients="allow"\
	--set unknown_clients="allow" 

	ckthere "cn=dhcptestpool,cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "base" "(objectClass=univentionDhcpPool)" "dhcptestpool" "object classes" $LINENO

	ckthere "cn=dhcptestpool,cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "base" "(&(dhcpPermitList=allow known clients)(dhcpPermitList=allow unknown clients)(dhcpPermitList=deny dynamic bootp clients)(dhcpPermitList=allow all clients))" "dhcptestpool" "permissions" $LINENO

	ckthere "cn=dhcptestpool,cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "base" "(dhcpRange=19.168.0.110 19.168.0.120)" "dhcptestpool" "range" $LINENO
	ckthere "cn=dhcptestpool,cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "base" "(dhcpRange=19.168.0.111 19.168.0.120)" "dhcptestpool" "range" $LINENO

	ckthere "cn=dhcptestpool,cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "base" "(univentionDhcpFailoverPeer=192.168.0.99)" "dhcptestpool" "failover peer" $LINENO

	###########################################################################
	# modify dhcp/pool
	###########################################################################

	adminwrap $LINENO dhcp/pool modify --superordinate \"cn=19.168.1.0,cn=testdhcpservice,cn=dhcp,$ldap_base\"\
	--dn \"cn=dhcptestpool,cn=19.168.1.0,cn=testdhcpservice,cn=dhcp,$ldap_base\"\
	--set name="dhcptestpool"\
	--set all_clients="deny"\
	--remove range=\"19.168.0.110 19.168.0.120\"\
	--append range=\"19.168.0.112 19.168.0.120\"\
	--set failover_peer=""\
	--set dynamic_bootp_clients="allow"\
	--set known_clients="deny"\
	--set unknown_clients="deny" 

	ckthere "cn=dhcptestpool,cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "base" "(objectClass=univentionDhcpPool)" "dhcptestpool" "object classes" $LINENO

	ckthere "cn=dhcptestpool,cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "base" "(&(dhcpPermitList=deny known clients)(dhcpPermitList=deny unknown clients)(dhcpPermitList=allow dynamic bootp clients)(dhcpPermitList=deny all clients))" "dhcptestpool" "permissions" $LINENO

	cknthere "cn=dhcptestpool,cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "base" "(dhcpRange=19.168.0.110 19.168.0.120)" "dhcptestpool" "range" $LINENO
	ckthere "cn=dhcptestpool,cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "base" "(dhcpRange=19.168.0.111 19.168.0.120)" "dhcptestpool" "range" $LINENO
	ckthere "cn=dhcptestpool,cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "base" "(dhcpRange=19.168.0.112 19.168.0.120)" "dhcptestpool" "range" $LINENO

	cknthere "cn=dhcptestpool,cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "base" "(univentionDhcpFailoverPeer=192.168.0.99)" "dhcptestpool" "failover peer" $LINENO
	###########################################################################
	# remove dhcp/pool
	###########################################################################
	adminwrap $LINENO dhcp/pool remove --superordinate \"cn=19.168.1.0,cn=testdhcpservice,cn=dhcp,$ldap_base\" --dn \"cn=dhcptestpool,cn=19.168.1.0,cn=testdhcpservice,cn=dhcp,$ldap_base\" 

	cknthere "cn=dhcptestpool,cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "base" "(objectClass=*)" "dhcptestpool" "existence" $LINENO

	###########################################################################
	# modify dhcp/subnet
	###########################################################################
	adminwrap $LINENO dhcp/subnet modify     --dn \"cn=19.168.1.0,cn=testdhcpservice,cn=dhcp,$ldap_base\" --remove range=\"19.168.1.100 19.168.1.150\" --append range=\"19.168.1.100 19.168.1.130\" --set subnetmask="255.255.0.0" 

	ckthere "cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "BASE" "(dhcpNetMask=16)" "testdhcpsubnet" "subnetmask" $LINENO
	cknthere "cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "BASE" "(dhcpRange=19.168.1.100 19.168.1.150)" "testdhcpsubnet" "range" $LINENO
	ckthere "cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "BASE" "(dhcpRange=19.168.1.100 19.168.1.130)" "testdhcpsubnet" "range" $LINENO
	ckthere "cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "BASE" "(dhcpRange=19.168.1.151 19.168.1.200)" "testdhcpsubnet" "range" $LINENO

	###########################################################################
	# remove dhcp/subnet
	###########################################################################

	adminwrap $LINENO dhcp/subnet remove --superordinate \"cn=testdhcpservice,cn=dhcp,$ldap_base\" 	--dn \"cn=19.168.1.0,cn=testdhcpservice,cn=dhcp,$ldap_base\" 

	cknthere "cn=19.168.1.0,cn=testdhcpservice,cn=dhcp" "BASE" "(objectClass=*)" "testdhcpsubnet" "existence" $LINENO

	###########################################################################
	# create dhcp/host
	###########################################################################
	adminwrap $LINENO dhcp/host create 	--superordinate \"cn=testdhcpservice,cn=dhcp,$ldap_base\" --set host="testdhcphost" --set hwaddress=\"ethernet 55:44:33:22:11:00\" --append fixedaddress="19.168.1.2" --append fixedaddress="19.168.1.3"  

	ckthere "cn=testdhcphost,cn=testdhcpservice,cn=dhcp" "BASE" "(dhcpHWAddress=ethernet 55:44:33:22:11:00)" "testdhcphost" "hwaddress" $LINENO
	ckthere "cn=testdhcphost,cn=testdhcpservice,cn=dhcp" "BASE" "(univentionDhcpFixedAddress=19.168.1.2)" "testdhcphost" "fixed address" $LINENO
	ckthere "cn=testdhcphost,cn=testdhcpservice,cn=dhcp" "BASE" "(univentionDhcpFixedAddress=19.168.1.3)" "testdhcphost" "fixed address" $LINENO
	###########################################################################
	# modify dhcp/host
	###########################################################################

	adminwrap $LINENO dhcp/host modify 	--dn \"cn=testdhcphost,cn=testdhcpservice,cn=dhcp,$ldap_base\" --set hwaddress=\"ethernet 55:44:33:22:11:01\" --remove fixedaddress="19.168.1.3" --append fixedaddress="19.168.1.1"

	ckthere "cn=testdhcphost,cn=testdhcpservice,cn=dhcp" "BASE" "(dhcpHWAddress=ethernet 55:44:33:22:11:01)" "testdhcphost" "hwaddress" $LINENO
	cknthere "cn=testdhcphost,cn=testdhcpservice,cn=dhcp" "BASE" "(univentionDhcpFixedAddress=19.168.1.3)" "testdhcphost" "fixed address" $LINENO
	ckthere "cn=testdhcphost,cn=testdhcpservice,cn=dhcp" "BASE" "(univentionDhcpFixedAddress=19.168.1.1)" "testdhcphost" "fixed address" $LINENO
	ckthere "cn=testdhcphost,cn=testdhcpservice,cn=dhcp" "BASE" "(univentionDhcpFixedAddress=19.168.1.2)" "testdhcphost" "fixed address" $LINENO

	############################################################################
	# remove dhcp/host
	############################################################################

	adminwrap $LINENO dhcp/host remove --superordinate \"cn=testdhcpservice,cn=dhcp,$ldap_base\" 	--dn \"cn=testdhcphost,cn=testdhcpservice,cn=dhcp,$ldap_base\" 

	cknthere "cn=testdhcphost,cn=testdhcpservice,cn=dhcp" "BASE" "(objectClass=*)" "testdhcphost" "existence" $LINENO

	#####################################################################################
	#####################################################################################
	# dns/forward_zone
	###################################################################################
	#####################################################################################

	#####################################################################################
	# create dns/forward_zone
	###################################################################################
	zrefresh="10" 
	zzonettl="10" 
	zretry="10" 
	zttl="20"
	zonename="dnstestzone"
	zonename2="dnstestzone2"
	zcontact="root@testzone.univention.de"
	zexpire="12"
	zserial="4"

	adminwrap $LINENO dns/forward_zone create --position \"cn=dns,$ldap_base\" \
	--set refresh="$zrefresh" \
	--set zonettl="$zzonettl" \
	--set retry="$zretry" \
	--append nameserver="19.168.1.201" \
	--append nameserver="19.168.1.202" \
	--set ttl="$zttl" \
	--set zone="$zonename" \
	--set contact="$zcontact" \
	--set expire="$zexpire" \
	--set serial="$zserial" 

	adminwrap $LINENO dns/forward_zone create --position \"cn=dns,$ldap_base\" \
	--set refresh="$zrefresh" \
	--set zonettl="$zzonettl" \
	--set retry="$zretry" \
	--set nameserver="19.168.1.202" \
	--set ttl="$zttl" \
	--set zone="$zonename2" \
	--set contact="$zcontact" \
	--set expire="$zexpire" \
	--set serial="$zserial"

	ckthere "zoneName=dnstestZone,cn=dns" "BASE" "(objectClass=dnsZone)" "testdnszone" "object class" $LINENO
	ckthere "zoneName=dnstestZone,cn=dns" "BASE" "(relativeDomainName=@)" "testdnszone" "relative domain name" $LINENO
	ckthere "zoneName=dnstestZone,cn=dns" "BASE" "(DNSTTL=$zzonettl)" "testdnszone" "zonettl" $LINENO
	ckthere "zoneName=dnstestZone,cn=dns" "BASE" "(NSRecord=19.168.1.201)" "testdnszone" "nameserver" $LINENO
	ckthere "zoneName=dnstestZone,cn=dns" "BASE" "(NSRecord=19.168.1.202)" "testdnszone" "nameserver" $LINENO
	#####################################################################################
	# test SOA
	#####################################################################################

	result=`ldapsearch -x -D "cn=admin,$ldap_base" -w \`cat /etc/ldap.secret\` -b "zoneName=dnstestzone,cn=dns,$ldap_base" -s BASE -LLL \
	"(objectClass=*)" 2>/dev/null | grep -i "SOARecord: " `
	if [ -z "$result" ]; then
		iscorrect=""
		echo "testdnszone: missing SOA" >>"${errorlog}"
	fi


	tzrefresh=`echo "$result"	|cut -d" " -f "5"`
	tzttl=`echo "$result"		|cut -d" " -f "8"`
	tzretry=`echo "$result"		|cut -d" " -f "6"`
	tznameserver=`echo "$result"	|cut -d" " -f "2"`
	tzexpire=`echo "$result"	|cut -d" " -f "7"`
	tzserial=`echo "$result"	|cut -d" " -f "4"`
	tzcontact=`echo "$result"	|cut -d" " -f "3"`

	if [ "$tzrefresh" != "$zrefresh" ]; then
		iscorrect=""
		echo "testzone: wrong refresh in SOA" >>"${errorlog}"
	fi

	if [ "$tzttl" != "$zttl" ]; then
		iscorrect=""
		echo "testzone: wrong ttl in SOA" >>"${errorlog}"
	fi

	if [ "$tzretry" != "$zretry" ]; then
		iscorrect=""
		echo "testzone: wrong retry in SOA" >>"${errorlog}"
	fi

	if [ "$tznameserver" != "19.168.1.201" ]; then
		iscorrect=""
		echo "testzone: wrong nameserver in SOA" >>"${errorlog}"
	fi

	if [ "$tzexpire" != "$zexpire" ]; then
		iscorrect=""
		echo "testzone: wrong expire in SOA" >>"${errorlog}"
	fi

	if [ "$tzserial" != "$zserial" ]; then
		iscorrect=""
		echo "testzone: wrong serial in SOA" >>"${errorlog}"
	fi

	if [ "$tzcontact" != `echo $zcontact|sed 's/@/./'` ]; then
		iscorrect=""
		echo "testzone: wrong serial in SOA" >>"${errorlog}"
	fi



	####################################################################################
	####################################################################################
	# dns/alias
	####################################################################################
	####################################################################################
	acname="betumen"
	azonettl="5"

	adminwrap $LINENO dns/alias create --superordinate \"zoneName=dnstestzone,cn=dns,$ldap_base\" \
	--set name="testdnsalias" --set cname=$acname --set zonettl=$azonettl 

	ckthere "relativeDomainName=testdnsalias,zoneName=dnstestzone,cn=dns" "BASE" "(objectClass=dnsZone)" "testdnsalias" "object class" $LINENO
	ckthere "relativeDomainName=testdnsalias,zoneName=dnstestzone,cn=dns" "BASE" "(CNAMERecord=$acname)" "testdnsalias" "cname" $LINENO
	ckthere "relativeDomainName=testdnsalias,zoneName=dnstestzone,cn=dns" "BASE" "(DNSTTL=$azonettl)" "testdnsalias" "zonettl" $LINENO

	acname="mojave"
	azonettl="77"

	adminwrap $LINENO dns/alias modify --superordinate \"zoneName=dnstestzone,cn=dns,$ldap_base\" --dn \"relativeDomainName=testdnsalias,zoneName=dnstestzone,cn=dns,$ldap_base\" \
	--set cname=$acname --set zonettl=$azonettl 

	ckthere "relativeDomainName=testdnsalias,zoneName=dnstestzone,cn=dns" "BASE" "(objectClass=dnsZone)" "testdnsalias" "object class" $LINENO
	ckthere "relativeDomainName=testdnsalias,zoneName=dnstestzone,cn=dns" "BASE" "(CNAMERecord=$acname)" "testdnsalias" "CName" $LINENO
	ckthere "relativeDomainName=testdnsalias,zoneName=dnstestzone,cn=dns" "BASE" "(DNSTTL=$azonettl)" "testdnsalias" "zone ttl" $LINENO

	adminwrap $LINENO dns/alias remove --superordinate \"zoneName=dnstestzone,cn=dns,$ldap_base\" --dn \"relativeDomainName=testdnsalias,zoneName=dnstestzone,cn=dns,$ldap_base\" 

	cknthere "relativeDomainName=testdnsalias,zoneName=dnstestzone,cn=dns" "BASE" "(objectClass=*)" "testdnsalias" "existence" $LINENO

	####################################################################################
	####################################################################################
	# END dns/alias
	####################################################################################
	####################################################################################

	####################################################################################
	####################################################################################
	# dns/host_record
	####################################################################################
	####################################################################################
	hzonettl=1234
	hname=testdnshostrecord
	htxt="das ist ein test text"
	htxt2="das ist ein text test"
	hmx="1 nobodo"
	hmx2="1 dibodo"
	ha="192.168.15.15"
	ha2="192.168.15.16"

	adminwrap $LINENO dns/host_record create --superordinate \"zoneName=$zonename,cn=dns,$ldap_base\" \
	--set zonettl="$hzonettl" \
	--set name="$hname" \
	--append txt=\"$htxt\" \
	--append txt=\"$htxt2\" \
	--append mx=\"$hmx\" \
	--append mx=\"$hmx2\" \
	--append a="$ha" \
	--append a="$ha2"  

	ckthere "relativeDomainName=$hname,zoneName=$zonename,cn=dns" "BASE" "(objectClass=dnsZone)" "$hname" "objectClass" $LINENO
	ckthere "relativeDomainName=$hname,zoneName=$zonename,cn=dns" "BASE" "(TXTRecord=$htxt)" "$hname" "TXT" $LINENO
	ckthere "relativeDomainName=$hname,zoneName=$zonename,cn=dns" "BASE" "(TXTRecord=$htxt2)" "$hname" "TXT" $LINENO
	ckthere "relativeDomainName=$hname,zoneName=$zonename,cn=dns" "BASE" "(MXRecord=$hmx)" "$hname" "MX" $LINENO
	ckthere "relativeDomainName=$hname,zoneName=$zonename,cn=dns" "BASE" "(MXRecord=$hmx2)" "$hname" "MX" $LINENO
	ckthere "relativeDomainName=$hname,zoneName=$zonename,cn=dns" "BASE" "(ARecord=$ha)" "$hname" "A" $LINENO
	ckthere "relativeDomainName=$hname,zoneName=$zonename,cn=dns" "BASE" "(ARecord=$ha2)" "$hname" "A" $LINENO

	hzonettl=4321
	htxt3="leo spar raps oel"
	hmx3="2 dubidubidu"
	ha3="0.8.1.5"

	adminwrap $LINENO dns/host_record modify --superordinate \"zoneName=dnstestzone,cn=dns,$ldap_base\" --dn \"relativeDomainName=$hname,zoneName=dnstestzone,cn=dns,$ldap_base\" \
	--set zonettl="$hzonettl" \
	--remove txt=\"$htxt\" \
	--append txt=\"$htxt3\" \
	--remove mx=\"$hmx\" \
	--append mx=\"$hmx3\" \
	--remove a="$ha" \
	--append a="$ha3"
	
	ckthere "relativeDomainName=$hname,zoneName=$zonename,cn=dns" "BASE" "(objectClass=dnsZone)" "$hname" "objectClass" $LINENO
	cknthere "relativeDomainName=$hname,zoneName=$zonename,cn=dns" "BASE" "(TXTRecord=$htxt)" "$hname" "TXT" $LINENO
	ckthere "relativeDomainName=$hname,zoneName=$zonename,cn=dns" "BASE" "(TXTRecord=$htxt2)" "$hname" "TXT" $LINENO
	ckthere "relativeDomainName=$hname,zoneName=$zonename,cn=dns" "BASE" "(TXTRecord=$htxt3)" "$hname" "TXT" $LINENO
	cknthere "relativeDomainName=$hname,zoneName=$zonename,cn=dns" "BASE" "(MXRecord=$hmx)" "$hname" "MX" $LINENO
	ckthere "relativeDomainName=$hname,zoneName=$zonename,cn=dns" "BASE" "(MXRecord=$hmx2)" "$hname" "MX" $LINENO
	ckthere "relativeDomainName=$hname,zoneName=$zonename,cn=dns" "BASE" "(MXRecord=$hmx3)" "$hname" "MX" $LINENO
	cknthere "relativeDomainName=$hname,zoneName=$zonename,cn=dns" "BASE" "(ARecord=$ha)" "$hname" "A" $LINENO
	ckthere "relativeDomainName=$hname,zoneName=$zonename,cn=dns" "BASE" "(ARecord=$ha2)" "$hname" "A" $LINENO
	ckthere "relativeDomainName=$hname,zoneName=$zonename,cn=dns" "BASE" "(ARecord=$ha3)" "$hname" "A" $LINENO


	#####################################################################################
	#####################################################################################
	## dns/srv_record
	#####################################################################################
	#####################################################################################

	sname="testdnssrvrecord tcp"
	srname="_testdnssrvrecord._tcp"
	szonettl=123
	slocation="1 1 6668 test.univention.de"
	slocation2="2 2 6669 test.univention.org"

	adminwrap $LINENO dns/srv_record create --superordinate \"zoneName=dnstestzone,cn=dns,$ldap_base\" \
	--set zonettl=\"$szonettl\" \
	--append location=\"$slocation\" \
	--append location=\"$slocation2\" \
	--set name=\"$sname\" 


	ckthere "relativeDomainName=$srname,zoneName=dnstestzone,cn=dns" "base" "(objectClass=dnsZone)" "testdnssrvrecord" "objectClass" $LINENO

	ckthere "relativeDomainName=$srname,zoneName=dnstestzone,cn=dns" "base" "(SRVRecord=$slocation)" "testdnssrvrecord" "SRVRecord" $LINENO
	ckthere "relativeDomainName=$srname,zoneName=dnstestzone,cn=dns" "base" "(SRVRecord=$slocation2)" "testdnssrvrecord" "SRVRecord" $LINENO

	ckthere "relativeDomainName=$srname,zoneName=dnstestzone,cn=dns" "base" "(DNSTTL=123)" "testdnssrvrecord" "DNSTTL"

	szonettl=124
	slocation3="3 3 6670 mooh.univention.org"

	adminwrap $LINENO dns/srv_record modify --superordinate \"zoneName=dnstestzone,cn=dns,$ldap_base\" --dn \"relativeDomainName=$srname,zoneName=dnstestzone,cn=dns,$ldap_base\"\
	--set zonettl=\"$szonettl\" \
	--append location=\"$slocation3\" \
	--remove location=\"$slocation\" \

	cknthere "relativeDomainName=$srname,zoneName=dnstestzone,cn=dns" "base" "(SRVRecord=$slocation)" "testdnssrvrecord" "SRVRecord" $LINENO
	ckthere "relativeDomainName=$srname,zoneName=dnstestzone,cn=dns" "base" "(SRVRecord=$slocation2)" "testdnssrvrecord" "SRVRecord" $LINENO
	ckthere "relativeDomainName=$srname,zoneName=dnstestzone,cn=dns" "base" "(SRVRecord=$slocation3)" "testdnssrvrecord" "SRVRecord" $LINENO

	ckthere "relativeDomainName=$srname,zoneName=dnstestzone,cn=dns" "base" "(DNSTTL=124)" "testdnssrvrecord" "DNSTTL"

	adminwrap $LINENO dns/srv_record remove --superordinate \"zoneName=dnstestzone,cn=dns,$ldap_base\" --dn \"relativeDomainName=$srname,zoneName=dnstestzone,cn=dns,$ldap_base\"
	####################################################################################
	####################################################################################
	# END dns/srv_record
	####################################################################################
	####################################################################################

	####################################################################################
	####################################################################################
	# dns/zone_txt_record
	####################################################################################
	####################################################################################
	adminwrap $LINENO dns/zone_txt_record create --superordinate \"zoneName=dnstestzone,cn=dns,$ldap_base\" \
	--set txt="nocheintesttext" 

	ckthere "zoneName=dnstestzone,cn=dns" "BASE" "(TXTRecord=nocheintesttext)" "dnstestzone" "TXT" $LINENO
	#####################################################################################
	# test modify
	#####################################################################################

	adminwrap $LINENO dns/zone_txt_record modify --dn \"zoneName=dnstestzone,cn=dns,$ldap_base\" --superordinate \"zoneName=dnstestzone,cn=dns,$ldap_base\" --arg "nocheintesttext"\
	--set txt=\"ein esel lese nie\" 

	ckthere "zoneName=dnstestzone,cn=dns" "BASE" "(TXTRecord=ein esel lese nie)" "dnstestzone" "TXT" $LINENO

	#####################################################################################
	# remove dns/zone_text_record
	#####################################################################################

	adminwrap $LINENO dns/zone_txt_record remove --superordinate \"zoneName=dnstestzone,cn=dns,$ldap_base\" --dn \"zoneName=dnstestzone,cn=dns,$ldap_base\" --arg \"ein esel lese nie\" 

	cknthere "zoneName=dnstestzone,cn=dns" "BASE" "(TXTRecord=ein esel lese nie)" "dnstestzone" "TXT" $LINENO

	####################################################################################
	####################################################################################
	# END dns/zone_txt_record
	####################################################################################
	####################################################################################

	###################################################################################
	####################################################################################
	# dns/zone_mx_record
	####################################################################################
	####################################################################################
	adminwrap $LINENO dns/zone_mx_record create --superordinate \"zoneName=dnstestzone,cn=dns,$ldap_base\" \
	--set mx=\"4 winzigweich\" 

	ckthere "zoneName=dnstestzone,cn=dns" "BASE" "(MXRecord=4 winzigweich)" "dnstestzone" "MX" $LINENO

	adminwrap $LINENO dns/zone_mx_record modify --superordinate \"zoneName=dnstestzone,cn=dns,$ldap_base\" --dn \"zoneName=dnstestzone,cn=dns,$ldap_base\" --arg \"4 winzigweich\"\
	--set mx=\"10 univention\" 

	ckthere "zoneName=dnstestzone,cn=dns" "BASE" "(MXRecord=10 univention)" "dnstestzone" "MX" $LINENO
	cknthere "zoneName=dnstestzone,cn=dns" "BASE" "(MXRecord=4 winzigweich)" "dnstestzone" "MX" $LINENO

	adminwrap $LINENO dns/zone_mx_record remove --superordinate \"zoneName=dnstestzone,cn=dns,$ldap_base\" --dn \"zoneName=dnstestzone,cn=dns,$ldap_base\"\
	--arg \"10 univention\" 

	cknthere "zoneName=dnstestzone,cn=dns" "BASE" "(MXRecord=*)" "dnstestzone" "MX" $LINENO


	####################################################################################
	####################################################################################
	# END dns/zone_mx_record
	####################################################################################
	####################################################################################

	#####################################################################################
	# modify dns/forward_zone
	#####################################################################################

	zrefresh="10" 
	zzonettl="11" 
	zretry="12" 
	zttl="13"
	zcontact="root@testzone.univention.de"
	zexpire="14"
	zserial="15"

	adminwrap $LINENO dns/forward_zone modify --dn \"zoneName=dnstestzone,cn=dns,$ldap_base\" \
	--set refresh="$zrefresh" \
	--set zonettl="$zzonettl" \
	--set retry="$zretry" \
	--remove nameserver="19.168.1.201" \
	--append nameserver="19.168.1.203" \
	--set ttl="$zttl" \
	--set contact="$zcontact" \
	--set expire="$zexpire" \
	--set serial="$zserial" 
	
	adminwrap $LINENO dns/host_record modify --superordinate \"zoneName=dnstestzone,cn=dns,$ldap_base\" --dn \"relativeDomainName=$hname,zoneName=dnstestzone,cn=dns,$ldap_base\" \
	--set zonettl="$hzonettl" \
	--remove txt=\"$htxt\" \
	--append txt=\"$htxt3\" \
	--remove mx=\"$hmx\" \
	--append mx=\"$hmx3\" \
	--remove a="$ha" \
	--append a="$ha3"
	


	####################################################################################
	####################################################################################
	# END dns/host_record
	####################################################################################
	####################################################################################

	ckthere "zoneName=$zonename,cn=dns" "BASE" "(objectClass=dnsZone)" "dnstestzone" "object class" $LINENO
	ckthere "zoneName=$zonename,cn=dns" "BASE" "(relativeDomainName=@)" "dnstestzone" "relative domain name" $LINENO
	ckthere "zoneName=$zonename,cn=dns" "BASE" "(DNSTTL=$zzonettl)" "dnstestzone" "zonettl" $LINENO
	cknthere "zoneName=$zonename,cn=dns" "BASE" "(NSRecord=19.168.1.201)" "testdnszone" "nameserver" $LINENO
	ckthere "zoneName=$zonename,cn=dns" "BASE" "(NSRecord=19.168.1.202)" "testdnszone" "nameserver" $LINENO
	ckthere "zoneName=$zonename,cn=dns" "BASE" "(NSRecord=19.168.1.203)" "testdnszone" "nameserver" $LINENO
	#####################################################################################
	# test SOA
	#####################################################################################

	result=`ldapsearch -x -D "cn=admin,$ldap_base" -w \`cat /etc/ldap.secret\` -b "zoneName=$zonename,cn=dns,$ldap_base" -s BASE -LLL \
	"(objectClass=*)" 2>/dev/null | grep -i "SOARecord: " `
	if [ -z "$result" ]; then
		iscorrect=""
		echo "testdnszone: missing SOA" >>"${errorlog}"
	fi


	tzrefresh=`echo "$result"	|cut -d" " -f "5"`
	tzttl=`echo "$result"		|cut -d" " -f "8"`
	tzretry=`echo "$result"		|cut -d" " -f "6"`
	tznameserver=`echo "$result"	|cut -d" " -f "2"`
	tzexpire=`echo "$result"	|cut -d" " -f "7"`
	tzserial=`echo "$result"	|cut -d" " -f "4"`
	tzcontact=`echo "$result"	|cut -d" " -f "3"`

	if [ "$tzrefresh" != "$zrefresh" ]; then
		iscorrect=""
		echo "testzone: wrong refresh in SOA" >>"${errorlog}"
	fi

	if [ "$tzttl" != "$zttl" ]; then
		iscorrect=""
		echo "testzone: wrong ttl in SOA" >>"${errorlog}"
	fi

	if [ "$tzretry" != "$zretry" ]; then
		iscorrect=""
		echo "testzone: wrong retry in SOA" >>"${errorlog}"
	fi

	if [ "$tznameserver" != "19.168.1.202" ]; then
		iscorrect=""
		echo "testzone: wrong nameserver in SOA" >>"${errorlog}"
	fi

	if [ "$tzexpire" != "$zexpire" ]; then
		iscorrect=""
		echo "testzone: wrong expire in SOA" >>"${errorlog}"
	fi

	if [ "$tzserial" != "$zserial" ]; then
		iscorrect=""
		echo "testzone: wrong serial in SOA" >>"${errorlog}"
	fi

	if [ "$tzcontact" != `echo $zcontact|sed 's/@/./'` ]; then
		iscorrect=""
		echo "testzone: wrong serial in SOA" >>"${errorlog}"
	fi
	
	adminwrap $LINENO dns/host_record remove --superordinate \"zoneName=dnstestzone,cn=dns,$ldap_base\" --dn \"relativeDomainName=$hname,zoneName=dnstestzone,cn=dns,$ldap_base\" 

	cknthere "relativeDomainName=$hname,zoneName=$zonename,cn=dns" "BASE" "(objectClass=*)" "$hname" "existence" $LINENO


	#####################################################################################
	#####################################################################################
	# dns/reverse_zone
	###################################################################################
	#####################################################################################

	zrefresh="10" 
	zzonettl="10" 
	zretry="10" 
	znameserver="19.168.1.201" 
	znameserver2="19.168.1.202" 
	zttl="20"
	zsubnet="19.168.1"
	zsubnet2="19.168.2"
	rzip1=`echo $zsubnet| cut -d"." -f 1`
	rzip2=`echo $zsubnet| cut -d"." -f 2`
	rzip3=`echo $zsubnet| cut -d"." -f 3`
	revzonename="${rzip3}.${rzip2}.${rzip1}.in-addr.arpa"
	revzonename2="2.${rzip2}.${rzip1}.in-addr.arpa"
	zcontact="root@testzone.univention.de"
	zexpire="12"
	zserial="4"

	adminwrap $LINENO dns/reverse_zone create --position \"cn=dns,$ldap_base\" \
	--set refresh="$zrefresh" \
	--set zonettl="$zzonettl" \
	--set retry="$zretry" \
	--append nameserver="$znameserver" \
	--append nameserver="$znameserver2" \
	--set ttl="$zttl" \
	--set subnet="$zsubnet" \
	--set contact="$zcontact" \
	--set expire="$zexpire" \
	--set serial="$zserial" 

	univention-admin dns/reverse_zone create --position "cn=dns,$ldap_base" \
	--set refresh="$zrefresh" \
	--set zonettl="$zzonettl" \
	--set retry="$zretry" \
	--set nameserver="$znameserver" \
	--set ttl="$zttl" \
	--set subnet="$zsubnet2" \
	--set contact="$zcontact" \
	--set expire="$zexpire" \
	--set serial="$zserial" 2>>"${errorlog}" >>"${errorlog}"

	ckthere "zoneName=$revzonename,cn=dns" "BASE" "(objectClass=dnsZone)" "$revzonename" "object class" $LINENO
	ckthere "zoneName=$revzonename,cn=dns" "BASE" "(relativeDomainName=@)" "$revzonename" "relative domain name" $LINENO
	ckthere "zoneName=$revzonename,cn=dns" "BASE" "(DNSTTL=$zzonettl)" "$revzonename" "zone ttl" $LINENO
	ckthere "zoneName=$revzonename,cn=dns" "BASE" "(NSRecord=$znameserver)" "$revzonename" "name server" $LINENO
	ckthere "zoneName=$revzonename,cn=dns" "BASE" "(NSRecord=$znameserver2)" "$revzonename" "name server" $LINENO
	#####################################################################################
	# test SOA
	#####################################################################################

	result=`ldapsearch -x -D "cn=admin,$ldap_base" -w \`cat /etc/ldap.secret\` -b "zoneName=$revzonename,cn=dns,$ldap_base" -s BASE -LLL \
	"(objectClass=*)" 2>/dev/null SOARecord| grep -i "SOARecord: " `
	if [ -z "$result" ]; then
		iscorrect=""
		echo "testdnszone: missing SOA" >>"${errorlog}"
	fi


	tzrefresh=`echo "$result"	|cut -d" " -f "5"`
	tzttl=`echo "$result"		|cut -d" " -f "8"`
	tzretry=`echo "$result"		|cut -d" " -f "6"`
	tznameserver=`echo "$result"	|cut -d" " -f "2"`
	tzexpire=`echo "$result"	|cut -d" " -f "7"`
	tzserial=`echo "$result"	|cut -d" " -f "4"`
	tzcontact=`echo "$result"	|cut -d" " -f "3"`

	if [ "$tzrefresh" != "$zrefresh" ]; then
		iscorrect=""
		echo "testzone: wrong refresh in SOA" >>"${errorlog}"
	fi

	if [ "$tzttl" != "$zttl" ]; then
		iscorrect=""
		echo "testzone: wrong ttl in SOA" >>"${errorlog}"
	fi

	if [ "$tzretry" != "$zretry" ]; then
		iscorrect=""
		echo "testzone: wrong retry in SOA" >>"${errorlog}"
	fi

	if [ "$tznameserver" != "$znameserver" ]; then
		iscorrect=""
		echo "testzone: wrong nameserver in SOA" >>"${errorlog}"
	fi

	if [ "$tzexpire" != "$zexpire" ]; then
		iscorrect=""
		echo "testzone: wrong expire in SOA" >>"${errorlog}"
	fi

	if [ "$tzserial" != "$zserial" ]; then
		iscorrect=""
		echo "testzone: wrong serial in SOA" >>"${errorlog}"
	fi

	if [ "$tzcontact" != `echo $zcontact|sed 's/@/./'` ]; then
		iscorrect=""
		echo "testzone: wrong serial in SOA" >>"${errorlog}"
	fi

	#####################################################################################
	#####################################################################################
	# dns/ptr_record
	#####################################################################################
	#####################################################################################

	#####################################################################################
	# create dns/ptr_record
	#####################################################################################

	adminwrap $LINENO dns/ptr_record create --superordinate \"zoneName=$revzonename,cn=dns,$ldap_base\" \
	--set address=5 \
	--set ptr_record="support.univention.de." 

	ckthere "relativeDomainName=5,zoneName=$revzonename,cn=dns" "BASE" "(PTRRecord=support.univention.de.)" "5" "existence" $LINENO

	#####################################################################################
	# modify dns/ptr_record
	#####################################################################################

	adminwrap $LINENO dns/ptr_record modify --superordinate \"zoneName=$revzonename,cn=dns,$ldap_base\" --dn \"relativeDomainName=5,zoneName=$revzonename,cn=dns,$ldap_base\" \
	--set ptr_record="support" 

	ckthere "relativeDomainName=5,zoneName=$revzonename,cn=dns" "BASE" "(PTRRecord=support)" "5" "existence" $LINENO

	adminwrap $LINENO dns/ptr_record remove  --superordinate \"zoneName=$revzonename,cn=dns,$ldap_base\" --dn \"relativeDomainname=5,zoneName=$revzonename,cn=dns,$ldap_base\" 

	cknthere "relativeDomainName=5,zoneName=$revzonename,cn=dns" "BASE" "(objectClass=*)" "5" "existence" $LINENO


	#####################################################################################
	#####################################################################################
	# END dns/ptr_record
	#####################################################################################
	#####################################################################################



	#####################################################################################
	# modify dns/reverse_zone
	#############################easteregg##;-)##########################################

	zrefresh="1" 
	zzonettl="2" 
	zretry="3" 
	znameserver3="192.168.0.25" 
	zttl="4"
	zsubnet="19.16.4"
	zcontact="Administrator@testzone.univention.de"
	zexpire="5"
	zserial="0"

	adminwrap $LINENO dns/reverse_zone modify --dn \"zoneName=$revzonename,cn=dns,$ldap_base\" \
	--set refresh="$zrefresh" \
	--set zonettl="$zzonettl" \
	--set retry="$zretry" \
	--remove nameserver="$znameserver" \
	--append nameserver="$znameserver3" \
	--set ttl="$zttl" \
	--set contact="$zcontact" \
	--set expire="$zexpire" \
	--set serial="$zserial" 

	ckthere "zoneName=$revzonename,cn=dns" "BASE" "(objectClass=dnsZone)" "$revzonename" "object class" $LINENO
	ckthere "zoneName=$revzonename,cn=dns" "BASE" "(relativeDomainName=@)" "$revzonename" "relative domain name" $LINENO
	ckthere "zoneName=$revzonename,cn=dns" "BASE" "(DNSTTL=$zzonettl)" "$revzonename" "zone ttl" $LINENO
	cknthere "zoneName=$revzonename,cn=dns" "BASE" "(NSRecord=$znameserver)" "$revzonename" "name server" $LINENO
	ckthere "zoneName=$revzonename,cn=dns" "BASE" "(NSRecord=$znameserver2)" "$revzonename" "name server" $LINENO
	ckthere "zoneName=$revzonename,cn=dns" "BASE" "(NSRecord=$znameserver3)" "$revzonename" "name server" $LINENO
	#####################################################################################
	# test SOA
	#####################################################################################

	result=`ldapsearch -x -D "cn=admin,$ldap_base" -w \`cat /etc/ldap.secret\` -b "zoneName=$revzonename,cn=dns,$ldap_base" -s BASE -LLL \
	"(objectClass=*)" 2>/dev/null SOARecord| grep -i "SOARecord: " `
	if [ -z "$result" ]; then
		iscorrect=""
		echo "testdnszone: missing SOA" >>"${errorlog}"
	fi


	tzrefresh=`echo "$result"	|cut -d" " -f "5"`
	tzttl=`echo "$result"		|cut -d" " -f "8"`
	tzretry=`echo "$result"		|cut -d" " -f "6"`
	tznameserver=`echo "$result"	|cut -d" " -f "2"`
	tzexpire=`echo "$result"	|cut -d" " -f "7"`
	tzserial=`echo "$result"	|cut -d" " -f "4"`
	tzcontact=`echo "$result"	|cut -d" " -f "3"`

	if [ "$tzrefresh" != "$zrefresh" ]; then
		iscorrect=""
		echo "testzone: wrong refresh in SOA" >>"${errorlog}"
	fi

	if [ "$tzttl" != "$zttl" ]; then
		iscorrect=""
		echo "testzone: wrong ttl in SOA" >>"${errorlog}"
	fi

	if [ "$tzretry" != "$zretry" ]; then
		iscorrect=""
		echo "testzone: wrong retry in SOA" >>"${errorlog}"
	fi

	if [ "$tznameserver" != "$znameserver2" ]; then
		iscorrect=""
		echo "testzone: wrong nameserver in SOA" >>"${errorlog}"
	fi

	if [ "$tzexpire" != "$zexpire" ]; then
		iscorrect=""
		echo "testzone: wrong expire in SOA" >>"${errorlog}"
	fi

	if [ "$tzserial" != "$zserial" ]; then
		iscorrect=""
		echo "testzone: wrong serial in SOA" >>"${errorlog}"
	fi

	if [ "$tzcontact" != `echo $zcontact|sed 's/@/./'` ]; then
		iscorrect=""
		echo "testzone: wrong serial in SOA" >>"${errorlog}"
	fi





	############################################################################
	# create computers/trustaccount
	############################################################################

	clientname=testtrustacc
	clientpass="foobarbazenga"

	adminwrap $LINENO computers/trustaccount create \
	--set password=$clientpass \
	--set name="$clientname" \
	--position \"cn=computers,$ldap_base\"

	passstring=`echo "${clientpass}"|univention-smbencrypt`
	ntpass=`echo $passstring|cut -d":" -f 2`
	lmpass=`echo $passstring|cut -d":" -f 1`

	ckthere "cn=${clientname},cn=computers" "BASE" "(&(sambaNTPassword=$ntpass)(sambaLMPassword=$lmpass))" "$clientname" "samba password" $LINENO

	############################################################################
	# modify computers/trustaccount
	############################################################################

	clientname=testtrustacc
	clientpass="looobaka"

	adminwrap $LINENO computers/trustaccount modify \
	--set password=$clientpass \
	--dn \"cn=${clientname},cn=computers,$ldap_base\" 


	############################################################################
	# samba password
	############################################################################
	passstring=`echo -n "${clientpass}"|univention-smbencrypt`
	ntpass=`echo $passstring|cut -d":" -f 2`
	lmpass=`echo $passstring|cut -d":" -f 1`
	ckthere "cn=${clientname},cn=computers" "BASE" "(&(sambaNTPassword=$ntpass)(sambaLMPassword=$lmpass))" "$clientname" "samba password" $LINENO

	adminwrap $LINENO computers/trustaccount remove --dn \"cn=${clientname},cn=computers,$ldap_base\" 

	cknthere "cn=${clientname},cn=computers" "BASE" "(objectClass=*)" "$clientname" "existence" $LINENO

	if [ -n "$doextended" ]
	then
		modelist=`seq 1 12`
	else
		modelist="8 9"
	fi
			for mode in $modelist;do
				############################################################################
				############################################################################
				# networks/network
				############################################################################
				############################################################################
					networkname="testnetwork"
					networkname2="testnetwork2"
					adminwrap $LINENO networks/network create \
					--set name="$networkname" \
					--set dnsEntryZoneForward=\"zoneName=$zonename,cn=dns,$ldap_base\" \
					--set dhcpEntryZone=\"cn=testdhcpservice,cn=dhcp,$ldap_base\" \
					--set dnsEntryZoneReverse=\"zoneName=$revzonename,cn=dns,$ldap_base\" \
					--set netmask="255.255.255.0" \
					--append ipRange=\"19.168.1.32 19.168.1.254\" \
					--set network="19.168.1.0" 

					adminwrap $LINENO networks/network create \
					--set name="$networkname2" \
					--set dnsEntryZoneForward=\"zoneName=$zonename2,cn=dns,$ldap_base\" \
					--set dhcpEntryZone=\"cn=testdhcpservice2,cn=dhcp,$ldap_base\" \
					--set dnsEntryZoneReverse=\"zoneName=$revzonename2,cn=dns,$ldap_base\" \
					--set netmask=\"255.255.0.0\" \
					--set ipRange=\"19.168.2.32 19.168.2.254\" \
					--set network=\"19.168.2.0\"

					ckthere "cn=testnetwork" "BASE" "(objectClass=univentionNetworkClass)" "testnetwork" "object class" $LINENO
					ckthere "cn=testnetwork" "BASE" "(univentionNetwork=19.168.1.0)" "testnetwork" "network" $LINENO
					ckthere "cn=testnetwork" "BASE" "(univentionNetmask=24)" "testnetwork" "netmask" $LINENO
					ckthere "cn=testnetwork" "BASE" "(univentionIpRange=19.168.1.32 19.168.1.254)" "testnetwork" "ip range" $LINENO
					ckthere "cn=testnetwork" "BASE" "(univentionDnsForwardZone=zoneName=dnstestzone,cn=dns,$ldap_base)" "testnetwork" "dns forward zone" $LINENO
					ckthere "cn=testnetwork" "BASE" "(univentionDnsReverseZone=zoneName=$revzonename,cn=dns,$ldap_base)" "testnetwork" "dns reverse zone" $LINENO
					ckthere "cn=testnetwork" "BASE" "(univentionDhcpEntry=cn=testdhcpservice,cn=dhcp,$ldap_base)" "testnetwork" "dhcp entry" $LINENO
					num=32
				for hosttype in managedclient domaincontroller_master domaincontroller_slave domaincontroller_backup ipmanagedclient thinclient mobileclient windows memberserver macos;do
					options=""
					if [ "$mode" = 1 ]; then posixopt="1"; kerberosopt="" ;remref=" --remove_referring ";usenetwork="network";fi
					if [ "$mode" = 2 ]; then posixopt="1"; kerberosopt="1";remref=" --remove_referring ";usenetwork="network";fi
					if [ "$mode" = 3 ]; then posixopt="" ; kerberosopt="1";remref=" --remove_referring ";usenetwork="network";fi
					if [ "$mode" = 4 ]; then posixopt="1"; kerberosopt="" ;remref="";usenetwork="network";fi
					if [ "$mode" = 5 ]; then posixopt="1"; kerberosopt="1";remref="";usenetwork="network";fi
					if [ "$mode" = 6 ]; then posixopt="" ; kerberosopt="1";remref="";usenetwork="network";fi
					if [ "$mode" = 7 ]; then posixopt="1"; kerberosopt="" ;remref=" --remove_referring ";usenetwork="";fi
					if [ "$mode" = 8 ]; then posixopt="1"; kerberosopt="1";remref=" --remove_referring ";usenetwork="";fi
					if [ "$mode" = 9 ]; then posixopt="" ; kerberosopt="1";remref=" --remove_referring ";usenetwork="";fi
					if [ "$mode" = 10 ]; then posixopt="1"; kerberosopt="" ;remref="";usenetwork="";fi
					if [ "$mode" = 11 ]; then posixopt="1"; kerberosopt="1";remref="";usenetwork="";fi
					if [ "$mode" = 12 ]; then posixopt="" ; kerberosopt="1";remref="";usenetwork="";fi

					if [ -n "$kerberosopt" ]
					then
						options="$options --option kerberos "
					fi
					if [ -n "$posixopt" ]
					then
						options="$options --option posix "
						posixsettings=" --set primaryGroup=\"cn=Domain Users,cn=groups,$ldap_base\" --set shell=\"/bin/bash\" --set unixhome=\"/home/gooba\""
					else
						posixsettings=""
					fi
					case "$hosttype" in ipmanagedclient|thinclient|windows|memberserver)
						if [ -n "$posixopt" ]
						then
							continue #these hosts have no posix attributes
						else
							options="" #these hosts have no options
						fi
					esac

					if [ "$hosttype" = "mobileclient" ]
					then
						if [ -z "$posixopt" ]
						then
							continue #does not work without posixopt
						fi
					fi
					
					doprint $LINENO "checking with $usenetwork $remref posixopt=$posixopt kerberosopt=$kerberosopt hosttype=$hosttype"

					extopts=""
					if [ -n "$doextended" ]
					then
						if [ "$hosttype" = "windows" ]
						then
							extopts=" --customattribute testpctyp=gurke "
						fi
					fi
					############################################################################
					############################################################################
					# computers/$hosttype
					############################################################################
					############################################################################

					############################################################################
					# create computers/$hosttype
					############################################################################

					clientpass="foobarbaz"
					clientname=test$num`echo $hosttype | sed "s/_/0/g"`
					clientmac="00:12:25:34:44:$num"
					clientip="19.168.1.$num"
					clientdesc="irgent so ein $hosttype halt"
					if [ -n "$usenetwork" ]
					then
						networktouse="--set network=\"cn=testnetwork,$ldap_base\""
					else
						networktouse="--set ip=\"$clientip\" --set dnsEntryZoneForward=\"zoneName=$zonename,cn=dns,$ldap_base\" --set dhcpEntryZone=\"cn=testdhcpservice,cn=dhcp,$ldap_base\" --set dnsEntryZoneReverse=\"zoneName=$revzonename,cn=dns,$ldap_base\" "
					fi

					adminwrap $LINENO computers/$hosttype create $options  --set description="\"$clientdesc\"" --set mac=\"$clientmac\" --set password=$clientpass --set name=\"$clientname\"  --position \"cn=computers,$ldap_base\" $networktouse $posixsettings $extopts
					
					if [ -n "$doextended" ]
					then
						if [ "$hosttype" = "windows" ]
						then
							ckthere "cn=$clientname,cn=computers" "BASE" "(testpctyp=gurke)" "$clientname ($options)" "extended attribute testhosttyp" $LINENO
						fi
					fi

					if [ -n "$posixopt" ]
					then
						ckthere "cn=$clientname,cn=computers" "BASE" "(homeDirectory=/home/gooba)" "$clientname ($options)" "unix home directory" $LINENO

						ckthere "cn=groups" "ONE" "(&(cn=Domain Users)(uniqueMember=cn=$clientname,cn=computers,$ldap_base))" "$clientname ($options)" "group membership" $LINENO

						ckthere "cn=$clientname,cn=computers" "BASE" "(loginShell=/bin/bash)" "$clientname ($options)" "login shell" $LINENO
					fi

					ckthere "relativeDomainName=$clientname,zoneName=$zonename,cn=dns" "BASE" "(&(objectClass=dNSZone)(ARecord=$clientip))" "$clientname ($options)" "dns forward zone entry" $LINENO

					ckthere "relativeDomainName=$num,zoneName=$revzonename,cn=dns" "BASE" "(&(objectClass=dNSZone)(PTRRecord=${clientname}.${zonename}.))" "$clientname ($options)" "dns reverse zone entry" $LINENO

					ckthere "cn=$clientname,cn=testdhcpservice,cn=dhcp" "BASE" "(&(objectClass=univentionDhcpHost)(cn=$clientname)(univentionDhcpFixedAddress=$clientip)(dhcpHWAddress=ethernet $clientmac))" "$clientname ($options)" "dhcp entry" $LINENO

				    ckthere "cn=$clientname,cn=computers" "BASE" "(description=$clientdesc)" "$clientname ($options)" "description" $LINENO
					###########################################################################
					# computers/$hosttype modify
					###########################################################################
					options=""
					clientdesc="ein besonderer $hosttype"

					if [ -n "$posixopt" ]
					then
						options="$options --option posix "
						posixsettings=" --set primaryGroup=\"cn=Users,cn=groups,$ldap_base\" --set shell=\"/bin/pksh\" --set unixhome=\"/home/goo\""
					else
						posixsettings=""
					fi

					clientpass="foobarbazi"
					clientip2="19.168.2.$num"
					if [ -n "$usenetwork" ]
					then
						networktouse="--set network=\"cn=testnetwork2,$ldap_base\""
					else
						networktouse="--set ip=\"$clientip2\" --set dnsEntryZoneForward=\"zoneName=$zonename2,cn=dns,$ldap_base\" --set dhcpEntryZone=\"cn=testdhcpservice2,cn=dhcp,$ldap_base\" --set dnsEntryZoneReverse=\"zoneName=$revzonename2,cn=dns,$ldap_base\" "
					fi
					if [ -n "$doextended" ]
					then
						if [ "$hosttype" = "windows" ]
						then
							extopts=" --customattribute testpctyp=banane "
						fi
					fi
					
					if [ -n "$dolocking" ]
					then
						checklocks $LINENO
						adminfailwrap $LINENO computers/$hosttype create $options  --set mac=\"$clientmac\" --set password=$clientpass --set name=\"$clientname\"  --position \"cn=computers,$ldap_base\" $networktouse $posixsettings $extopts
						checklocks $LINENO
						adminfailwrap $LINENO computers/$hosttype create $options  --set mac=\"$clientmac\" --set password=$clientpass --set name=\"o$clientname\"  --position \"cn=computers,$ldap_base\" $networktouse $posixsettings $extopts
						checklocks $LINENO
					fi

					

					adminwrap $LINENO computers/$hosttype modify $options --set description="\"$clientdesc\"" --set password=$clientpass $networktouse --dn \"cn=$clientname,cn=computers,$ldap_base\" $posixsettings $extopts
					
					if [ -n "$doextended" ]
					then
						if [ "$hosttype" = "windows" ]
						then
							ckthere "cn=$clientname,cn=computers" "BASE" "(testpctyp=banane)" "$clientname ($options)" "extended attribute testhosttyp" $LINENO
							cknthere "cn=$clientname,cn=computers" "BASE" "(testpctyp=gurke)" "$clientname ($options)" "extended attribute testhosttyp" $LINENO
						fi
					fi

					if [ -n "$posixopt" ]
					then
						ckthere "cn=$clientname,cn=computers" "BASE" "(homeDirectory=/home/goo)" "$clientname ($options)" "unix home directory" $LINENO

						ckthere "cn=groups" "ONE" "(&(cn=Users)(uniqueMember=cn=$clientname,cn=computers,$ldap_base))" "$clientname ($options)" "group membership" $LINENO

						ckthere "cn=$clientname,cn=computers" "BASE" "(loginShell=/bin/pksh)" "$clientname ($options)" "login shell" $LINENO
					fi

					ckthere "relativeDomainName=$clientname,zoneName=$zonename2,cn=dns" "BASE" "(&(objectClass=dNSZone)(ARecord=$clientip2))" "$clientname ($options)" "dns forward zone entry" $LINENO 

					ckthere "relativeDomainName=$num,zoneName=$revzonename2,cn=dns" "BASE" "(&(objectClass=dNSZone)(PTRRecord=${clientname}.${zonename2}.))" "$clientname ($options)" "dns reverse zone entry" $LINENO

					ckthere "cn=$clientname,cn=testdhcpservice2,cn=dhcp" "BASE" "(&(objectClass=univentionDhcpHost)(cn=$clientname)(univentionDhcpFixedAddress=$clientip2)(dhcpHWAddress=ethernet $clientmac))" "$clientname ($options)" "dhcp entry" $LINENO
				    ckthere "cn=$clientname,cn=computers" "BASE" "(description=$clientdesc)" "$clientname ($options)" "description" $LINENO

					############################################################################
					# check removal
					############################################################################

					errcheck $LINENO
					echo -n -e "\n\ttrying to remove computers/$hosttype"
					echo -n -e "\n\ttrying to remove computers/$hosttype" >>"${errorlog}"
					if univention-admin computers/$hosttype remove $remref --dn "cn=$clientname,cn=computers,$ldap_base" 2>>"${errorlog}" >>"${errorlog}"
					then
						echo -e "\t\tOK"
						echo -e "\t\tOK" >>"${errorlog}"
					else
						if [ "$mode" = 3 ] 
						then
							if univention-admin computers/ipmanagedclient remove $remref --dn "cn=$clientname,cn=computers,$ldap_base" 2>>"${errorlog}" >>"${errorlog}"
							then
								echo " WARNING: inconsistency: computers/$hosttype mutated to comupters/ipmanagedclient because of missing posixAccount"
								echo " WARNING: inconsistency: computers/$hosttype mutated to comupters/ipmanagedclient because of missing posixAccount"	>>"${errorlog}"
							else
								echo -e "\t\tERR"
								echo -e "\t\tERR" >>"${errorlog}"
								doexit $LINENO
							fi
						else
							echo -e "\t\tERR"
							echo -e "\t\tERR" >>"${errorlog}"
							doexit $LINENO
						fi
					fi
					echo -n -e "\tverifying"
					iscorrect="1"
					cknthere "cn=$clientname,cn=computers" "BASE" "(objectClass=*)" "$clientname ($options)" "existence" $LINENO
					if [ -n "$remref" ]
					then

						cknthere "relativeDomainName=$clientname,zoneName=$zonename,cn=dns" "BASE" "(&(objectClass=dNSZone)(ARecord=$clientip))" "$clientname ($options)" "dns forward zone entry not deleted" $LINENO 

						cknthere "relativeDomainName=$num,zoneName=$revzonename,cn=dns" "BASE" "(&(objectClass=dNSZone)(PTRRecord=${clientname}.${zonename}.))" "$clientname ($options)" "dns reverse zone entry not deleted" $LINENO

						cknthere "cn=$clientname,cn=testdhcpservice,cn=dhcp" "BASE" "(&(objectClass=univentionDhcpHost)(cn=$clientname)(univentionDhcpFixedAddress=$clientip)(dhcpHWAddress=ethernet $clientmac))" "$clientname ($options)" "dhcp entry not deleted" $LINENO

						cknthere "relativeDomainName=$clientname,zoneName=$zonename2,cn=dns" "BASE" "(&(objectClass=dNSZone)(ARecord=$clientip2))" "$clientname ($options)" "dns forward zone entry not deleted" $LINENO 

						cknthere "relativeDomainName=$num,zoneName=$revzonename2,cn=dns" "BASE" "(&(objectClass=dNSZone)(PTRRecord=${clientname}.${zonename2}.))" "$clientname ($options)" "dns reverse zone entry not deleted" $LINENO

						cknthere "cn=$clientname,cn=testdhcpservice2,cn=dhcp" "BASE" "(&(objectClass=univentionDhcpHost)(cn=$clientname)(univentionDhcpFixedAddress=$clientip2)(dhcpHWAddress=ethernet $clientmac))" "$clientname ($options)" "dhcp entry not deleted" $LINENO

					fi

					(( num=$num+1 ))
				done	
					############################################################################
					# remove networks/network
					############################################################################

					adminwrap $LINENO networks/network remove --dn \"cn=testnetwork,$ldap_base\" 
					adminwrap $LINENO networks/network remove --dn \"cn=testnetwork2,$ldap_base\"

					cknthere "cn=testnetwork" "base" "(objectClass=*)" "testnetwork" "existence" $LINENO
			done
			############################################################################
			############################################################################
			# networks/network
			############################################################################
			############################################################################
			networkname="testnetwork"
			networkname2="testnetwork2"
			adminwrap $LINENO networks/network create \
			--set name="$networkname" \
			--set dnsEntryZoneForward=\"zoneName=$zonename,cn=dns,$ldap_base\" \
			--set dhcpEntryZone=\"cn=testdhcpservice,cn=dhcp,$ldap_base\" \
			--set dnsEntryZoneReverse=\"zoneName=$revzonename,cn=dns,$ldap_base\" \
			--set netmask="255.255.255.0" \
			--append ipRange=\"19.168.1.32 19.168.1.254\" \
			--append ipRange=\"19.168.1.30 19.168.1.31\" \
			--set network="19.168.1.0" 

			univention-admin networks/network create \
			--set name="$networkname2" \
			--set dnsEntryZoneForward="zoneName=$zonename2,cn=dns,$ldap_base" \
			--set dhcpEntryZone="cn=testdhcpservice2,cn=dhcp,$ldap_base" \
			--set dnsEntryZoneReverse="zoneName=$revzonename2,cn=dns,$ldap_base" \
			--set netmask="255.255.0.0" \
			--set ipRange="19.168.2.32 19.168.2.254" \
			--set network="19.168.2.0" 2>>"${errorlog}" >>"${errorlog}"

			ckthere "cn=testnetwork" "BASE" "(objectClass=univentionNetworkClass)" "testnetwork" "object class" $LINENO
			ckthere "cn=testnetwork" "BASE" "(univentionNetwork=19.168.1.0)" "testnetwork" "network" $LINENO
			ckthere "cn=testnetwork" "BASE" "(univentionNetmask=24)" "testnetwork" "netmask" $LINENO
			ckthere "cn=testnetwork" "BASE" "(univentionIpRange=19.168.1.32 19.168.1.254)" "testnetwork" "ip range" $LINENO
			ckthere "cn=testnetwork" "BASE" "(univentionIpRange=19.168.1.30 19.168.1.31)" "testnetwork" "ip range" $LINENO
			ckthere "cn=testnetwork" "BASE" "(univentionDnsForwardZone=zoneName=dnstestzone,cn=dns,$ldap_base)" "testnetwork" "dns forward zone" $LINENO
			ckthere "cn=testnetwork" "BASE" "(univentionDnsReverseZone=zoneName=$revzonename,cn=dns,$ldap_base)" "testnetwork" "dns reverse zone" $LINENO
			ckthere "cn=testnetwork" "BASE" "(univentionDhcpEntry=cn=testdhcpservice,cn=dhcp,$ldap_base)" "testnetwork" "dhcp entry" $LINENO
fi



if [ -n "$doshare" ]
then

	############################################################################
	############################################################################
	# shares/printer
	############################################################################
	############################################################################

	adminwrap $LINENO shares/printer create --position \"cn=shares,$ldap_base\" --set name=testprinter --set model=\"clown 6.1\" --set uri=\"//host/printer\" --append spoolHost=\"host\" --append spoolHost=\"host2\"

	ckthere "cn=testprinter,cn=shares" "BASE" "(objectClass=univentionPrinter)" "testprinter" "object class" $LINENO

	ckthere "cn=testprinter,cn=shares" "BASE" "(univentionPrinterURI=//host/printer)" "testprinter" "uri" $LINENO

	ckthere "cn=testprinter,cn=shares" "BASE" "(univentionPrinterSpoolHost=host)" "testprinter" "host" $LINENO
	ckthere "cn=testprinter,cn=shares" "BASE" "(univentionPrinterSpoolHost=host2)" "testprinter" "host" $LINENO

	ckthere "cn=testprinter,cn=shares" "BASE" "(univentionPrinterModel=clown 6.1)" "testprinter" "model" $LINENO

	adminwrap $LINENO shares/printer modify --dn \"cn=testprinter,cn=shares,$ldap_base\" --set name=testprinter --set model=\"clown 6.2\" --set uri=\"//host/coffee\"

	ckthere "cn=testprinter,cn=shares" "BASE" "(objectClass=univentionPrinter)" "testprinter" "object class" $LINENO

	ckthere "cn=testprinter,cn=shares" "BASE" "(univentionPrinterURI=//host/coffee)" "testprinter" "uri" $LINENO

	ckthere "cn=testprinter,cn=shares" "BASE" "(univentionPrinterSpoolHost=host)" "testprinter" "host" $LINENO

	ckthere "cn=testprinter,cn=shares" "BASE" "(univentionPrinterModel=clown 6.2)" "testprinter" "model" $LINENO

	adminwrap $LINENO shares/printer remove --dn "cn=testprinter,cn=shares,$ldap_base"
	############################################################################
	############################################################################
	# shares/share
	############################################################################
	############################################################################

	for whattodo in 1 2;do
		for mode in 1 2 3;do

			if [ "$whattodo"=1 ]; then
				############################################################################
				# create shares/share
				############################################################################
				spublic=0
				screatemode="666"
				sdirectorymode="777"
				sforcecreatemode="888"
				sforcedirectorymode="999"
				spath="/home/share"
				shost="$hostname"
				sbrowseable="1"
				sname="myshare"
				ssname="mooshare"
				swriteable="1"

				if [ $mode = 1 ]
				then
					sambaopts="--set sambaDirectoryMode=$sdirectorymode --set sambaForceCreateMode=$sforcecreatemode --set sambaPublic=$spublic --set sambaCreateMode=$screatemode --set sambaForceDirectoryMode=$sforcedirectorymode --set sambaBrowseable=$sbrowseable --set sambaName=$ssname --set sambaWriteable=$swriteable "
					nfsopts=""
					options=" --option samba "
				fi
				if [ $mode = 2 ]
				then
					sambaopts="--set sambaDirectoryMode=$sdirectorymode --set sambaForceCreateMode=$sforcecreatemode --set sambaPublic=$spublic --set sambaCreateMode=$screatemode --set sambaForceDirectoryMode=$sforcedirectorymode --set sambaBrowseable=$sbrowseable --set sambaName=$ssname --set sambaWriteable=$swriteable "
					nfsopts=" --set writeable=$swriteable "
					options=" --option nfs --option samba "
				fi
				if [ $mode = 3 ]
				then
					sambaopts=""
					nfsopts=" --set writeable=$swriteable "
					options=" --option nfs "
				fi
				adminwrap $LINENO shares/share create $options --set path=$spath --set host=$shost --set name=$sname --set writeable=$swriteable --position \"cn=shares,$ldap_base\" $sambaopts $nfsopts 
			fi
			if [ "$whattodo"=2 ];then
				############################################################################
				# test Modify Share
				############################################################################

				spublic=1
				screatemode="555"
				sdirectorymode="444"
				sforcecreatemode="333"
				sforcedirectorymode="222"
				spath="/home/sharez"
				sbrowseable="0"
				sname="myshare"
				ssname="moosharez"
				swriteable="0"

				if [ $mode = 1 ]
				then
					sambaopts="--set sambaDirectoryMode=$sdirectorymode --set sambaForceCreateMode=$sforcecreatemode --set sambaPublic=$spublic --set sambaCreateMode=$screatemode --set sambaForceDirectoryMode=$sforcedirectorymode --set sambaBrowseable=$sbrowseable --set sambaName=$ssname --set sambaWriteable=$swriteable "
					nfsopts=""
					options=" --option samba "
				fi
				if [ $mode = 2 ]
				then
					sambaopts="--set sambaDirectoryMode=$sdirectorymode --set sambaForceCreateMode=$sforcecreatemode --set sambaPublic=$spublic --set sambaCreateMode=$screatemode --set sambaForceDirectoryMode=$sforcedirectorymode --set sambaBrowseable=$sbrowseable --set sambaName=$ssname --set sambaWriteable=$swriteable "
					nfsopts=" --set writeable=$swriteable "
					options=" --option nfs --option samba "
				fi
				if [ $mode = 3 ]
				then
					sambaopts=""
					nfsopts=" --set writeable=$swriteable "
					options=" --option nfs "
					module_list shares/share $LINENO silent
				fi

				adminwrap $LINENO shares/share modify $options --set path=$spath --set host=$shost --set writeable=$swriteable --dn \"cn=$sname,cn=shares,$ldap_base\" $sambaopts $nfsopts 
			fi

			ckthere "cn=$sname,cn=shares" "BASE" "(objectClass=univentionShare)" "$sname" "object classes" $LINENO

			if [ -n "$nfs" ]
			then
				ckthere "cn=$sname,cn=shares" "BASE" "(objectClass=univentionShareNFS)" "$sname" "object classes" $LINENO

				if [ "$swriteable" = "1" ]; then
					dummy=yes
				else
					dummy=no
				fi
				ckthere "cn=$sname,cn=shares" "BASE" "(univentionShareWriteable=$dummy)" "$sname" "object classes" $LINENO
			fi

			if [ -n "$sambaopts" ]
			then
				ckthere "cn=$sname,cn=shares" "BASE" "(objectClass=univentionShareSamba)" "$sname" "object classes" $LINENO

				if [ "$spublic" = "1" ]; then
					dummy=yes
				else
					dummy=no
				fi
				ckthere "cn=$sname,cn=shares" "BASE" "(univentionShareSambaPublic=$dummy)" "$sname" "samba public" $LINENO

				if [ "$sbrowseable" = "1" ]; then
					dummy=yes
				else
					dummy=no
				fi
				ckthere "cn=$sname,cn=shares" "BASE" "(univentionShareSambaBrowseable=$dummy)" "$sname" "samba browseable" $LINENO

				ckthere "cn=$sname,cn=shares" "BASE" "(univentionShareSambaCreateMode=$screatemode)" "$sname" "samba create mode" $LINENO

				ckthere "cn=$sname,cn=shares" "BASE" "(univentionShareSambaDirectoryMode=$sdirectorymode)" "$sname" "samba directory mode" $LINENO

				ckthere "cn=$sname,cn=shares" "BASE" "(univentionShareSambaForceCreateMode=$sforcecreatemode)" "$sname" "samba force create mode" $LINENO

				ckthere "cn=$sname,cn=shares" "BASE" "(univentionShareSambaForceDirectoryMode=$sforcedirectorymode)" "$sname" "samba force directory mode" $LINENO

				ckthere "cn=$sname,cn=shares" "BASE" "(univentionShareSambaName=$ssname)" "$sname" "samba name" $LINENO
			fi
			ckthere "cn=$sname,cn=shares" "BASE" "(cn=$sname)" "$sname" "share name" $LINENO

			ckthere "cn=$sname,cn=shares" "BASE" "(univentionSharePath=$spath)" "$sname" "path" $LINENO

			ckthere "cn=$sname,cn=shares" "BASE" "(univentionShareHost=$shost)" "$sname" "share host" $LINENO


			if [ "$whattodo"=1 ];then
				adminwrap $LINENO shares/share remove --dn \"cn=$sname,cn=shares,$ldap_base\" 


				cknthere "cn=$sname,cn=shares" "BASE" "(objectClass=*)" "$sname" "existence" $LINENO
			fi
		done
	done
fi

get_attribute_names()
{
	univention-admin $1 2>/dev/null | { read x; read x ; while read i;do echo $i | cut -d" " -f"1" - ;done }
}

policy_get_attribute()
{
	get_attribute_names "policies/$1" | { while read i; 
		do
			case $i in "fixedAttributes"|"emptyAttributes"|"requiredObjectClasses"|"prohibitedObjectClasses")	
				continue;;
			esac
			echo -n "$i "
		done
	}| cut -d" " -f"$2" -
}

policy_append_remove_test()
{
	attribute1=`policy_get_attribute $2 1`
	attribute2=`policy_get_attribute $2 2`
	attribute3=`policy_get_attribute $2 3`
	if [ -n "$attribute1" -a -n "$attribute2" -a -n "$attribute3" ]
	then
		adminwrap $1 "policies/$2" create --append emptyAttributes=$attribute1 --append emptyAttributes=$attribute2 \
			--append fixedAttributes=$attribute2 --append fixedAttributes=$attribute3 --set name=testpolicy$2 \
			--append requiredObjectClasses=rclass1 --append requiredObjectClasses=rclass2 \
			--append prohibitedObjectClasses=pclass1 --append prohibitedObjectClasses=pclass2
		
		ckthere "cn=testpolicy$2" "base" "(emptyAttributes=$attribute1)" "policy/$2" "emptyAttributes" $LINENO
		ckthere "cn=testpolicy$2" "base" "(emptyAttributes=$attribute2)" "policy/$2" "emptyAttributes" $LINENO

		ckthere "cn=testpolicy$2" "base" "(fixedAttributes=$attribute2)" "policy/$2" "fixedAttributes" $LINENO
		ckthere "cn=testpolicy$2" "base" "(fixedAttributes=$attribute3)" "policy/$2" "fixedAttributes" $LINENO
		
		ckthere "cn=testpolicy$2" "base" "(requiredObjectClasses=rclass1)" "policy/$2" "requiredObjectClasses" $LINENO
		ckthere "cn=testpolicy$2" "base" "(requiredObjectClasses=rclass2)" "policy/$2" "requiredObjectClasses" $LINENO

		ckthere "cn=testpolicy$2" "base" "(prohibitedObjectClasses=pclass1)" "policy/$2" "prohibitedObjectClasses" $LINENO
		ckthere "cn=testpolicy$2" "base" "(prohibitedObjectClasses=pclass2)" "policy/$2" "prohibitedObjectClasses" $LINENO

		adminwrap $1 "policies/$2" modify --dn "cn=testpolicy$2,$ldap_base" \
					--append emptyAttributes=$attribute3 --remove emptyAttributes=$attribute1 \
					--append fixedAttributes=$attribute1 --remove fixedAttributes=$attribute3 \
					--append requiredObjectClasses=rclass3 --remove requiredObjectClasses=rclass1 \
					--append prohibitedObjectClasses=pclass3 --remove prohibitedObjectClasses=pclass1

		cknthere "cn=testpolicy$2" "base" "(emptyAttributes=$attribute1)" "policy/$2" "emptyAttributes" $LINENO
		ckthere "cn=testpolicy$2" "base" "(emptyAttributes=$attribute2)" "policy/$2" "emptyAttributes" $LINENO
		ckthere "cn=testpolicy$2" "base" "(emptyAttributes=$attribute3)" "policy/$2" "emptyAttributes" $LINENO

		cknthere "cn=testpolicy$2" "base" "(fixedAttributes=$attribute3)" "policy/$2" "fixedAttributes" $LINENO
		ckthere "cn=testpolicy$2" "base" "(fixedAttributes=$attribute2)" "policy/$2" "fixedAttributes" $LINENO
		ckthere "cn=testpolicy$2" "base" "(fixedAttributes=$attribute1)" "policy/$2" "fixedAttributes" $LINENO
		
		cknthere "cn=testpolicy$2" "base" "(requiredObjectClasses=rclass1)" "policy/$2" "requiredObjectClasses" $LINENO
		ckthere "cn=testpolicy$2" "base" "(requiredObjectClasses=rclass2)" "policy/$2" "requiredObjectClasses" $LINENO
		ckthere "cn=testpolicy$2" "base" "(requiredObjectClasses=rclass3)" "policy/$2" "requiredObjectClasses" $LINENO

		cknthere "cn=testpolicy$2" "base" "(prohibitedObjectClasses=pclass1)" "policy/$2" "prohibitedObjectClasses" $LINENO
		ckthere "cn=testpolicy$2" "base" "(prohibitedObjectClasses=pclass2)" "policy/$2" "prohibitedObjectClasses" $LINENO
		ckthere "cn=testpolicy$2" "base" "(prohibitedObjectClasses=pclass3)" "policy/$2" "prohibitedObjectClasses" $LINENO

		adminwrap $1 "policies/$2" remove --dn "cn=testpolicy$2,$ldap_base"

		cknthere "cn=testpolicy$2" "base" "(objectClasses=*)" "policy/$2" "existence" $LINENO
	elif [ -n "$attribute1" -a -n "$attribute2" ]
	then
		adminwrap $1 "policies/$2" create --append emptyAttributes=$attribute1 \
			--append fixedAttributes=$attribute2 --set name=testpolicy$2 \
			--append requiredObjectClasses=rclass1 --append requiredObjectClasses=rclass2 \
			--append prohibitedObjectClasses=pclass1 --append prohibitedObjectClasses=pclass2
		
		ckthere "cn=testpolicy$2" "base" "(emptyAttributes=$attribute1)" "policy/$2" "emptyAttributes" $LINENO

		ckthere "cn=testpolicy$2" "base" "(fixedAttributes=$attribute2)" "policy/$2" "fixedAttributes" $LINENO
		
		ckthere "cn=testpolicy$2" "base" "(requiredObjectClasses=rclass1)" "policy/$2" "requiredObjectClasses" $LINENO
		ckthere "cn=testpolicy$2" "base" "(requiredObjectClasses=rclass2)" "policy/$2" "requiredObjectClasses" $LINENO

		ckthere "cn=testpolicy$2" "base" "(prohibitedObjectClasses=pclass1)" "policy/$2" "prohibitedObjectClasses" $LINENO
		ckthere "cn=testpolicy$2" "base" "(prohibitedObjectClasses=pclass2)" "policy/$2" "prohibitedObjectClasses" $LINENO

		adminwrap $1 "policies/$2" modify --dn "cn=testpolicy$2,$ldap_base" \
					--append emptyAttributes=$attribute2 --remove emptyAttributes=$attribute1 \
					--append fixedAttributes=$attribute1 --remove fixedAttributes=$attribute2 \
					--append requiredObjectClasses=rclass3 --remove requiredObjectClasses=rclass1 \
					--append prohibitedObjectClasses=pclass3 --remove prohibitedObjectClasses=pclass1

		cknthere "cn=testpolicy$2" "base" "(emptyAttributes=$attribute1)" "policy/$2" "emptyAttributes" $LINENO
		ckthere "cn=testpolicy$2" "base" "(emptyAttributes=$attribute2)" "policy/$2" "emptyAttributes" $LINENO

		cknthere "cn=testpolicy$2" "base" "(fixedAttributes=$attribute2)" "policy/$2" "fixedAttributes" $LINENO
		ckthere "cn=testpolicy$2" "base" "(fixedAttributes=$attribute1)" "policy/$2" "fixedAttributes" $LINENO
		
		cknthere "cn=testpolicy$2" "base" "(requiredObjectClasses=rclass1)" "policy/$2" "requiredObjectClasses" $LINENO
		ckthere "cn=testpolicy$2" "base" "(requiredObjectClasses=rclass2)" "policy/$2" "requiredObjectClasses" $LINENO
		ckthere "cn=testpolicy$2" "base" "(requiredObjectClasses=rclass3)" "policy/$2" "requiredObjectClasses" $LINENO

		cknthere "cn=testpolicy$2" "base" "(prohibitedObjectClasses=pclass1)" "policy/$2" "prohibitedObjectClasses" $LINENO
		ckthere "cn=testpolicy$2" "base" "(prohibitedObjectClasses=pclass2)" "policy/$2" "prohibitedObjectClasses" $LINENO
		ckthere "cn=testpolicy$2" "base" "(prohibitedObjectClasses=pclass3)" "policy/$2" "prohibitedObjectClasses" $LINENO

		adminwrap $1 "policies/$2" remove --dn "cn=testpolicy$2,$ldap_base"

		cknthere "cn=testpolicy$2" "base" "(objectClasses=*)" "policy/$2" "existence" $LINENO
	elif [ -n "$attribute1" ]
	then
		adminwrap $1 "policies/$2" create --append emptyAttributes=$attribute1 \
		    --set name=testpolicy$2 \
			--append requiredObjectClasses=rclass1 --append requiredObjectClasses=rclass2 \
			--append prohibitedObjectClasses=pclass1 --append prohibitedObjectClasses=pclass2
		
		ckthere "cn=testpolicy$2" "base" "(emptyAttributes=$attribute1)" "policy/$2" "emptyAttributes" $LINENO

		ckthere "cn=testpolicy$2" "base" "(fixedAttributes=$attribute2)" "policy/$2" "fixedAttributes" $LINENO
		
		ckthere "cn=testpolicy$2" "base" "(requiredObjectClasses=rclass1)" "policy/$2" "requiredObjectClasses" $LINENO
		ckthere "cn=testpolicy$2" "base" "(requiredObjectClasses=rclass2)" "policy/$2" "requiredObjectClasses" $LINENO

		ckthere "cn=testpolicy$2" "base" "(prohibitedObjectClasses=pclass1)" "policy/$2" "prohibitedObjectClasses" $LINENO
		ckthere "cn=testpolicy$2" "base" "(prohibitedObjectClasses=pclass2)" "policy/$2" "prohibitedObjectClasses" $LINENO

		adminwrap $1 "policies/$2" modify --dn "cn=testpolicy$2,$ldap_base" \
					--remove emptyAttributes=$attribute1 \
					--append fixedAttributes=$attribute1 \
					--append requiredObjectClasses=rclass3 --remove requiredObjectClasses=rclass1 \
					--append prohibitedObjectClasses=pclass3 --remove prohibitedObjectClasses=pclass1

		ckthere "cn=testpolicy$2" "base" "(emptyAttributes=$attribute1)" "policy/$2" "emptyAttributes" $LINENO

		cknthere "cn=testpolicy$2" "base" "(fixedAttributes=$attribute1)" "policy/$2" "fixedAttributes" $LINENO
		
		cknthere "cn=testpolicy$2" "base" "(requiredObjectClasses=rclass1)" "policy/$2" "requiredObjectClasses" $LINENO
		ckthere "cn=testpolicy$2" "base" "(requiredObjectClasses=rclass2)" "policy/$2" "requiredObjectClasses" $LINENO
		ckthere "cn=testpolicy$2" "base" "(requiredObjectClasses=rclass3)" "policy/$2" "requiredObjectClasses" $LINENO

		cknthere "cn=testpolicy$2" "base" "(prohibitedObjectClasses=pclass1)" "policy/$2" "prohibitedObjectClasses" $LINENO
		ckthere "cn=testpolicy$2" "base" "(prohibitedObjectClasses=pclass2)" "policy/$2" "prohibitedObjectClasses" $LINENO
		ckthere "cn=testpolicy$2" "base" "(prohibitedObjectClasses=pclass3)" "policy/$2" "prohibitedObjectClasses" $LINENO

		adminwrap $1 "policies/$2" remove --dn "cn=testpolicy$2,$ldap_base"

		cknthere "cn=testpolicy$2" "base" "(objectClasses=*)" "policy/$2" "existence" $LINENO
	fi
}


if [ -n "$dopolicies" ]
then
	
	############################################################################
	# policies/admin_container
	############################################################################
	adminwrap $LINENO policies/admin_container create \
		--set name="testadmincontainerpolicy" \
		--set listModules="users/passwd"
	ckthere "cn=testadmincontainerpolicy" "base" "(univentionAdminListModules=users/passwd)" "policy/admin_container" "listModules" $LINENO
	
	adminwrap $LINENO policies/admin_container modify \
		--dn \"cn=testadmincontainerpolicy,$ldap_base\" \
		--set listModules="groups/group"
	ckthere "cn=testadmincontainerpolicy" "base" "(univentionAdminListModules=groups/group)" "policy/admin_container" "listModules" $LINENO
	
	adminwrap $LINENO policies/admin_container remove --dn \"cn=testadmincontainerpolicy,$ldap_base\"

	cknthere "cn=testadmincontainerpolicy" "base" "(objectClass=*)" "policy/admin_container" "existence" $LINENO

	policy_append_remove_test $LINENO admin_container

    	
	############################################################################
	# policies/autostart
	############################################################################
	adminwrap $LINENO policies/autostart create \
	--set name=testautostartpolicy \
	--set autostartScript=reboot

	ckthere "cn=testautostartpolicy" "base" "(univentionAutoStartScript=reboot)" "policy/autostart" "autostartScript" $LINENO
	
	adminwrap $LINENO policies/autostart modify \
	--dn \"cn=testautostartpolicy,$ldap_base\" \
	--set autostartScript=nuke

	ckthere "cn=testautostartpolicy" "base" "(univentionAutoStartScript=nuke)" "policy/autostart" "autostartScript" $LINENO
			
	adminwrap $LINENO policies/autostart remove \
	--dn \"cn=testautostartpolicy,$ldap_base\" 

	cknthere "cn=testautostartpolicy" "base" "(objectClass=*)" "policy/autostart" "existence" $LINENO
	
	policy_append_remove_test $LINENO autostart

	############################################################################
	# policies/clientdevices
	############################################################################
	
	adminwrap $LINENO policies/clientdevices create \
		--set name=testclientdevicespolicy \
		--set clientDevicesActivate=0

	ckthere "cn=testclientdevicespolicy" "base" "(univentionClientDevicesActivate=0)" "policy/clientdevices" "clientDevicesActivate" $LINENO

	adminwrap $LINENO policies/clientdevices modify \
		--dn \"cn=testclientdevicespolicy,$ldap_base\" \
		--set clientDevicesActivate=1

	ckthere "cn=testclientdevicespolicy" "base" "(univentionClientDevicesActivate=1)" "policy/clientdevices" "clientDevicesActivate" $LINENO

	adminwrap $LINENO policies/clientdevices remove \
		--dn \"cn=testclientdevicespolicy,$ldap_base\"

	cknthere "cn=testclientdevicespolicy" "base" "(objectClass=*)" "policy/clientdevices" "existence" $LINENO

	policy_append_remove_test $LINENO clientdevices
	

	############################################################################
	# policies/*packages
	############################################################################
	for uhost in Master Slave Member Client MobileClient; do
		mhost=`echo $uhost |tr [:upper:] [:lower:]`
		if [ "$uhost" = "MobileClient" ]
		then 
			host=client
		else
			host=$mhost
		fi
		if [ "$mhost" = "client" ]; then
			mhost="managedclient"
		fi	
		adminwrap $LINENO policies/${mhost}packages create \
		--set name=test${mhost}packagespolicy \
		--set ${host}Packages=this \
		--set ${host}PackagesRemove=that

		ckthere "cn=test${mhost}packagespolicy" "base" "(univention${uhost}Packages=this)" "policy/${mhost}packages" "${host}Packages" $LINENO
		ckthere "cn=test${mhost}packagespolicy" "base" "(univention${uhost}PackagesRemove=that)" "policy/${mhost}packages" "${host}PackagesRemove" $LINENO

		adminwrap $LINENO policies/${mhost}packages modify \
		--dn \"cn=test${mhost}packagespolicy,$ldap_base\" \
		--set ${host}Packages=these \
		--set ${host}PackagesRemove=those

		ckthere "cn=test${mhost}packagespolicy" "base" "(univention${uhost}Packages=these)" "policy/${mhost}packages" "${host}Packages" $LINENO
		ckthere "cn=test${mhost}packagespolicy" "base" "(univention${uhost}PackagesRemove=those)" "policy/${mhost}packages" "${host}PackagesRemove" $LINENO
		cknthere "cn=test${mhost}packagespolicy" "base" "(univention${uhost}Packages=this)" "policy/${mhost}packages" "${host}Packages" $LINENO
		cknthere "cn=test${mhost}packagespolicy" "base" "(univention${uhost}PackagesRemove=that)" "policy/${mhost}packages" "${host}PackagesRemove" $LINENO

		adminwrap $LINENO policies/${mhost}packages remove \
		--dn \"cn=test${mhost}packagespolicy,$ldap_base\"

		cknthere "cn=test${mhost}packagespolicy" "base" "(objectClass=*)" "policy/${mhost}packages" "existence" $LINENO

		policy_append_remove_test $LINENO ${mhost}packages
	done
	############################################################################
	# create policies/desktop
	############################################################################
	prequiredclasses="posixAccount"
	pprohibitedclasses="univentionHost"
	pfixedattributes="univentionDesktopProfile"
	planguage="de_DE@euro"
	pname="testdesktoppolicy"
	pprofile="gaga"

	adminwrap $LINENO policies/desktop create \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--set language=$planguage  \
	--set name=$pname  \
	--set profile=$pprofile \
	--position \"cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "BASE" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyDesktop))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(fixedAttributes=$pfixedattributes)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDesktopLanguage=$planguage)" "$pname" "language" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDesktopProfile=$pprofile)" "$pname" "profile" $LINENO

	############################################################################
	# modify policies/desktop
	############################################################################
	prequiredclasses="univentionHost"
	pprohibitedclasses="posixAccount"
	pfixedattributes="univentionDesktopLanguage"
	planguage="en_US"
	pname="testdesktoppolicy"
	pprofile="mumu"

	adminwrap $LINENO policies/desktop modify \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--set language=$planguage  \
	--set name=$pname  \
	--set profile=$pprofile \
	--dn \"cn=$pname,cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "BASE" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyDesktop))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(fixedAttributes=$pfixedattributes)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDesktopLanguage=$planguage)" "$pname" "language" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDesktopProfile=$pprofile)" "$pname" "profile" $LINENO

	adminwrap $LINENO policies/desktop remove --dn \"cn=$pname,cn=policies,$ldap_base\" 

	cknthere "cn=$pname,cn=policies" "BASE" "(objectClass=*)" "$pname" "existence" $LINENO

	policy_append_remove_test $LINENO desktop
	
	
	############################################################################
	############################################################################
	# policies/dhcp_boot
	############################################################################
	############################################################################

	adminwrap $LINENO policies/dhcp_boot create \
		--set name=testdhcpbootpolicy \
		--set boot_server=nohost.nowhere \
		--set boot_filename=narf
	
	ckthere "cn=testdhcpbootpolicy" "BASE" "(univentionDhcpBootServer=nohost.nowhere)" "policies/dhcp_boot" "boot_server" $LINENO
	ckthere "cn=testdhcpbootpolicy" "BASE" "(univentionDhcpBootFilename=narf)" "policies/dhcp_boot" "boot_filename" $LINENO
	
	
	adminwrap $LINENO policies/dhcp_boot modify \
		--dn \"cn=testdhcpbootpolicy,$ldap_base\" \
		--set boot_server=somehost.somewhere \
		--set boot_filename=blargh
	
	ckthere "cn=testdhcpbootpolicy" "BASE" "(univentionDhcpBootServer=somehost.somewhere)" "policies/dhcp_boot" "boot_server" $LINENO
	ckthere "cn=testdhcpbootpolicy" "BASE" "(univentionDhcpBootFilename=blargh)" "policies/dhcp_boot" "boot_filename" $LINENO
	
	
	adminwrap $LINENO policies/dhcp_boot remove \
		--dn \"cn=testdhcpbootpolicy,$ldap_base\" 
	
	cknthere "cn=testdhcpbootpolicy" "BASE" "(objectClass=*)" "policies/dhcp_boot" "existence" $LINENO
	
	policy_append_remove_test $LINENO dhcp_boot
	
	
	############################################################################
	############################################################################
	# policies/dhcp_dns
	############################################################################
	############################################################################

	############################################################################
	# create policies/dhcp_dns
	############################################################################
	prequiredclasses="univentionHost"
	pprohibitedclasses="posixAcount"
	pdomainname="moo.bla"
	pdomainnameservers1="localhost"
	pdomainnameservers2="schnuffi"
	pfixedattributes="univentionDhcpDomainName"
	pprofile="gaga"
	pname="testpolicydhcpdns"

	adminwrap $LINENO policies/dhcp_dns create \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--set domain_name=$pdomainname  \
	--append domain_name_servers=$pdomainnameservers1  \
	--append domain_name_servers=$pdomainnameservers2  \
	--set name=$pname  \
	--position \"cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "BASE" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyDhcpDns))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(requiredObjectClasses=$prequiredclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpDomainName=$pdomainname)" "$pname" "domain name" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpDomainNameServers=$pdomainnameservers1)" "$pname" "domain name servers" $LINENO
	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpDomainNameServers=$pdomainnameservers2)" "$pname" "domain name servers" $LINENO

	############################################################################
	# modify policies/dhcp_dns
	############################################################################
	prequiredclasses="posixAccount"
	pprohibitedclasses="person"
	pdomainname="bla.moo"
	pdomainnameservers3="web.de"
	pfixedattributes="univentionDhcpDomainNameServers"
	pprofile="muhu"
	pname="testpolicydhcpdns"

	adminwrap $LINENO policies/dhcp_dns modify \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--set domain_name=$pdomainname  \
	--append domain_name_servers=$pdomainnameservers3  \
	--remove domain_name_servers=$pdomainnameservers1  \
	--dn \"cn=$pname,cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "BASE" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyDhcpDns))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(requiredObjectClasses=$prequiredclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpDomainName=$pdomainname)" "$pname" "domain name" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpDomainNameServers=$pdomainnameservers3)" "$pname" "domain name servers" $LINENO
	cknthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpDomainNameServers=$pdomainnameservers1)" "$pname" "domain name servers" $LINENO
	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpDomainNameServers=$pdomainnameservers2)" "$pname" "domain name servers" $LINENO

	adminwrap $LINENO policies/dhcp_dns remove --dn "cn=$pname,cn=policies,$ldap_base" 

	cknthere "cn=$pname,cn=policies" "BASE" "(objectClass=*)" "$pname" "existence" $LINENO

	policy_append_remove_test $LINENO dhcp_dns
	############################################################################
	############################################################################
	# policie/dhcp_dnsupdate
	############################################################################
	############################################################################

	############################################################################
	# create policie/dhcp_dnsupdate
	############################################################################
	prequiredclasses="univentionHost"
	pprohibitedclasses="posixAcount"
	pfixedattributes="univentionDhcpDdnsDomainname"
	pprofile="gaga"
	pname="testpolicydhcpdnsupdate"
	pupdatestaticleases="true"
	pddnsrevdomainname="bla"
	pddnshostname="urk"
	pddnsdoforwardupdate="true"
	pddnsdomainname="wa"
	pclientupdates="allow"
	pddnsupdates="on"
	pddnsupdatestyle="ad-hoc"


	adminwrap $LINENO policies/dhcp_dnsupdate create \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--set updateStaticLeases=$pupdatestaticleases \
	--set ddnsRevDomainname=$pddnsrevdomainname \
	--set ddnsHostname=$pddnshostname \
	--set ddnsDoForwardUpdate=$pddnsdoforwardupdate \
	--set ddnsDomainname=$pddnsdomainname  \
	--set clientUpdates=$pclientupdates  \
	--set ddnsUpdates=$pddnsupdates  \
	--set ddnsUpdateStyle=$pddnsupdatestyle \
	--set name=$pname  \
	--position \"cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "BASE" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyDhcpDnsUpdate))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpDdnsHostname=$pddnshostname)" "$pname" "dhcp dns hostname" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpDdnsDomainname=$pddnsdomainname)" "$pname" "dhcp dns domainname" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpDdnsRevDomainname=$pddnsrevdomainname)" "$pname" "dhcp dns reverse domainname" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpDdnsUpdates=$pddnsupdates)" "$pname" "dhcp dns updates" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentiondhcpddnsupdatestyle=$pddnsupdatestyle)" "$pname" "dhcp nds update style" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentiondhcpdoforwardupdates=$pddnsdoforwardupdate)" "$pname" "dhcp dns do forward update" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentiondhcpupdatestaticleases=$pupdatestaticleases)" "$pname" "dhcp dns update static leases" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentiondhcpclientupdates=$pclientupdates)" "$pname" "dhcp dns client updates" $LINENO


	############################################################################
	# modify policie/dhcp_dnsupdate
	############################################################################
	prequiredclasses="posixAccount"
	pprohibitedclasses="univentionHost"
	pfixedattributes="univentionDhcpDdnsDomainname"
	pprofile="wawawa"
	pname="testpolicydhcpdnsupdate"
	pupdatestaticleases="false"
	pddnsrevdomainname="blubb"
	pddnshostname="torkel"
	pddnsdoforwardupdate="false"
	pddnsdomainname="nowhere"
	pclientupdates="deny"
	pddnsupdates="off"
	pddnsupdatestyle="interim"


	adminwrap $LINENO policies/dhcp_dnsupdate modify \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--set updateStaticLeases=$pupdatestaticleases \
	--set ddnsRevDomainname=$pddnsrevdomainname \
	--set ddnsHostname=$pddnshostname \
	--set ddnsDoForwardUpdate=$pddnsdoforwardupdate \
	--set ddnsDomainname=$pddnsdomainname  \
	--set clientUpdates=$pclientupdates  \
	--set ddnsUpdates=$pddnsupdates  \
	--set ddnsUpdateStyle=$pddnsupdatestyle \
	--dn \"cn=$pname,cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "BASE" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyDhcpDnsUpdate))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpDdnsHostname=$pddnshostname)" "$pname" "dhcp dns hostname" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpDdnsDomainname=$pddnsdomainname)" "$pname" "dhcp dns domainname" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpDdnsRevDomainname=$pddnsrevdomainname)" "$pname" "dhcp dns reverse domainname" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpDdnsUpdates=$pddnsupdates)" "$pname" "dhcp dns updates" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentiondhcpddnsupdatestyle=$pddnsupdatestyle)" "$pname" "dhcp nds update style" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentiondhcpdoforwardupdates=$pddnsdoforwardupdate)" "$pname" "dhcp dns do forward update" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentiondhcpupdatestaticleases=$pupdatestaticleases)" "$pname" "dhcp dns update static leases" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentiondhcpclientupdates=$pclientupdates)" "$pname" "dhcp dns client updates" $LINENO

	adminwrap $LINENO policies/dhcp_dnsupdate remove --dn \"cn=$pname,cn=policies,$ldap_base\" 

	cknthere "cn=$pname,cn=policies" "BASE" "(objectClass=*)" "$pname" "existence" $LINENO

	policy_append_remove_test $LINENO dhcp_dnsupdate


	############################################################################
	############################################################################
	# policies/dhcp_leasetime
	############################################################################
	############################################################################



	############################################################################
	# create policies/dhcp_leasetime
	############################################################################
	prequiredclasses="univentionHost"
	pprohibitedclasses="posixAcount"
	pfixedattributes="univentionDhcpLeaseTimeDefault"
	pname="testpolicydhcpleasetime"
	pleasetimemax="15"
	pleasetimemin="5"
	pleasetimedef="10"

	adminwrap $LINENO policies/dhcp_leasetime create \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--set lease_time_min=$pleasetimemin \
	--set lease_time_max=$pleasetimemax \
	--set lease_time_default=$pleasetimedef \
	--set name=$pname  \
	--position \"cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "BASE" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyDhcpLeasetime))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpLeaseTimeDefault=$pleasetimedef)" "$pname" "default lease time" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpLeaseTimeMin=$pleasetimemin)" "$pname" "min lease time" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpLeaseTimeMax=$pleasetimemax)" "$pname" "max lease time" $LINENO

	############################################################################
	# modify policies/dhcp_leasetime
	############################################################################
	prequiredclasses="posixAccount"
	pprohibitedclasses="univentionHost"
	pfixedattributes="univentionDhcpLeaseTimeMax"
	pname="testpolicydhcpleasetime"
	pleasetimemax="25"
	pleasetimemin="15"
	pleasetimedef="20"

	adminwrap $LINENO policies/dhcp_leasetime modify \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--set lease_time_min=$pleasetimemin \
	--set lease_time_max=$pleasetimemax \
	--set lease_time_default=$pleasetimedef \
	--dn \"cn=$pname,cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "BASE" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyDhcpLeasetime))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpLeaseTimeDefault=$pleasetimedef)" "$pname" "default lease time" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpLeaseTimeMin=$pleasetimemin)" "$pname" "min lease time" $LINENO

	ckthere "cn=$pname,cn=policies" "BASE" "(univentionDhcpLeaseTimeMax=$pleasetimemax)" "$pname" "max lease time" $LINENO


	adminwrap $LINENO policies/dhcp_leasetime remove --dn \"cn=$pname,cn=policies,$ldap_base\" 

	cknthere "cn=$pname,cn=policies" "BASE" "(objectClass=*)" "$pname" "existence" $LINENO

	policy_append_remove_test $LINENO dhcp_leasetime

	############################################################################
	############################################################################
	# policies/dhcp_netbios
	############################################################################
	############################################################################


	############################################################################
	# create policies/dhcp_netbios
	############################################################################
	prequiredclasses="univentionHost"
	pprohibitedclasses="posixAcount"
	pfixedattributes="univentionDhcpNetbiosNameServers"
	pname="testpolicydhcpnetbios"
	pnetbiosnameservers="mooh"
	pnetbiosnameservers2="gulli"
	pnetbiosscope="watawa"
	pnetbiosnodetype="1"

	adminwrap $LINENO policies/dhcp_netbios create \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--append netbios_name_servers=$pnetbiosnameservers \
	--append netbios_name_servers=$pnetbiosnameservers2 \
	--set netbios_scope=$pnetbiosscope \
	--set netbios_node_type=$pnetbiosnodetype \
	--set name=$pname  \
	--position \"cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "base" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyDhcpNetbios))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpNetbiosNameServers=$pnetbiosnameservers)" "$pname" "dhcp netbios name servers" $LINENO
	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpNetbiosNameServers=$pnetbiosnameservers2)" "$pname" "dhcp netbios name servers" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpNetbiosScope=$pnetbiosscope)" "$pname" "dhcp netbios scope" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpNetbiosNodeType=$pnetbiosnodetype)" "$pname" $LINENO

	############################################################################
	# modify policies/dhcp_netbios
	############################################################################
	prequiredclasses="tapatata"
	pprohibitedclasses="bogawoga"
	pfixedattributes="univentionDhcpNetbiosScope"
	pname="testpolicydhcpnetbios"
	pnetbiosnameservers3="ooohm"
	pnetbiosscope="tawata"
	pnetbiosnodetype="4"

	adminwrap $LINENO policies/dhcp_netbios modify \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--append netbios_name_servers=$pnetbiosnameservers3 \
	--remove netbios_name_servers=$pnetbiosnameservers \
	--set netbios_scope=$pnetbiosscope \
	--set netbios_node_type=$pnetbiosnodetype \
	--dn \"cn=$pname,cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "base" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyDhcpNetbios))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	cknthere "cn=$pname,cn=policies" "base" "(univentionDhcpNetbiosNameServers=$pnetbiosnameservers)" "$pname" "dhcp netbios name servers" $LINENO
	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpNetbiosNameServers=$pnetbiosnameservers2)" "$pname" "dhcp netbios name servers" $LINENO
	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpNetbiosNameServers=$pnetbiosnameservers3)" "$pname" "dhcp netbios name servers" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpNetbiosScope=$pnetbiosscope)" "$pname" "dhcp netbios scope" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpNetbiosNodeType=$pnetbiosnodetype)" "$pname" $LINENO

	adminwrap $LINENO policies/dhcp_netbios remove --dn \"cn=$pname,cn=policies,$ldap_base\" 

	cknthere "cn=$pname,cn=policies" "base" "(objectClass=*)" "$pname" "existence" $LINENO

	policy_append_remove_test $LINENO dhcp_netbios

	############################################################################
	############################################################################
	# policies/dhcp_routing
	############################################################################
	############################################################################



	############################################################################
	# create policies/dhcp_routing
	############################################################################
	prequiredclasses="univentionHost"
	pprohibitedclasses="posixAcount"
	pfixedattributes="univentionDhcpRouters"
	pname="testpolicydhcprouting"
	prouters="noboda"
	prouters2="goliodogra"

	adminwrap $LINENO policies/dhcp_routing create \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--set name=$pname  \
	--append routers=$prouters \
	--append routers=$prouters2 \
	--position \"cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "base" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyDhcpRouting))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	ckthere "cn=$pname,cn=policies" "base"  "(univentionDhcpRouters=$prouters)" "$pname" "dhcp routers" $LINENO
	ckthere "cn=$pname,cn=policies" "base"  "(univentionDhcpRouters=$prouters2)" "$pname" "dhcp routers" $LINENO

	############################################################################
	# modify policies/dhcp_routing
	############################################################################
	prequiredclasses="hooogla"
	pprohibitedclasses="moowatagasteh"
	pfixedattributes="univentionDhcpRouters"
	pname="testpolicydhcprouting"
	prouters3="uathnsishnt"

	adminwrap $LINENO policies/dhcp_routing modify \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--remove fixedAttributes=$pfixedattributes  \
	--append routers=$prouters3 \
	--remove routers=$prouters \
	--dn \"cn=$pname,cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "base" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyDhcpRouting))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	cknthere "cn=$pname,cn=policies" "base" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	cknthere "cn=$pname,cn=policies" "base" "(univentionDhcpRouters=$prouters)" "$pname" "dhcp routers" $LINENO
	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpRouters=$prouters2)" "$pname" "dhcp routers" $LINENO
	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpRouters=$prouters3)" "$pname" "dhcp routers" $LINENO

	adminwrap $LINENO policies/dhcp_routing remove --dn \"cn=$pname,cn=policies,$ldap_base\" 

	cknthere "cn=$pname,cn=policies" "base" "(objectClass=*)" "$pname" "existence" $LINENO

	policy_append_remove_test $LINENO dhcp_routing
	############################################################################
	############################################################################
	# policies/dhcp_scope
	############################################################################
	############################################################################


	############################################################################
	# create policies/dhcp_scope
	############################################################################
	prequiredclasses="univentionHost"
	pprohibitedclasses="posixAcount"
	pfixedattributes="univentionDhcpBootp"
	pname="testpolicydhcpscope"
	pbootp="allow"
	pdeclines="deny"
	pduplicates="allow"
	pbooting="deny"
	punknownclients="deny"

	adminwrap $LINENO policies/dhcp_scope create \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--set name=$pname  \
	--set bootp=$pbootp \
	--set declines=$pdeclines \
	--set duplicates=$pduplicates \
	--set booting=$pbooting \
	--set scopeUnknownClients=$punknownclients \
	--position \"cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "base" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyDhcpScope))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpBooting=$pbooting)" "$pname" "dhcp booting" $LINENO

	ckthere  "cn=$pname,cn=policies" "base" "(univentionDhcpDeclines=$pdeclines)" "$pname" "dhcp declines" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpUnknownClients=$punknownclients)" "$pname" "dhcp unknown clients" $LINENO

	ckthere "cn=$pname,cn=policies" "base"  "(univentionDhcpBootp=$pbootp)" "$pname" "dhcp bootp" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpDuplicates=$pduplicates)" "$pname" "dhcp duplicates" $LINENO

	############################################################################
	# modify policies/dhcp_scope
	############################################################################
	prequiredclasses="univentionHost"
	pprohibitedclasses="posixAcount"
	pfixedattributes="univentionDhcpBooting"
	pname="testpolicydhcpscope"
	pbootp="deny"
	pdeclines="allow"
	pduplicates="deny"
	pbooting="allow"
	punknownclients="allow"

	adminwrap $LINENO policies/dhcp_scope modify \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--set bootp=$pbootp \
	--set declines=$pdeclines \
	--set duplicates=$pduplicates \
	--set booting=$pbooting \
	--set scopeUnknownClients=$punknownclients \
	--dn \"cn=$pname,cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "base" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyDhcpScope))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpBooting=$pbooting)" "$pname" "dhcp booting" $LINENO

	ckthere  "cn=$pname,cn=policies" "base" "(univentionDhcpDeclines=$pdeclines)" "$pname" "dhcp declines" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpUnknownClients=$punknownclients)" "$pname" "dhcp unknown clients" $LINENO

	ckthere "cn=$pname,cn=policies" "base"  "(univentionDhcpBootp=$pbootp)" "$pname" "dhcp bootp" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpDuplicates=$pduplicates)" "$pname" "dhcp duplicates" $LINENO

	adminwrap $LINENO policies/dhcp_scope remove --dn \"cn=$pname,cn=policies,$ldap_base\" 

	cknthere "cn=$pname,cn=policies" "base" "(objectClass=*)" "$pname" "existence" $LINENO

	policy_append_remove_test $LINENO dhcp_scope
	############################################################################
	############################################################################
	# policies/dhcp_statements
	############################################################################
	############################################################################

	############################################################################
	# create policies/dhcp_statements
	############################################################################
	prequiredclasses="univentionHost"
	pprohibitedclasses="posixAcount"
	pfixedattributes="univentionDhcpBootUnknownClients"
	pname="testpolicydhcpstatements"
	pgetleasehostnames="true"
	pservername="vatutsi"
	ppingcheck="true"
	pauthoritative="yes"
	pbootunknownclients="true"
	pserveridentifier="lebtwostacs"

	adminwrap $LINENO policies/dhcp_statements create \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--set name=$pname  \
	--set getLeaseHostnames=$pgetleasehostnames \
	--set serverName=$pservername \
	--set pingCheck=$ppingcheck \
	--set authoritative=$pauthoritative \
	--set boot-unknown-clients=$pbootunknownclients \
	--set serverIdentifier=$pserveridentifier \
	--position \"cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "base" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyDhcpStatements))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	ckthere  "cn=$pname,cn=policies" "base" "(univentionDhcpAuthoritative=$pauthoritative)" "$pname" "dhcp authoritative" $LINENO

	ckthere  "cn=$pname,cn=policies" "base" "(univentionDhcpBootUnknownClients=$pbootunknownclients)" "$pname" "dhcp boot unknown clients" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpPingCheck=$ppingcheck)" "$pname" "dhcp ping check" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpGetLeaseHostnames=$pgetleasehostnames)" "$pname" "get leases host names" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpServerIdentifier=$pserveridentifier)" "$pname" "dhcp server identifier" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpServerName=$pservername)" "$pname" "dhcp server name" $LINENO


	############################################################################
	# modify policies/dhcp_statements
	############################################################################
	prequiredclasses="urgle"
	pprohibitedclasses="blargh"
	pfixedattributes="univentionDhcpServerName"
	pname="testpolicydhcpstatements"
	pgetleasehostnames="false"
	pservername="tesothaotuesnthua"
	ppingcheck="false"
	pauthoritative="no"
	pbootunknownclients="false"
	pserveridentifier="ahuuhathnusasaohtue"

	adminwrap $LINENO policies/dhcp_statements modify \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--set getLeaseHostnames=$pgetleasehostnames \
	--set serverName=$pservername \
	--set pingCheck=$ppingcheck \
	--set authoritative=$pauthoritative \
	--set boot-unknown-clients=$pbootunknownclients \
	--set serverIdentifier=$pserveridentifier \
	--dn \"cn=$pname,cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "base" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyDhcpStatements))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	ckthere  "cn=$pname,cn=policies" "base" "(univentionDhcpAuthoritative=$pauthoritative)" "$pname" "dhcp authoritative" $LINENO

	ckthere  "cn=$pname,cn=policies" "base" "(univentionDhcpBootUnknownClients=$pbootunknownclients)" "$pname" "dhcp boot unknown clients" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpPingCheck=$ppingcheck)" "$pname" "dhcp ping check" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpGetLeaseHostnames=$pgetleasehostnames)" "$pname" "get leases host names" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpServerIdentifier=$pserveridentifier)" "$pname" "dhcp server identifier" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionDhcpServerName=$pservername)" "$pname" "dhcp server name" $LINENO

	adminwrap $LINENO policies/dhcp_statements remove --dn \"cn=$pname,cn=policies,$ldap_base\" 

	cknthere "cn=$pname,cn=policies" "base" "(objectClass=*)" "$pname" "existence" $LINENO
	
	policy_append_remove_test $LINENO dhcp_statements

	############################################################################
	############################################################################
	# policies/pwhistory
	############################################################################
	############################################################################



	############################################################################
	# create policies/pwhistory
	############################################################################
	prequiredclasses="univentionHost"
	pprohibitedclasses="posixAcount"
	pfixedattributes="univentionPWHistoryLen"
	pname="testpolicypwhistory"
	plength="3"

	adminwrap $LINENO policies/pwhistory create \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--set name=$pname  \
	--set length=$plength \
	--position \"cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "base" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyPWHistory))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionPWHistoryLen=$plength)" "$pname" "length" $LINENO

	############################################################################
	# modify policies/pwhistory
	############################################################################
	prequiredclasses="hashhshnte"
	pprohibitedclasses="sanotehs"
	pname="testpolicypwhistory"
	plength="5"

	adminwrap $LINENO policies/pwhistory modify \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--remove fixedAttributes=$pfixedattributes  \
	--set length=$plength \
	--dn \"cn=$pname,cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "base" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyPWHistory))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	cknthere "cn=$pname,cn=policies" "base" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionPWHistoryLen=$plength)" "$pname" "length" $LINENO

	adminwrap $LINENO policies/pwhistory remove --dn \"cn=$pname,cn=policies,$ldap_base\" 

	cknthere "cn=$pname,cn=policies" "base" "(objectClass=*)" "$pname" "existence" $LINENO
	
	policy_append_remove_test $LINENO pwhistory

	############################################################################
	############################################################################
	# policies/ldapserver
	############################################################################
	############################################################################

	adminwrap $LINENO policies/ldapserver create \
		--set name=testldapserverpolicy \
		--set ldapServer=fake
    
	ckthere "cn=testldapserverpolicy" "base" "(univentionLDAPServer=fake)" testldapserverpolicy "ldapserver" $LINENO
	
	adminwrap $LINENO policies/ldapserver modify \
		--dn \"cn=testldapserverpolicy,$ldap_base\" \
		--set ldapServer=real
    
	ckthere "cn=testldapserverpolicy" "base" "(univentionLDAPServer=real)" testldapserverpolicy "ldapserver" $LINENO
	
	adminwrap $LINENO policies/ldapserver remove \
		--dn \"cn=testldapserverpolicy,$ldap_base\"
    
	cknthere "cn=testldapserverpolicy" "base" "(objectClass=*)" testldapserverpolicy "existence" $LINENO
	
	policy_append_remove_test $LINENO ldapserver
	
	############################################################################
	############################################################################
	# policies/mailquota
	############################################################################
	############################################################################

	adminwrap $LINENO policies/mailquota create \
		--set name=testmailquotapolicy \
		--set MailQuota=4
    
	ckthere "cn=testmailquotapolicy" "base" "(univentionMailQuotaMB=4)" testmailquotapolicy "mailquota" $LINENO
	
	adminwrap $LINENO policies/mailquota modify \
		--dn \"cn=testmailquotapolicy,$ldap_base\" \
		--set MailQuota=3
    
	ckthere "cn=testmailquotapolicy" "base" "(univentionMailQuotaMB=3)" testmailquotapolicy "mailquota" $LINENO
	
	adminwrap $LINENO policies/mailquota remove \
		--dn \"cn=testmailquotapolicy,$ldap_base\"
    
	cknthere "cn=testmailquotapolicy" "base" "(objectClass=*)" testmailquotapolicy "existence" $LINENO
	
	policy_append_remove_test $LINENO mailquota
	
	############################################################################
	############################################################################
	# policies/maintenance
	############################################################################
	############################################################################
	
	adminwrap $LINENO policies/maintenance create \
		--set name=testmaintenancepolicy \
		--set startup=1 \
		--set shutdown=1 \
		--set cron=1 \
		--set reboot=00:45 \
		--append month=June \
		--append month=February \
		--append weekday=Tuesday \
		--append weekday=Thursday \
		--append day=2 \
		--append day=5 \
		--append hour=6 \
		--append hour=7 \
		--append minute=5 \
		--append minute=10 

	ckthere "cn=testmaintenancepolicy" "base" "(univentionInstallationStartup=1)" testmaintenancepolicy "mailquota" $LINENO
	ckthere "cn=testmaintenancepolicy" "base" "(univentionInstallationReboot=00:45)" testmaintenancepolicy "reboot" $LINENO
	ckthere "cn=testmaintenancepolicy" "base" "(univentionCronActive=1)" testmaintenancepolicy "cron" $LINENO
	ckthere "cn=testmaintenancepolicy" "base" "(univentionCron=5,10 6,7 2,5 6,2 2,4)" testmaintenancepolicy "crontab" $LINENO
	ckthere "cn=testmaintenancepolicy" "base" "(univentionInstallationShutdown=1)" testmaintenancepolicy "shutdown" $LINENO
	
	
	adminwrap $LINENO policies/maintenance modify \
		--dn \"cn=testmaintenancepolicy,$ldap_base\" \
		--set startup=0 \
		--set shutdown=0 \
		--set cron=0 \
		--set reboot=00:15 \
		--remove month=June \
		--append month=March \
		--remove weekday=Tuesday \
		--append weekday=Friday \
		--remove day=2 \
		--append day=6 \
		--remove hour=6 \
		--append hour=8 \
		--remove minute=5 \
		--append minute=15 

	ckthere "cn=testmaintenancepolicy" "base" "(univentionInstallationStartup=0)" testmaintenancepolicy "mailquota" $LINENO
	ckthere "cn=testmaintenancepolicy" "base" "(univentionInstallationReboot=00:15)" testmaintenancepolicy "reboot" $LINENO
	ckthere "cn=testmaintenancepolicy" "base" "(univentionCronActive=0)" testmaintenancepolicy "cron" $LINENO
	ckthere "cn=testmaintenancepolicy" "base" "(univentionCron=10,15 7,8 5,6 2,3 4,5)" testmaintenancepolicy "crontab" $LINENO
	ckthere "cn=testmaintenancepolicy" "base" "(univentionInstallationShutdown=0)" testmaintenancepolicy "shutdown" $LINENO
	
		
	adminwrap $LINENO policies/maintenance remove \
		--dn \"cn=testmaintenancepolicy,$ldap_base\"

	cknthere "cn=testmaintenancepolicy" "base" "(objectClass=*)" testmaintenancepolicy "existence" $LINENO
	
	policy_append_remove_test $LINENO maintenance

	############################################################################
	############################################################################
	# policies/print_quota
	############################################################################
	############################################################################
	adminwrap $LINENO policies/print_quota create \
	--set name=testprintquotapolicy \
	--set quotaUsers=\"5 4 Administrator\" \
	--set quotaGroupsPerUsers=\"9 10 Administrators\"\
	--set quotaGroups=\"6 7 Administrators\"
	ckthere "cn=testprintquotapolicy" "base" "(univentionPrintQuotaUsers=5 4 Administrator)" testprintquotapolicy quotausers $LINENO
	ckthere "cn=testprintquotapolicy" "base" "(univentionPrintQuotaGroups=6 7 Administrators)" testprintqotapolicy quotagroups $LINENO
	ckthere "cn=testprintquotapolicy" "base" "(univentionPrintQuotaGroupsPerUsers=9 10 Administrators)" testprintquotapolicy quotagroupsperusers $LINENO

	
	adminwrap $LINENO policies/print_quota modify \
	--dn \"cn=testprintquotapolicy,$ldap_base\" \
	--set quotaUsers=\"50 40 Administrator\" \
	--set quotaGroupsPerUsers=\"90 100 Administrators\"\
	--set quotaGroups=\"60 70 Administrators\"
	ckthere "cn=testprintquotapolicy" "base" "(univentionPrintQuotaUsers=50 40 Administrator)" testprintquotapolicy quotausers $LINENO
	ckthere "cn=testprintquotapolicy" "base" "(univentionPrintQuotaGroups=60 70 Administrators)" testprintqotapolicy quotagroups $LINENO
	ckthere "cn=testprintquotapolicy" "base" "(univentionPrintQuotaGroupsPerUsers=90 100 Administrators)" testprintquotapolicy quotagroupsperusers $LINENO

	adminwrap $LINENO policies/print_quota remove \
	    --dn \"cn=testprintquotapolicy,$ldap_base\"
	cknthere "cn=testprintquotapolicy" "base" "(objectClass=*)" testprintquotapolicy existence $LINENO
	
	############################################################################
	############################################################################
	# policies/printserver
	############################################################################
	############################################################################
	
	adminwrap $LINENO policies/printserver create \
	--set name=testprintserverpolicy \
	--set printServer=nohost.local

	ckthere "cn=testprintserverpolicy" "base" "(univentionPrintServer=nohost.local)" testprintserverpolicy "printServer" $LINENO

	adminwrap $LINENO policies/printserver modify \
	--dn \"cn=testprintserverpolicy,$ldap_base\" \
	--set printServer=anyhost.anywhere

	ckthere "cn=testprintserverpolicy" "base" "(univentionPrintServer=anyhost.anywhere)" testprintserverpolicy "printServer" $LINENO

	adminwrap $LINENO policies/printserver remove \
	--dn \"cn=testprintserverpolicy,$ldap_base\" 

	cknthere "cn=testprintserverpolicy" "base" "(objectClass=*)" testprintserverpolicy "printServer" $LINENO
	
	policy_append_remove_test $LINENO printserver
	############################################################################
	############################################################################
	# policies/pwhistory
	############################################################################
	############################################################################
	adminwrap $LINENO policies/pwhistory create \
	--set name=testpwhistorypolicy \
	--set length=4 \
	--set expiryInterval=4 \
	--set pwLength=4 

	ckthere "cn=testpwhistorypolicy" "base" "(univentionPWHistoryLen=4)" testpwhistorypolicy univentionPWHistoryLen $LINENO
	ckthere "cn=testpwhistorypolicy" "base" "(univentionPWExpiryInterval=4)" testpwhistorypolicy univentionPWExpiryInterval $LINENO
	ckthere "cn=testpwhistorypolicy" "base" "(cn=testpwhistorypolicy)" testpwhistorypolicy cn $LINENO
	ckthere "cn=testpwhistorypolicy" "base" "(univentionPWLength=4)" testpwhistorypolicy univentionPWLength $LINENO

	adminwrap $LINENO policies/pwhistory modify \
	--dn \"cn=testpwhistorypolicy,$ldap_base\" \
	--set length=5 \
	--set expiryInterval=5 \
	--set pwLength=5 

	ckthere "cn=testpwhistorypolicy" "base" "(cn=testpwhistorypolicy)" testpwhistorypolicy cn $LINENO
	ckthere "cn=testpwhistorypolicy" "base" "(univentionPWExpiryInterval=5)" testpwhistorypolicy univentionPWExpiryInterval $LINENO
	ckthere "cn=testpwhistorypolicy" "base" "(univentionPWHistoryLen=5)" testpwhistorypolicy univentionPWHistoryLen $LINENO
	ckthere "cn=testpwhistorypolicy" "base" "(univentionPWLength=5)" testpwhistorypolicy univentionPWLength $LINENO

	adminwrap $LINENO policies/pwhistory remove \
	--dn \"cn=testpwhistorypolicy,$ldap_base\"
	cknthere "cn=testpwhistorypolicy" "base" "(objectClass=*)" testpwhistorypolicy existence $LINENO

	policy_append_remove_test $LINENO pwhistory

	############################################################################
	############################################################################
	# policies/release
	############################################################################
	############################################################################
	adminwrap $LINENO policies/release create \
	--set name=testreleasepolicy \
	--set releaseVersion=4 

	ckthere "cn=testreleasepolicy" "base" "(cn=testreleasepolicy)" testreleasepolicy cn $LINENO
	ckthere "cn=testreleasepolicy" "base" "(univentionUpdateVersion=4)" testreleasepolicy univentionUpdateVersion $LINENO

	adminwrap $LINENO policies/release modify \
	--dn \"cn=testreleasepolicy,$ldap_base\" \
	--set releaseVersion=5 

	ckthere "cn=testreleasepolicy" "base" "(cn=testreleasepolicy)" testreleasepolicy cn $LINENO
	ckthere "cn=testreleasepolicy" "base" "(univentionUpdateVersion=5)" testreleasepolicy univentionUpdateVersion $LINENO

	adminwrap $LINENO policies/release remove \
	--dn \"cn=testreleasepolicy,$ldap_base\"

	cknthere "cn=testreleasepolicy" "base" "(objectClass=*)" testreleasepolicy existence $LINENO

	policy_append_remove_test $LINENO release

	############################################################################
	############################################################################
	# policies/repositoryserver
	############################################################################
	############################################################################
	adminwrap $LINENO policies/repositoryserver create \
	--set name=testrepositoryserverpolicy \
	--set repositoryServer=baba 

	ckthere "cn=testrepositoryserverpolicy" "base" "(cn=testrepositoryserverpolicy)" testrepositoryserverpolicy cn $LINENO
	ckthere "cn=testrepositoryserverpolicy" "base" "(univentionRepositoryServer=baba)" testrepositoryserverpolicy univentionRepositoryServer $LINENO

	adminwrap $LINENO policies/repositoryserver modify \
	--dn \"cn=testrepositoryserverpolicy,$ldap_base\" \
	--set repositoryServer=bubu

	ckthere "cn=testrepositoryserverpolicy" "base" "(univentionRepositoryServer=bubu)" testrepositoryserverpolicy univentionRepositoryServer $LINENO

	adminwrap $LINENO policies/repositoryserver remove \
	--dn \"cn=testrepositoryserverpolicy,$ldap_base\"

	cknthere "cn=testrepositoryserverpolicy" "base" "(objectClass=*)" testrepositoryserverpolicy existence $LINENO
	
	policy_append_remove_test $LINENO repositoryserver
	############################################################################
	############################################################################
	# policies/repositorysync
	############################################################################
	############################################################################
	
	adminwrap $LINENO policies/repositorysync create \
		--set name=testrepositorysyncpolicy \
		--append month=June \
		--append month=February \
		--append weekday=Tuesday \
		--append weekday=Thursday \
		--append day=2 \
		--append day=5 \
		--append hour=6 \
		--append hour=7 \
		--append minute=5 \
		--append minute=10 

	ckthere "cn=testrepositorysyncpolicy" "base" "(univentionRepositoryCron=5,10 6,7 2,5 6,2 2,4)" testrepositorysyncpolicy "crontab" $LINENO
	
	
	adminwrap $LINENO policies/repositorysync modify \
		--dn \"cn=testrepositorysyncpolicy,$ldap_base\" \
		--remove month=June \
		--append month=March \
		--remove weekday=Tuesday \
		--append weekday=Friday \
		--remove day=2 \
		--append day=6 \
		--remove hour=6 \
		--append hour=8 \
		--remove minute=5 \
		--append minute=15 

	ckthere "cn=testrepositorysyncpolicy" "base" "(univentionRepositoryCron=10,15 7,8 5,6 2,3 4,5)" testrepositorysyncpolicy "crontab" $LINENO
	
		
	adminwrap $LINENO policies/repositorysync remove \
		--dn \"cn=testrepositorysyncpolicy,$ldap_base\"

	cknthere "cn=testrepositorysyncpolicy" "base" "(objectClass=*)" testrepositorysyncpolicy "existence" $LINENO

	policy_append_remove_test $LINENO repositorysync
	############################################################################
	############################################################################
	# policies/share_userquota
	############################################################################
	############################################################################
	adminwrap $LINENO policies/share_userquota create \
	--set name=testshareuserquotapolicy \
	--set softLimitSpace=100 \
	--set hardLimitSpace=200 \
	--set softLimitInodes=30 \
	--set hardLimitInodes=40 

	ckthere "cn=testshareuserquotapolicy" "base" "(univentionQuotaHardLimitSpace=200)" testshareuserquotapolicy univentionQuotaHardLimitSpace $LINENO
	ckthere "cn=testshareuserquotapolicy" "base" "(univentionQuotaSoftLimitInodes=30)" testshareuserquotapolicy univentionQuotaSoftLimitInodes $LINENO
	ckthere "cn=testshareuserquotapolicy" "base" "(univentionQuotaHardLimitInodes=40)" testshareuserquotapolicy univentionQuotaHardLimitInodes $LINENO
	ckthere "cn=testshareuserquotapolicy" "base" "(univentionQuotaSoftLimitSpace=100)" testshareuserquotapolicy univentionQuotaSoftLimitSpace $LINENO


	adminwrap $LINENO policies/share_userquota modify \
	--dn \"cn=testshareuserquotapolicy,$ldap_base\" \
	--set softLimitSpace=200 \
	--set hardLimitSpace=300 \
	--set softLimitInodes=40 \
	--set hardLimitInodes=50 

	ckthere "cn=testshareuserquotapolicy" "base" "(univentionQuotaHardLimitSpace=300)" testshareuserquotapolicy univentionQuotaHardLimitSpace $LINENO
	ckthere "cn=testshareuserquotapolicy" "base" "(univentionQuotaSoftLimitInodes=40)" testshareuserquotapolicy univentionQuotaSoftLimitInodes $LINENO
	ckthere "cn=testshareuserquotapolicy" "base" "(univentionQuotaHardLimitInodes=50)" testshareuserquotapolicy univentionQuotaHardLimitInodes $LINENO
	ckthere "cn=testshareuserquotapolicy" "base" "(univentionQuotaSoftLimitSpace=200)" testshareuserquotapolicy univentionQuotaSoftLimitSpace $LINENO
	
	adminwrap $LINENO policies/share_userquota remove \
	--dn \"cn=testshareuserquotapolicy,$ldap_base\" 
	cknthere "cn=testshareuserquotapolicy" "base" "(objectClass=*)" testshareuserquotapolicy existence $LINENO




	############################################################################
	############################################################################
	# policies/sound
	############################################################################
	############################################################################

	############################################################################
	# create policies/sound
	############################################################################
	prequiredclasses="univentionHost"
	pprohibitedclasses="posixAcount"
	pfixedattributes="univentionSoundEnabled"
	pname="testpolicysound"
	penable="1"
	pmodule="sb"

	adminwrap $LINENO policies/sound create \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--set name=$pname  \
	--set enable=$penable \
	--set soundModule=$pmodule \
	--position \"cn=policies,$ldap_base\" 

	ckthere  "cn=$pname,cn=policies" "base" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicySoundConfiguration))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionSoundEnabled=$penable)" "$pname" "enable" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionSoundModule=$pmodule)" "$pname" "sound module" $LINENO

	############################################################################
	# modify policies/sound
	############################################################################
	prequiredclasses="gaga"
	pprohibitedclasses="blabalete"
	pfixedattributes="univentionSoundModule"
	pname="testpolicysound"
	penable="0"
	pmodule="auto"

	adminwrap $LINENO policies/sound modify \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--set name=$pname  \
	--set enable=$penable \
	--set soundModule=$pmodule \
	--dn \"cn=$pname,cn=policies,$ldap_base\" 

	ckthere  "cn=$pname,cn=policies" "base" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicySoundConfiguration))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionSoundEnabled=$penable)" "$pname" "enable" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionSoundModule=$pmodule)" "$pname" "sound module" $LINENO

	adminwrap $LINENO policies/sound remove --dn \"cn=$pname,cn=policies,$ldap_base\" 

	cknthere "cn=$pname,cn=policies" "base" "(objectclass=*)" "$pname" "existence" $LINENO

	policy_append_remove_test $LINENO sound

	for i in "1" "2"
	do
		############################################################################
		############################################################################
		# create policies/thinclient
		############################################################################
		############################################################################

		if [ "$i" -eq "1" ]
		then
			############################################################################
			# create policies/thinclient
			############################################################################
			prequiredclasses="univentionHost"
			pprohibitedclasses="posixAcount"
			pfixedattributes='univentionWindowsDomain'
			pemptyattributes='univentionAuthServer'
			pname="testpolicythinclient"
			pwindowsterminalserver="unsinkbar2"
			pwindowsterminalserver2="titanic"
			pwindowsdomain="loo"
			pfileserver="goo"
			pfileserver2="poo"
			pauthserver="some"
			pauthserver2="any"
			plinuxterminalserver="none"
			plinuxterminalserver2="mob"



			adminwrap $LINENO policies/thinclient create \
			--set requiredObjectClasses=$prequiredclasses  \
			--set prohibitedObjectClasses=$pprohibitedclasses  \
			--set name=$pname  \
			--append windowsTerminalServer=$pwindowsterminalserver \
			--append windowsTerminalServer=$pwindowsterminalserver2 \
			--set windowsDomain=$pwindowsdomain \
			--append fileServer=$pfileserver \
			--append fileServer=$pfileserver2 \
			--append authServer=$pauthserver \
			--append authServer=$pauthserver2 \
			--append linuxTerminalServer=$plinuxterminalserver \
			--append linuxTerminalServer=$plinuxterminalserver2 \
			--position \"cn=policies,$ldap_base\"
		fi
		if [ "$i" -eq "2" ]
		then
			############################################################################
			# modify policies/thinclient
			############################################################################
			prequiredclasses="posixAccount"
			pprohibitedclasses="univentionHost"
			pname="testpolicythinclient"
			pwindowsterminalserver3="logotoroi"
			pwindowsdomain="goo"
			pfileserver3="pooly"
			pauthserver3="nogohali"
			plinuxterminalserver3="anyboo"



			adminwrap $LINENO policies/thinclient modify \
			--set requiredObjectClasses=$prequiredclasses  \
			--set prohibitedObjectClasses=$pprohibitedclasses  \
			--set name=$pname  \
			--append windowsTerminalServer=$pwindowsterminalserver3 \
			--remove windowsTerminalServer=$pwindowsterminalserver \
			--set windowsDomain=$pwindowsdomain \
			--append fileServer=$pfileserver3 \
			--remove fileServer=$pfileserver \
			--append authServer=$pauthserver3 \
			--remove authServer=$pauthserver \
			--append linuxTerminalServer=$plinuxterminalserver3 \
			--remove linuxTerminalServer=$plinuxterminalserver \
			--dn \"cn=$pname,cn=policies,$ldap_base\"
		fi

		ckthere "cn=$pname,cn=policies" "BASE" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyThinclient))" "$pname" "object classes" $LINENO

		ckthere "cn=$pname,cn=policies" "BASE" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

		ckthere "cn=$pname,cn=policies" "BASE" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO


		ckthere "cn=$pname,cn=policies" "BASE" "(univentionWindowsTerminalServer=$pwindowsterminalserver2)" "$pname" "windows terminal server" $LINENO

		ckthere "cn=$pname,cn=policies" "BASE" "(univentionWindowsDomain=$pwindowsdomain)" "$pname" "windows domain" $LINENO

		ckthere "cn=$pname,cn=policies" "BASE" "(univentionDesktopServer=$plinuxterminalserver2)" "$pname" "Linux terminal server" $LINENO

		ckthere "cn=$pname,cn=policies" "BASE" "(univentionFileServer=$pfileserver2)" "$pname" "file server" $LINENO

		ckthere "cn=$pname,cn=policies" "BASE" "(univentionAuthServer=$pauthserver2)" "$pname" "auth server" $LINENO


		if [ "$i" -eq "2" ]
		then
			ckthere "cn=$pname,cn=policies" "BASE" "(univentionFileServer=$pfileserver3)" "$pname" "file server" $LINENO
			cknthere "cn=$pname,cn=policies" "BASE" "(univentionFileServer=$pfileserver)" "$pname" "file server" $LINENO
			ckthere "cn=$pname,cn=policies" "BASE" "(univentionDesktopServer=$plinuxterminalserver3)" "$pname" "Linux terminal server" $LINENO
			cknthere "cn=$pname,cn=policies" "BASE" "(univentionDesktopServer=$plinuxterminalserver)" "$pname" "Linux terminal server" $LINENO
			ckthere "cn=$pname,cn=policies" "BASE" "(univentionWindowsTerminalServer=$pwindowsterminalserver3)" "$pname" "windows terminal server" $LINENO
			cknthere "cn=$pname,cn=policies" "BASE" "(univentionWindowsTerminalServer=$pwindowsterminalserver)" "$pname" "windows terminal server" $LINENO
			ckthere "cn=$pname,cn=policies" "BASE" "(univentionAuthServer=$pauthserver3)" "$pname" "auth server" $LINENO
			cknthere "cn=$pname,cn=policies" "BASE" "(univentionAuthServer=$pauthserver)" "$pname" "auth server" $LINENO

			adminwrap $LINENO  policies/thinclient remove --dn "cn=$pname,cn=policies,$ldap_base"
			cknthere "cn=$pname,cn=policies" "BASE" "(objectClass=*)" "testpolicythinclient" "existence" $LINENO
		else
			ckthere "cn=$pname,cn=policies" "BASE" "(univentionAuthServer=$pauthserver)" "$pname" "auth server" $LINENO
			ckthere "cn=$pname,cn=policies" "BASE" "(univentionWindowsTerminalServer=$pwindowsterminalserver)" "$pname" "windows terminal server" $LINENO
			ckthere "cn=$pname,cn=policies" "BASE" "(univentionDesktopServer=$plinuxterminalserver)" "$pname" "Linux terminal server" $LINENO
			ckthere "cn=$pname,cn=policies" "BASE" "(univentionFileServer=$pfileserver)" "$pname" "file server" $LINENO
		fi
	done
	policy_append_remove_test $LINENO thinclient

	############################################################################
	############################################################################
	# policies/xfree
	############################################################################
	############################################################################

	############################################################################
	# create policies/xfree
	############################################################################
	prequiredclasses="univentionHost"
	pprohibitedclasses="posixAcount"
	pfixedattributes="univentionXResolution"
	pname="testpolicyxfree"
	presolution="640x480"
	pcolordepth="16"
	pmouseprotocol="PS/2"
	pxmodule="trident"
	pkeyboardvariant="nodeadkeys"
	phsync="30-60"
	pmousedevice="/dev/psaux"
	pvrefresh="40-100"
	pkeyboardlayout="de"


	adminwrap $LINENO policies/xfree create \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--set name=$pname  \
	--set resolution=$presolution \
	--set colorDepth=$pcolordepth \
	--set mouseProtocol=$pmouseprotocol \
	--set xModule=$pxmodule \
	--set keyboardVariant=$pkeyboardvariant \
	--set hSync=$phsync \
	--set mouseDevice=$pmousedevice \
	--set vRefresh=$pvrefresh \
	--set keyboardLayout=$pkeyboardlayout \
	--position \"cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "base" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyXConfiguration))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionXColorDepth=$pcolordepth)" "$pname" "color depth" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionXMouseProtocol=$pmouseprotocol)" "$pname" "mouse protocol" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionXKeyboardLayout=$pkeyboardlayout)" "$pname" "keyboard layout" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionXKeyboardVariant=$pkeyboardvariant)" "$pname" "keyboard variant" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionXHSync=$phsync)" "$pname" "h-sync" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionXMouseDevice=$pmousedevice)" "$pname" "mouse device" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionXResolution=$presolution)" "$pname" "resolution" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionXVRefresh=$pvrefresh)" "$pname" "v-refresh" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionXModule=$pxmodule)" "$pname" "xmodule" $LINENO

	############################################################################
	# modify policies/xfree
	############################################################################
	prequiredclasses="saehtusote"
	pprohibitedclasses="uasethsue"
	pfixedattributes="univentionXColorDepth"
	pname="testpolicyxfree"
	presolution="1024x768"
	pcolordepth="24"
	pmouseprotocol="Auto"
	pxmodule="vesa"
	pkeyboardvariant="ctrl:nocaps"
	phsync="30-50"
	pmousedevice="/dev/input/mice"
	pvrefresh="40-50"
	pkeyboardlayout="us"

	adminwrap $LINENO policies/xfree modify \
	--set requiredObjectClasses=$prequiredclasses  \
	--set prohibitedObjectClasses=$pprohibitedclasses  \
	--set fixedAttributes=$pfixedattributes  \
	--set name=$pname  \
	--set resolution=$presolution \
	--set colorDepth=$pcolordepth \
	--set mouseProtocol=$pmouseprotocol \
	--set xModule=$pxmodule \
	--set keyboardVariant=$pkeyboardvariant \
	--set hSync=$phsync \
	--set mouseDevice=$pmousedevice \
	--set vRefresh=$pvrefresh \
	--set keyboardLayout=$pkeyboardlayout \
	--dn \"cn=$pname,cn=policies,$ldap_base\" 

	ckthere "cn=$pname,cn=policies" "base" "(&(objectClass=univentionPolicy)(objectClass=univentionPolicyXConfiguration))" "$pname" "object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(requiredObjectClasses=$prequiredclasses)" "$pname" "required object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(prohibitedObjectClasses=$pprohibitedclasses)" "$pname" "prohibited object classes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(fixedAttributes=$pfixedattributes)" "$pname" "fixed attributes" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionXColorDepth=$pcolordepth)" "$pname" "color depth" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionXMouseProtocol=$pmouseprotocol)" "$pname" "mouse protocol" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionXKeyboardLayout=$pkeyboardlayout)" "$pname" "keyboard layout" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionXKeyboardVariant=$pkeyboardvariant)" "$pname" "keyboard variant" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionXHSync=$phsync)" "$pname" "h-sync" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionXMouseDevice=$pmousedevice)" "$pname" "mouse device" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionXResolution=$presolution)" "$pname" "resolution" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionXVRefresh=$pvrefresh)" "$pname" "v-refresh" $LINENO

	ckthere "cn=$pname,cn=policies" "base" "(univentionXModule=$pxmodule)" "$pname" "xmodule" $LINENO

	adminwrap $LINENO policies/xfree remove --dn \"cn=$pname,cn=policies,$ldap_base\" 

	cknthere "cn=$pname,cn=policies" "base" "(objectClass=*)" "$pname" "existence" $LINENO
	
	policy_append_remove_test $LINENO xfree
fi

if [ -n "$dosettings" ]
then

	############################################################################
	############################################################################
	# settings/default
	############################################################################
	############################################################################

	############################################################################
	# modify settings/default
	############################################################################

	sdefaultkdeprofiles="moobaz"
	sdefaultkdeprofiles2="goobaz"
	sdefaultgroup="cn=Domain Admins,cn=groups,$ldap_base"
	sdefaultcomputergroup="cn=Domain Users,cn=groups,$ldap_base"
	sname="default"
	sdefaultdomaincontrollergroup="cn=Domain Users,cn=groups,$ldap_base"

	adminwrap $LINENO settings/default modify \
	--append defaultKdeProfiles=\"$sdefaultkdeprofiles\" \
	--append defaultKdeProfiles=\"$sdefaultkdeprofiles2\" \
	--set defaultGroup=\"$sdefaultgroup\" \
	--set defaultComputerGroup=\"$sdefaultcomputergroup\" \
	--set defaultDomainControllerGroup=\"$sdefaultdomaincontrollergroup\" \
	--dn \"cn=default,cn=univention,$ldap_base\" 

	ckthere "cn=$sname,cn=univention" "base" "(univentionDefaultKdeProfiles=$sdefaultkdeprofiles)" "$sname" "default kde profiles" $LINENO
	ckthere "cn=$sname,cn=univention" "base" "(univentionDefaultKdeProfiles=$sdefaultkdeprofiles2)" "$sname" "default kde profiles" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionDefaultGroup=$sdefaultgroup)" "$sname" "default group" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionDefaultComputerGroup=$sdefaultcomputergroup)" "$sname" "default computer group" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionDefaultDomainControllerGroup=$sdefaultdomaincontrollergroup)" "$sname" "default domain controller group" $LINENO

	############################################################################
	# modify settings/default
	############################################################################

	adminwrap $LINENO settings/default modify \
	--append defaultKdeProfiles="none" \
	--remove defaultKdeProfiles=\"$sdefaultkdeprofiles\" \
	--append defaultKdeProfiles="/usr/share/univention-kde-profiles/kde.lockeddown" \
	--remove defaultKdeProfiles=\"$sdefaultkdeprofiles2\" \
	--append defaultKdeProfiles="/usr/share/univention-kde-profiles/kde.restricted" \
	--set defaultGroup=\"cn=Domain Users,cn=groups,$ldap_base\" \
	--set defaultComputerGroup=\"cn=Windows Hosts,cn=groups,$ldap_base\" \
	--set defaultDomainControllerGroup=\"cn=DC Slave Hosts,cn=groups,$ldap_base\" \
	--dn \"cn=default,cn=univention,$ldap_base\" 

	ckthere "cn=$sname,cn=univention" "base" "(&(univentionDefaultKdeProfiles=none)(univentionDefaultKdeProfiles=/usr/share/univention-kde-profiles/kde.lockeddown)(univentionDefaultKdeProfiles=/usr/share/univention-kde-profiles/kde.restricted))" "$sname" "default kde profiles" $LINENO

	cknthere "cn=$sname,cn=univention" "base" "(univentionDefaultKdeProfiles=$sdefaultkdeprofiles)" "$sname" "default kde profiles" $LINENO
	cknthere "cn=$sname,cn=univention" "base" "(univentionDefaultKdeProfiles=$sdefaultkdeprofiles2)" "$sname" "default kde profiles" $LINENO
	ckthere "cn=$sname,cn=univention" "base" "(univentionDefaultGroup=cn=Domain Users,cn=groups,$ldap_base)" "$sname" "default group" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionDefaultComputerGroup=cn=Windows Hosts,cn=groups,$ldap_base)" "$sname" "default computer group" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionDefaultDomainControllerGroup=cn=DC Slave Hosts,cn=groups,$ldap_base)" "$sname" "default domain controller group" $LINENO

	############################################################################
	############################################################################
	# settings/directory
	############################################################################
	############################################################################

	############################################################################
	# modify settings/directory
	############################################################################

	sname="default containers"

	scomputers="$ldap_base"
	sgroups="$ldap_base"
	sdhcp="$ldap_base"
	sdns="$ldap_base"
	slicense="$ldap_base"
	susers="$ldap_base"
	sprinters="$ldap_base"
	sshares="$ldap_base"
	scomputers2="cn=users,$ldap_base"
	sgroups2="cn=users,$ldap_base"
	sdhcp2="cn=users,$ldap_base"
	sdns2="cn=users,$ldap_base"
	slicense2="cn=users,$ldap_base"
	susers2="cn=groups,$ldap_base"
	sprinters2="cn=users,$ldap_base"
	sshares2="cn=users,$ldap_base"

	adminwrap $LINENO settings/directory modify \
	--set computers=\"$scomputers\" \
	--set computers=\"$scomputers2\" \
	--set groups=\"$sgroups\" \
	--set groups=\"$sgroups2\" \
	--set dhcp=\"$sdhcp\" \
	--set dhcp=\"$sdhcp2\" \
	--set dns=\"$sdns\" \
	--set dns=\"$sdns2\" \
	--set license=\"$slicense\" \
	--set license=\"$slicense2\" \
	--set users=\"$susers\" \
	--set users=\"$susers2\" \
	--set printers=\"$sprinters\" \
	--set printers=\"$sprinters2\" \
	--set shares=\"$sshares\" \
	--set shares=\"$sshares2\" \
	--dn \"cn=default containers,cn=univention,$ldap_base\" 

	ckthere "cn=$sname,cn=univention" "base" "(univentionComputersObject=$scomputers)" "$sname" "computers" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionGroupsObject=$sgroups)" "$sname" "groups" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionDhcpObject=$sdhcp)" "$sname" "dhcp" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionLicenseObject=$slicense)" "$sname" "license" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionDnsObject=$sdns)" "$sname" "dns" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionUsersObject=$susers)" "$sname" "users" $LINENO
	
	ckthere "cn=$sname,cn=univention" "base" "(univentionSharesObject=$sshares)" "$sname" "users" $LINENO
	
	ckthere "cn=$sname,cn=univention" "base" "(univentionPrintersObject=$sprinters)" "$sname" "users" $LINENO
	
	ckthere "cn=$sname,cn=univention" "base" "(univentionComputersObject=$scomputers2)" "$sname" "computers" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionGroupsObject=$sgroups2)" "$sname" "groups" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionDhcpObject=$sdhcp2)" "$sname" "dhcp" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionLicenseObject=$slicense2)" "$sname" "license" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionDnsObject=$sdns2)" "$sname" "dns" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionUsersObject=$susers2)" "$sname" "users" $LINENO
	
	ckthere "cn=$sname,cn=univention" "base" "(univentionSharesObject=$sshares2)" "$sname" "users" $LINENO
	
	ckthere "cn=$sname,cn=univention" "base" "(univentionPrintersObject=$sprinters2)" "$sname" "users" $LINENO

	############################################################################
	# modify settings/directory
	############################################################################

	sname="default containers"

	scomputers3="cn=computers,$ldap_base"
	sgroups3="cn=groups,$ldap_base"
	sdhcp3="cn=dhcp,$ldap_base"
	sdns3="cn=dns,$ldap_base"
	slicense3="cn=license,cn=univention,$ldap_base"
	susers3="cn=users,$ldap_base"
	sshares3="cn=shares,$ldap_base"
	sprinters3="cn=printers,$ldap_base"

	adminwrap $LINENO settings/directory modify \
	--append computers=\"$scomputers3\" \
	--append groups=\"$sgroups3\" \
	--append dhcp=\"$sdhcp3\" \
	--append dns=\"$sdns3\" \
	--append license=\"$slicense3\" \
	--append users=\"$susers3\" \
	--append shares=\"$sshares3\" \
	--append printers=\"$sprinters3\" \
	--remove computers=\"$scomputers2\" \
	--remove groups=\"$sgroups2\" \
	--remove dhcp=\"$sdhcp2\" \
	--remove dns=\"$sdns2\" \
	--remove license=\"$slicense2\" \
	--remove users=\"$susers2\" \
	--remove shares=\"$sshares2\" \
	--remove printers=\"$sprinters2\" \
	--remove computers=\"$scomputers\" \
	--remove groups=\"$sgroups\" \
	--remove dhcp=\"$sdhcp\" \
	--remove dns=\"$sdns\" \
	--remove license=\"$slicense\" \
	--remove users=\"$susers\" \
	--remove shares=\"$sshares\" \
	--remove printers=\"$sprinters\" \
	--dn \"cn=$sname,cn=univention,$ldap_base\" 

	ckthere "cn=$sname,cn=univention" "base" "(univentionComputersObject=$scomputers3)" "$sname" "computers" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionGroupsObject=$sgroups3)" "$sname" "groups" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionDhcpObject=$sdhcp3)" "$sname" "dhcp" $LINENO


	ckthere "cn=$sname,cn=univention" "base" "(univentionLicenseObject=$slicense3)" "$sname" "license" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionDnsObject=$sdns3)" "$sname" "dns" $LINENO

	ckthere "cn=$sname,cn=univention" "base" "(univentionUsersObject=$susers3)" "$sname" "users" $LINENO
	
	ckthere "cn=$sname,cn=univention" "base" "(univentionSharesObject=$sshares3)" "$sname" "users" $LINENO
	
	ckthere "cn=$sname,cn=univention" "base" "(univentionPrintersObject=$sprinters3)" "$sname" "users" $LINENO
	
	cknthere "cn=$sname,cn=univention" "base" "(univentionComputersObject=$scomputers)" "$sname" "computers" $LINENO

	cknthere "cn=$sname,cn=univention" "base" "(univentionGroupsObject=$sgroups)" "$sname" "groups" $LINENO

	cknthere "cn=$sname,cn=univention" "base" "(univentionDhcpObject=$sdhcp)" "$sname" "dhcp" $LINENO


	cknthere "cn=$sname,cn=univention" "base" "(univentionLicenseObject=$slicense)" "$sname" "license" $LINENO

	cknthere "cn=$sname,cn=univention" "base" "(univentionDnsObject=$sdns)" "$sname" "dns" $LINENO

	cknthere "cn=$sname,cn=univention" "base" "(univentionUsersObject=$susers)" "$sname" "users" $LINENO
	
	cknthere "cn=$sname,cn=univention" "base" "(univentionSharesObject=$sshares)" "$sname" "users" $LINENO
	
	cknthere "cn=$sname,cn=univention" "base" "(univentionPrintersObject=$sprinters)" "$sname" "users" $LINENO
	
	cknthere "cn=$sname,cn=univention" "base" "(univentionComputersObject=$scomputers2)" "$sname" "computers" $LINENO

	cknthere "cn=$sname,cn=univention" "base" "(univentionGroupsObject=$sgroups2)" "$sname" "groups" $LINENO

	cknthere "cn=$sname,cn=univention" "base" "(univentionDhcpObject=$sdhcp2)" "$sname" "dhcp" $LINENO


	cknthere "cn=$sname,cn=univention" "base" "(univentionLicenseObject=$slicense2)" "$sname" "license" $LINENO

	cknthere "cn=$sname,cn=univention" "base" "(univentionDnsObject=$sdns2)" "$sname" "dns" $LINENO

	cknthere "cn=$sname,cn=univention" "base" "(univentionUsersObject=$susers2)" "$sname" "users" $LINENO
	
	cknthere "cn=$sname,cn=univention" "base" "(univentionSharesObject=$sshares2)" "$sname" "users" $LINENO
	
	cknthere "cn=$sname,cn=univention" "base" "(univentionPrintersObject=$sprinters2)" "$sname" "users" $LINENO


	############################################################################
	# settings/printermodel
	############################################################################

	adminwrap $LINENO settings/printermodel create --superordinate \"cn=univention,$ldap_base\" --set name=testprintermodels\
	--append printmodel=\"\\\"fooprinter.ppd\\\" \\\"fooprinter 1 cups v2\\\"\"  \
	--append printmodel=\"\\\"fooprinter2.ppd\\\" \\\"fooprinter 2 cups v2\\\"\"   

	ckthere "cn=testprintermodels,cn=univention" "base" "(objectClass=univentionPrinterModels)" "testprintermodel" "object classes" $LINENO

	ckthere "cn=testprintermodels,cn=univention" "base" '(printerModel="fooprinter.ppd" "fooprinter 1 cups v2")' "testprintermodels" "printer model" $LINENO

	ckthere "cn=testprintermodels,cn=univention" "base" '(printerModel="fooprinter2.ppd" "fooprinter 2 cups v2")' "testprintermodels" "printer model" $LINENO

	adminwrap $LINENO settings/printermodel modify --dn \"cn=testprintermodels,cn=univention,$ldap_base\" \
	--remove printmodel=\"\\\"fooprinter.ppd\\\" \\\"fooprinter 1 cups v2\\\"\"  \
	--append printmodel=\"\\\"fooprinter3.ppd\\\" \\\"fooprinter 3 cups v2\\\"\"

	cknthere "cn=testprintermodels,cn=univention" "base" '(printerModel="fooprinter.ppd" "fooprinter 1 cups v2")' "testprintermodels" "printer model" $LINENO

	ckthere "cn=testprintermodels,cn=univention" "base" '(printerModel="fooprinter2.ppd" "fooprinter 2 cups v2")' "testprintermodels" "printer model" $LINENO

	ckthere "cn=testprintermodels,cn=univention" "base" '(printerModel="fooprinter3.ppd" "fooprinter 3 cups v2")' "testprintermodels" "printer model" $LINENO

	adminwrap $LINENO settings/printermodel remove --superordinate \"cn=univention,$ldap_base\" --dn \"cn=testprintermodels,cn=univention,$ldap_base\"

	cknthere "cn=testprintermodels,cn=univention" "base" "(objectClass=*)" "testprintermodel" "object classes" $LINENO


	##################################################################################################################
	##################################################################################################################
	# settings/packages
	##################################################################################################################
	##################################################################################################################

	adminwrap $LINENO settings/packages create \
		--set name=testpackagessetting \
		--append packageList=vi \
		--append packageList=emacs
	
	ckthere "cn=testpackagessetting" "base" '(univentionPackageDefinition=vi)' settings/packages packageList	$LINENO
	ckthere "cn=testpackagessetting" "base" '(univentionPackageDefinition=emacs)' settings/packages packageList	$LINENO
	
	adminwrap $LINENO settings/packages modify \
		--dn \"cn=testpackagessetting,$ldap_base\" \
		--append packageList=vim \
		--remove packageList=emacs
	
	ckthere "cn=testpackagessetting" "base" '(univentionPackageDefinition=vi)' settings/packages packageList	$LINENO
	ckthere "cn=testpackagessetting" "base" '(univentionPackageDefinition=vim)' settings/packages packageList	$LINENO
	cknthere "cn=testpackagessetting" "base" '(univentionPackageDefinition=emacs)' settings/packages packageList	$LINENO

	adminwrap $LINENO settings/packages remove \
		--dn \"cn=testpackagessetting,$ldap_base\"

	cknthere "cn=testpackagessetting" "base" '(objectClass=*)' settings/packages existence	$LINENO
	
	##################################################################################################################
	##################################################################################################################
	# settings/printeruri
	##################################################################################################################
	##################################################################################################################
	adminwrap $LINENO settings/printeruri create \
		--set name=testprinterurisetting \
		--append printeruri=/dev/null \
		--append printeruri=/dev/zero
	
	ckthere "cn=testprinterurisetting" "base" '(printerURI=/dev/null)' settings/printeruri printeruri	$LINENO
	ckthere "cn=testprinterurisetting" "base" '(printerURI=/dev/zero)' settings/printeruri printeruri	$LINENO
	
	adminwrap $LINENO settings/printeruri modify \
		--dn \"cn=testprinterurisetting,$ldap_base\" \
		--append printeruri=/dev/bogus \
		--remove printeruri=/dev/zero
	
	ckthere "cn=testprinterurisetting" "base" '(printerURI=/dev/null)' settings/printeruri printeruri	$LINENO
	ckthere "cn=testprinterurisetting" "base" '(printerURI=/dev/bogus)' settings/printeruri printeruri	$LINENO
	cknthere "cn=testprinterurisetting" "base" '(printerURI=/dev/zero)' settings/printeruri printeruri	$LINENO

	adminwrap $LINENO settings/printeruri remove \
		--dn \"cn=testprinterurisetting,$ldap_base\"

	cknthere "cn=testprinterurisetting" "base" '(objectClass=*)' settings/printeruri existence	$LINENO
	
	##################################################################################################################
	##################################################################################################################
	# settings/sambaconfig
	##################################################################################################################
	##################################################################################################################

	adminwrap $LINENO settings/sambaconfig create \
	--set name=testsambaconfigsetting \
	--set passwordLength=9 \
	--set passwordHistory=3 \
	--set minPasswordAge=50 \
	--set maxPasswordAge=60 \
	--set badLockoutAttempts=5 \
	--set lockoutDuration=33 \
	--set resetCountMinutes=22 \
	--set logonToChangePW=1 \
	--set disconnectTime=24 \
	--set refuseMachinePWChange=0
	
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaBadLockoutAttempts=5)' testsambaconfigsetting univentionSambaBadLockoutAttempts $LINENO
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaPasswordHistory=3)' testsambaconfigsetting univentionSambaPasswordHistory $LINENO
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaRefuseMachinePWChange=0)' testsambaconfigsetting univentionSambaMachinePWChange $LINENO
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaLockoutDuration=33)' testsambaconfigsetting univentionSambaLockoutDuration $LINENO
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaResetCountMinutes=22)' testsambaconfigsetting univentionSambaResetCountMinutes $LINENO
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaMinPasswordAge=50)' testsambaconfigsetting univentionSambaMinPasswordAge $LINENO
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaMinPasswordLength=9)' testsambaconfigsetting univentionSambaMinPasswordLength $LINENO
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaMaxPasswordAge=60)' testsambaconfigsetting univentionSambaMaxPasswordAge $LINENO
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaLogonToChangePW=2)' testsambaconfigsetting univentionSambaLogonToChangePW $LINENO
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaDisconnectTime=24)' testsambaconfigsetting univentionDisconnectTime $LINENO
	
	adminwrap $LINENO settings/sambaconfig modify \
	--dn \"cn=testsambaconfigsetting,$ldap_base\" \
	--set passwordLength=10 \
	--set passwordHistory=4 \
	--set minPasswordAge=51 \
	--set maxPasswordAge=61 \
	--set badLockoutAttempts=6 \
	--set lockoutDuration=34 \
	--set resetCountMinutes=23 \
	--set logonToChangePW=0 \
	--set disconnectTime=25 \
	--set refuseMachinePWChange=1
	
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaBadLockoutAttempts=6)' testsambaconfigsetting univentionSambaBadLockoutAttempts $LINENO
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaPasswordHistory=4)' testsambaconfigsetting univentionSambaPasswordHistory $LINENO
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaRefuseMachinePWChange=1)' testsambaconfigsetting univentionSambaMachinePWChange $LINENO
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaLockoutDuration=34)' testsambaconfigsetting univentionSambaLockoutDuration $LINENO
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaResetCountMinutes=23)' testsambaconfigsetting univentionSambaResetCountMinutes $LINENO
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaMinPasswordAge=51)' testsambaconfigsetting univentionSambaMinPasswordAge $LINENO
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaMinPasswordLength=10)' testsambaconfigsetting univentionSambaMinPasswordLength $LINENO
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaMaxPasswordAge=61)' testsambaconfigsetting univentionSambaMaxPasswordAge $LINENO
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaLogonToChangePW=0)' testsambaconfigsetting univentionSambaLogonToChangePW $LINENO
	ckthere "cn=testsambaconfigsetting" "base" '(univentionSambaDisconnectTime=25)' testsambaconfigsetting univentionDisconnectTime $LINENO

	adminwrap $LINENO settings/sambaconfig remove \
	--dn \"cn=testsambaconfigsetting,$ldap_base\" 

	cknthere "cn=testsambaconfigsetting" "base" '(objectClass=*)' testsambaconfigsetting existence $LINENO

	##################################################################################################################
	##################################################################################################################
	# settings/sambadomain
	##################################################################################################################
	##################################################################################################################

	adminwrap $LINENO settings/sambadomain create \
	--set name=testsambadomainsetting \
	--set SID=2.3.4.5 \
	--set NextUserRid=114 \
	--set NextGroupRid=215 \
	--set NextRid=316

	ckthere "sambaDomainName=testsambadomainsetting" "base" '(sambaNextRid=316)' testsambadomainsetting sambaNextRid $LINENO
	ckthere "sambaDomainName=testsambadomainsetting" "base" '(objectClass=sambaDomain)' testsambadomainsetting objectClass $LINENO
	ckthere "sambaDomainName=testsambadomainsetting" "base" '(sambaSID=2.3.4.5)' testsambadomainsetting sambaSID $LINENO
	ckthere "sambaDomainName=testsambadomainsetting" "base" '(sambaNextGroupRid=215)' testsambadomainsetting sambaNextGroupRid $LINENO
	ckthere "sambaDomainName=testsambadomainsetting" "base" '(sambaNextUserRid=114)' testsambadomainsetting sambaNextUserRid $LINENO

	adminwrap $LINENO settings/sambadomain modify \
	--dn \"sambaDomainName=testsambadomainsetting,$ldap_base\" \
	--set NextUserRid=115 \
	--set NextGroupRid=216 \
	--set NextRid=317

	ckthere "sambaDomainName=testsambadomainsetting" "base" '(sambaNextRid=317)' testsambadomainsetting sambaNextRid $LINENO
	ckthere "sambaDomainName=testsambadomainsetting" "base" '(objectClass=sambaDomain)' testsambadomainsetting objectClass $LINENO
	ckthere "sambaDomainName=testsambadomainsetting" "base" '(sambaNextGroupRid=216)' testsambadomainsetting sambaNextGroupRid $LINENO
	ckthere "sambaDomainName=testsambadomainsetting" "base" '(sambaNextUserRid=115)' testsambadomainsetting sambaNextUserRid $LINENO

	adminwrap $LINENO settings/sambadomain remove \
	--dn \"sambaDomainName=testsambadomainsetting,$ldap_base\"

	cknthere "sambaDomainName=testsambadomainsetting" "base" '(objectClass=*)' testsambadomainsetting existence $LINENO



	##################################################################################################################
	##################################################################################################################
	# settings/prohibited_username
	##################################################################################################################
	##################################################################################################################
	
	adminwrap $LINENO  settings/prohibited_username create --append usernames="boot" --append usernames="nobody" --set name=testsettingprohibitedusername

	ckthere "cn=testsettingprohibitedusername" "base" "(prohibitedUsername=nobody)" testsettingprohibitedusername "prohibited username" $LINENO
	ckthere "cn=testsettingprohibitedusername" "base" "(prohibitedUsername=boot)" testsettingprohibitedusername "prohibited username" $LINENO
	
	adminwrap $LINENO  settings/prohibited_username modify --append usernames="root" --remove usernames="boot" --dn \"cn=testsettingprohibitedusername,$ldap_base\"

	ckthere "cn=testsettingprohibitedusername" "base" "(prohibitedUsername=nobody)" testsettingprohibitedusername "prohibited username" $LINENO
	cknthere "cn=testsettingprohibitedusername" "base" "(prohibitedUsername=boot)" testsettingprohibitedusername "prohibited username" $LINENO
	
	ckthere "cn=testsettingprohibitedusername" "base" "(prohibitedUsername=root)" testsettingprohibitedusername "prohibited username" $LINENO
	
	adminwrap $LINENO  settings/prohibited_username remove --dn \"cn=testsettingprohibitedusername,$ldap_base\"
	
	cknthere "cn=testsettingprohibitedusername" "base" "(objectClass=*)" testsettingprohibitedusername "existence" $LINENO

	##################################################################################################################
	##################################################################################################################
	# settings/service
	##################################################################################################################
	##################################################################################################################
	adminwrap $LINENO settings/service create \
		--set name=testservicesetting

	ckthere "cn=testservicesetting" "base" "(objectClass=*)" testservicesetting "existence" $LINENO
	adminwrap $LINENO settings/service remove \
		--dn \"cn=testservicesetting,$ldap_base\"
	cknthere "cn=testservicesetting" "base" "(objectClass=*)" testservicesetting "existence" $LINENO

	##################################################################################################################
	##################################################################################################################
	# settings/user
	##################################################################################################################
	##################################################################################################################

	#Not allowed to create this
	#adminwrap $LINENO settings/user create\
	#	--set name=testusersettings \
	#	--set baseDN=\"$ldap_base\" \
	#	--set listWizards=shares/print \
	#	--set listWebModules=modself \
	#	--set selfAttributes=homeShare 
	#ckthere "cn=testusersettings" "base" "(univentionAdminBaseDN=$ldap_base)" "settings/user" "baseDN" $LINENO
	#ckthere "cn=testusersettings" "base" "(univentionAdminListWizards=shares/print)" "settings/user" "listWizards" $LINENO
	#ckthere "cn=testusersettings" "base" "(univentionAdminListWebModules=modself)" "settings/user" "listWebModules" $LINENO
	#ckthere "cn=testusersettings" "base" "(univentionAdminSelfAttributes=homeShare)" "settings/user" "selfAttributes" $LINENO

	#adminwrap $LINENO settings/user modify\
	#	--dn \"cn=testusersettings,$ldap_base\" \
	#	--set baseDN=\"cn=users,$ldap_base\" \
	#	--set listWizards=users/user \
	#	--set listWebModules=modbrowse \
	#	--set selfAttributes=description 
	#ckthere "cn=testusersettings" "base" "(univentionAdminBaseDN=cn=users,$ldap_base)" "settings/user" "baseDN" $LINENO
	#ckthere "cn=testusersettings" "base" "(univentionAdminListWizards=users/user)" "settings/user" "listWizards" $LINENO
	#ckthere "cn=testusersettings" "base" "(univentionAdminListWebModules=modbrowse)" "settings/user" "listWebModules" $LINENO
	#ckthere "cn=testusersettings" "base" "(univentionAdminSelfAttributes=description)" "settings/user" "selfAttributes" $LINENO
	#
	#adminwrap $LINENO settings/user remove --dn \"cn=testusersettings,$ldap_base\"
	#cknthere "cn=testusersettings" "base" "(objectClass=*)" "settings/user" "existence" $LINENO

	##################################################################################################################
	##################################################################################################################
	# settings/usertemplate
	##################################################################################################################
	##################################################################################################################
	

	sshell="/bin/bash"                            
	sdescription="this is some user"                      
	ssambahome="/smb/home/<username>"                        
	stitle="none"                            
	sorganisation="univention"                     
	spasswordexpiry="" # FIXME                    
	semail="<username>@univention.de"                      
	semail2="<username>@plopp.com"                      
	suserexpiry="" # FIXME                      
	sscriptpath="/smb/scripts/<username>"                      
	sunixhome="/home/<username>"                       
	sprofilepath="/home/<username>/profile"                   
	shomedrive="I"                    
	sname="testsettingsusertemplate"                         

	adminwrap $LINENO settings/usertemplate create --set name=$sname --set shell=$sshell --set description=\"$sdescription\" \
				--set sambahome=\"$ssambahome\" --set title=$stitle --set organisation=$sorganisation --append e-mail=\"$semail\" \
				--append e-mail=\"$semail2\" --set scriptpath=\"$sscriptpath\" --set unixhome=\"$sunixhome\" \
				--set profilepath=\"$sprofilepath\" --set homedrive=$shomedrive
	
	ckthere	"cn=testsettingsusertemplate" "base" "(loginShell=$sshell)" testsettingsusertemplate shell $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(description=$sdescription)" testsettingsusertemplate description $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(sambaHomePath=$ssambahome)" testsettingsusertemplate sambahome $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(title=$stitle)" testsettingsusertemplate title $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(o=$sorganisation)" testsettingsusertemplate organisation $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(mail=$semail)" testsettingsusertemplate email $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(mail=$semail2)" testsettingsusertemplate email $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(sambaLogonScript=$sscriptpath)" testsettingsusertemplate scriptpath $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(homeDirectory=$sunixhome)" testsettingsusertemplate unixhome $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(sambaProfilepath=$sprofilepath)" testsettingsusertemplate profilepath $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(sambaHomeDrive=$shomedrive)" testsettingsusertemplate profilepath $LINENO
							  
	sshell="/bin/ksh"                            
	sdescription="this is some awesome user"                      
	ssambahome="/home/<username>"                        
	stitle="Master"                            
	sorganisation="gummikraut"                     
	spasswordexpiry="" # FIXME                    
	semail3="master@<username>.plopp.com"                      
	suserexpiry="" # FIXME                      
	sscriptpath="/home/smbscripts/<username>"                      
	sunixhome="/homedrive/home/<username>"                       
	sprofilepath="/homedrive/home/<username>/profile"                   
	shomedrive="J"                    
	sname="testsettingsusertemplate"                         
	
	adminwrap $LINENO settings/usertemplate modify --dn \"cn=$sname,$ldap_base\" --set shell=$sshell --set description=\"$sdescription\" \
				--set sambahome=\"$ssambahome\" --set title=$stitle --set organisation=$sorganisation --remove e-mail=\"$semail\" \
				--append e-mail=\"$semail3\" --set scriptpath=\"$sscriptpath\" --set unixhome=\"$sunixhome\" \
				--set profilepath=\"$sprofilepath\" --set homedrive=$shomedrive
	
	ckthere	"cn=testsettingsusertemplate" "base" "(loginShell=$sshell)" testsettingsusertemplate shell $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(description=$sdescription)" testsettingsusertemplate description $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(sambaHomePath=$ssambahome)" testsettingsusertemplate sambahome $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(title=$stitle)" testsettingsusertemplate title $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(o=$sorganisation)" testsettingsusertemplate organisation $LINENO
	cknthere	"cn=testsettingsusertemplate" "base" "(mail=$semail)" testsettingsusertemplate email $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(mail=$semail2)" testsettingsusertemplate email $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(mail=$semail3)" testsettingsusertemplate email $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(sambaLogonScript=$sscriptpath)" testsettingsusertemplate scriptpath $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(homeDirectory=$sunixhome)" testsettingsusertemplate unixhome $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(sambaProfilepath=$sprofilepath)" testsettingsusertemplate profilepath $LINENO
	ckthere	"cn=testsettingsusertemplate" "base" "(sambaHomeDrive=$shomedrive)" testsettingsusertemplate profilepath $LINENO

	adminwrap $LINENO settings/usertemplate remove --dn \"cn=$sname,$ldap_base\"
	cknthere "cn=testsettingsusertemplate" "base" "(objectClass=*)" testsettingsusertemplate existence $LINENO

	##################################################################################################################
	##################################################################################################################
	# settings/xconfig_choices
	##################################################################################################################
	##################################################################################################################
	# the rest of tis test seems to be missing maybe it was accidentally deleted
	# FIXME
	#adminwrap $LINENO settings/xconfig_choices create \
	
    

fi

if [ -n "$dohosts" ]
then
	adminwrap $LINENO networks/network modify \
	--dn "cn=testnetwork,$ldap_base" \
	--set dnsEntryZoneForward=\"zoneName=$zonename2,cn=dns,$ldap_base\" \
	--set dhcpEntryZone=\"cn=testdhcpservice2,cn=dhcp,$ldap_base\" \
	--set dnsEntryZoneReverse=\"zoneName=$revzonename2,cn=dns,$ldap_base\" \
	--remove ipRange=\"19.168.1.32 19.168.1.254\" \
	--append ipRange=\"19.168.1.28 19.168.1.29\" \
	--set network="19.168.1.0" 

	ckthere "cn=testnetwork" "BASE" "(objectClass=univentionNetworkClass)" "testnetwork" "object class" $LINENO
	ckthere "cn=testnetwork" "BASE" "(univentionNetwork=19.168.1.0)" "testnetwork" "network" $LINENO
	ckthere "cn=testnetwork" "BASE" "(univentionNetmask=24)" "testnetwork" "netmask" $LINENO
	cknthere "cn=testnetwork" "BASE" "(univentionIpRange=19.168.1.32 19.168.1.254)" "testnetwork" "ip range" $LINENO
	ckthere "cn=testnetwork" "BASE" "(univentionIpRange=19.168.1.30 19.168.1.31)" "testnetwork" "ip range" $LINENO
	ckthere "cn=testnetwork" "BASE" "(univentionIpRange=19.168.1.28 19.168.1.29)" "testnetwork" "ip range" $LINENO
	ckthere "cn=testnetwork" "BASE" "(univentionDnsForwardZone=zoneName=dnstestzone2,cn=dns,$ldap_base)" "testnetwork" "dns forward zone" $LINENO
	ckthere "cn=testnetwork" "BASE" "(univentionDnsReverseZone=zoneName=$revzonename2,cn=dns,$ldap_base)" "testnetwork" "dns reverse zone" $LINENO
	ckthere "cn=testnetwork" "BASE" "(univentionDhcpEntry=cn=testdhcpservice2,cn=dhcp,$ldap_base)" "testnetwork" "dhcp entry" $LINENO
	############################################################################
	# remove networks/network
	############################################################################

	adminwrap $LINENO networks/network remove --dn \"cn=testnetwork,$ldap_base\" 
	univention-admin  networks/network remove --dn \"cn=testnetwork2,$ldap_base\" >/dev/null 2>/dev/null

	cknthere "cn=testnetwork" "base" "(objectClass=*)" "testnetwork" "existence" $LINENO

	############################################################################
	# remove dhcp/server
	############################################################################

	adminwrap $LINENO dhcp/server remove  --superordinate \"cn=testdhcpservice,cn=dhcp,$ldap_base\"	--dn \"cn=testdhcpserver,cn=testdhcpservice,cn=dhcp,$ldap_base\" 

	cknthere "cn=testdhcpserver,cn=testdhcpservice,cn=dhcp" "base" "(objectclass=*)" "testdhcpserver" "existence" $LINENO

	univention-admin dhcp/host list --superordinate "cn=testdhcpservice,cn=dhcp,$ldap_base" | grep '^DN: '| sed 's/^DN: //' |\
	{
		while read x
		do
			if ldapdelete -x -r -D "cn=admin,$ldap_base" -w "`cat /etc/ldap.secret`" "${x}" 2>/dev/null >/dev/null 
			then
				echo "removing ${olist[${i}]}" >> "${errorlog}"
			fi
		done
	}


	############################################################################
	# remove dhcp/service
	############################################################################

	adminwrap $LINENO dhcp/service remove 	--dn \"cn=testdhcpservice,cn=dhcp,$ldap_base\" 

	cknthere "cn=testdhcpservice,cn=dhcp" "base" "(objectClass=*)" "testdhcpservice" "existence" $LINENO


	univention-admin dns/host_record list --superordinate "zoneName=dnstestzone,cn=dns,$ldap_base" | grep '^DN: ' | sed 's/^DN: //' |\
	{
		while read x
		do
			if ldapdelete -x -r -D "cn=admin,$ldap_base" -w "`cat /etc/ldap.secret`" "${x}" 2>/dev/null >/dev/null 
			then
				echo "removing ${olist[${i}]}" >> "${errorlog}"
			fi
		done
	}


	adminwrap $LINENO dns/forward_zone remove --dn \"zoneName=$zonename,cn=dns,$ldap_base\" 

	cknthere "zoneName=$zonename,cn=dns" "base" "(objectclass=*)" "testdnsforwardzone" "existence" $LINENO

	univention-admin dns/ptr_record list --superordinate "zoneName=$revzonename,cn=dns,$ldap_base" | grep '^DN: '| sed 's/^DN: //' |\
	{
		while read x
		do
			if ldapdelete -x -r -D "cn=admin,$ldap_base" -w "`cat /etc/ldap.secret`" "${x}" 2>/dev/null >/dev/null 
			then
				echo "removing ${olist[${i}]}" >> "${errorlog}"
			fi
		done
	}

	adminwrap $LINENO dns/reverse_zone remove --dn \"zoneName=$revzonename,cn=dns,$ldap_base\" 

	cknthere "zoneName=$revzonename,cn=dns" "base" "(objectclass=*)" "testdnsreversezone" "existence" $LINENO
fi
if [ -n "$doextended" ]
then
	adminwrap $LINENO settings/customattribute remove --dn \"cn=testOLBACCESS,cn=custom attributes,cn=univention,$ldap_base\"
	adminwrap $LINENO settings/customattribute remove --dn \"cn=testou,cn=custom attributes,cn=univention,$ldap_base\"
	adminwrap $LINENO settings/customattribute remove --dn \"cn=testinternetAccount,cn=custom attributes,cn=univention,$ldap_base\"
	adminwrap $LINENO settings/customattribute remove --dn \"cn=testfiliale,cn=custom attributes,cn=univention,$ldap_base\"
	adminwrap $LINENO settings/customattribute remove --dn \"cn=testpctyp,cn=custom attributes,cn=univention,$ldap_base\"
	mv /etc/ldap/slapd.conf.testbackup /etc/ldap/slapd.conf
	/etc/init.d/slapd restart
fi

createcomputers_managedclient()
{
	pos=$1
	adminwrap $LINENO computers/managedclient create --set name=testclientcomputer --position=\"$pos,$ldap_base\"
}

checkcomputers_managedclient()
{
	pos=$1
	ckthere "cn=testclientcomputer,$pos" "base" "(objectClass=*)" testclientcomputer existence $LINENO

}
createcomputers_domaincontroller_backup()
{
	pos=$1
	adminwrap $LINENO computers/domaincontroller_backup create --set name=testdomaincontroller_backupcomputer --position=\"$pos,$ldap_base\"
}

checkcomputers_domaincontroller_backup()
{
	pos=$1
	ckthere "cn=testdomaincontroller_backupcomputer,$pos" "base" "(objectClass=*)" testdomaincontrollerbackupcomputer existence $LINENO

}
createcomputers_domaincontroller_master()
{
	pos=$1
	adminwrap $LINENO computers/domaincontroller_master create --set name=testdomaincontroller_mastercomputer --position=\"$pos,$ldap_base\"
}

checkcomputers_domaincontroller_master()
{
	pos=$1
	ckthere "cn=testdomaincontroller_mastercomputer,$pos" "base" "(objectClass=*)" testdomaincontroller_mastercomputer existence $LINENO

}
createcomputers_domaincontroller_slave()
{
	pos=$1
	adminwrap $LINENO computers/domaincontroller_slave create --set name=testdomaincontroller_slavecomputer --position=\"$pos,$ldap_base\"
}

checkcomputers_domaincontroller_slave()
{
	pos=$1
	ckthere "cn=testdomaincontroller_slavecomputer,$pos" "base" "(objectClass=*)" testdomaincontroller_slavecomputer existence $LINENO

}
createcomputers_ipmanagedclient()
{
	pos=$1
	adminwrap $LINENO computers/ipmanagedclient create --set name=testipmanagedclientcomputer --position=\"$pos,$ldap_base\"
}

checkcomputers_ipmanagedclient()
{
	pos=$1
	ckthere "cn=testipmanagedclientcomputer,$pos" "base" "(objectClass=*)" testipmanagedclientcomputer existence $LINENO

}
createcomputers_macos()
{
	pos=$1
	adminwrap $LINENO computers/macos create --set name=testmacoscomputer --position=\"$pos,$ldap_base\"
}

checkcomputers_macos()
{
	pos=$1
	ckthere "cn=testmacoscomputer,$pos" "base" "(objectClass=*)" testmacoscomputer existence $LINENO

}
createcomputers_memberserver()
{
	pos=$1
	adminwrap $LINENO computers/memberserver create --set name=testmemberservercomputer --position=\"$pos,$ldap_base\"
}

checkcomputers_memberserver()
{
	pos=$1
	ckthere "cn=testmemberservercomputer,$pos" "base" "(objectClass=*)" testmemberservercomputer existence $LINENO

}
createcomputers_mobileclient()
{
	pos=$1
	adminwrap $LINENO computers/mobileclient create --set name=testmobileclientcomputer --position=\"$pos,$ldap_base\"
}

checkcomputers_mobileclient()
{
	pos=$1
	ckthere "cn=testmobileclientcomputer,$pos" "base" "(objectClass=*)" testmobileclientcomputer existence $LINENO

}
createcomputers_thinclient()
{
	pos=$1
	adminwrap $LINENO computers/thinclient create --set name=testthinclientcomputer --set ip=3.5.5.7 --set mac=2:4:2:1:2:3 --position=\"$pos,$ldap_base\"
}

checkcomputers_thinclient()
{
	pos=$1
	ckthere "cn=testthinclientcomputer,$pos" "base" "(objectClass=*)" testthinclientcomputer existence $LINENO

}
createcomputers_trustaccount()
{
	pos=$1
	adminwrap $LINENO computers/trustaccount create --set name=testtrustaccountcomputer --set password=mumumumumu --position=\"$pos,$ldap_base\"
}

checkcomputers_trustaccount()
{
	pos=$1
	ckthere "cn=testtrustaccountcomputer,$pos" "base" "(objectClass=*)" testtrustaccountcomputer existence $LINENO

}
createcomputers_windows()
{
	pos=$1
	adminwrap $LINENO computers/windows create --set name=testwindowscomputer --position=\"$pos,$ldap_base\"
}

checkcomputers_windows()
{
	pos=$1
	ckthere "cn=testwindowscomputer,$pos" "base" "(objectClass=*)" testwindowscomputer existence $LINENO

}
createdhcp_service()
{
	pos=$1
	adminwrap $LINENO dhcp/service create 	--position \"$pos,$ldap_base\" --set service="testdhcpservice" 
}

checkdhcp_service()
{
	pos=$1
	ckthere "cn=testdhcpservice,$pos" "base" "(objectClass=*)" testdhcpservice existence $LINENO

}
createdhcp_host()
{
	pos=$1
	createdhcp_service $pos
	adminwrap $LINENO dhcp/host create 	--superordinate \"cn=testdhcpservice,$pos,$ldap_base\" --set host="testdhcphost" --set hwaddress=\"ethernet 55:44:33:22:11:00\" 
}

checkdhcp_host()
{
	pos=$1
	ckthere "cn=testdhcphost,cn=testdhcpservice,$pos" "base" "(objectClass=*)" testdhcphost existence $LINENO

}
createdhcp_subnet()
{
	pos=$1
	createdhcp_service $pos
	adminwrap $LINENO dhcp/subnet create  	--superordinate \"cn=testdhcpservice,$pos,$ldap_base\" --set subnet="19.168.1.0" --set subnetmask="255.255.255.0"
}

checkdhcp_subnet()
{
	pos=$1
	ckthere "cn=19.168.1.0,cn=testdhcphost,cn=testdhcpservice,$pos" "base" "(objectClass=*)" testdhcphost existence $LINENO

}
createdhcp_pool()
{
	pos=$1
	createdhcp_subnet $pos
	adminwrap $LINENO dhcp/pool create --superordinate \"cn=19.168.1.0,cn=testdhcpservice,$pos,$ldap_base\"\
	--set name="dhcptestpool"\
	--set all_clients="allow"\
	--append range=\"19.168.0.110 19.168.0.120\"\
	--append range=\"19.168.0.111 19.168.0.120\"
}

checkdhcp_pool()
{
	pos=$1
	ckthere "cn=dhcptestpool,cn=19.168.1.0,cn=testdhcpservice,$pos" "base" "(objectClass=*)" testdhcppool existence $LINENO

}
createdhcp_server()
{
	pos=$1
	createdhcp_service $pos
	adminwrap $LINENO dhcp/server create  	--superordinate \"cn=testdhcpservice,$pos,$ldap_base\" --set server="testdhcpserver" 
}

checkdhcp_server()
{
	pos=$1
	ckthere "cn=testdhcpserver,cn=testdhcpservice,$pos" "base" "(objectClass=*)" testdhcpserver existence $LINENO

}
createdhcp_shared()
{
	pos=$1
	createdhcp_service $pos
	adminwrap $LINENO dhcp/shared create	--superordinate \"cn=testdhcpservice,$pos,$ldap_base\" --set name=testdhcpshared
}

checkdhcp_shared()
{
	pos=$1
	ckthere "cn=testdhcpshared,cn=testdhcpservice,$pos" "base" "(objectClass=*)" testdhcpshared existence $LINENO

}
createdhcp_subnet()
{
	pos=$1
	createdhcp_service $pos
	adminwrap $LINENO dhcp/subnet create	--superordinate \"cn=testdhcpservice,$pos,$ldap_base\" --set subnet="153.212.111.0" --set subnetmask="255.255.255.0"
}

checkdhcp_subnet()
{
	pos=$1
	ckthere "cn=153.212.111.0,cn=testdhcpservice,$pos" "base" "(objectClass=*)" testdhcpsubnet existence $LINENO 

}
createdhcp_sharedsubnet()
{
	pos=$1
	createdhcp_subnet $pos
	adminwrap $LINENO dhcp/sharedsubnet create	--superordinate \"cn=153.212.111.0,cn=testdhcpservice,$pos,$ldap_base\"  --set subnet="135.212.111.50" --set subnetmask="255.255.255.127"
}

checkdhcp_sharedsubnet()
{
	pos=$1
	ckthere "cn=135.212.111.50,cn=153.212.111.0,cn=testdhcpservice,$pos" "base" "(objectClass=*)" testdhcpsharedsubnet existence $LINENO

}
	
createdns_forward_zone()
{
	pos=$1
	zrefresh="10" 
	zzonettl="10" 
	zretry="10" 
	zttl="20"
	zonename="dnstestzone"
	zcontact="root@testzone.univention.de"
	zexpire="12"
	zserial="4"
	adminwrap $LINENO dns/forward_zone create --position \"$pos,$ldap_base\" \
	--set refresh="$zrefresh" \
	--set zonettl="$zzonettl" \
	--set retry="$zretry" \
	--set nameserver="19.168.1.202" \
	--set ttl="$zttl" \
	--set zone="$zonename" \
	--set contact="$zcontact" \
	--set expire="$zexpire" \
	--set serial="$zserial"
}

checkdns_forward_zone()
{
	pos=$1
	ckthere "zoneName=dnstestzone,$pos" "base" "(objectClass=*)" dns_forward_zone existence $LINENO

}
createdns_alias()
{
	pos=$1
	createdns_forward_zone $pos
	adminwrap $LINENO dns/alias create --superordinate \"zoneName=dnstestzone,$pos,$ldap_base\" \
	--set name="testdnsalias" --set cname=funny
}

checkdns_alias()
{
	pos=$1
	ckthere "relativeDomainName=testdnsalias,zoneName=dnstestzone,$pos" "base" "(objectClass=*)" dns_forward_zone existence $LINENO

}
createdns_host_record()
{
	pos=$1
	createdns_forward_zone $pos
	hzonettl=1234
	hname=testdnshostrecord
	htxt="das ist ein test text"
	htxt2="das ist ein text test"
	hmx="1 nobodo"
	hmx2="1 dibodo"
	ha="192.168.15.15"
	ha2="192.168.15.16"

	adminwrap $LINENO dns/host_record create --superordinate \"zoneName=dnstestzone,$pos,$ldap_base\" \
	--set zonettl="$hzonettl" \
	--set name="$hname" \
	--append txt=\"$htxt\" \
	--append txt=\"$htxt2\" \
	--append mx=\"$hmx\" \
	--append mx=\"$hmx2\" \
	--append a="$ha" \
	--append a="$ha2"  
}

checkdns_host_record()
{
	pos=$1
	ckthere "relativeDomainName=testdnsalias,zoneName=dnstestzone,$pos" "base" "(objectClass=*)" testdhcphost existence $LINENO

}
createdns_ptr_record()
{
	pos=$1
	createdns_reverse_zone $pos
	adminwrap $LINENO dns/ptr_record create --superordinate \"zoneName=1.168.19.in-addr.arpa,$pos,$ldap_base\" \
	--set address=5 \
	--set ptr_record="support.univention.de." 
}

checkdns_ptr_record()
{
	pos=$1
	ckthere "relativeDomainName=5,zoneName=dnstestzone,$pos" "base" "(objectClass=*)" dns_ptr_record existence $LINENO

}
	
createdns_reverse_zone()
{
	pos=$1
	zrefresh="10" 
	zzonettl="10" 
	zretry="10" 
	znameserver="19.168.1.201" 
	zttl="20"
	zsubnet="19.168.1"
	zcontact="root@testzone.univention.de"
	zexpire="12"
	zserial="4"

	adminwrap $LINENO dns/reverse_zone create --position \"$pos,$ldap_base\" \
	--set refresh="$zrefresh" \
	--set zonettl="$zzonettl" \
	--set retry="$zretry" \
	--append nameserver="$znameserver" \
	--set ttl="$zttl" \
	--set subnet="$zsubnet" \
	--set contact="$zcontact" \
	--set expire="$zexpire" \
	--set serial="$zserial" 
}

checkdns_reverse_zone()
{
	pos=$1
	ckthere "zoneName=1.168.19.in-addr.arpa,$pos" "base" "(objectClass=*)" dns_reverse_zone existence $LINENO

}
createdns_srv_record()
{
	pos=$1
	createdns_forward_zone $pos
	sname="testdnssrvrecord tcp"
	srname="_testdnssrvrecord._tcp"
	szonettl=123
	slocation="1 1 6668 test.univention.de"
	slocation2="2 2 6669 test.univention.org"

	adminwrap $LINENO dns/srv_record create --superordinate \"zoneName=dnstestzone,$pos,$ldap_base\" \
	--set zonettl=\"$szonettl\" \
	--append location=\"$slocation\" \
	--append location=\"$slocation2\" \
	--set name=\"$sname\" 
}

checkdns_srv_record()
{
	pos=$1
	ckthere "relativeDomainName=_testdnssrvrecord._tcp,zoneName=dnstestzone,$pos" "base" "(objectClass=*)" dns_srv_record existence $LINENO

}
createdns_zone_mx_record()
{
	pos=$1
	createdns_forward_zone $pos
	adminwrap $LINENO dns/zone_mx_record create --superordinate \"zoneName=dnstestzone,$pos,$ldap_base\" \
	--set mx=\"4 winzigweich\"
}	

checkdns_zone_mx_record()
{
	pos=$1
	ckthere "zoneName=dnstestzone,$pos" "BASE" "(MXRecord=4 winzigweich)" "dnstestzone" "MX" $LINENO
}
createdns_zone_txt_record()
{
	pos=$1
	createdns_forward_zone $pos
	adminwrap $LINENO dns/zone_txt_record create --superordinate \"zoneName=dnstestzone,$pos,$ldap_base\" \
	--set txt="nocheintesttext" 
}
checkdns_zone_txt_record()
{
	pos=$1
	ckthere "zoneName=dnstestzone,$pos" "BASE" "(TXTRecord=nocheintesttext)" "dnstestzone" "TXT" $LINENO
}

creategroups_group()
{
	pos=$1
	adminwrap $LINENO groups/group create --position \"$pos,$ldap_base\" --set name=testgroup
}

checkgroups_group()
{
	pos=$1
	ckthere "cn=testgroup,$pos" base "(objectClass=*)" group existence $LINENO
}
createmail_domain()
{
	pos=$1
	adminwrap $LINENO mail/domain create --set name=testmaildomain --position \"$pos,$ldap_base\"
}
checkmail_domain()
{
	pos=$1
	ckthere "cn=testmaildomain,$pos" base "(objectClass=*)" mail_domain existence $LINENO
}
createmail_folder()
{
	pos=$1
	createmail_domain $pos
	adminwrap $LINENO mail/folder create --set name=testmailfolder --position \"$pos,$ldap_base\" --set mailDomain=testmaildomain --set kolabHomeServer=$hostname
}
checkmail_folder()
{
	pos=$1
	ckthere "cn=testmailfolder@testmaildomain,$pos" base "(objectClass=*)" mail_folder existence $LINENO
}
createmail_lists()
{
	pos=$1
	adminwrap $LINENO mail/lists create --set name=testmaillists --position \"$pos,$ldap_base\"
}
checkmail_lists()
{
	pos=$1
	ckthere "cn=testmaillists,$pos" base "(objectClass=*)" mail_lists existence $LINENO
}
createmail_mail()
{
	pos=$1
	adminwrap $LINENO mail/mail create --set name=testmailmail --position \"$pos,$ldap_base\"
}
checkmail_mail()
{
	pos=$1
	ckthere "cn=testmailmail,$pos" base "(objectClass=*)" mail_mail existence $LINENO
}
createnetworks_network()
{
	pos=$1
	adminwrap $LINENO networks/network create --set name=testnetwork --position \"$pos,$ldap_base\" --set network="194.214.8.0" --set netmask="255.255.255.0"
}
checknetworks_network()
{
	pos=$1
	ckthere "cn=testnetwork,$pos" base "(objectClass=*)" network existence $LINENO
}
createpolicies()
	{
		type=$1
		adminwrap $LINENO policies/$type create --set name=test${type}policy --position=\"$2,$ldap_base\"
	}
checkpolicies()
	{
		type=$1
		ckthere "cn=test${type}policy,$2" base "(objectClass=*)" test${type}policy existence $LINENO
	}
createsettings_cn()
{
	pos=$1
	adminwrap $LINENO settings/cn create --set name=testcnsettings --position \"$pos,$ldap_base\"
}
checksettings_cn()
{
	pos=$1
	ckthere "cn=testcnsettings,$pos" base "(objectClass=*)" cnsettings existence $LINENO
}
createsettings_customattribute()
{
	pos=$1
	adminwrap $LINENO settings/customattribute create --set name=testcustomattributesettings --position \"$pos,$ldap_base\" --set shortDescription="someAttribute" --set objectClass="hopeThisDoesNotMatchAnything" --set ldapMapping="novalue" --set module=users/user
}
checksettings_customattribute()
{
	pos=$1
	ckthere "cn=testcustomattributesettings,$pos" base "(objectClass=*)" customattributesettings existence $LINENO
}
createsettings_lock()
{
	pos=$1
	adminwrap $LINENO settings/lock create --set name=testlocksettings --position \"$pos,$ldap_base\"
}
checksettings_lock()
{
	pos=$1
	ckthere "cn=testlocksettings,$pos" base "(objectClass=*)" locksettings existence $LINENO
}
createsettings_packages()
{
	pos=$1
	adminwrap $LINENO settings/packages create --set name=testpackagessettings --position \"$pos,$ldap_base\"
}
checksettings_packages()
{
	pos=$1
	ckthere "cn=testpackagessettings,$pos" base "(objectClass=*)" packagessettings existence $LINENO
}
createsettings_printermodel()
{
	pos=$1
	adminwrap $LINENO settings/printermodel create --set name=testprintermodelsettings --position \"$pos,$ldap_base\"
}
checksettings_printermodel()
{
	pos=$1
	ckthere "cn=testprintermodelsettings,$pos" base "(objectClass=*)" printermodelsettings existence $LINENO
}
createsettings_prohibited_username()
{
	pos=$1
	adminwrap $LINENO settings/prohibited_username create --set name=testprohibited_usernamesettings --position \"$pos,$ldap_base\"
}
checksettings_prohibited_username()
{
	pos=$1
	ckthere "cn=testprohibited_usernamesettings,$pos" base "(objectClass=*)" prohibited_usernamesettings existence $LINENO
}
createsettings_sambaconfig()
{
	pos=$1
	adminwrap $LINENO settings/sambaconfig create --set name=testsambaconfigsettings --position \"$pos,$ldap_base\"
}
checksettings_sambaconfig()
{
	pos=$1
	ckthere "cn=testsambaconfigsettings,$pos" base "(objectClass=*)" sambaconfigsettings existence $LINENO
}
createsettings_service()
{
	pos=$1
	adminwrap $LINENO settings/service create --set name=testservicesettings --position \"$pos,$ldap_base\"
}
checksettings_service()
{
	pos=$1
	ckthere "cn=testservicesettings,$pos" base "(objectClass=*)" servicesettings existence $LINENO
}
createsettings_usertemplate()
{
	pos=$1
	adminwrap $LINENO settings/usertemplate create --set name=testusertemplatesettings --position \"$pos,$ldap_base\"
}
checksettings_usertemplate()
{
	pos=$1
	ckthere "cn=testusertemplatesettings,$pos" base "(objectClass=*)" usertemplatesettings existence $LINENO
}
createshares_printer()
{
	pos=$1
	adminwrap $LINENO shares/printer create --set name=testprintershares --position \"$pos,$ldap_base\" --set uri="http://www.printer.net" --set spoolHost=$hostname --set model=default
}
checkshares_printer()
{
	pos=$1
	ckthere "cn=testprintershares,$pos" base "(objectClass=*)" printershares existence $LINENO
}
createshares_printergroup()
{
	pos=$1
	createshares_printer $1
	adminwrap $LINENO shares/printergroup create --set name=testprintergroupshares --position \"$pos,$ldap_base\" --set groupMember=testprintershares --set spoolHost=$hostname
}
checkshares_printergroup()
{
	pos=$1
	ckthere "cn=testprintergroupshares,$pos" base "(objectClass=*)" printergroupshares existence $LINENO
}
createshares_share()
{
	pos=$1
	adminwrap $LINENO shares/share create --set name=testshareshares --position \"$pos,$ldap_base\" --set host=ba --set path=/mu
}
checkshares_share()
{
	pos=$1
	ckthere "cn=testshareshares,$pos" base "(objectClass=*)" shareshares existence $LINENO
}
createusers_user()
{
	pos=$1
	adminwrap $LINENO users/user create --set name=testuserusers --position \"$pos,$ldap_base\" --set lastname=duempel --set password=geheimnisvoll --set kolabHomeServer=$hostname
}
checkusers_user()
{
	pos=$1
	ckthere "cn=testuserusers,$pos" base "(objectClass=*)" userusers existence $LINENO
}

if [ -n "$dorecursive" ]
then
	for otype in computers_managedclient \
			computers_domaincontroller_backup \
			computers_domaincontroller_master \
			computers_domaincontroller_slave \
			computers_ipmanagedclient \
			computers_macos \
			computers_memberserver \
			computers_mobileclient \
			computers_thinclient \
			computers_trustaccount \
			computers_windows \
			dhcp_host \
			dhcp_pool \
			dhcp_server \
			dhcp_shared \
			dhcp_sharedsubnet \
			dhcp_subnet \
			dns_alias \
			dns_forward_zone \
			dns_host_record \
			dns_ptr_record \
			dns_reverse_zone \
			dns_srv_record \
			dns_zone_mx_record \
			dns_zone_txt_record \
			groups_group \
			mail_domain \
			mail_folder \
			mail_lists \
			networks_network \
			"policies admin_container" \
			"policies autostart" \
			"policies clientdevices" \
			"policies managedclientpackages" \
			"policies desktop" \
			"policies dhcp_boot" \
			"policies dhcp_dns" \
			"policies dhcp_dnsupdate" \
			"policies dhcp_leasetime" \
			"policies dhcp_routing" \
			"policies dhcp_netbios" \
			"policies dhcp_scope" \
			"policies dhcp_statements" \
			"policies ldapserver" \
			"policies mailquota" \
			"policies masterpackages" \
			"policies memberpackages" \
			"policies mobileclientpackages" \
			"policies policy" \
			"policies print_quota" \
			"policies printserver" \
			"policies pwhistory" \
			"policies release" \
			"policies repositoryserver" \
			"policies repositorysync" \
			"policies share_userquota" \
			"policies slavepackages" \
			"policies sound" \
			"policies thinclient" \
			"policies xfree" \
			settings_customattribute \
			settings_packages \
			settings_printermodel \
			settings_prohibited_username \
			settings_sambaconfig \
			settings_service \
			settings_usertemplate \
			shares_printer \
			shares_printergroup \
			shares_share \
			users_user \



do
		errcheck $LINENO
		echo
		echo recursive remove $otype
		adminwrap $LINENO container/cn create --set name=delme
		create${otype} "cn=delme"
		check${otype} "cn=delme"
		adminwrap $LINENO container/cn remove --recursive --dn \"cn=delme,$ldap_base\"
		cknthere "cn=delme" base "(objectClass=*)" "cn=delme" "existence" $LINENO
		ldapdelete -x -D "cn=admin,$ldap_base" -w "`cat /etc/ldap.secret`" -r "cn=delme,$ldap_base" >> /dev/null 2>&1
		errcheck $LINENO
		echo
		echo recursive move $otype
		adminwrap $LINENO container/cn create --set name=there
		adminwrap $LINENO container/cn create --set name=moveme
		create${otype} "cn=moveme"
		adminwrap $LINENO container/cn move --dn \"cn=moveme,$ldap_base\" --recursive --position \"cn=there,$ldap_base\"
		check${otype} "cn=moveme,cn=there"
		adminwrap $LINENO container/cn remove --recursive --dn \"cn=there,$ldap_base\"
		cknthere "cn=there" base "(objectClass=*)" "cn=there" "existence" $LINENO
		cknthere "cn=moveme" base "(objectClass=*)" "cn=there" "existence" $LINENO
		ldapdelete -x -D "cn=admin,$ldap_base" -w "`cat /etc/ldap.secret`" -r "cn=moveme,$ldap_base" >> /dev/null 2>&1
		ldapdelete -x -D "cn=admin,$ldap_base" -w "`cat /etc/ldap.secret`" -r "cn=there,$ldap_base"  >> /dev/null 2>&1
	done
fi
errcheck $LINENO

