Hello community, here is the log from the commit of package dovecot checked in at Fri May 26 12:46:35 CEST 2006. -------- --- dovecot/dovecot.changes 2006-05-16 19:01:21.000000000 +0200 +++ dovecot/dovecot.changes 2006-05-25 08:52:52.000000000 +0200 @@ -1,0 +2,39 @@ +Thu May 25 08:18:17 CEST 2006 - mrueckert@suse.de + +- Update to 1.0.beta8: + * Fixed a security hole with mbox: "1 LIST .. *" command could + list all directories and files under the mbox root directory, so + if your mails were stored in eg. /var/mail/%u/ directory, the + command would list everything under /var/mail. + + + Unless nfs_check=no or mmap_disable=yes, check for the first login + if the user's index directory exists in NFS mount. If so, refuse to + run. This is done only on first login to avoid constant extra + overhead. + + If we have plugins set and imap_capability unset, figure out the + IMAP capabilities automatically by running imap binary at startup. + The generated capability list isn't updated until Dovecot is + restarted completely, so if you add or remove IMAP plugins you + should restart. If you have problems related to this, set + imap_capabilities setting manually to work around it. + + Added auth_username_format setting + - pop3_lock_session setting wasn't really working + - Lots of fixes related to quota handling. It's still not working + perfectly though. + - Lots of index handling fixes, especially with mmap_disable=yes + - Maildir: saving mails could have sometimes caused "Append with UID + n, but next_uid = m" errors + - flock() locking never timeouted because ignoring SIGALRM caused the + system call just to be restarted when SIGALRM occurred (probably not + with all OSes though?) + - kqueue: Fixed "Unrecognized event". Patch by Vaclav Haisman + +- removed dovecot-1.0.beta7_directory-traversal.patch: + the patch is included in 1.0.beta8 +- dovecot-1.0.beta3_indexfixes.patch: included in beta8 +- replaced dovecot-1.0.beta1_pie.patch with + dovecot-1.0.beta6_pie.patch: rediff for new version +- no longer use %{_libdir}/dovecot as libexecdir. We use + %{_prefix}/lib/dovecot now. + +------------------------------------------------------------------- Old: ---- dovecot-1.0.beta1_pie.patch dovecot-1.0.beta3.tar.bz2 dovecot-1.0.beta3_indexfixes.patch dovecot-1.0.beta7_directory-traversal.patch New: ---- dovecot-1.0.beta6_pie.patch dovecot-1.0.beta8.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ dovecot.spec ++++++ --- /var/tmp/diff_new_pack.r9KoHd/_old 2006-05-26 12:45:44.000000000 +0200 +++ /var/tmp/diff_new_pack.r9KoHd/_new 2006-05-26 12:45:44.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package dovecot (Version 1.0.beta3) +# spec file for package dovecot (Version 1.0.beta8) # # Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -11,22 +11,24 @@ # norootforbuild Name: dovecot -BuildRequires: krb5-devel mysql-devel openldap2 openldap2-devel pam-devel pkgconfig postgresql-devel sqlite-devel -Version: 1.0.beta3 -Release: 13 +Version: 1.0.beta8 +Release: 1 +# Group: Productivity/Networking/Email/Servers License: LGPL, X11/MIT +# BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: krb5-devel mysql-devel openldap2 openldap2-devel pam-devel pkgconfig postgresql-devel sqlite-devel Prereq: /usr/sbin/useradd, /usr/sbin/usermod, /usr/sbin/groupadd +# URL: http://www.dovecot.org -Source: http://www.dovecot.org/test/%{name}-%{version}.tar.bz2 +Source: http://www.dovecot.org/test/%{name}-%{version}.tar.gz Source1: dovecot-lda.tar.bz2 Source2: %{name}.init Source3: %{name}.pam Source4: %{name}.README.SuSE -Patch1: dovecot-1.0.beta3_indexfixes.patch -Patch2: dovecot-1.0.beta7_directory-traversal.patch -Patch9: dovecot-1.0.beta1_pie.patch +Patch9: dovecot-1.0.beta6_pie.patch +# Summary: IMAP and POP3 Server Written Primarily with Security in Mind %description @@ -46,8 +48,6 @@ %prep %setup -a 1 -%patch1 -%patch2 %patch9 %{__sed} -i -e 's|#ssl_disable = no|ssl_disable = yes|' %{name}-example.conf %{__sed} -i -e 's|/usr/libexec|%{_libdir}|g' %{name}-example.conf @@ -78,7 +78,7 @@ --with-prefetch-userdb \ --with-storages="maildir,mbox" \ --sysconfdir=%{_sysconfdir}/%{name} \ - --libexecdir=%{_libdir} \ + --libexecdir=%{_prefix}/lib/ \ --with-moduledir=%{_libdir}/%{name}/modules %{__make} pushd dovecot-lda @@ -86,7 +86,7 @@ %configure \ --with-dovecot=../ \ --sysconfdir=%{_sysconfdir}/%{name} \ - --libexecdir=%{_libdir} \ + --libexecdir=%{_prefix}/lib/ \ --with-moduledir=%{_libdir}/%{name}/modules %{__make} popd @@ -94,9 +94,8 @@ %install %makeinstall docdir=%{_docdir}/%{name} -pushd dovecot-lda - %makeinstall docdir=%{_docdir}/%{name} -popd + +%makeinstall -C dovecot-lda docdir=%{_docdir}/%{name} find %{buildroot}%{_libdir}/%{name}/modules/ -type f -name \*.la -print0 | xargs -r0 rm -v find %{buildroot}%{_libdir}/%{name}/modules/ -type f -name \*.a -print0 | xargs -r0 rm -v %{__install} -m 0755 -d \ @@ -119,7 +118,7 @@ %{__install} -m 0644 dovecot-lda/ChangeLog %{buildroot}%{_docdir}/%{name}/ChangeLog.lda # additional docs for the main package %{__install} -m 0644 \ - ABOUT-NLS COPYING COPYING.MIT NEWS TODO AUTHORS COPYING.LGPL README ChangeLog \ + COPYING COPYING.MIT NEWS TODO AUTHORS COPYING.LGPL README ChangeLog \ %{buildroot}%{_docdir}/%{name}/ %{__gzip} -9v %{buildroot}%{_docdir}/%{name}/ChangeLog # install the init script @@ -151,19 +150,21 @@ %dir %{_sysconfdir}/%{name} %config(noreplace) %attr(0644,root,root) %{_sysconfdir}/%{name}/* %config(noreplace) %{_sysconfdir}/pam.d/%{name} -%dir %{_libdir}/%{name} -%{_libdir}/%{name}/checkpassword-reply -%{_libdir}/%{name}/dovecot-auth -%{_libdir}/%{name}/rawlog -%{_libdir}/%{name}/imap* -%{_libdir}/%{name}/pop3* -%{_libdir}/%{name}/deliver -%{_libdir}/%{name}/dict -%{_libdir}/%{name}/gdbhelper -%{_libdir}/%{name}/ssl-build-param +%dir %{_prefix}/lib/%{name} +%{_prefix}/lib/%{name}/checkpassword-reply +%{_prefix}/lib/%{name}/dovecot-auth +%{_prefix}/lib/%{name}/rawlog +%{_prefix}/lib/%{name}/imap* +%{_prefix}/lib/%{name}/pop3* +%{_prefix}/lib/%{name}/deliver +%{_prefix}/lib/%{name}/dict +%{_prefix}/lib/%{name}/gdbhelper +%{_prefix}/lib/%{name}/ssl-build-param +%{_prefix}/lib/%{name}/sievec # # plugins # +%dir %{_libdir}/%{name} %dir %{_libdir}/%{name}/modules/ %{_libdir}/%{name}/modules/lib01_quota_plugin.so %{_libdir}/%{name}/modules/lib02_trash_plugin.so @@ -180,6 +181,11 @@ %{_libdir}/%{name}/modules/lda/lib02_trash_plugin.so %dir %{_libdir}/%{name}/modules/pop3 %{_libdir}/%{name}/modules/pop3/lib01_convert_plugin.so +%{_libdir}/%{name}/modules/pop3/lib01_quota_plugin.so +# acl plugin +%{_libdir}/%{name}/modules/imap/lib01_acl_plugin.so +%{_libdir}/%{name}/modules/lda/lib01_acl_plugin.so +%{_libdir}/%{name}/modules/lib01_acl_plugin.so # # documentation # @@ -191,6 +197,40 @@ %dir %attr(0750, root, %{name}) %{_var}/run/%{name}/login %changelog -n dovecot +* Thu May 25 2006 - mrueckert@suse.de +- Update to 1.0.beta8: + * Fixed a security hole with mbox: "1 LIST .. *" command could + list all directories and files under the mbox root directory, so + if your mails were stored in eg. /var/mail/%%u/ directory, the + command would list everything under /var/mail. + + Unless nfs_check=no or mmap_disable=yes, check for the first login + if the user's index directory exists in NFS mount. If so, refuse to + run. This is done only on first login to avoid constant extra + overhead. + + If we have plugins set and imap_capability unset, figure out the + IMAP capabilities automatically by running imap binary at startup. + The generated capability list isn't updated until Dovecot is + restarted completely, so if you add or remove IMAP plugins you + should restart. If you have problems related to this, set + imap_capabilities setting manually to work around it. + + Added auth_username_format setting +- pop3_lock_session setting wasn't really working +- Lots of fixes related to quota handling. It's still not working + perfectly though. +- Lots of index handling fixes, especially with mmap_disable=yes +- Maildir: saving mails could have sometimes caused "Append with UID + n, but next_uid = m" errors +- flock() locking never timeouted because ignoring SIGALRM caused the + system call just to be restarted when SIGALRM occurred (probably not + with all OSes though?) +- kqueue: Fixed "Unrecognized event". Patch by Vaclav Haisman +- removed dovecot-1.0.beta7_directory-traversal.patch: + the patch is included in 1.0.beta8 +- dovecot-1.0.beta3_indexfixes.patch: included in beta8 +- replaced dovecot-1.0.beta1_pie.patch with + dovecot-1.0.beta6_pie.patch: rediff for new version +- no longer use %%{_libdir}/dovecot as libexecdir. We use + %%{_prefix}/lib/dovecot now. * Tue May 16 2006 - mrueckert@suse.de - added dovecot-1.0.beta7_directory-traversal.patch: Fix Mailbox names list disclosure with mboxes (#175188) ++++++ dovecot-1.0.beta1_pie.patch -> dovecot-1.0.beta6_pie.patch ++++++ --- dovecot/dovecot-1.0.beta1_pie.patch 2006-02-08 15:26:00.000000000 +0100 +++ dovecot/dovecot-1.0.beta6_pie.patch 2006-05-25 08:52:52.000000000 +0200 @@ -18,7 +18,7 @@ AC_ARG_ENABLE(debug, [ --enable-debug Enable some extra checks for debugging], if test x$enableval = xyes; then -@@ -1640,6 +1649,30 @@ +@@ -1636,6 +1645,30 @@ STORAGE_LIBS="$STORAGE_LIBS $index_libs" AC_SUBST(STORAGE_LIBS) @@ -49,8 +49,9 @@ dnl ** dnl ** SQL drivers dnl ** -@@ -1730,3 +1763,4 @@ - echo "Building with GSSAPI support ........ : $have_gssapi" +@@ -1727,3 +1760,5 @@ echo "Building with user database modules . :$userdb" echo "Building with password lookup modules :$passdb" + echo "Building with SQL drivers ............:$sql_drivers" +echo "Building with PIE: $want_pie" ++ ++++++ dovecot-lda.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/dovecot-lda/ChangeLog new/dovecot-lda/ChangeLog --- old/dovecot-lda/ChangeLog 2006-02-08 17:04:54.000000000 +0100 +++ new/dovecot-lda/ChangeLog 2006-05-25 07:39:54.000000000 +0200 @@ -1,3 +1,94 @@ +2006-05-12 21:03 cras + + * src/sieve-cmu.c: Don't log keeps. + +2006-05-12 21:00 cras + + * src/: deliver.c, sieve-cmu.c: Do some more logging. + +2006-05-12 20:42 cras + + * src/libsieve/: bc_emit.c, script.c, sievec.c: Replaced syslog() + calls with Dovecot's i_info/i_error calls + +2006-05-12 20:41 cras + + * src/libsieve/: Makefile.am, sievec.c: Compile sievec binary. + +2006-05-12 20:24 cras + + * src/: common.h, deliver.c, smtpclient.c: Added sendmail_path and + hostname settings. + +2006-05-12 20:19 cras + + * src/deliver.c: If there's no log_path defined, log to syslog. + Just like other parts of Dovecot. + +2006-05-04 00:59 cras + + * src/deliver.c: Use lib_signals_ignore() for SIGPIPE + +2006-04-28 15:53 cras + + * src/deliver.c: Ignore SIGXFSZ signal if it exists. We don't want + to crash if some file is too large. + +2006-04-28 15:48 cras + + * src/deliver.c: Remove all environment but TZ and HOME before + doing anything so the existing environment doesn't mess up + settings (especially MAIL). + +2006-04-21 15:32 cras + + * src/Makefile.am: Link mountpoint.o manually to get + mountpoint_get() included into binary, so quota plugin can use + it. + +2006-04-20 18:17 cras + + * src/deliver.c: Changed default socket to + /var/run/dovecot/auth-master again. Nowadays /var/run/dovecot is + world-rx so it's a better place for it. + +2006-04-13 21:47 cras + + * src/libsieve/bc_emit.c: Commented out a debug syslog message, + which I've no idea why it would be useful ever.. + +2006-04-13 21:46 cras + + * src/deliver.c: Use syslog_facility setting + +2006-04-13 20:45 cras + + * src/deliver.c: Unload modules after destroying storages + +2006-04-13 20:28 cras + + * src/deliver.c: Use mail_plugins and mail_plugin_dir settings + inside protocol lda {} + +2006-04-13 20:16 cras + + * src/deliver.c: Set also environments inside plugin { .. } + +2006-04-02 11:20 cras + + * src/deliver.c: Use mail_storage_parse_env() to parse lock_method + and mail storage flags. + +2006-03-25 10:44 cras + + * src/deliver.c: Getting sieve path from userdb wasn't working, it + was always overwritten by global sieve path. + +2006-03-21 10:15 cras + + * src/deliver.c: Fixed to compile with latest Dovecot's module-dir + changes. + 2006-02-08 17:00 cras * src/duplicate.c: Fixed to work with dotlock changes diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/dovecot-lda/src/Makefile.am new/dovecot-lda/src/Makefile.am --- old/dovecot-lda/src/Makefile.am 2006-01-12 15:32:50.000000000 +0100 +++ new/dovecot-lda/src/Makefile.am 2006-05-25 07:39:05.000000000 +0200 @@ -13,6 +13,11 @@ -I$(dovecotdir)/src/lib-storage/index/mbox \ -DSYSCONFDIR=\""$(sysconfdir)"\" +# get some functions included which only plugins use. liblib should probably +# be a shared library so this wouldn't be needed.. +unused_objects = \ + $(dovecotdir)/src/lib/mountpoint.o + libs = \ libsieve/libsieve.a \ $(dovecotdir)/src/lib-storage/register/libstorage-register.a \ @@ -23,7 +28,8 @@ $(dovecotdir)/src/lib-mail/libmail.a \ $(dovecotdir)/src/lib-dict/libdict.a \ $(dovecotdir)/src/lib-charset/libcharset.a \ - $(dovecotdir)/src/lib/liblib.a + $(dovecotdir)/src/lib/liblib.a \ + $(unused_objects) deliver_LDADD = \ $(libs) \ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/dovecot-lda/src/common.h new/dovecot-lda/src/common.h --- old/dovecot-lda/src/common.h 2006-02-08 15:19:08.000000000 +0100 +++ new/dovecot-lda/src/common.h 2006-05-25 07:39:05.000000000 +0200 @@ -7,6 +7,7 @@ struct sieve_settings { const char *hostname; const char *postmaster_address; + const char *sendmail_path; }; extern struct sieve_settings *sieve_set; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/dovecot-lda/src/deliver.c new/dovecot-lda/src/deliver.c --- old/dovecot-lda/src/deliver.c 2006-02-08 15:19:08.000000000 +0100 +++ new/dovecot-lda/src/deliver.c 2006-05-25 07:39:05.000000000 +0200 @@ -34,7 +34,7 @@ #define SIEVE_SCRIPT_PATH "~/.dovecot.sieve" #define DEFAULT_CONFIG_FILE SYSCONFDIR"/dovecot.conf" -#define DEFAULT_AUTH_SOCKET_PATH "/var/run/dovecot-auth-master" +#define DEFAULT_AUTH_SOCKET_PATH "/var/run/dovecot/auth-master" /* After buffer grows larger than this, create a temporary file to /tmp where to read the mail. */ @@ -337,7 +337,8 @@ value = p = strchr(line, '='); if (value == NULL) { if (strchr(line, '{') != NULL) { - if (strcmp(line, "protocol lda {") == 0) + if (strcmp(line, "protocol lda {") == 0 || + strcmp(line, "plugin {") == 0) lda_section = TRUE; sections++; } @@ -449,13 +450,18 @@ return input; } -static void open_logfile(void) +static void open_logfile(const char *username) { - if (getenv("LOG_PATH") == NULL) - i_set_failure_syslog("deliver", LOG_NDELAY, LOG_MAIL); - else { + const char *prefix; + + prefix = t_strdup_printf("deliver(%s)", username); + if (getenv("LOG_PATH") == NULL) { + const char *env = getenv("SYSLOG_FACILITY"); + i_set_failure_syslog(prefix, LOG_NDELAY, + env == NULL ? LOG_MAIL : atoi(env)); + } else { /* log to file or stderr */ - i_set_failure_file(getenv("LOG_PATH"), "deliver"); + i_set_failure_file(getenv("LOG_PATH"), prefix); } if (getenv("INFO_LOG_PATH") != NULL) @@ -477,7 +483,6 @@ return NULL; } - script_path = home_expand(SIEVE_SCRIPT_PATH); if (*script_path != '/' && *script_path != '\0') { /* relative path. change to absolute. */ script_path = t_strconcat(getenv("HOME"), "/", @@ -507,8 +512,8 @@ { const char *config_path = DEFAULT_CONFIG_FILE; const char *mailbox = "INBOX"; - const char *auth_socket; - const char *home, *destination, *mail_env, *str, *script_path; + const char *auth_socket, *env_tz; + const char *home, *destination, *user, *mail_env, *str, *script_path; const struct var_expand_table *table; enum mail_storage_flags flags; enum mail_storage_lock_method lock_method; @@ -525,8 +530,20 @@ lib_signals_init(); lib_signals_set_handler(SIGINT, TRUE, sig_die, NULL); lib_signals_set_handler(SIGTERM, TRUE, sig_die, NULL); - lib_signals_set_handler(SIGPIPE, FALSE, NULL, NULL); + lib_signals_ignore(SIGPIPE); lib_signals_set_handler(SIGALRM, FALSE, NULL, NULL); +#ifdef SIGXFSZ + lib_signals_set_handler(SIGXFSZ, FALSE, NULL, NULL); +#endif + + /* Clean up environment. */ + env_tz = getenv("TZ"); + home = getenv("HOME"); + env_clean(); + if (env_tz != NULL) + env_put(t_strconcat("TZ=", env_tz, NULL)); + if (home != NULL) + env_put(t_strconcat("HOME=", home, NULL)); destination = NULL; for (i = 1; i < argc; i++) { @@ -560,9 +577,26 @@ "Unknown argument: %s", argv[1]); } } + if (destination != NULL) + user = destination; + else if (geteuid() != 0) { + /* we're non-root. get our username. */ + struct passwd *pw; + + pw = getpwuid(geteuid()); + if (pw != NULL) + user = t_strdup(pw->pw_name); + else { + i_fatal("Couldn't lookup our username (uid=%s)", + dec2str(geteuid())); + } + } else { + i_fatal_status(EX_USAGE, + "destination user parameter (-d user) not given"); + } config_file_init(config_path); - open_logfile(); + open_logfile(user); if (destination != NULL) { auth_socket = getenv("AUTH_SOCKET_PATH"); @@ -579,27 +613,22 @@ could be written. If it fails, don't worry. */ (void)chdir(home); } - } else if (geteuid() != 0) { - /* we're non-root. get our username. */ - struct passwd *pw; - - pw = getpwuid(geteuid()); - if (pw != NULL) - destination = t_strdup(pw->pw_name); - } - - if (destination == NULL) { - i_fatal_status(EX_USAGE, - "destination user parameter (-d user) not given"); + } else { + destination = user; } sieve_set = i_new(struct sieve_settings, 1); - sieve_set->hostname = my_hostname; /* FIXME: configurable */ + sieve_set->hostname = getenv("HOSTNAME"); + if (sieve_set->hostname == NULL) + sieve_set->hostname = my_hostname; sieve_set->postmaster_address = getenv("POSTMASTER_ADDRESS"); if (sieve_set->postmaster_address == NULL) { i_fatal_status(EX_CONFIG, "postmaster_address setting not given"); } + sieve_set->sendmail_path = getenv("SENDMAIL_PATH"); + if (sieve_set->sendmail_path == NULL) + sieve_set->sendmail_path = "/usr/lib/sendmail"; dict_client_register(); mail_storage_init(); @@ -615,39 +644,24 @@ mail_env = expand_mail_env(mail_env, table); } - flags = 0; - if (getenv("FULL_FILESYSTEM_ACCESS") != NULL) - flags |= MAIL_STORAGE_FLAG_FULL_FS_ACCESS; - if (getenv("DEBUG") != NULL) - flags |= MAIL_STORAGE_FLAG_DEBUG; - if (getenv("MMAP_DISABLE") != NULL) - flags |= MAIL_STORAGE_FLAG_MMAP_DISABLE; - if (getenv("MMAP_NO_WRITE") != NULL) - flags |= MAIL_STORAGE_FLAG_MMAP_NO_WRITE; - if (getenv("MAIL_READ_MMAPED") != NULL) - flags |= MAIL_STORAGE_FLAG_MMAP_MAILS; - if (getenv("MAIL_SAVE_CRLF") != NULL) - flags |= MAIL_STORAGE_FLAG_SAVE_CRLF; - str = getenv("POP3_UIDL_FORMAT"); if (str != NULL && (str = strchr(str, '%')) != NULL && str != NULL && var_get_key(str + 1) == 'm') flags |= MAIL_STORAGE_FLAG_KEEP_HEADER_MD5; - str = getenv("LOCK_METHOD"); - if (str == NULL || strcmp(str, "flock") == 0) - lock_method = MAIL_STORAGE_LOCK_FLOCK; - else if (strcmp(str, "fcntl") == 0) - lock_method = MAIL_STORAGE_LOCK_FCNTL; - else if (strcmp(str, "dotlock") == 0) - lock_method = MAIL_STORAGE_LOCK_DOTLOCK; - else - i_fatal("Unknown lock_method: %s", str); - - modules = getenv("MODULE_DIR") == NULL ? NULL : - module_dir_load(getenv("MODULE_DIR"), TRUE); + if (getenv("MAIL_PLUGIN_DIR") == NULL) + modules = NULL; + else { + if (getenv("MAIL_PLUGIN_DIR") == NULL) { + i_fatal("MAIL_PLUGINS given but " + "MAIL_PLUGIN_DIR was not"); + } + modules = module_dir_load(getenv("MAIL_PLUGIN_DIR"), + getenv("MAIL_PLUGINS"), TRUE); + } /* FIXME: how should we handle namespaces? */ + mail_storage_parse_env(&flags, &lock_method); storage = mail_storage_create_with_data(mail_env, destination, flags, lock_method); if (storage == NULL) { @@ -705,10 +719,11 @@ mailbox_close(&box); duplicate_deinit(); - module_dir_unload(&modules); mail_storage_destroy(&mbox_storage); mail_storage_destroy(&storage); - mail_storage_deinit(); + + module_dir_unload(&modules); + mail_storage_deinit(); dict_client_unregister(); lib_signals_deinit(); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/dovecot-lda/src/libsieve/Makefile.am new/dovecot-lda/src/libsieve/Makefile.am --- old/dovecot-lda/src/libsieve/Makefile.am 2005-10-17 15:59:10.000000000 +0200 +++ new/dovecot-lda/src/libsieve/Makefile.am 2006-05-25 07:39:05.000000000 +0200 @@ -1,3 +1,7 @@ +pkglibexecdir = $(libexecdir)/dovecot + +pkglibexec_PROGRAMS = sievec + noinst_LIBRARIES = libsieve.a AM_YFLAGS = -d -p $* @@ -13,6 +17,15 @@ sieve-lex.c: sieve-lex.l $(LEX) -t sieve-lex.l > sieve-lex.c +sievec_SOURCES = \ + sievec.c \ + ../map.c \ + ../imparse.c + +sievec_LDADD = \ + libsieve.a \ + $(dovecotdir)/src/lib/liblib.a + libsieve_a_SOURCES = \ addr.y \ sieve.y \ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/dovecot-lda/src/libsieve/bc_emit.c new/dovecot-lda/src/libsieve/bc_emit.c --- old/dovecot-lda/src/libsieve/bc_emit.c 2005-10-14 22:21:47.000000000 +0200 +++ new/dovecot-lda/src/libsieve/bc_emit.c 2006-05-25 07:39:05.000000000 +0200 @@ -1,7 +1,7 @@ /* bc_emit.c -- sieve bytecode - pass 2 of the compiler * Rob Siemborski * Jen Smith - * $Id: bc_emit.c,v 1.2 2005/10/14 20:21:47 cras Exp $ + * $Id: bc_emit.c,v 1.4 2006/05/12 18:42:29 cras Exp $ */ /*********************************************************** Copyright 2001 by Carnegie Mellon University @@ -36,7 +36,6 @@ #include "bytecode.h" -#include <syslog.h> #include <sys/types.h> #include <unistd.h> @@ -321,7 +320,7 @@ /*debugging variable to check filelen*/ /*int location;*/ - syslog(LOG_DEBUG, "entered bc_action_emit with filelen: %d", filelen); + /*syslog(LOG_DEBUG, "entered bc_action_emit with filelen: %d", filelen);*/ /* All non-string data MUST be sizeof(int) byte alligned so the end of each string may require a pad */ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/dovecot-lda/src/libsieve/script.c new/dovecot-lda/src/libsieve/script.c --- old/dovecot-lda/src/libsieve/script.c 2005-10-15 15:31:26.000000000 +0200 +++ new/dovecot-lda/src/libsieve/script.c 2006-05-25 07:39:05.000000000 +0200 @@ -1,6 +1,6 @@ /* script.c -- sieve script functions * Larry Greenfield - * $Id: script.c,v 1.4 2005/10/15 13:31:26 cras Exp $ + * $Id: script.c,v 1.5 2006/05/12 18:42:29 cras Exp $ */ /*********************************************************** Copyright 1999 by Carnegie Mellon University @@ -32,7 +32,6 @@ #include <stdlib.h> #include <string.h> #include <ctype.h> -#include <syslog.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/dovecot-lda/src/libsieve/sievec.c new/dovecot-lda/src/libsieve/sievec.c --- old/dovecot-lda/src/libsieve/sievec.c 2005-03-29 20:37:59.000000000 +0200 +++ new/dovecot-lda/src/libsieve/sievec.c 2006-05-25 07:39:05.000000000 +0200 @@ -1,6 +1,6 @@ /* sievec.c -- compile a sieve script to bytecode manually * Rob Siemborski - * $Id: sievec.c,v 1.1.1.1 2005/03/29 18:37:59 cras Exp $ + * $Id: sievec.c,v 1.3 2006/05/12 18:42:29 cras Exp $ */ /* * Copyright (c) 1999-2000 Carnegie Mellon University. All rights reserved. @@ -48,7 +48,6 @@ #endif #include "sieve_interface.h" -#include <syslog.h> #include "libconfig.h" #include "xmalloc.h" @@ -63,8 +62,7 @@ #include <sys/stat.h> #include <fcntl.h> -/* config.c stuff */ -const int config_need_data = 0; +struct et_list *_et_list = NULL; int is_script_parsable(FILE *stream, char **errstr, sieve_script_t **ret); @@ -78,20 +76,16 @@ sieve_script_t *s; bytecode_info_t *bc; int c, fd, usage_error = 0; - char *alt_config = NULL; while ((c = getopt(argc, argv, "C:")) != EOF) switch (c) { - case 'C': /* alt config file */ - alt_config = optarg; - break; default: usage_error = 1; break; } if (usage_error || (argc - optind) < 2) { - printf("Syntax: %s [-C <altconfig>] <filename> <outputfile>\n", + printf("Syntax: %s <filename> <outputfile>\n", argv[0]); exit(1); } @@ -102,9 +96,6 @@ exit(1); } - /* Load configuration file. */ - config_read(alt_config); - if(is_script_parsable(instream, &err, &s) == TIMSIEVE_FAIL) { if(err) { printf("Unable to parse script: %s\n", err); @@ -140,9 +131,9 @@ } /* to make larry's stupid functions happy :) */ -void foo(void) +static void foo(void) { - fatal("stub function called", 0); + i_fatal("stub function called"); } sieve_vacation_t vacation = { 0, /* min response */ @@ -157,30 +148,24 @@ void *message_context __attribute__((unused)), const char **errmsg __attribute__((unused))) { - fatal("stub function called", 0); + i_fatal("stub function called"); return SIEVE_FAIL; } -int mysieve_error(int lineno, const char *msg, - void *i __attribute__((unused)), void *s) +static int mysieve_error(int lineno, const char *msg, + void *i __attribute__((unused)), void *s) { char buf[1024]; char **errstr = (char **) s; snprintf(buf, 80, "line %d: %s\r\n", lineno, msg); *errstr = xrealloc(*errstr, strlen(*errstr) + strlen(buf) + 30); - syslog(LOG_DEBUG, "%s", buf); + i_info("%s", buf); strcat(*errstr, buf); return SIEVE_OK; } -void fatal(const char *s, int code) -{ - printf("Fatal error: %s (%d)\r\n", s, code); - - exit(1); -} /* end the boilerplate */ /* returns TRUE or FALSE */ @@ -192,75 +177,75 @@ res = sieve_interp_alloc(&i, NULL); if (res != SIEVE_OK) { - syslog(LOG_ERR, "sieve_interp_alloc() returns %d\n", res); + i_error("sieve_interp_alloc() returns %d\n", res); return TIMSIEVE_FAIL; } res = sieve_register_redirect(i, (sieve_callback *) &foo); if (res != SIEVE_OK) { - syslog(LOG_ERR, "sieve_register_redirect() returns %d\n", res); + i_error("sieve_register_redirect() returns %d\n", res); return TIMSIEVE_FAIL; } res = sieve_register_discard(i, (sieve_callback *) &foo); if (res != SIEVE_OK) { - syslog(LOG_ERR, "sieve_register_discard() returns %d\n", res); + i_error("sieve_register_discard() returns %d\n", res); return TIMSIEVE_FAIL; } res = sieve_register_reject(i, (sieve_callback *) &foo); if (res != SIEVE_OK) { - syslog(LOG_ERR, "sieve_register_reject() returns %d\n", res); + i_error("sieve_register_reject() returns %d\n", res); return TIMSIEVE_FAIL; } res = sieve_register_fileinto(i, (sieve_callback *) &foo); if (res != SIEVE_OK) { - syslog(LOG_ERR, "sieve_register_fileinto() returns %d\n", res); + i_error("sieve_register_fileinto() returns %d\n", res); return TIMSIEVE_FAIL; } res = sieve_register_keep(i, (sieve_callback *) &foo); if (res != SIEVE_OK) { - syslog(LOG_ERR, "sieve_register_keep() returns %d\n", res); + i_error("sieve_register_keep() returns %d\n", res); return TIMSIEVE_FAIL; } res = sieve_register_imapflags(i, NULL); if (res != SIEVE_OK) { - syslog(LOG_ERR, "sieve_register_imapflags() returns %d\n", res); + i_error("sieve_register_imapflags() returns %d\n", res); return TIMSIEVE_FAIL; } res = sieve_register_size(i, (sieve_get_size *) &foo); if (res != SIEVE_OK) { - syslog(LOG_ERR, "sieve_register_size() returns %d\n", res); + i_error("sieve_register_size() returns %d\n", res); return TIMSIEVE_FAIL; } res = sieve_register_header(i, (sieve_get_header *) &foo); if (res != SIEVE_OK) { - syslog(LOG_ERR, "sieve_register_header() returns %d\n", res); + i_error("sieve_register_header() returns %d\n", res); return TIMSIEVE_FAIL; } res = sieve_register_envelope(i, (sieve_get_envelope *) &foo); if (res != SIEVE_OK) { - syslog(LOG_ERR, "sieve_register_envelope() returns %d\n", res); + i_error("sieve_register_envelope() returns %d\n", res); return TIMSIEVE_FAIL; } res = sieve_register_vacation(i, &vacation); if (res != SIEVE_OK) { - syslog(LOG_ERR, "sieve_register_vacation() returns %d\n", res); + i_error("sieve_register_vacation() returns %d\n", res); return TIMSIEVE_FAIL; } res = sieve_register_notify(i, &sieve_notify); if (res != SIEVE_OK) { - syslog(LOG_ERR, "sieve_register_notify() returns %d\n", res); + i_error("sieve_register_notify() returns %d\n", res); return TIMSIEVE_FAIL; } res = sieve_register_parse_error(i, &mysieve_error); if (res != SIEVE_OK) { - syslog(LOG_ERR, "sieve_register_parse_error() returns %d\n", res); + i_error("sieve_register_parse_error() returns %d\n", res); return TIMSIEVE_FAIL; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/dovecot-lda/src/sieve-cmu.c new/dovecot-lda/src/sieve-cmu.c --- old/dovecot-lda/src/sieve-cmu.c 2006-02-08 15:19:08.000000000 +0100 +++ new/dovecot-lda/src/sieve-cmu.c 2006-05-25 07:39:05.000000000 +0200 @@ -106,14 +106,17 @@ /* ok, let's see if we've redirected this message before */ if (duplicate_check(dupeid, strlen(dupeid), sd->username)) { /*duplicate_log(m->id, sd->username, "redirect");*/ - i_info("Duplicated redirection (%s: %s -> %s)", m->id, - sd->username, rc->addr); + i_info("discarded duplicate forward (%s -> %s)", + str_sanitize(m->id, 80), str_sanitize(rc->addr, 80)); return SIEVE_OK; } } if ((res = mail_send_forward(m->mail, rc->addr)) == 0) { /* mark this message as redirected */ + i_info("forwarded id %s to <%s>", + m->id == NULL ? "" : str_sanitize(m->id, 80), + str_sanitize(rc->addr, 80)); if (dupeid != NULL) { duplicate_mark(dupeid, strlen(dupeid), sd->username, ioloop_time + DUPLICATE_DEFAULT_KEEP); @@ -131,22 +134,13 @@ static int sieve_discard(void *ac __attribute__((unused)), void *ic __attribute__((unused)), - void *sc, void *mc, + void *sc __attribute__((unused)), void *mc, const char **errmsg __attribute__((unused))) { - script_data_t *sd = (script_data_t *) sc; sieve_msgdata_t *md = mc; /* ok, we won't file it, but log it */ - if (md->id && strlen(md->id) < 80) { - i_info("sieve: discarded message to %s id %s", - sd->username, str_sanitize(md->id, 80)); - } - else { - i_info("sieve: discarded message to %s", - sd->username); - } - + i_info("discarded id %s", md->id == NULL ? "" : str_sanitize(md->id, 80)); return SIEVE_OK; } @@ -166,12 +160,14 @@ } if (strlen(md->return_path) == 0) { - i_info("sieve: discarded reject to <> for %s id %s", - sd->username, str_sanitize(md->id, 80)); + i_info("discarded reject to <> id %s", + md->id == NULL ? "" : str_sanitize(md->id, 80)); return SIEVE_OK; } if ((res = mail_send_rejection(md->mail, sd->username, rc->msg)) == 0) { + i_info("rejected id %s", + md->id == NULL ? "" : str_sanitize(md->id, 80)); return SIEVE_OK; } else { if (res == -1) { @@ -238,6 +234,8 @@ if (save_mail(sd->storage, fc->mailbox, md->mail, flags, keywords) < 0) return SIEVE_FAIL; + + i_info("saved mail to %s", md->mailbox); return SIEVE_OK; } @@ -398,8 +396,7 @@ if (sd->errors == NULL) { sd->errors = str_new(default_pool, 1024); - i_info("sieve parse error for %s: line %d: %s", - sd->username, lineno, msg); + i_info("sieve parse error: line %d: %s", lineno, msg); } str_printfa(sd->errors, "line %d: %s\n", lineno, msg); @@ -408,13 +405,10 @@ static int sieve_execute_error_handler(const char *msg, void *ic __attr_unused__, - void *sc, void *mc __attr_unused__) + void *sc __attr_unused__, + void *mc __attr_unused__) { - script_data_t *sd = (script_data_t *) sc; - - i_info("sieve runtime error for %s: %s", - sd->username, msg); - + i_info("sieve runtime error: %s", msg); return SIEVE_OK; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/dovecot-lda/src/smtpclient.c new/dovecot-lda/src/smtpclient.c --- old/dovecot-lda/src/smtpclient.c 2006-01-13 19:31:30.000000000 +0100 +++ new/dovecot-lda/src/smtpclient.c 2006-05-25 07:39:05.000000000 +0200 @@ -40,7 +40,7 @@ * */ /* - * $Id: smtpclient.c,v 1.3 2006/01/13 15:15:52 cras Exp $ + * $Id: smtpclient.c,v 1.4 2006/05/12 18:24:40 cras Exp $ */ #include "common.h" @@ -67,18 +67,12 @@ close(fds[1]); /* make the pipe be stdin */ dup2(fds[0], 0); - execv("/usr/lib/sendmail", (char **) argv); - - /* if we're here we suck */ - printf("451 lmtpd: didn't exec() sendmail?!?\r\n"); - i_fatal("couldn't exec() sendmail"); + (void)execv(sieve_set->sendmail_path, (char **)argv); + i_fatal("couldn't exec() sendmail: %m"); } - if (p < 0) { - /* failure */ - *sm = NULL; - return p; - } + if (p == -1) + i_fatal("fork() failed: %m"); /* parent */ close(fds[0]); ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun...