[Dovecot] Patch for rawlog.c

Andreas Schulze andreas.schulze at datev.de
Thu Jun 22 10:08:06 EEST 2006


hello

The homedirectories are stored as a relative path in my userdb

One problem ocoures with rawlog:
rawloging occures only if a directory $HOME/dovecot.rawlog exist.
this is checked with lstat

for me $HOME is always "username/". This is relative to /var/mail and works.

in rawlog.c lstat should now check "username//dovecot.rawlog" which fails.
lstat can check "/var/mail/username//dovecot.rawlog" or "./dovecot.rawlog"
( All checks test the existence of the same dir. )

I patched rawlog.c for me to force always the test of "./dovecot.rawlog"
I think, this is no problem, because imap-auth / pop3-auth always change to the correct
location.

mayby I am wrong, because I'm _NOT_ dealing with mboxes, only maildirs.
then you may discard this ...

--- snip
diff -Naur dovecot-1.0.beta9.orig/src/util/rawlog.c dovecot-1.0.beta9/src/util/rawlog.c
--- dovecot-1.0.beta9.orig/src/util/rawlog.c    2006-02-26 11:05:31.000000000 +0100
+++ dovecot-1.0.beta9/src/util/rawlog.c 2006-06-23 08:37:57.684368256 +0200
@@ -21,6 +21,7 @@
 
 #define TIMESTAMP_WAIT_TIME 5
 #define TIMESTAMP_FORMAT "* OK [RAWLOG TIMESTAMP] %Y-%m-%d %H:%M:%S\n"
+#define RAWLOG_DIRNAME "./dovecot.rawlog"
 
 static struct ioloop *ioloop;
 
@@ -261,20 +262,14 @@
 
 static void rawlog_open(bool write_timestamps)
 {
-       const char *home, *path;
        struct stat st;
        int sfd[2];
        pid_t pid;
 
-       home = getenv("HOME");
-       if (home == NULL)
-               home = ".";
-
        /* see if we want rawlog */
-       path = t_strconcat(home, "/dovecot.rawlog", NULL);
-       if (lstat(path, &st) < 0) {
+       if (lstat(RAWLOG_DIRNAME, &st) < 0) {
                if (errno != ENOENT)
-                       i_warning("lstat() failed for %s: %m", path);
+                       i_warning("lstat() failed for %s: %m", RAWLOG_DIRNAME);
                return;
        }
        if (!S_ISDIR(st.st_mode))
@@ -305,7 +300,7 @@
                                          dec2str(getppid())));
 
        ioloop = io_loop_create(system_pool);
-       rawlog_proxy_create(0, 1, sfd[0], path, write_timestamps);
+       rawlog_proxy_create(0, 1, sfd[0], RAWLOG_DIRNAME, write_timestamps);
        io_loop_run(ioloop);
        io_loop_destroy(&ioloop);
 
---- snap





-- 
Andreas Schulze

DATEV eG, Paumgartner Strasse 6-14, D - 90429 Nürnberg
Abt. Internet- und Securitydienste
 Telefon : +49 911 276 2648
 Telefax : +49 911 276 7892
   Mobil : +49 172 8122883
  E-Mail : andreas.schulze_at_datev.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://dovecot.org/pipermail/dovecot/attachments/20060622/ca874874/attachment.pgp


More information about the dovecot mailing list