#!/usr/share/ucs-test/runner bash
## desc: Test accessing sysvol with smbclient using machine.secret
## exposure: safe
## packages:
##  - univention-samba4
## bugs: [30818]
## roles:
## - domaincontroller_master
## - domaincontroller_backup
## - domaincontroller_slave

. "$TESTLIBPATH/shares.sh" || exit 137

password="$(cat /etc/machine.secret)"

info "----Accessing sysvol using smbclient and hostname/machine.secret credentials"
for ((i=0;i<10;i++))
do
	output="$(smbclient -U "$hostname\$%$password" "//$ldap_master/sysvol" -c "ls $domainname/Policies" 2>&1)" &&
		exit $RETVAL
	sleep 3
done

error "$output"
fail_test 1 "Could not access Policies on sysvol with machine.secret credentials"

exit $RETVAL
