Deleted Added
full compact
mci.c (120259) mci.c (132946)
1/*
2 * Copyright (c) 1998-2003 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 *
1/*
2 * Copyright (c) 1998-2003 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 * $FreeBSD: head/contrib/sendmail/src/mci.c 120259 2003-09-19 23:14:57Z gshapiro $
12 * $FreeBSD: head/contrib/sendmail/src/mci.c 132946 2004-08-01 01:16:16Z gshapiro $
13 */
14
15#include <sendmail.h>
16
13 */
14
15#include <sendmail.h>
16
17SM_RCSID("@(#)$Id: mci.c,v 8.205.2.4 2003/03/31 17:35:27 ca Exp $")
17SM_RCSID("@(#)$Id: mci.c,v 8.211 2003/03/31 17:35:50 ca Exp $")
18
19#if NETINET || NETINET6
20# include <arpa/inet.h>
21#endif /* NETINET || NETINET6 */
22
23#include <dirent.h>
24
25static int mci_generate_persistent_path __P((const char *, char *,

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

483 SM_FREE_CLR(mci->mci_rstatus);
484 if (rstat != NULL)
485 mci->mci_rstatus = sm_strdup_x(rstat);
486}
487/*
488** MCI_DUMP -- dump the contents of an MCI structure.
489**
490** Parameters:
18
19#if NETINET || NETINET6
20# include <arpa/inet.h>
21#endif /* NETINET || NETINET6 */
22
23#include <dirent.h>
24
25static int mci_generate_persistent_path __P((const char *, char *,

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

483 SM_FREE_CLR(mci->mci_rstatus);
484 if (rstat != NULL)
485 mci->mci_rstatus = sm_strdup_x(rstat);
486}
487/*
488** MCI_DUMP -- dump the contents of an MCI structure.
489**
490** Parameters:
491** fp -- output file pointer
491** mci -- the MCI structure to dump.
492**
493** Returns:
494** none.
495**
496** Side Effects:
497** none.
498*/

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

525 { MCIF_TLS, "TLS" },
526 { MCIF_TLSACT, "TLSACT" },
527#endif /* STARTTLS */
528 { MCIF_DLVR_BY, "DLVR_BY" },
529 { 0, NULL }
530};
531
532void
492** mci -- the MCI structure to dump.
493**
494** Returns:
495** none.
496**
497** Side Effects:
498** none.
499*/

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

526 { MCIF_TLS, "TLS" },
527 { MCIF_TLSACT, "TLSACT" },
528#endif /* STARTTLS */
529 { MCIF_DLVR_BY, "DLVR_BY" },
530 { 0, NULL }
531};
532
533void
533mci_dump(mci, logit)
534mci_dump(fp, mci, logit)
535 SM_FILE_T *fp;
534 register MCI *mci;
535 bool logit;
536{
537 register char *p;
538 char *sep;
539 char buf[4000];
540
541 sep = logit ? " " : "\n\t";

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

593 p += strlen(p);
594 (void) sm_snprintf(p, SPACELEFT(buf, p),
595 "host=%s, lastuse=%s",
596 mci->mci_host, ctime(&mci->mci_lastuse));
597printit:
598 if (logit)
599 sm_syslog(LOG_DEBUG, CurEnv->e_id, "%.1000s", buf);
600 else
536 register MCI *mci;
537 bool logit;
538{
539 register char *p;
540 char *sep;
541 char buf[4000];
542
543 sep = logit ? " " : "\n\t";

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

595 p += strlen(p);
596 (void) sm_snprintf(p, SPACELEFT(buf, p),
597 "host=%s, lastuse=%s",
598 mci->mci_host, ctime(&mci->mci_lastuse));
599printit:
600 if (logit)
601 sm_syslog(LOG_DEBUG, CurEnv->e_id, "%.1000s", buf);
602 else
601 (void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "%s\n", buf);
603 (void) sm_io_fprintf(fp, SM_TIME_DEFAULT, "%s\n", buf);
602}
603/*
604** MCI_DUMP_ALL -- print the entire MCI cache
605**
606** Parameters:
604}
605/*
606** MCI_DUMP_ALL -- print the entire MCI cache
607**
608** Parameters:
609** fp -- output file pointer
607** logit -- if set, log the result instead of printing
608** to stdout.
609**
610** Returns:
611** none.
612*/
613
614void
610** logit -- if set, log the result instead of printing
611** to stdout.
612**
613** Returns:
614** none.
615*/
616
617void
615mci_dump_all(logit)
618mci_dump_all(fp, logit)
619 SM_FILE_T *fp;
616 bool logit;
617{
618 register int i;
619
620 if (MciCache == NULL)
621 return;
622
623 for (i = 0; i < MaxMciCache; i++)
620 bool logit;
621{
622 register int i;
623
624 if (MciCache == NULL)
625 return;
626
627 for (i = 0; i < MaxMciCache; i++)
624 mci_dump(MciCache[i], logit);
628 mci_dump(fp, MciCache[i], logit);
625}
626/*
627** MCI_LOCK_HOST -- Lock host while sending.
628**
629** If we are contacting a host, we'll need to
630** update the status information in the host status
631** file, and if we want to do that, we ought to have
632** locked it. This has the (according to some)

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

921 break;
922
923 case 'U': /* last usage time */
924 mci->mci_lastuse = atol(&buf[1]);
925 break;
926
927 case '.': /* end of file */
928 if (tTd(56, 93))
629}
630/*
631** MCI_LOCK_HOST -- Lock host while sending.
632**
633** If we are contacting a host, we'll need to
634** update the status information in the host status
635** file, and if we want to do that, we ought to have
636** locked it. This has the (according to some)

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

925 break;
926
927 case 'U': /* last usage time */
928 mci->mci_lastuse = atol(&buf[1]);
929 break;
930
931 case '.': /* end of file */
932 if (tTd(56, 93))
929 mci_dump(mci, false);
933 mci_dump(sm_debug_file(), mci, false);
930 return 0;
931
932 default:
933 sm_syslog(LOG_CRIT, NOQID,
934 "%s: line %d: Unknown host status line \"%s\"",
935 FileName == NULL ? mci->mci_host : FileName,
936 LineNumber, buf);
937 LineNumber = saveLineNumber;

--- 561 unchanged lines hidden ---
934 return 0;
935
936 default:
937 sm_syslog(LOG_CRIT, NOQID,
938 "%s: line %d: Unknown host status line \"%s\"",
939 FileName == NULL ? mci->mci_host : FileName,
940 LineNumber, buf);
941 LineNumber = saveLineNumber;

--- 561 unchanged lines hidden ---