deliver.c (223701) | deliver.c (244833) |
---|---|
1/* | 1/* |
2 * Copyright (c) 1998-2010 Sendmail, Inc. and its suppliers. | 2 * Copyright (c) 1998-2010, 2012 Sendmail, Inc. and its suppliers. |
3 * All rights reserved. 4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. 5 * Copyright (c) 1988, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * By using this file, you agree to the terms and conditions set 9 * forth in the LICENSE file which can be found at the top level of 10 * the sendmail distribution. 11 * 12 */ 13 14#include <sendmail.h> 15#include <sm/time.h> 16 | 3 * All rights reserved. 4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. 5 * Copyright (c) 1988, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * By using this file, you agree to the terms and conditions set 9 * forth in the LICENSE file which can be found at the top level of 10 * the sendmail distribution. 11 * 12 */ 13 14#include <sendmail.h> 15#include <sm/time.h> 16 |
17SM_RCSID("@(#)$Id: deliver.c,v 8.1024 2011/01/12 23:52:59 ca Exp $") | 17SM_RCSID("@(#)$Id: deliver.c,v 8.1027 2012/12/19 02:49:21 ca Exp $") |
18 19#if HASSETUSERCONTEXT 20# include <login_cap.h> 21#endif /* HASSETUSERCONTEXT */ 22 23#if NETINET || NETINET6 24# include <arpa/inet.h> 25#endif /* NETINET || NETINET6 */ --- 6 unchanged lines hidden (view full) --- 32static void dup_queue_file __P((ENVELOPE *, ENVELOPE *, int)); 33static void mailfiletimeout __P((int)); 34static void endwaittimeout __P((int)); 35static int parse_hostsignature __P((char *, char **, MAILER *)); 36static void sendenvelope __P((ENVELOPE *, int)); 37static int coloncmp __P((const char *, const char *)); 38 39#if STARTTLS | 18 19#if HASSETUSERCONTEXT 20# include <login_cap.h> 21#endif /* HASSETUSERCONTEXT */ 22 23#if NETINET || NETINET6 24# include <arpa/inet.h> 25#endif /* NETINET || NETINET6 */ --- 6 unchanged lines hidden (view full) --- 32static void dup_queue_file __P((ENVELOPE *, ENVELOPE *, int)); 33static void mailfiletimeout __P((int)); 34static void endwaittimeout __P((int)); 35static int parse_hostsignature __P((char *, char **, MAILER *)); 36static void sendenvelope __P((ENVELOPE *, int)); 37static int coloncmp __P((const char *, const char *)); 38 39#if STARTTLS |
40# include <openssl/err.h> |
|
40static int starttls __P((MAILER *, MCI *, ENVELOPE *)); 41static int endtlsclt __P((MCI *)); 42#endif /* STARTTLS */ 43# if STARTTLS || SASL 44static bool iscltflgset __P((ENVELOPE *, int)); 45# endif /* STARTTLS || SASL */ 46 47/* --- 4224 unchanged lines hidden (view full) --- 4272 { 4273 (void) sm_strlcpyn(bp, SPACELEFT(buf, bp), 2, ", mailer=", 4274 m->m_name); 4275 bp += strlen(bp); 4276 } 4277 4278 /* pri: changes with each delivery attempt */ 4279 (void) sm_snprintf(bp, SPACELEFT(buf, bp), ", pri=%ld", | 41static int starttls __P((MAILER *, MCI *, ENVELOPE *)); 42static int endtlsclt __P((MCI *)); 43#endif /* STARTTLS */ 44# if STARTTLS || SASL 45static bool iscltflgset __P((ENVELOPE *, int)); 46# endif /* STARTTLS || SASL */ 47 48/* --- 4224 unchanged lines hidden (view full) --- 4273 { 4274 (void) sm_strlcpyn(bp, SPACELEFT(buf, bp), 2, ", mailer=", 4275 m->m_name); 4276 bp += strlen(bp); 4277 } 4278 4279 /* pri: changes with each delivery attempt */ 4280 (void) sm_snprintf(bp, SPACELEFT(buf, bp), ", pri=%ld", |
4280 e->e_msgpriority); | 4281 PRT_NONNEGL(e->e_msgpriority)); |
4281 bp += strlen(bp); 4282 4283 /* relay: max 66 bytes for IPv4 addresses */ 4284 if (mci != NULL && mci->mci_host != NULL) 4285 { 4286 extern SOCKADDR CurHostAddr; 4287 4288 (void) sm_strlcpyn(bp, SPACELEFT(buf, bp), 2, ", relay=", --- 1903 unchanged lines hidden (view full) --- 6192 ssl_err = SSL_get_error(clt_ssl, result); 6193 i = tls_retry(clt_ssl, rfd, wfd, tlsstart, 6194 TimeOuts.to_starttls, ssl_err, "client"); 6195 if (i > 0) 6196 goto ssl_retry; 6197 6198 if (LogLevel > 5) 6199 { | 4282 bp += strlen(bp); 4283 4284 /* relay: max 66 bytes for IPv4 addresses */ 4285 if (mci != NULL && mci->mci_host != NULL) 4286 { 4287 extern SOCKADDR CurHostAddr; 4288 4289 (void) sm_strlcpyn(bp, SPACELEFT(buf, bp), 2, ", relay=", --- 1903 unchanged lines hidden (view full) --- 6193 ssl_err = SSL_get_error(clt_ssl, result); 6194 i = tls_retry(clt_ssl, rfd, wfd, tlsstart, 6195 TimeOuts.to_starttls, ssl_err, "client"); 6196 if (i > 0) 6197 goto ssl_retry; 6198 6199 if (LogLevel > 5) 6200 { |
6201 unsigned long l; 6202 const char *sr; 6203 6204 l = ERR_peek_error(); 6205 sr = ERR_reason_error_string(l); |
|
6200 sm_syslog(LOG_WARNING, NOQID, | 6206 sm_syslog(LOG_WARNING, NOQID, |
6201 "STARTTLS=client, error: connect failed=%d, SSL_error=%d, errno=%d, retry=%d", 6202 result, ssl_err, errno, i); 6203 if (LogLevel > 8) | 6207 "STARTTLS=client, error: connect failed=%d, reason=%s, SSL_error=%d, errno=%d, retry=%d", 6208 result, sr == NULL ? "unknown" : sr, ssl_err, 6209 errno, i); 6210 if (LogLevel > 9) |
6204 tlslogerr("client"); 6205 } 6206 6207 SSL_free(clt_ssl); 6208 clt_ssl = NULL; 6209 return EX_SOFTWARE; 6210 } 6211 mci->mci_ssl = clt_ssl; --- 66 unchanged lines hidden --- | 6211 tlslogerr("client"); 6212 } 6213 6214 SSL_free(clt_ssl); 6215 clt_ssl = NULL; 6216 return EX_SOFTWARE; 6217 } 6218 mci->mci_ssl = clt_ssl; --- 66 unchanged lines hidden --- |