From 4d00447448b2ef70b398fa74182bd9348cfb6e58 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Tue, 6 Feb 2018 16:13:52 +0100 Subject: [PATCH] Handle Bcc being a fully qualified address in rotate script GLPI #30996 --- root/etc/cron.monthly/maillog-rotate | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/root/etc/cron.monthly/maillog-rotate b/root/etc/cron.monthly/maillog-rotate index 731e98e..3744a16 100644 --- a/root/etc/cron.monthly/maillog-rotate +++ b/root/etc/cron.monthly/maillog-rotate @@ -11,8 +11,16 @@ if [ "$BCC" != "enabled" -o "$ARCHIVE" != "enabled" ]; then fi USER=$(db configuration getprop qpsmtpd BccUser || echo 'maillog') +# Truncate if it's a mail address +USER=${USER%@*} HOME="/home/e-smith/files/users/$USER" +# Stop here if the home dir doesn't exist +if [ \! -d $HOME ]; then + echo "$HOME doesn't exist" + exit 1 +fi + MONTH=$(date +%m) YEAR=$(date +%Y)