Squishing Dovecot

Just had a slight hiccup with Dovecot after the latest zentyal component update.

I’ve added zlib compression to my IMAP folders, and after the update, this setting was lost from dovecot.conf. It seems that with compressed files in the maildir and without the zlib plugin, dovecot gets a little confused whereby it alters the S=UNCOMPRESSEDFILESIZE tag on the mail file.

This will sort it (crudely)

[code]
#!/bin/bash
# Check mail file S-size
if [[ $1 == "" ]]; then
echo $0 "You need to pass a folder"
exit -1
fi

tocheck=`find $1 -maxdepth 1 -iname ‘*,S=*’ -print`
for filename in $tocheck; do
echo Looking at $filename
iszipped=`file $filename | grep gzip` filesize=`gunzip -l $filename | awk ‘NR==2 {print $2;}’`
if [[ ${#iszipped} -gt 1 ]]; then
newfilename=`echo $filename | sed -e ‘s/S=[0-9]*:/S=’$filesize’:/’`
echo \t\t\tAltering $filename to S=$filesize
mv $filename $newfilename
fi
done; [/code]

Leave a Reply