diff options
Diffstat (limited to 'mail/cyrus-imapd/patches/patch-ae')
-rw-r--r-- | mail/cyrus-imapd/patches/patch-ae | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/mail/cyrus-imapd/patches/patch-ae b/mail/cyrus-imapd/patches/patch-ae new file mode 100644 index 00000000000..02384394cec --- /dev/null +++ b/mail/cyrus-imapd/patches/patch-ae @@ -0,0 +1,80 @@ +$NetBSD: patch-ae,v 1.6 2006/10/09 12:46:01 obache Exp $ + +--- imap/backend.c.orig 2006-02-08 05:57:27.000000000 +0900 ++++ imap/backend.c +@@ -264,25 +264,28 @@ static void timed_out(int sig) + } + } + +-struct backend *backend_connect(struct backend *ret, const char *server, ++struct backend *backend_connect(struct backend *ret_backend, const char *server, + struct protocol_t *prot, const char *userid, + const char **auth_status) + { + /* need to (re)establish connection to server or create one */ + int sock = -1; + int r; +- int err = 0; ++ int err = -1; + struct addrinfo hints, *res0 = NULL, *res1 = NULL, *res; + struct sockaddr_un sunsock; + char buf[2048], *mechlist = NULL; + struct sigaction action; ++ struct backend *ret; + +- if (!ret) { ++ if (!ret_backend) { + ret = xmalloc(sizeof(struct backend)); + memset(ret, 0, sizeof(struct backend)); + strlcpy(ret->hostname, server, sizeof(ret->hostname)); + ret->timeout = NULL; + } ++ else ++ ret = ret_backend; + + if (server[0] == '/') { /* unix socket */ + res0 = &hints; +@@ -312,7 +315,7 @@ struct backend *backend_connect(struct b + if (err) { + syslog(LOG_ERR, "getaddrinfo(%s) failed: %s", + server, gai_strerror(err)); +- free(ret); ++ if (!ret_backend) free(ret); + return NULL; + } + /* Get addrinfo struct for local interface. */ +@@ -363,7 +366,7 @@ struct backend *backend_connect(struct b + if (res0 != &hints) + freeaddrinfo(res0); + syslog(LOG_ERR, "connect(%s) failed: %m", server); +- free(ret); ++ if (!ret_backend) free(ret); + return NULL; + } + memcpy(&ret->addr, res->ai_addr, res->ai_addrlen); +@@ -381,7 +384,7 @@ struct backend *backend_connect(struct b + syslog(LOG_ERR, + "backend_connect(): couldn't read initial greeting: %s", + ret->in->error ? ret->in->error : "(null)"); +- free(ret); ++ if (!ret_backend) free(ret); + close(sock); + return NULL; + } +@@ -396,13 +399,15 @@ struct backend *backend_connect(struct b + if ((r = backend_authenticate(ret, prot, &mechlist, userid, auth_status))) { + syslog(LOG_ERR, "couldn't authenticate to backend server: %s", + sasl_errstring(r, NULL, NULL)); +- free(ret); ++ if (!ret_backend) free(ret); + close(sock); + ret = NULL; + } + } + + if (mechlist) free(mechlist); ++ ++ if (!ret_backend) ret_backend = ret; + + return ret; + } |