sieve problems (continued)

Christian Schulte cs at schulte.it
Sat May 29 22:13:29 EDT 2004


Bob Tito wrote:
> 
> Here's the config:
> configdirectory: /var/imap
> partition-default: /var/spool/imap
> unixhierarchysep: yes
> altnamespace: yes
> allowplaintext: yes
> quotawarn: 90
> imapidlepoll: 60
> admins: cyrus
> singleinstancestore: yes
> duplicatesuppression: yes
> sieveusehomedir: false
> sievedir: /var/imap/sieve
> sendmail: /usr/sbin/sendmail
> postmaster: postmaster
> sasl_mech_list: PLAIN LOGIN
> sasl_pwcheck_method: auxprop
> sasl_auxprop_plugin: sql
> sasl_password_format: crypt
> sasl_sql_user: someuser ;-)
> sasl_sql_passwd: somepassword ;-)
> sasl_sql_hostnames: localhost
> sasl_sql_database: mail
> sasl_sql_select: SELECT password FROM accountuser WHERE username = '%u'
> tls_cert_file: /var/imap/server.pem
> tls_key_file: /var/imap/server.pem
> tls_ca_file: /var/imap/server.pem
> tls_ca_path: /var/imap/server.pem
> lmtp_overquota_perm_failure: yes
> lmtp_over_quota_perm_failure: yes
> lmtp_downcase_rcpt: yes
> 
> 

Does the attached patch fix the problem ? At least it was reproduceable 
now and the patch fixed it here.

--
Christian
-------------- next part --------------
--- cyrus-imapd-2.2.5.old/imap/lmtpd.c	2004-05-22 05:45:51.000000000 +0200
+++ cyrus-imapd-2.2.5/imap/lmtpd.c	2004-05-29 17:51:43.000000000 +0200
@@ -410,7 +410,8 @@
 
 #ifdef USE_SIEVE
 	    mydata.cur_rcpt = n;
-	    r = run_sieve(user, domain, mailbox, sieve_interp, &mydata);
+	    r = run_sieve(user, domain, mailbox, sieve_interp, &mydata,
+	                  &lmtpd_namespace);
 	    /* if there was no sieve script, or an error during execution,
 	       r is non-zero and we'll do normal delivery */
 #else
--- cyrus-imapd-2.2.5.old/imap/lmtp_sieve.c	2004-05-22 05:45:51.000000000 +0200
+++ cyrus-imapd-2.2.5/imap/lmtp_sieve.c	2004-05-29 17:54:44.000000000 +0200
@@ -821,7 +821,8 @@
 }
 
 int run_sieve(const char *user, const char *domain, const char *mailbox,
-	      sieve_interp_t *interp, sieve_msgdata_t *msgdata)
+	      sieve_interp_t *interp, sieve_msgdata_t *msgdata,
+	      struct namespace *lmtpd_namespace)
 {
     char fname[MAX_MAILBOX_PATH+1];
     int r = 0;
@@ -830,6 +831,7 @@
 	script_data_t *sdata = NULL;
 	sieve_bytecode_t *bc = NULL;
 	char userbuf[MAX_MAILBOX_NAME+1];
+	char authuserbuf[MAX_MAILBOX_NAME +1];
 
 	sdata = (script_data_t *) xmalloc(sizeof(script_data_t));
 
@@ -838,9 +840,16 @@
 	    strlcat(userbuf, "@", sizeof(userbuf));
 	    strlcat(userbuf, domain, sizeof(userbuf));
 	}
+        strlcpy(authuserbuf, userbuf, sizeof(authuserbuf));
+	if (config_getswitch(IMAPOPT_UNIXHIERARCHYSEP)) {
+	    mboxname_hiersep_toexternal(lmtpd_namespace, authuserbuf,
+	                                (domain ?
+	                                 strcspn(authuserbuf, "@")
+	                                     : strlen(authuserbuf)));
+	}
 	sdata->username = userbuf;
 	sdata->mailboxname = mailbox;
-	sdata->authstate = auth_newstate(userbuf);
+	sdata->authstate = auth_newstate(authuserbuf);
 
 	r = sieve_script_load(fname, &bc);
 	if (r == SIEVE_OK) {
--- cyrus-imapd-2.2.5.old/imap/lmtp_sieve.h	2004-02-12 03:32:23.000000000 +0100
+++ cyrus-imapd-2.2.5/imap/lmtp_sieve.h	2004-05-29 17:51:25.000000000 +0200
@@ -70,6 +70,7 @@
 
 sieve_interp_t *setup_sieve(void);
 int run_sieve(const char *user, const char *domain, const char *mailbox,
-	      sieve_interp_t *interp, sieve_msgdata_t *mydata);
+	      sieve_interp_t *interp, sieve_msgdata_t *mydata,
+	      struct namespace *lmtpd_namespace);
 
 #endif /* LMTP_SIEVE_H */


More information about the Info-cyrus mailing list