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