From: Timo Sirainen Date: Tue, 15 Jun 2004 02:44:05 +0000 (+0300) Subject: Added support for vpopmail pop-before-smtp relay X-Git-Tag: 1.1.alpha1~3974 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0772d725fef3cdb013a50cc1f79e46730bf11f7;p=thirdparty%2Fdovecot%2Fcore.git Added support for vpopmail pop-before-smtp relay --HG-- branch : HEAD --- diff --git a/src/auth/passdb-vpopmail.c b/src/auth/passdb-vpopmail.c index 1cf77eb558..28d52279f1 100644 --- a/src/auth/passdb-vpopmail.c +++ b/src/auth/passdb-vpopmail.c @@ -14,6 +14,8 @@ #include "userdb-vpopmail.h" +#include + static void vpopmail_verify_plain(struct auth_request *request, const char *password, verify_plain_callback_t *callback) @@ -55,6 +57,25 @@ vpopmail_verify_plain(struct auth_request *request, const char *password, return; } +#ifdef HAVE_VPOPMAIL_OPEN_SMTP_RELAY + if (strcmp(request->protocol, "POP3") == 0 || + strcmp(request->protocol, "IMAP") == 0) { + const char *host = net_ip2addr(&request->remote_ip); + if (host != NULL) { + /* use putenv() directly rather than env_put() which + would leak memory every time we got here. use a + static buffer for putenv() as SUSv2 requirements + would otherwise corrupt our environment later. */ + static char ip_env[256]; + + i_snprintf(ip_env, sizeof(ip_env), + "TCPREMOTEIP=%s", host); + putenv(ip_env); + open_smtp_relay(); + } + } +#endif + callback(PASSDB_RESULT_OK, request); }