38f2261
#!/bin/sh
38f2261
IMAPCONF=/etc/imapd.conf
38f2261
38f2261
CONFDIR=$(grep -se "^configdirectory:" $IMAPCONF | cut -d":" -f2)
38f2261
if [ "x$CONFDIR" = "x" ]; then
38f2261
  echo "$0 error: configdirectory not found in /etc/imapd.conf, exiting!"
38f2261
  exit 1
38f2261
fi
38f2261
38f2261
find $CONFDIR -type d ! -name "lost+found" -exec chmod 700 {} \; -exec chown cyrus:mail {} \;
9e566a4
grep -sE "^(meta|)partition-.*:" $IMAPCONF | cut -d":" -f2 | while read SPOOLDIR; do
38f2261
  if [ "x$SPOOLDIR" = "x" ]; then
9e566a4
    echo "$0 warning: invalid (meta)partition configuration in /etc/imapd.conf found!"
38f2261
  else
38f2261
    find $SPOOLDIR -type d ! -name "lost+found" -exec chmod 700 {} \; -exec chown cyrus:mail {} \;
38f2261
  fi
38f2261
done
38f2261
38f2261
find $CONFDIR -type f ! -name "lost+found" -exec chmod 600 {} \; -exec chown cyrus:mail {} \;
9e566a4
grep -sE "^(meta|)partition-.*:" $IMAPCONF | cut -d":" -f2 | while read SPOOLDIR; do
38f2261
  if [ "x$SPOOLDIR" = "x" ]; then
9e566a4
    echo "$0 warning: invalid (meta)partition configuration in /etc/imapd.conf found!"
38f2261
  else
38f2261
    find $SPOOLDIR -type f ! -name "lost+found" -exec chmod 600 {} \; -exec chown cyrus:mail {} \;
38f2261
  fi
38f2261
done
38f2261
38f2261
# lmtp socket must be accessible by group mail
38f2261
chmod 750 $CONFDIR
38f2261
chmod 750 ${CONFDIR}/socket