On Wed, May 24, 2017, at 04:17 PM, Don Lewis wrote:
> This first version of the patch worked for me.  A problem with
> 
> the second version of the patch is that mlookup() gets called in
> 
> a bunch of different places and the server variable would need
> 
> to be initialized in all of them.  In verify_user(), mlookup is called
> 
> several times, so server would have to be set to NULL before
> 
> each call.
> 
> 

Oh, good catch, I didn't look for other occurrences.  

Attached is an updated version of my patch that initialises these
variables correctly.

Cheers,

ellie
diff --git a/imap/lmtpd.c b/imap/lmtpd.c
index 5fe507a..7428f72 100644
--- a/imap/lmtpd.c
+++ b/imap/lmtpd.c
@@ -712,9 +712,10 @@ int deliver(message_data_t *msgdata, char *authuser,
 
     /* loop through each recipient, attempting delivery for each */
     for (n = 0; n < nrcpts; n++) {
-	char namebuf[MAX_MAILBOX_BUFFER] = "", *server;
+	char namebuf[MAX_MAILBOX_BUFFER] = "";
 	char userbuf[MAX_MAILBOX_BUFFER];
 	const char *rcpt, *user, *domain, *mailbox;
+	char *server = NULL;
 	int r = 0;
 
 	rcpt = msg_getrcptall(msgdata, n);
@@ -954,7 +955,7 @@ static int verify_user(const char *user, const char *domain, char *mailbox,
     }
 
     if (!r) {
-	char *server, *acl;
+	char *server = NULL, *acl = NULL;
 	long aclcheck = !user ? ACL_POST : 0;
 	/*
 	 * check to see if mailbox exists and we can append to it:
@@ -1061,8 +1062,9 @@ FILE *spoolfile(message_data_t *msgdata)
        (don't bother if we're only a proxy) */
     n = isproxy ? 0 : msg_getnumrcpt(msgdata);
     for (i = 0; !f && (i < n); i++) {
-	char namebuf[MAX_MAILBOX_BUFFER] = "", *server;
+	char namebuf[MAX_MAILBOX_BUFFER] = "";
 	const char *user, *domain, *mailbox;
+	char *server = NULL;
 	int r;
 
 	/* build the mailboxname from the recipient address */
----
Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus

Reply via email to