#!/usr/share/ucs-test/runner bash
# shellcheck shell=bash
## desc: Check that the mail spool permissions are correct
## bugs: [39887]
## tags: [producttest]
## packages:
## - univention-mail-dovecot
## exposure: safe

# shellcheck source=../../lib/base.sh
. "$TESTLIBPATH/base.sh" || exit 137

DOVEMAIL_UID=$(getent passwd dovemail | cut -d: -f3)
DOVEMAIL_GID=$(getent passwd dovemail | cut -d: -f4)

files="$(find /var/spool/dovecot/ -not \( -uid "$DOVEMAIL_UID" -gid "$DOVEMAIL_GID" \) -ls)"
[ -z "$files" ] ||
	fail_fast 110 "found wrong UID/GID in dovecot mail spool:
$files"
