Deleted Added
full compact
mci.c (90795) mci.c (94337)
1/*
1/*
2 * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
2 * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 * Copyright (c) 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
3 * All rights reserved.
4 * Copyright (c) 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/* $FreeBSD: head/contrib/sendmail/src/mci.c 90795 2002-02-17 21:58:34Z gshapiro $ */
14/* $FreeBSD: head/contrib/sendmail/src/mci.c 94337 2002-04-10 03:06:22Z gshapiro $ */
15
16#include <sendmail.h>
17
15
16#include <sendmail.h>
17
18SM_RCSID("@(#)$Id: mci.c,v 8.202 2001/11/05 22:12:17 ca Exp $")
18SM_RCSID("@(#)$Id: mci.c,v 8.204 2002/02/22 18:24:57 ca Exp $")
19
20#if NETINET || NETINET6
21# include <arpa/inet.h>
22#endif /* NETINET || NETINET6 */
23
24#include <dirent.h>
25
26static int mci_generate_persistent_path __P((const char *, char *,

--- 127 unchanged lines hidden (view full) ---

154 for (i = 0; i < MaxMciCache; i++)
155 {
156 mci = MciCache[i];
157 if (mci == NULL || mci->mci_state == MCIS_CLOSED)
158 {
159 bestmci = &MciCache[i];
160 continue;
161 }
19
20#if NETINET || NETINET6
21# include <arpa/inet.h>
22#endif /* NETINET || NETINET6 */
23
24#include <dirent.h>
25
26static int mci_generate_persistent_path __P((const char *, char *,

--- 127 unchanged lines hidden (view full) ---

154 for (i = 0; i < MaxMciCache; i++)
155 {
156 mci = MciCache[i];
157 if (mci == NULL || mci->mci_state == MCIS_CLOSED)
158 {
159 bestmci = &MciCache[i];
160 continue;
161 }
162 if ((mci->mci_lastuse + MciCacheTimeout < now ||
162 if ((mci->mci_lastuse + MciCacheTimeout <= now ||
163 (mci->mci_mailer != NULL &&
164 mci->mci_mailer->m_maxdeliveries > 0 &&
165 mci->mci_deliveries + 1 >= mci->mci_mailer->m_maxdeliveries))&&
166 mci != savemci)
167 {
168 /* connection idle too long or too many deliveries */
169 bestmci = &MciCache[i];
170

--- 214 unchanged lines hidden (view full) ---

385 (struct sockaddr *) &CurHostAddr, &socklen);
386 }
387 }
388 if (mci->mci_state == MCIS_CLOSED)
389 {
390 time_t now = curtime();
391
392 /* if this info is stale, ignore it */
163 (mci->mci_mailer != NULL &&
164 mci->mci_mailer->m_maxdeliveries > 0 &&
165 mci->mci_deliveries + 1 >= mci->mci_mailer->m_maxdeliveries))&&
166 mci != savemci)
167 {
168 /* connection idle too long or too many deliveries */
169 bestmci = &MciCache[i];
170

--- 214 unchanged lines hidden (view full) ---

385 (struct sockaddr *) &CurHostAddr, &socklen);
386 }
387 }
388 if (mci->mci_state == MCIS_CLOSED)
389 {
390 time_t now = curtime();
391
392 /* if this info is stale, ignore it */
393 if (now > mci->mci_lastuse + MciInfoTimeout)
393 if (mci->mci_lastuse + MciInfoTimeout <= now)
394 {
395 mci->mci_lastuse = now;
396 mci->mci_errno = 0;
397 mci->mci_exitstat = EX_OK;
398 }
399 }
400
401 return mci;

--- 105 unchanged lines hidden (view full) ---

507{
508 { MCIF_VALID, "VALID" },
509 { MCIF_CACHED, "CACHED" },
510 { MCIF_ESMTP, "ESMTP" },
511 { MCIF_EXPN, "EXPN" },
512 { MCIF_SIZE, "SIZE" },
513 { MCIF_8BITMIME, "8BITMIME" },
514 { MCIF_7BIT, "7BIT" },
394 {
395 mci->mci_lastuse = now;
396 mci->mci_errno = 0;
397 mci->mci_exitstat = EX_OK;
398 }
399 }
400
401 return mci;

--- 105 unchanged lines hidden (view full) ---

507{
508 { MCIF_VALID, "VALID" },
509 { MCIF_CACHED, "CACHED" },
510 { MCIF_ESMTP, "ESMTP" },
511 { MCIF_EXPN, "EXPN" },
512 { MCIF_SIZE, "SIZE" },
513 { MCIF_8BITMIME, "8BITMIME" },
514 { MCIF_7BIT, "7BIT" },
515 { MCIF_MULTSTAT, "MULTSTAT" },
516 { MCIF_INHEADER, "INHEADER" },
517 { MCIF_CVT8TO7, "CVT8TO7" },
518 { MCIF_DSN, "DSN" },
519 { MCIF_8BITOK, "8BITOK" },
520 { MCIF_CVT7TO8, "CVT7TO8" },
521 { MCIF_INMIME, "INMIME" },
522 { MCIF_AUTH, "AUTH" },
523 { MCIF_AUTHACT, "AUTHACT" },

--- 784 unchanged lines hidden (view full) ---

1308 ret = stat(pathname, &statbuf);
1309 if (ret < 0)
1310 {
1311 if (tTd(56, 2))
1312 sm_dprintf("mci_purge_persistent: Failed to stat %s: %s\n",
1313 pathname, sm_errstring(errno));
1314 return ret;
1315 }
515 { MCIF_INHEADER, "INHEADER" },
516 { MCIF_CVT8TO7, "CVT8TO7" },
517 { MCIF_DSN, "DSN" },
518 { MCIF_8BITOK, "8BITOK" },
519 { MCIF_CVT7TO8, "CVT7TO8" },
520 { MCIF_INMIME, "INMIME" },
521 { MCIF_AUTH, "AUTH" },
522 { MCIF_AUTHACT, "AUTHACT" },

--- 784 unchanged lines hidden (view full) ---

1307 ret = stat(pathname, &statbuf);
1308 if (ret < 0)
1309 {
1310 if (tTd(56, 2))
1311 sm_dprintf("mci_purge_persistent: Failed to stat %s: %s\n",
1312 pathname, sm_errstring(errno));
1313 return ret;
1314 }
1316 if (curtime() - statbuf.st_mtime < MciInfoTimeout)
1315 if (curtime() - statbuf.st_mtime <= MciInfoTimeout)
1317 return 1;
1318 if (hostname != NULL)
1319 {
1320 /* remove the file */
1321 ret = unlink(pathname);
1322 if (ret < 0)
1323 {
1324 if (LogLevel > 8)

--- 166 unchanged lines hidden ---
1316 return 1;
1317 if (hostname != NULL)
1318 {
1319 /* remove the file */
1320 ret = unlink(pathname);
1321 if (ret < 0)
1322 {
1323 if (LogLevel > 8)

--- 166 unchanged lines hidden ---