On Mon, 2007-03-26 at 18:34 +0200, Stephan Bosch wrote:
http://sinas.rename-it.nl/~sirius/dovecot-1.0.rc28-MANAGESIEVE-v3.diff.gz
I finally took a look at this. The biggest problem is that there's way too much duplicated code.
lib-managesieve: Is the only thing different from lib-imap that it does UTF8 validation? Then rather add some utf8-flag to the imap-parser. Or maybe add some string validation callback which does it in lib-managesieve.
managesieve: I guess the commands-common.c could be put somewhere.. Hmm. Also client.c has a lot of copy&pasted code. I'm not sure what's the right place for these though.
login: There is still too much duplication in the login code (also for imap/pop3). I'm thinking about cleaning this up after v1.0. Wonder if there should exist just one login binary which can handle multiple protocols (and support plugins)..
Sieve plugin would need to be merged somehow to this to avoid adding lib-sieve/cmu.
There's also one bug:
/* FIXME: Is this buffer on the stack method allowable for
* dovecot at all or do we need to define some t_buffer?
*/
static const int bufsize = 255;
char linkbuf[bufsize];
ret = readlink(storage->active_path, linkbuf, bufsize-1);
linkbuf[ret] = '\0'; //// ret can be -1
.. return t_strdup(linkbuf);
Change rather to something like:
char linkbuf[PATH_MAX];
ret = readlink(storage->active_path, linkbuf, sizeof(linkbuf));
.. return t_strndup(linkbuf, ret);