Fix USERDIR to delete
All checks were successful
gitea/evoadmin-mail/pipeline/head This commit looks good
gitea/evoadmin-mail/pipeline/tag This commit looks good

Not sure why we didn’t use directly the homeDirectory ldap entry, but
just trying to minimize the patch by trying to figure out the path from
the uid and domain…
This commit is contained in:
David Prevot 2023-07-26 15:08:11 +02:00
parent c7a83045fc
commit cf873c35eb

View file

@ -39,11 +39,12 @@ if [ "$PASSWORD" != "$READPASS" ]; then
fi
# mv pseudo-homeDir to directory.<date> for deleted users
USERDIR=${USERIS%%@$DOMAINIS}
if [ "$DEL" == "on" ]; then
if [[ -n $USERIS && -n $DOMAINIS && -e "/home/vmail/$DOMAINIS" && -e "/home/vmail/$DOMAINIS/$USERIS" ]]; then
mv /home/vmail/$DOMAINIS/$USERIS /home/vmail/$DOMAINIS/$USERIS.$DATE
chown -R root:root /home/vmail/$DOMAINIS/$USERIS.$DATE
chmod -R 700 /home/vmail/$DOMAINIS/$USERIS.$DATE
if [[ -n $USERIS && -n $DOMAINIS && -n $USERDIR && -e "/home/vmail/$DOMAINIS" && -e "/home/vmail/$DOMAINIS/$USERDIR" ]]; then
mv /home/vmail/$DOMAINIS/$USERDIR /home/vmail/$DOMAINIS/$USERDIR.$DATE
chown -R root:root /home/vmail/$DOMAINIS/$USERDIR.$DATE
chmod -R 700 /home/vmail/$DOMAINIS/$USERDIR.$DATE
fi
exit 0
fi