deliver.c (98841) | deliver.c (102528) |
---|---|
1/* 2 * Copyright (c) 1998-2002 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 <sys/time.h> 16 | 1/* 2 * Copyright (c) 1998-2002 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 <sys/time.h> 16 |
17SM_RCSID("@(#)$Id: deliver.c,v 8.940 2002/06/06 00:03:16 gshapiro Exp $") | 17SM_RCSID("@(#)$Id: deliver.c,v 8.940.2.3 2002/08/16 14:56:01 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 */ --- 982 unchanged lines hidden (view full) --- 1008 ee->e_xfp = NULL; 1009 1010 /* 1011 ** Make sure both are in the same directory. 1012 */ 1013 1014 (void) sm_strlcpy(f1buf, queuename(e, type), sizeof f1buf); 1015 (void) sm_strlcpy(f2buf, queuename(ee, type), sizeof f2buf); | 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 */ --- 982 unchanged lines hidden (view full) --- 1008 ee->e_xfp = NULL; 1009 1010 /* 1011 ** Make sure both are in the same directory. 1012 */ 1013 1014 (void) sm_strlcpy(f1buf, queuename(e, type), sizeof f1buf); 1015 (void) sm_strlcpy(f2buf, queuename(ee, type), sizeof f2buf); |
1016 1017 /* Force the df to disk if it's not there yet */ 1018 if (type == DATAFL_LETTER && e->e_dfp != NULL && 1019 sm_io_setinfo(e->e_dfp, SM_BF_COMMIT, NULL) < 0 && 1020 errno != EINVAL) 1021 { 1022 syserr("!dup_queue_file: can't commit %s", f1buf); 1023 /* NOTREACHED */ 1024 } 1025 |
|
1016 if (link(f1buf, f2buf) < 0) 1017 { 1018 int save_errno = errno; 1019 1020 syserr("sendall: link(%s, %s)", f1buf, f2buf); 1021 if (save_errno == EEXIST) 1022 { 1023 if (unlink(f2buf) < 0) --- 516 unchanged lines hidden (view full) --- 1540 SM_SET_H_ERRNO(0); 1541 ovr = true; 1542 1543 /* do config file checking of compatibility */ 1544#if _FFR_QUARANTINE 1545 quarantine = (e->e_quarmsg != NULL); 1546#endif /* _FFR_QUARANTINE */ 1547 rcode = rscheck("check_compat", e->e_from.q_paddr, to->q_paddr, | 1026 if (link(f1buf, f2buf) < 0) 1027 { 1028 int save_errno = errno; 1029 1030 syserr("sendall: link(%s, %s)", f1buf, f2buf); 1031 if (save_errno == EEXIST) 1032 { 1033 if (unlink(f2buf) < 0) --- 516 unchanged lines hidden (view full) --- 1550 SM_SET_H_ERRNO(0); 1551 ovr = true; 1552 1553 /* do config file checking of compatibility */ 1554#if _FFR_QUARANTINE 1555 quarantine = (e->e_quarmsg != NULL); 1556#endif /* _FFR_QUARANTINE */ 1557 rcode = rscheck("check_compat", e->e_from.q_paddr, to->q_paddr, |
1548 e, true, true, 3, NULL, e->e_id); | 1558 e, RSF_RMCOMM|RSF_COUNT, 3, NULL, 1559 e->e_id); |
1549 if (rcode == EX_OK) 1550 { 1551 /* do in-code checking if not discarding */ 1552 if (!bitset(EF_DISCARD, e->e_flags)) 1553 { 1554 rcode = checkcompat(to, e); 1555 ovr = false; 1556 } --- 785 unchanged lines hidden (view full) --- 2342 if (contextaddr != NULL) 2343 { 2344 struct passwd *pwd; 2345 2346 if (contextaddr->q_ruser != NULL) 2347 pwd = sm_getpwnam(contextaddr->q_ruser); 2348 else 2349 pwd = sm_getpwnam(contextaddr->q_user); | 1560 if (rcode == EX_OK) 1561 { 1562 /* do in-code checking if not discarding */ 1563 if (!bitset(EF_DISCARD, e->e_flags)) 1564 { 1565 rcode = checkcompat(to, e); 1566 ovr = false; 1567 } --- 785 unchanged lines hidden (view full) --- 2353 if (contextaddr != NULL) 2354 { 2355 struct passwd *pwd; 2356 2357 if (contextaddr->q_ruser != NULL) 2358 pwd = sm_getpwnam(contextaddr->q_ruser); 2359 else 2360 pwd = sm_getpwnam(contextaddr->q_user); |
2350 if (pwd != NULL) 2351 (void) setusercontext(NULL, 2352 pwd, pwd->pw_uid, 2353 LOGIN_SETRESOURCES|LOGIN_SETPRIORITY); | 2361 if (pwd != NULL && 2362 setusercontext(NULL, pwd, pwd->pw_uid, 2363 LOGIN_SETRESOURCES|LOGIN_SETPRIORITY) == -1 && 2364 suidwarn) 2365 { 2366 syserr("openmailer: setusercontext() failed"); 2367 exit(EX_TEMPFAIL); 2368 } |
2354 } 2355# endif /* HASSETUSERCONTEXT */ 2356 2357#if HASNICE 2358 /* tweak niceness */ 2359 if (m->m_nice != 0) 2360 (void) nice(m->m_nice); 2361#endif /* HASNICE */ --- 512 unchanged lines hidden (view full) --- 2874 usetls = !iscltflgset(e, D_NOTLS); 2875 2876 if (usetls) 2877 { 2878 host = macvalue(macid("{server_name}"), e); 2879 olderrors = Errors; 2880 QuickAbort = false; 2881 SuprErrs = true; | 2369 } 2370# endif /* HASSETUSERCONTEXT */ 2371 2372#if HASNICE 2373 /* tweak niceness */ 2374 if (m->m_nice != 0) 2375 (void) nice(m->m_nice); 2376#endif /* HASNICE */ --- 512 unchanged lines hidden (view full) --- 2889 usetls = !iscltflgset(e, D_NOTLS); 2890 2891 if (usetls) 2892 { 2893 host = macvalue(macid("{server_name}"), e); 2894 olderrors = Errors; 2895 QuickAbort = false; 2896 SuprErrs = true; |
2882 if (rscheck("try_tls", host, NULL, e, true, 2883 false, 7, host, NOQID) != EX_OK | 2897 if (rscheck("try_tls", host, NULL, e, 2898 RSF_RMCOMM, 7, host, NOQID) != EX_OK |
2884 || Errors > olderrors) 2885 usetls = false; 2886 SuprErrs = saveSuprErrs; 2887 QuickAbort = saveQuickAbort; 2888 } 2889 2890 if (usetls) 2891 { --- 51 unchanged lines hidden (view full) --- 2943 ** we have to drop the connection no matter what 2944 ** However, we call tls_server to give it the chance 2945 ** to log the problem and return an appropriate 2946 ** error code. 2947 */ 2948 2949 if (rscheck("tls_server", 2950 macvalue(macid("{verify}"), e), | 2899 || Errors > olderrors) 2900 usetls = false; 2901 SuprErrs = saveSuprErrs; 2902 QuickAbort = saveQuickAbort; 2903 } 2904 2905 if (usetls) 2906 { --- 51 unchanged lines hidden (view full) --- 2958 ** we have to drop the connection no matter what 2959 ** However, we call tls_server to give it the chance 2960 ** to log the problem and return an appropriate 2961 ** error code. 2962 */ 2963 2964 if (rscheck("tls_server", 2965 macvalue(macid("{verify}"), e), |
2951 NULL, e, true, true, 5, host, 2952 NOQID) != EX_OK || | 2966 NULL, e, RSF_RMCOMM|RSF_COUNT, 5, 2967 host, NOQID) != EX_OK || |
2953 Errors > olderrors || 2954 rcode == EX_SOFTWARE) 2955 { 2956 char enhsc[ENHSCLEN]; 2957 extern char MsgBuf[]; 2958 2959 if (ISSMTPCODE(MsgBuf) && 2960 extenhsc(MsgBuf + 4, ' ', enhsc) > 0) --- 275 unchanged lines hidden (view full) --- 3236 if (!QS_IS_UNMARKED(to->q_state)) 3237 continue; 3238 3239 /* mark recipient state as "ok so far" */ 3240 to->q_state = QS_OK; 3241 e->e_to = to->q_paddr; 3242# if STARTTLS 3243 i = rscheck("tls_rcpt", to->q_user, NULL, e, | 2968 Errors > olderrors || 2969 rcode == EX_SOFTWARE) 2970 { 2971 char enhsc[ENHSCLEN]; 2972 extern char MsgBuf[]; 2973 2974 if (ISSMTPCODE(MsgBuf) && 2975 extenhsc(MsgBuf + 4, ' ', enhsc) > 0) --- 275 unchanged lines hidden (view full) --- 3251 if (!QS_IS_UNMARKED(to->q_state)) 3252 continue; 3253 3254 /* mark recipient state as "ok so far" */ 3255 to->q_state = QS_OK; 3256 e->e_to = to->q_paddr; 3257# if STARTTLS 3258 i = rscheck("tls_rcpt", to->q_user, NULL, e, |
3244 true, true, 3, mci->mci_host, 3245 e->e_id); | 3259 RSF_RMCOMM|RSF_COUNT, 3, 3260 mci->mci_host, e->e_id); |
3246 if (i != EX_OK) 3247 { 3248 markfailure(e, to, mci, i, false); 3249 giveresponse(i, to->q_status, m, mci, 3250 ctladdr, xstart, e, to); 3251 if (i == EX_TEMPFAIL) 3252 { 3253 mci->mci_retryrcpt = true; --- 2900 unchanged lines hidden --- | 3261 if (i != EX_OK) 3262 { 3263 markfailure(e, to, mci, i, false); 3264 giveresponse(i, to->q_status, m, mci, 3265 ctladdr, xstart, e, to); 3266 if (i == EX_TEMPFAIL) 3267 { 3268 mci->mci_retryrcpt = true; --- 2900 unchanged lines hidden --- |