Deleted Added
full compact
conf.c (159613) conf.c (168520)
1/*
1/*
2 * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
2 * Copyright (c) 1998-2007 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 *
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 * $FreeBSD: head/contrib/sendmail/src/conf.c 159613 2006-06-14 16:25:31Z gshapiro $
12 * $FreeBSD: head/contrib/sendmail/src/conf.c 168520 2007-04-09 01:44:16Z gshapiro $
13 */
14
15#include <sendmail.h>
16
13 */
14
15#include <sendmail.h>
16
17SM_RCSID("@(#)$Id: conf.c,v 8.1082 2006/03/22 22:49:33 ca Exp $")
17SM_RCSID("@(#)$Id: conf.c,v 8.1128 2007/04/03 21:32:29 ca Exp $")
18
18
19#include <sm/sendmail.h>
19#include <sendmail/pathnames.h>
20#if NEWDB
21# include "sm/bdb.h"
22#endif /* NEWDB */
23
20#include <sendmail/pathnames.h>
21#if NEWDB
22# include "sm/bdb.h"
23#endif /* NEWDB */
24
25#include <daemon.h>
26#include "map.h"
27
24#ifdef DEC
25# if NETINET6
26/* for the IPv6 device lookup */
27# define _SOCKADDR_LEN
28# include <macros.h>
29# endif /* NETINET6 */
30#endif /* DEC */
31

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

154 { "restrictmailq", PRIV_RESTRICTMAILQ },
155 { "restrictqrun", PRIV_RESTRICTQRUN },
156 { "noetrn", PRIV_NOETRN },
157 { "noverb", PRIV_NOVERB },
158 { "authwarnings", PRIV_AUTHWARNINGS },
159 { "noreceipts", PRIV_NORECEIPTS },
160 { "nobodyreturn", PRIV_NOBODYRETN },
161 { "goaway", PRIV_GOAWAY },
28#ifdef DEC
29# if NETINET6
30/* for the IPv6 device lookup */
31# define _SOCKADDR_LEN
32# include <macros.h>
33# endif /* NETINET6 */
34#endif /* DEC */
35

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

158 { "restrictmailq", PRIV_RESTRICTMAILQ },
159 { "restrictqrun", PRIV_RESTRICTQRUN },
160 { "noetrn", PRIV_NOETRN },
161 { "noverb", PRIV_NOVERB },
162 { "authwarnings", PRIV_AUTHWARNINGS },
163 { "noreceipts", PRIV_NORECEIPTS },
164 { "nobodyreturn", PRIV_NOBODYRETN },
165 { "goaway", PRIV_GOAWAY },
162#if _FFR_PRIV_NOACTUALRECIPIENT
163 { "noactualrecipient", PRIV_NOACTUALRECIPIENT },
166 { "noactualrecipient", PRIV_NOACTUALRECIPIENT },
164#endif /* _FFR_PRIV_NOACTUALRECIPIENT */
165 { NULL, 0 }
166};
167
168/*
169** DontBlameSendmail values
170*/
171
172struct dbsval DontBlameSendmailValues[] =

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

374 (void) close(i);
375 }
376 else
377 InetMode = AF_INET;
378#else /* NETINET6 */
379 InetMode = AF_INET;
380#endif /* NETINET6 */
381 ControlSocketName = NULL;
167 { NULL, 0 }
168};
169
170/*
171** DontBlameSendmail values
172*/
173
174struct dbsval DontBlameSendmailValues[] =

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

376 (void) close(i);
377 }
378 else
379 InetMode = AF_INET;
380#else /* NETINET6 */
381 InetMode = AF_INET;
382#endif /* NETINET6 */
383 ControlSocketName = NULL;
382 memset(&ConnectOnlyTo, '\0', sizeof ConnectOnlyTo);
384 memset(&ConnectOnlyTo, '\0', sizeof(ConnectOnlyTo));
383 DataFileBufferSize = 4096;
384 XscriptFileBufferSize = 4096;
385 for (i = 0; i < MAXRWSETS; i++)
386 RuleSetNames[i] = NULL;
387#if MILTER
388 InputFilters[0] = NULL;
389#endif /* MILTER */
390 RejectLogInterval = 3 HOURS;

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

409 struct passwd *defpwent;
410 static char defuserbuf[40];
411
412 DefUser = defuserbuf;
413 defpwent = sm_getpwuid(DefUid);
414 (void) sm_strlcpy(defuserbuf,
415 (defpwent == NULL || defpwent->pw_name == NULL)
416 ? "nobody" : defpwent->pw_name,
385 DataFileBufferSize = 4096;
386 XscriptFileBufferSize = 4096;
387 for (i = 0; i < MAXRWSETS; i++)
388 RuleSetNames[i] = NULL;
389#if MILTER
390 InputFilters[0] = NULL;
391#endif /* MILTER */
392 RejectLogInterval = 3 HOURS;

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

411 struct passwd *defpwent;
412 static char defuserbuf[40];
413
414 DefUser = defuserbuf;
415 defpwent = sm_getpwuid(DefUid);
416 (void) sm_strlcpy(defuserbuf,
417 (defpwent == NULL || defpwent->pw_name == NULL)
418 ? "nobody" : defpwent->pw_name,
417 sizeof defuserbuf);
419 sizeof(defuserbuf));
418 if (tTd(37, 4))
419 sm_dprintf("setdefuser: DefUid=%d, DefUser=%s\n",
420 (int) DefUid, DefUser);
421}
422/*
423** SETUPQUEUES -- initialize default queues
424**
425** The mqueue QUEUE structure gets filled in after readcf() but
426** we need something to point to now for the mailer setup,
427** which use "mqueue" as default queue.
428*/
429
430static void
431setupqueues()
432{
433 char buf[100];
434
435 MaxRunnersPerQueue = 1;
420 if (tTd(37, 4))
421 sm_dprintf("setdefuser: DefUid=%d, DefUser=%s\n",
422 (int) DefUid, DefUser);
423}
424/*
425** SETUPQUEUES -- initialize default queues
426**
427** The mqueue QUEUE structure gets filled in after readcf() but
428** we need something to point to now for the mailer setup,
429** which use "mqueue" as default queue.
430*/
431
432static void
433setupqueues()
434{
435 char buf[100];
436
437 MaxRunnersPerQueue = 1;
436 (void) sm_strlcpy(buf, "mqueue, P=/var/spool/mqueue", sizeof buf);
438 (void) sm_strlcpy(buf, "mqueue, P=/var/spool/mqueue", sizeof(buf));
437 makequeue(buf, false);
438}
439/*
440** SETUPMAILERS -- initialize default mailers
441*/
442
443static void
444setupmailers()
445{
446 char buf[100];
447
448 (void) sm_strlcpy(buf, "prog, P=/bin/sh, F=lsouDq9, T=X-Unix/X-Unix/X-Unix, A=sh -c \201u",
439 makequeue(buf, false);
440}
441/*
442** SETUPMAILERS -- initialize default mailers
443*/
444
445static void
446setupmailers()
447{
448 char buf[100];
449
450 (void) sm_strlcpy(buf, "prog, P=/bin/sh, F=lsouDq9, T=X-Unix/X-Unix/X-Unix, A=sh -c \201u",
449 sizeof buf);
451 sizeof(buf));
450 makemailer(buf);
451
452 (void) sm_strlcpy(buf, "*file*, P=[FILE], F=lsDFMPEouq9, T=X-Unix/X-Unix/X-Unix, A=FILE \201u",
452 makemailer(buf);
453
454 (void) sm_strlcpy(buf, "*file*, P=[FILE], F=lsDFMPEouq9, T=X-Unix/X-Unix/X-Unix, A=FILE \201u",
453 sizeof buf);
455 sizeof(buf));
454 makemailer(buf);
455
456 (void) sm_strlcpy(buf, "*include*, P=/dev/null, F=su, A=INCLUDE \201u",
456 makemailer(buf);
457
458 (void) sm_strlcpy(buf, "*include*, P=/dev/null, F=su, A=INCLUDE \201u",
457 sizeof buf);
459 sizeof(buf));
458 makemailer(buf);
459 initerrmailers();
460}
461/*
462** SETUPMAPS -- set up map classes
463*/
464
465#define MAPDEF(name, ext, flags, parse, open, close, lookup, store) \

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

660
661#if SOCKETMAP
662 /* arbitrary daemons */
663 MAPDEF("socket", NULL, MCF_ALIASOK,
664 map_parseargs, socket_map_open, socket_map_close,
665 socket_map_lookup, null_map_store);
666#endif /* SOCKETMAP */
667
460 makemailer(buf);
461 initerrmailers();
462}
463/*
464** SETUPMAPS -- set up map classes
465*/
466
467#define MAPDEF(name, ext, flags, parse, open, close, lookup, store) \

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

662
663#if SOCKETMAP
664 /* arbitrary daemons */
665 MAPDEF("socket", NULL, MCF_ALIASOK,
666 map_parseargs, socket_map_open, socket_map_close,
667 socket_map_lookup, null_map_store);
668#endif /* SOCKETMAP */
669
670#if _FFR_DPRINTF_MAP
671 /* dprintf map -- logs information to syslog */
672 MAPDEF("dprintf", NULL, 0,
673 dprintf_map_parseargs, null_map_open, null_map_close,
674 dprintf_map_lookup, null_map_store);
675#endif /* _FFR_DPRINTF_MAP */
676
668 if (tTd(38, 2))
669 {
670 /* bogus map -- always return tempfail */
671 MAPDEF("bogus", NULL, MCF_ALIASOK|MCF_OPTFILE,
672 map_parseargs, null_map_open, null_map_close,
673 bogus_map_lookup, null_map_store);
674 }
675}

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

700{
701 register int i;
702 int nmaps;
703 char *maptype[MAXMAPSTACK];
704 short mapreturn[MAXMAPACTIONS];
705 char buf[MAXLINE];
706
707 /*
677 if (tTd(38, 2))
678 {
679 /* bogus map -- always return tempfail */
680 MAPDEF("bogus", NULL, MCF_ALIASOK|MCF_OPTFILE,
681 map_parseargs, null_map_open, null_map_close,
682 bogus_map_lookup, null_map_store);
683 }
684}

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

709{
710 register int i;
711 int nmaps;
712 char *maptype[MAXMAPSTACK];
713 short mapreturn[MAXMAPACTIONS];
714 char buf[MAXLINE];
715
716 /*
708 ** Set up default hosts maps.
709 */
710
711#if 0
712 nmaps = switch_map_find("hosts", maptype, mapreturn);
713 for (i = 0; i < nmaps; i++)
714 {
715 if (strcmp(maptype[i], "files") == 0 &&
716 stab("hosts.files", ST_MAP, ST_FIND) == NULL)
717 {
718 (void) sm_strlcpy(buf, "hosts.files text -k 0 -v 1 /etc/hosts",
719 sizeof buf);
720 (void) makemapentry(buf);
721 }
722# if NAMED_BIND
723 else if (strcmp(maptype[i], "dns") == 0 &&
724 stab("hosts.dns", ST_MAP, ST_FIND) == NULL)
725 {
726 (void) sm_strlcpy(buf, "hosts.dns dns A", sizeof buf);
727 (void) makemapentry(buf);
728 }
729# endif /* NAMED_BIND */
730# if NISPLUS
731 else if (strcmp(maptype[i], "nisplus") == 0 &&
732 stab("hosts.nisplus", ST_MAP, ST_FIND) == NULL)
733 {
734 (void) sm_strlcpy(buf, "hosts.nisplus nisplus -k name -v address hosts.org_dir",
735 sizeof buf);
736 (void) makemapentry(buf);
737 }
738# endif /* NISPLUS */
739# if NIS
740 else if (strcmp(maptype[i], "nis") == 0 &&
741 stab("hosts.nis", ST_MAP, ST_FIND) == NULL)
742 {
743 (void) sm_strlcpy(buf, "hosts.nis nis -k 0 -v 1 hosts.byname",
744 sizeof buf);
745 (void) makemapentry(buf);
746 }
747# endif /* NIS */
748# if NETINFO
749 else if (strcmp(maptype[i], "netinfo") == 0 &&
750 stab("hosts.netinfo", ST_MAP, ST_FIND) == NULL)
751 {
752 (void) sm_strlcpy(buf, "hosts.netinfo netinfo -v name /machines",
753 sizeof buf);
754 (void) makemapentry(buf);
755 }
756# endif /* NETINFO */
757 }
758#endif /* 0 */
759
760 /*
761 ** Make sure we have a host map.
762 */
763
764 if (stab("host", ST_MAP, ST_FIND) == NULL)
765 {
766 /* user didn't initialize: set up host map */
717 ** Make sure we have a host map.
718 */
719
720 if (stab("host", ST_MAP, ST_FIND) == NULL)
721 {
722 /* user didn't initialize: set up host map */
767 (void) sm_strlcpy(buf, "host host", sizeof buf);
723 (void) sm_strlcpy(buf, "host host", sizeof(buf));
768#if NAMED_BIND
769 if (ConfigLevel >= 2)
724#if NAMED_BIND
725 if (ConfigLevel >= 2)
770 (void) sm_strlcat(buf, " -a. -D", sizeof buf);
726 (void) sm_strlcat(buf, " -a. -D", sizeof(buf));
771#endif /* NAMED_BIND */
772 (void) makemapentry(buf);
773 }
774
775 /*
776 ** Set up default aliases maps
777 */
778
779 nmaps = switch_map_find("aliases", maptype, mapreturn);
780 for (i = 0; i < nmaps; i++)
781 {
782 if (strcmp(maptype[i], "files") == 0 &&
783 stab("aliases.files", ST_MAP, ST_FIND) == NULL)
784 {
785 (void) sm_strlcpy(buf, "aliases.files null",
727#endif /* NAMED_BIND */
728 (void) makemapentry(buf);
729 }
730
731 /*
732 ** Set up default aliases maps
733 */
734
735 nmaps = switch_map_find("aliases", maptype, mapreturn);
736 for (i = 0; i < nmaps; i++)
737 {
738 if (strcmp(maptype[i], "files") == 0 &&
739 stab("aliases.files", ST_MAP, ST_FIND) == NULL)
740 {
741 (void) sm_strlcpy(buf, "aliases.files null",
786 sizeof buf);
742 sizeof(buf));
787 (void) makemapentry(buf);
788 }
789#if NISPLUS
790 else if (strcmp(maptype[i], "nisplus") == 0 &&
791 stab("aliases.nisplus", ST_MAP, ST_FIND) == NULL)
792 {
793 (void) sm_strlcpy(buf, "aliases.nisplus nisplus -kalias -vexpansion mail_aliases.org_dir",
743 (void) makemapentry(buf);
744 }
745#if NISPLUS
746 else if (strcmp(maptype[i], "nisplus") == 0 &&
747 stab("aliases.nisplus", ST_MAP, ST_FIND) == NULL)
748 {
749 (void) sm_strlcpy(buf, "aliases.nisplus nisplus -kalias -vexpansion mail_aliases.org_dir",
794 sizeof buf);
750 sizeof(buf));
795 (void) makemapentry(buf);
796 }
797#endif /* NISPLUS */
798#if NIS
799 else if (strcmp(maptype[i], "nis") == 0 &&
800 stab("aliases.nis", ST_MAP, ST_FIND) == NULL)
801 {
802 (void) sm_strlcpy(buf, "aliases.nis nis mail.aliases",
751 (void) makemapentry(buf);
752 }
753#endif /* NISPLUS */
754#if NIS
755 else if (strcmp(maptype[i], "nis") == 0 &&
756 stab("aliases.nis", ST_MAP, ST_FIND) == NULL)
757 {
758 (void) sm_strlcpy(buf, "aliases.nis nis mail.aliases",
803 sizeof buf);
759 sizeof(buf));
804 (void) makemapentry(buf);
805 }
806#endif /* NIS */
807#if NETINFO
808 else if (strcmp(maptype[i], "netinfo") == 0 &&
809 stab("aliases.netinfo", ST_MAP, ST_FIND) == NULL)
810 {
811 (void) sm_strlcpy(buf, "aliases.netinfo netinfo -z, /aliases",
760 (void) makemapentry(buf);
761 }
762#endif /* NIS */
763#if NETINFO
764 else if (strcmp(maptype[i], "netinfo") == 0 &&
765 stab("aliases.netinfo", ST_MAP, ST_FIND) == NULL)
766 {
767 (void) sm_strlcpy(buf, "aliases.netinfo netinfo -z, /aliases",
812 sizeof buf);
768 sizeof(buf));
813 (void) makemapentry(buf);
814 }
815#endif /* NETINFO */
816#if HESIOD
817 else if (strcmp(maptype[i], "hesiod") == 0 &&
818 stab("aliases.hesiod", ST_MAP, ST_FIND) == NULL)
819 {
820 (void) sm_strlcpy(buf, "aliases.hesiod hesiod aliases",
769 (void) makemapentry(buf);
770 }
771#endif /* NETINFO */
772#if HESIOD
773 else if (strcmp(maptype[i], "hesiod") == 0 &&
774 stab("aliases.hesiod", ST_MAP, ST_FIND) == NULL)
775 {
776 (void) sm_strlcpy(buf, "aliases.hesiod hesiod aliases",
821 sizeof buf);
777 sizeof(buf));
822 (void) makemapentry(buf);
823 }
824#endif /* HESIOD */
778 (void) makemapentry(buf);
779 }
780#endif /* HESIOD */
825 }
826 if (stab("aliases", ST_MAP, ST_FIND) == NULL)
827 {
828 (void) sm_strlcpy(buf, "aliases switch aliases", sizeof buf);
829 (void) makemapentry(buf);
830 }
831
832#if 0 /* "user" map class is a better choice */
833 /*
834 ** Set up default users maps.
835 */
836
837 nmaps = switch_map_find("passwd", maptype, mapreturn);
838 for (i = 0; i < nmaps; i++)
839 {
840 if (strcmp(maptype[i], "files") == 0 &&
841 stab("users.files", ST_MAP, ST_FIND) == NULL)
781#if LDAPMAP && defined(SUN_EXTENSIONS) && \
782 defined(SUN_SIMPLIFIED_LDAP) && HASLDAPGETALIASBYNAME
783 else if (strcmp(maptype[i], "ldap") == 0 &&
784 stab("aliases.ldap", ST_MAP, ST_FIND) == NULL)
842 {
785 {
843 (void) sm_strlcpy(buf, "users.files text -m -z: -k0 -v6 /etc/passwd",
786 (void) strlcpy(buf, "aliases.ldap ldap -b . -h localhost -k mail=%0 -v mailgroup",
844 sizeof buf);
845 (void) makemapentry(buf);
846 }
787 sizeof buf);
788 (void) makemapentry(buf);
789 }
847# if NISPLUS
848 else if (strcmp(maptype[i], "nisplus") == 0 &&
849 stab("users.nisplus", ST_MAP, ST_FIND) == NULL)
850 {
851 (void) sm_strlcpy(buf, "users.nisplus nisplus -m -kname -vhome passwd.org_dir",
852 sizeof buf);
853 (void) makemapentry(buf);
854 }
855# endif /* NISPLUS */
856# if NIS
857 else if (strcmp(maptype[i], "nis") == 0 &&
858 stab("users.nis", ST_MAP, ST_FIND) == NULL)
859 {
860 (void) sm_strlcpy(buf, "users.nis nis -m passwd.byname",
861 sizeof buf);
862 (void) makemapentry(buf);
863 }
864# endif /* NIS */
865# if HESIOD
866 else if (strcmp(maptype[i], "hesiod") == 0 &&
867 stab("users.hesiod", ST_MAP, ST_FIND) == NULL)
868 {
869 (void) sm_strlcpy(buf, "users.hesiod hesiod", sizeof buf);
870 (void) makemapentry(buf);
871 }
872# endif /* HESIOD */
790#endif /* LDAPMAP && defined(SUN_EXTENSIONS) && ... */
873 }
791 }
874 if (stab("users", ST_MAP, ST_FIND) == NULL)
792 if (stab("aliases", ST_MAP, ST_FIND) == NULL)
875 {
793 {
876 (void) sm_strlcpy(buf, "users switch -m passwd", sizeof buf);
794 (void) sm_strlcpy(buf, "aliases switch aliases", sizeof(buf));
877 (void) makemapentry(buf);
878 }
795 (void) makemapentry(buf);
796 }
879#endif /* 0 */
880}
797}
798
881/*
882** SWITCH_MAP_FIND -- find the list of types associated with a map
883**
884** This is the system-dependent interface to the service switch.
885**
886** Parameters:
887** service -- the name of the service of interest.
888** maptype -- an out-array of strings containing the types

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

1039 if (ConfigFileRead)
1040 servicecachetime = now;
1041 fp = safefopen(ServiceSwitchFile, O_RDONLY, 0, sff);
1042 if (fp != NULL)
1043 {
1044 char buf[MAXLINE];
1045
1046 while (sm_io_fgets(fp, SM_TIME_DEFAULT, buf,
799/*
800** SWITCH_MAP_FIND -- find the list of types associated with a map
801**
802** This is the system-dependent interface to the service switch.
803**
804** Parameters:
805** service -- the name of the service of interest.
806** maptype -- an out-array of strings containing the types

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

957 if (ConfigFileRead)
958 servicecachetime = now;
959 fp = safefopen(ServiceSwitchFile, O_RDONLY, 0, sff);
960 if (fp != NULL)
961 {
962 char buf[MAXLINE];
963
964 while (sm_io_fgets(fp, SM_TIME_DEFAULT, buf,
1047 sizeof buf) != NULL)
965 sizeof(buf)) != NULL)
1048 {
1049 register char *p;
1050
1051 p = strpbrk(buf, "#\n");
1052 if (p != NULL)
1053 *p = '\0';
1054 p = strpbrk(buf, " \t");
1055 if (p != NULL)

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

1322 usrerr("553 No ARPA mail through this machine: see your system administration");
1323 /* e->e_flags |= EF_NO_BODY_RETN; to suppress body on return */
1324 to->q_status = "5.7.1";
1325 return EX_UNAVAILABLE;
1326 }
1327#endif /* EXAMPLE_CODE */
1328 return EX_OK;
1329}
966 {
967 register char *p;
968
969 p = strpbrk(buf, "#\n");
970 if (p != NULL)
971 *p = '\0';
972 p = strpbrk(buf, " \t");
973 if (p != NULL)

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

1240 usrerr("553 No ARPA mail through this machine: see your system administration");
1241 /* e->e_flags |= EF_NO_BODY_RETN; to suppress body on return */
1242 to->q_status = "5.7.1";
1243 return EX_UNAVAILABLE;
1244 }
1245#endif /* EXAMPLE_CODE */
1246 return EX_OK;
1247}
1248
1249#ifdef SUN_EXTENSIONS
1250static void
1251init_md_sun()
1252{
1253 struct stat sbuf;
1254
1255 /* Check for large file descriptor */
1256 if (fstat(fileno(stdin), &sbuf) < 0)
1257 {
1258 if (errno == EOVERFLOW)
1259 {
1260 perror("stdin");
1261 exit(EX_NOINPUT);
1262 }
1263 }
1264}
1265#endif /* SUN_EXTENSIONS */
1266
1330/*
1331** INIT_MD -- do machine dependent initializations
1332**
1333** Systems that have global modes that should be set should do
1334** them here rather than in main.
1335*/
1336
1337#ifdef _AUX_SOURCE

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

1354#ifdef SUN_EXTENSIONS
1355 init_md_sun();
1356#endif /* SUN_EXTENSIONS */
1357
1358#if _CONVEX_SOURCE
1359 /* keep gethostby*() from stripping the local domain name */
1360 set_domain_trim_off();
1361#endif /* _CONVEX_SOURCE */
1267/*
1268** INIT_MD -- do machine dependent initializations
1269**
1270** Systems that have global modes that should be set should do
1271** them here rather than in main.
1272*/
1273
1274#ifdef _AUX_SOURCE

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

1291#ifdef SUN_EXTENSIONS
1292 init_md_sun();
1293#endif /* SUN_EXTENSIONS */
1294
1295#if _CONVEX_SOURCE
1296 /* keep gethostby*() from stripping the local domain name */
1297 set_domain_trim_off();
1298#endif /* _CONVEX_SOURCE */
1362#ifdef __QNX__
1299#if defined(__QNX__) && !defined(__QNXNTO__)
1363 /*
1364 ** Due to QNX's network distributed nature, you can target a tcpip
1365 ** stack on a different node in the qnx network; this patch lets
1366 ** this feature work. The __sock_locate() must be done before the
1367 ** environment is clear.
1368 */
1369 __sock_locate();
1370#endif /* __QNX__ */

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

1523# endif /* LA_TYPE == LA_SHORT */
1524# endif /* LA_TYPE == LA_INT */
1525 extern off_t lseek();
1526
1527 if (kmem < 0)
1528 {
1529# ifdef _AUX_SOURCE
1530 (void) sm_strlcpy(Nl[X_AVENRUN].n_name, LA_AVENRUN,
1300 /*
1301 ** Due to QNX's network distributed nature, you can target a tcpip
1302 ** stack on a different node in the qnx network; this patch lets
1303 ** this feature work. The __sock_locate() must be done before the
1304 ** environment is clear.
1305 */
1306 __sock_locate();
1307#endif /* __QNX__ */

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

1460# endif /* LA_TYPE == LA_SHORT */
1461# endif /* LA_TYPE == LA_INT */
1462 extern off_t lseek();
1463
1464 if (kmem < 0)
1465 {
1466# ifdef _AUX_SOURCE
1467 (void) sm_strlcpy(Nl[X_AVENRUN].n_name, LA_AVENRUN,
1531 sizeof Nl[X_AVENRUN].n_name);
1468 sizeof(Nl[X_AVENRUN].n_name));
1532 Nl[1].n_name[0] = '\0';
1533# endif /* _AUX_SOURCE */
1534
1535# if defined(_AIX3) || defined(_AIX4)
1469 Nl[1].n_name[0] = '\0';
1470# endif /* _AUX_SOURCE */
1471
1472# if defined(_AIX3) || defined(_AIX4)
1536 if (knlist(Nl, 1, sizeof Nl[0]) < 0)
1473 if (knlist(Nl, 1, sizeof(Nl[0])) < 0)
1537# else /* defined(_AIX3) || defined(_AIX4) */
1538 if (nlist(_PATH_UNIX, Nl) < 0)
1539# endif /* defined(_AIX3) || defined(_AIX4) */
1540 {
1541 if (tTd(3, 1))
1542 sm_dprintf("getla: nlist(%s): %s\n", _PATH_UNIX,
1543 sm_errstring(errno));
1544 return -1;

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

2001 {
2002 sm_syslog(LOG_ERR, NOQID,
2003 "can't open %s: %s",
2004 _PATH_AVENRUN, sm_errstring(errno));
2005 return -1;
2006 }
2007 }
2008
1474# else /* defined(_AIX3) || defined(_AIX4) */
1475 if (nlist(_PATH_UNIX, Nl) < 0)
1476# endif /* defined(_AIX3) || defined(_AIX4) */
1477 {
1478 if (tTd(3, 1))
1479 sm_dprintf("getla: nlist(%s): %s\n", _PATH_UNIX,
1480 sm_errstring(errno));
1481 return -1;

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

1938 {
1939 sm_syslog(LOG_ERR, NOQID,
1940 "can't open %s: %s",
1941 _PATH_AVENRUN, sm_errstring(errno));
1942 return -1;
1943 }
1944 }
1945
2009 r = read(afd, &avenrun, sizeof avenrun);
1946 r = read(afd, &avenrun, sizeof(avenrun));
2010
2011 if (tTd(3, 5))
2012 sm_dprintf("getla: avenrun = %d\n", avenrun);
2013 loadav = (int) (avenrun + FSCALE/2) >> FSHIFT;
2014 if (tTd(3, 1))
2015 sm_dprintf("getla: %d\n", loadav);
2016 return loadav;
2017}

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

2148*/
2149
2150void
2151sm_getla()
2152{
2153 char labuf[8];
2154
2155 CurrentLA = getla();
1947
1948 if (tTd(3, 5))
1949 sm_dprintf("getla: avenrun = %d\n", avenrun);
1950 loadav = (int) (avenrun + FSCALE/2) >> FSHIFT;
1951 if (tTd(3, 1))
1952 sm_dprintf("getla: %d\n", loadav);
1953 return loadav;
1954}

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

2085*/
2086
2087void
2088sm_getla()
2089{
2090 char labuf[8];
2091
2092 CurrentLA = getla();
2156 (void) sm_snprintf(labuf, sizeof labuf, "%d", CurrentLA);
2093 (void) sm_snprintf(labuf, sizeof(labuf), "%d", CurrentLA);
2157 macdefine(&GlobalMacros, A_TEMP, macid("{load_avg}"), labuf);
2158}
2159/*
2160** SHOULDQUEUE -- should this message be queued or sent?
2161**
2162** Compares the message cost to the load average to decide.
2163**
2164** Note: Do NOT change this API! It is documented in op.me

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

2204 }
2205#endif /* _FFR_MEMSTAT */
2206 if (CurrentLA < QueueLA)
2207 {
2208 if (tTd(3, 30))
2209 sm_dprintf("false (CurrentLA < QueueLA)\n");
2210 return false;
2211 }
2094 macdefine(&GlobalMacros, A_TEMP, macid("{load_avg}"), labuf);
2095}
2096/*
2097** SHOULDQUEUE -- should this message be queued or sent?
2098**
2099** Compares the message cost to the load average to decide.
2100**
2101** Note: Do NOT change this API! It is documented in op.me

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

2141 }
2142#endif /* _FFR_MEMSTAT */
2143 if (CurrentLA < QueueLA)
2144 {
2145 if (tTd(3, 30))
2146 sm_dprintf("false (CurrentLA < QueueLA)\n");
2147 return false;
2148 }
2212# if 0 /* this code is reported to cause oscillation around RefuseLA */
2213 if (CurrentLA >= RefuseLA && QueueLA < RefuseLA)
2214 {
2215 if (tTd(3, 30))
2216 sm_dprintf("TRUE (CurrentLA >= RefuseLA)\n");
2217 return true;
2218 }
2219# endif /* 0 */
2220 rval = pri > (QueueFactor / (CurrentLA - QueueLA + 1));
2221 if (tTd(3, 30))
2222 sm_dprintf("%s (by calculation)\n", rval ? "true" : "false");
2223 return rval;
2224}
2149 rval = pri > (QueueFactor / (CurrentLA - QueueLA + 1));
2150 if (tTd(3, 30))
2151 sm_dprintf("%s (by calculation)\n", rval ? "true" : "false");
2152 return rval;
2153}
2154
2225/*
2226** REFUSECONNECTIONS -- decide if connections should be refused
2227**
2228** Parameters:
2155/*
2156** REFUSECONNECTIONS -- decide if connections should be refused
2157**
2158** Parameters:
2229** name -- daemon name (for error messages only)
2230** e -- the current envelope.
2159** e -- the current envelope.
2231** d -- number of daemon
2160** dn -- number of daemon.
2232** active -- was this daemon actually active?
2233**
2234** Returns:
2235** true if incoming SMTP connections should be refused
2236** (for now).
2237** false if we should accept new work.
2238**
2239** Side Effects:
2240** Sets process title when it is rejecting connections.
2241*/
2242
2243bool
2161** active -- was this daemon actually active?
2162**
2163** Returns:
2164** true if incoming SMTP connections should be refused
2165** (for now).
2166** false if we should accept new work.
2167**
2168** Side Effects:
2169** Sets process title when it is rejecting connections.
2170*/
2171
2172bool
2244refuseconnections(name, e, d, active)
2245 char *name;
2173refuseconnections(e, dn, active)
2246 ENVELOPE *e;
2174 ENVELOPE *e;
2247 int d;
2175 int dn;
2248 bool active;
2249{
2250 static time_t lastconn[MAXDAEMONS];
2251 static int conncnt[MAXDAEMONS];
2252 static time_t firstrejtime[MAXDAEMONS];
2253 static time_t nextlogtime[MAXDAEMONS];
2176 bool active;
2177{
2178 static time_t lastconn[MAXDAEMONS];
2179 static int conncnt[MAXDAEMONS];
2180 static time_t firstrejtime[MAXDAEMONS];
2181 static time_t nextlogtime[MAXDAEMONS];
2182 int limit;
2254#if _FFR_MEMSTAT
2255 long memfree;
2256#endif /* _FFR_MEMSTAT */
2257
2258#if XLA
2259 if (!xla_smtp_ok())
2260 return true;
2261#endif /* XLA */
2262
2183#if _FFR_MEMSTAT
2184 long memfree;
2185#endif /* _FFR_MEMSTAT */
2186
2187#if XLA
2188 if (!xla_smtp_ok())
2189 return true;
2190#endif /* XLA */
2191
2263 SM_ASSERT(d >= 0);
2264 SM_ASSERT(d < MAXDAEMONS);
2192 SM_ASSERT(dn >= 0);
2193 SM_ASSERT(dn < MAXDAEMONS);
2265 if (ConnRateThrottle > 0)
2266 {
2267 time_t now;
2268
2269 now = curtime();
2270 if (active)
2271 {
2194 if (ConnRateThrottle > 0)
2195 {
2196 time_t now;
2197
2198 now = curtime();
2199 if (active)
2200 {
2272 if (now != lastconn[d])
2201 if (now != lastconn[dn])
2273 {
2202 {
2274 lastconn[d] = now;
2275 conncnt[d] = 1;
2203 lastconn[dn] = now;
2204 conncnt[dn] = 1;
2276 }
2205 }
2277 else if (conncnt[d]++ > ConnRateThrottle)
2206 else if (conncnt[dn]++ > ConnRateThrottle)
2278 {
2279#define D_MSG_CRT "deferring connections on daemon %s: %d per second"
2280 /* sleep to flatten out connection load */
2281 sm_setproctitle(true, e, D_MSG_CRT,
2207 {
2208#define D_MSG_CRT "deferring connections on daemon %s: %d per second"
2209 /* sleep to flatten out connection load */
2210 sm_setproctitle(true, e, D_MSG_CRT,
2282 name, ConnRateThrottle);
2211 Daemons[dn].d_name,
2212 ConnRateThrottle);
2283 if (LogLevel > 8)
2284 sm_syslog(LOG_INFO, NOQID, D_MSG_CRT,
2213 if (LogLevel > 8)
2214 sm_syslog(LOG_INFO, NOQID, D_MSG_CRT,
2285 name, ConnRateThrottle);
2215 Daemons[dn].d_name,
2216 ConnRateThrottle);
2286 (void) sleep(1);
2287 }
2288 }
2217 (void) sleep(1);
2218 }
2219 }
2289 else if (now != lastconn[d])
2290 conncnt[d] = 0;
2220 else if (now != lastconn[dn])
2221 conncnt[dn] = 0;
2291 }
2292
2293
2294#if _FFR_MEMSTAT
2295 if (RefuseLowMem > 0 &&
2296 sm_memstat_get(MemoryResource, &memfree) >= 0 &&
2297 memfree < RefuseLowMem)
2298 {
2299# define R_MSG_LM "rejecting connections on daemon %s: free memory: %ld"
2222 }
2223
2224
2225#if _FFR_MEMSTAT
2226 if (RefuseLowMem > 0 &&
2227 sm_memstat_get(MemoryResource, &memfree) >= 0 &&
2228 memfree < RefuseLowMem)
2229 {
2230# define R_MSG_LM "rejecting connections on daemon %s: free memory: %ld"
2300 sm_setproctitle(true, e, R_MSG_LM, name, memfree);
2231 sm_setproctitle(true, e, R_MSG_LM, Daemons[dn].d_name, memfree);
2301 if (LogLevel > 8)
2232 if (LogLevel > 8)
2302 sm_syslog(LOG_NOTICE, NOQID, R_MSG_LM, name, memfree);
2233 sm_syslog(LOG_NOTICE, NOQID, R_MSG_LM,
2234 Daemons[dn].d_name, memfree);
2303 return true;
2304 }
2305#endif /* _FFR_MEMSTAT */
2306 sm_getla();
2235 return true;
2236 }
2237#endif /* _FFR_MEMSTAT */
2238 sm_getla();
2307 if (RefuseLA > 0 && CurrentLA >= RefuseLA)
2239 limit = (Daemons[dn].d_refuseLA != DPO_NOTSET) ?
2240 Daemons[dn].d_refuseLA : RefuseLA;
2241 if (limit > 0 && CurrentLA >= limit)
2308 {
2309 time_t now;
2310
2311# define R_MSG_LA "rejecting connections on daemon %s: load average: %d"
2312# define R2_MSG_LA "have been rejecting connections on daemon %s for %s"
2242 {
2243 time_t now;
2244
2245# define R_MSG_LA "rejecting connections on daemon %s: load average: %d"
2246# define R2_MSG_LA "have been rejecting connections on daemon %s for %s"
2313 sm_setproctitle(true, e, R_MSG_LA, name, CurrentLA);
2247 sm_setproctitle(true, e, R_MSG_LA, Daemons[dn].d_name,
2248 CurrentLA);
2314 if (LogLevel > 8)
2249 if (LogLevel > 8)
2315 sm_syslog(LOG_NOTICE, NOQID, R_MSG_LA, name, CurrentLA);
2250 sm_syslog(LOG_NOTICE, NOQID, R_MSG_LA,
2251 Daemons[dn].d_name, CurrentLA);
2316 now = curtime();
2252 now = curtime();
2317 if (firstrejtime[d] == 0)
2253 if (firstrejtime[dn] == 0)
2318 {
2254 {
2319 firstrejtime[d] = now;
2320 nextlogtime[d] = now + RejectLogInterval;
2255 firstrejtime[dn] = now;
2256 nextlogtime[dn] = now + RejectLogInterval;
2321 }
2257 }
2322 else if (nextlogtime[d] < now)
2258 else if (nextlogtime[dn] < now)
2323 {
2259 {
2324 sm_syslog(LOG_ERR, NOQID, R2_MSG_LA, name,
2325 pintvl(now - firstrejtime[d], true));
2326 nextlogtime[d] = now + RejectLogInterval;
2260 sm_syslog(LOG_ERR, NOQID, R2_MSG_LA, Daemons[dn].d_name,
2261 pintvl(now - firstrejtime[dn], true));
2262 nextlogtime[dn] = now + RejectLogInterval;
2327 }
2328 return true;
2329 }
2330 else
2263 }
2264 return true;
2265 }
2266 else
2331 firstrejtime[d] = 0;
2267 firstrejtime[dn] = 0;
2332
2268
2333 if (DelayLA > 0 && CurrentLA >= DelayLA)
2269 limit = (Daemons[dn].d_delayLA != DPO_NOTSET) ?
2270 Daemons[dn].d_delayLA : DelayLA;
2271 if (limit > 0 && CurrentLA >= limit)
2334 {
2335 time_t now;
2336 static time_t log_delay = (time_t) 0;
2337
2338# define MIN_DELAY_LOG 90 /* wait before logging this again */
2339# define D_MSG_LA "delaying connections on daemon %s: load average=%d >= %d"
2340 /* sleep to flatten out connection load */
2272 {
2273 time_t now;
2274 static time_t log_delay = (time_t) 0;
2275
2276# define MIN_DELAY_LOG 90 /* wait before logging this again */
2277# define D_MSG_LA "delaying connections on daemon %s: load average=%d >= %d"
2278 /* sleep to flatten out connection load */
2341 sm_setproctitle(true, e, D_MSG_LA, name, DelayLA);
2279 sm_setproctitle(true, e, D_MSG_LA, Daemons[dn].d_name, limit);
2342 if (LogLevel > 8 && (now = curtime()) > log_delay)
2343 {
2344 sm_syslog(LOG_INFO, NOQID, D_MSG_LA,
2280 if (LogLevel > 8 && (now = curtime()) > log_delay)
2281 {
2282 sm_syslog(LOG_INFO, NOQID, D_MSG_LA,
2345 name, CurrentLA, DelayLA);
2283 Daemons[dn].d_name, CurrentLA, limit);
2346 log_delay = now + MIN_DELAY_LOG;
2347 }
2348 (void) sleep(1);
2349 }
2350
2284 log_delay = now + MIN_DELAY_LOG;
2285 }
2286 (void) sleep(1);
2287 }
2288
2351 if (MaxChildren > 0 && CurChildren >= MaxChildren)
2289 limit = (Daemons[dn].d_maxchildren != DPO_NOTSET) ?
2290 Daemons[dn].d_maxchildren : MaxChildren;
2291 if (limit > 0 && CurChildren >= limit)
2352 {
2353 proc_list_probe();
2292 {
2293 proc_list_probe();
2354 if (CurChildren >= MaxChildren)
2294 if (CurChildren >= limit)
2355 {
2356#define R_MSG_CHILD "rejecting connections on daemon %s: %d children, max %d"
2357 sm_setproctitle(true, e, R_MSG_CHILD,
2295 {
2296#define R_MSG_CHILD "rejecting connections on daemon %s: %d children, max %d"
2297 sm_setproctitle(true, e, R_MSG_CHILD,
2358 name, CurChildren, MaxChildren);
2298 Daemons[dn].d_name, CurChildren,
2299 limit);
2359 if (LogLevel > 8)
2360 sm_syslog(LOG_INFO, NOQID, R_MSG_CHILD,
2300 if (LogLevel > 8)
2301 sm_syslog(LOG_INFO, NOQID, R_MSG_CHILD,
2361 name, CurChildren, MaxChildren);
2302 Daemons[dn].d_name, CurChildren,
2303 limit);
2362 return true;
2363 }
2364 }
2365 return false;
2366}
2304 return true;
2305 }
2306 }
2307 return false;
2308}
2309
2367/*
2368** SETPROCTITLE -- set process title for ps
2369**
2370** Parameters:
2371** fmt -- a printf style format string.
2372** a, b, c -- possible parameters to fmt.
2373**
2374** Returns:

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

2487 ** Move the environment so setproctitle can use the space at
2488 ** the top of memory.
2489 */
2490
2491 if (envp != NULL)
2492 {
2493 for (i = 0; envp[i] != NULL; i++)
2494 continue;
2310/*
2311** SETPROCTITLE -- set process title for ps
2312**
2313** Parameters:
2314** fmt -- a printf style format string.
2315** a, b, c -- possible parameters to fmt.
2316**
2317** Returns:

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

2430 ** Move the environment so setproctitle can use the space at
2431 ** the top of memory.
2432 */
2433
2434 if (envp != NULL)
2435 {
2436 for (i = 0; envp[i] != NULL; i++)
2437 continue;
2495 environ = (char **) xalloc(sizeof (char *) * (i + 1));
2438 environ = (char **) xalloc(sizeof(char *) * (i + 1));
2496 for (i = 0; envp[i] != NULL; i++)
2497 environ[i] = newstr(envp[i]);
2498 environ[i] = NULL;
2499 }
2500
2501 /*
2502 ** Save start and extent of argv for setproctitle.
2503 */

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

2656 va_dcl
2657#endif /* __STDC__ */
2658{
2659 char buf[SPT_BUFSIZE];
2660 SM_VA_LOCAL_DECL
2661
2662 /* print the argument string */
2663 SM_VA_START(ap, fmt);
2439 for (i = 0; envp[i] != NULL; i++)
2440 environ[i] = newstr(envp[i]);
2441 environ[i] = NULL;
2442 }
2443
2444 /*
2445 ** Save start and extent of argv for setproctitle.
2446 */

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

2599 va_dcl
2600#endif /* __STDC__ */
2601{
2602 char buf[SPT_BUFSIZE];
2603 SM_VA_LOCAL_DECL
2604
2605 /* print the argument string */
2606 SM_VA_START(ap, fmt);
2664 (void) sm_vsnprintf(buf, sizeof buf, fmt, ap);
2607 (void) sm_vsnprintf(buf, sizeof(buf), fmt, ap);
2665 SM_VA_END(ap);
2666
2667 if (status)
2668 proc_list_set(CurrentPid, buf);
2669
2670 if (ProcTitlePrefix != NULL)
2671 {
2672 char prefix[SPT_BUFSIZE];
2673
2608 SM_VA_END(ap);
2609
2610 if (status)
2611 proc_list_set(CurrentPid, buf);
2612
2613 if (ProcTitlePrefix != NULL)
2614 {
2615 char prefix[SPT_BUFSIZE];
2616
2674 expand(ProcTitlePrefix, prefix, sizeof prefix, e);
2617 expand(ProcTitlePrefix, prefix, sizeof(prefix), e);
2675 setproctitle("%s: %s", prefix, buf);
2676 }
2677 else
2678 setproctitle("%s", buf);
2679}
2680/*
2681** WAITFOR -- wait for a particular process id.
2682**

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

2884 /* try /usr/include/whoami.h -- has a #define somewhere */
2885 if ((file = sm_io_open(SmFtStdio, SM_TIME_DEFAULT,
2886 "/usr/include/whoami.h", SM_IO_RDONLY, NULL))
2887 != NULL)
2888 {
2889 char buf[MAXLINE];
2890
2891 while (sm_io_fgets(file, SM_TIME_DEFAULT,
2618 setproctitle("%s: %s", prefix, buf);
2619 }
2620 else
2621 setproctitle("%s", buf);
2622}
2623/*
2624** WAITFOR -- wait for a particular process id.
2625**

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

2827 /* try /usr/include/whoami.h -- has a #define somewhere */
2828 if ((file = sm_io_open(SmFtStdio, SM_TIME_DEFAULT,
2829 "/usr/include/whoami.h", SM_IO_RDONLY, NULL))
2830 != NULL)
2831 {
2832 char buf[MAXLINE];
2833
2834 while (sm_io_fgets(file, SM_TIME_DEFAULT,
2892 buf, sizeof buf) != NULL)
2835 buf, sizeof(buf)) != NULL)
2893 {
2894 if (sm_io_sscanf(buf, "#define sysname \"%*[^\"]\"",
2895 NODE_LENGTH, name->nodename) > 0)
2896 break;
2897 }
2898 (void) sm_io_close(file, SM_TIME_DEFAULT);
2899 if (name->nodename[0] != '\0')
2900 return 0;

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

3258 for (d = DefaultUserShells; *d != NULL; d++)
3259 {
3260 if (strcmp(shell, *d) == 0)
3261 return true;
3262 }
3263 return false;
3264 }
3265
2836 {
2837 if (sm_io_sscanf(buf, "#define sysname \"%*[^\"]\"",
2838 NODE_LENGTH, name->nodename) > 0)
2839 break;
2840 }
2841 (void) sm_io_close(file, SM_TIME_DEFAULT);
2842 if (name->nodename[0] != '\0')
2843 return 0;

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

3201 for (d = DefaultUserShells; *d != NULL; d++)
3202 {
3203 if (strcmp(shell, *d) == 0)
3204 return true;
3205 }
3206 return false;
3207 }
3208
3266 while (sm_io_fgets(shellf, SM_TIME_DEFAULT, buf, sizeof buf) != NULL)
3209 while (sm_io_fgets(shellf, SM_TIME_DEFAULT, buf, sizeof(buf)) != NULL)
3267 {
3268 register char *p, *q;
3269
3270 p = buf;
3271 while (*p != '\0' && *p != '#' && *p != '/')
3272 p++;
3273 if (*p == '#' || *p == '\0')
3274 continue;

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

3330# include <sys/mount.h>
3331# endif /* SFS_TYPE == SFS_MOUNT */
3332# if SFS_TYPE == SFS_STATVFS
3333# include <sys/statvfs.h>
3334# endif /* SFS_TYPE == SFS_STATVFS */
3335
3336long
3337freediskspace(dir, bsize)
3210 {
3211 register char *p, *q;
3212
3213 p = buf;
3214 while (*p != '\0' && *p != '#' && *p != '/')
3215 p++;
3216 if (*p == '#' || *p == '\0')
3217 continue;

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

3273# include <sys/mount.h>
3274# endif /* SFS_TYPE == SFS_MOUNT */
3275# if SFS_TYPE == SFS_STATVFS
3276# include <sys/statvfs.h>
3277# endif /* SFS_TYPE == SFS_STATVFS */
3278
3279long
3280freediskspace(dir, bsize)
3338 char *dir;
3281 const char *dir;
3339 long *bsize;
3340{
3341# if SFS_TYPE == SFS_NONE
3342 if (bsize != NULL)
3343 *bsize = 4096L;
3344
3345 /* assume free space is plentiful */
3346 return (long) LONG_MAX;

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

3368# ifndef SFS_BAVAIL
3369# define SFS_BAVAIL f_bavail
3370# endif /* ! SFS_BAVAIL */
3371
3372# if SFS_TYPE == SFS_USTAT
3373 if (stat(dir, &statbuf) == 0 && ustat(statbuf.st_dev, &fs) == 0)
3374# else /* SFS_TYPE == SFS_USTAT */
3375# if SFS_TYPE == SFS_4ARGS
3282 long *bsize;
3283{
3284# if SFS_TYPE == SFS_NONE
3285 if (bsize != NULL)
3286 *bsize = 4096L;
3287
3288 /* assume free space is plentiful */
3289 return (long) LONG_MAX;

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

3311# ifndef SFS_BAVAIL
3312# define SFS_BAVAIL f_bavail
3313# endif /* ! SFS_BAVAIL */
3314
3315# if SFS_TYPE == SFS_USTAT
3316 if (stat(dir, &statbuf) == 0 && ustat(statbuf.st_dev, &fs) == 0)
3317# else /* SFS_TYPE == SFS_USTAT */
3318# if SFS_TYPE == SFS_4ARGS
3376 if (statfs(dir, &fs, sizeof fs, 0) == 0)
3319 if (statfs(dir, &fs, sizeof(fs), 0) == 0)
3377# else /* SFS_TYPE == SFS_4ARGS */
3378# if SFS_TYPE == SFS_STATVFS
3379 if (statvfs(dir, &fs) == 0)
3380# else /* SFS_TYPE == SFS_STATVFS */
3381# if defined(ultrix)
3382 if (statfs(dir, &fs) > 0)
3383# else /* defined(ultrix) */
3384 if (statfs(dir, &fs) == 0)

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

3573 int save_errno;
3574# if !HASFLOCK
3575 int action;
3576 struct flock lfd;
3577
3578 if (ext == NULL)
3579 ext = "";
3580
3320# else /* SFS_TYPE == SFS_4ARGS */
3321# if SFS_TYPE == SFS_STATVFS
3322 if (statvfs(dir, &fs) == 0)
3323# else /* SFS_TYPE == SFS_STATVFS */
3324# if defined(ultrix)
3325 if (statfs(dir, &fs) > 0)
3326# else /* defined(ultrix) */
3327 if (statfs(dir, &fs) == 0)

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

3516 int save_errno;
3517# if !HASFLOCK
3518 int action;
3519 struct flock lfd;
3520
3521 if (ext == NULL)
3522 ext = "";
3523
3581 memset(&lfd, '\0', sizeof lfd);
3524 memset(&lfd, '\0', sizeof(lfd));
3582 if (bitset(LOCK_UN, type))
3583 lfd.l_type = F_UNLCK;
3584 else if (bitset(LOCK_EX, type))
3585 lfd.l_type = F_WRLCK;
3586 else
3587 lfd.l_type = F_RDLCK;
3588
3589 if (bitset(LOCK_NB, type))

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

3938}
3939
3940
3941void
3942vendor_post_defaults(e)
3943 ENVELOPE *e;
3944{
3945#ifdef __QNX__
3525 if (bitset(LOCK_UN, type))
3526 lfd.l_type = F_UNLCK;
3527 else if (bitset(LOCK_EX, type))
3528 lfd.l_type = F_WRLCK;
3529 else
3530 lfd.l_type = F_RDLCK;
3531
3532 if (bitset(LOCK_NB, type))

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

3881}
3882
3883
3884void
3885vendor_post_defaults(e)
3886 ENVELOPE *e;
3887{
3888#ifdef __QNX__
3946 char *p;
3947
3948 /* Makes sure the SOCK environment variable remains */
3889 /* Makes sure the SOCK environment variable remains */
3949 if (p = getextenv("SOCK"))
3950 sm_setuserenv("SOCK", p);
3890 sm_setuserenv("SOCK", NULL);
3951#endif /* __QNX__ */
3952#if defined(SUN_EXTENSIONS) && defined(SUN_DEFAULT_VALUES)
3953 sun_post_defaults(e);
3954#endif /* defined(SUN_EXTENSIONS) && defined(SUN_DEFAULT_VALUES) */
3955}
3956/*
3957** VENDOR_DAEMON_SETUP -- special vendor setup needed for daemon mode
3958*/

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

4038#endif /* TCPWRAPPERS */
4039
4040 if (tTd(48, 3))
4041 sm_dprintf("validate_connection(%s, %s)\n",
4042 hostname, anynet_ntoa(sap));
4043
4044 connection_rate_check(sap, e);
4045 if (rscheck("check_relay", hostname, anynet_ntoa(sap),
3891#endif /* __QNX__ */
3892#if defined(SUN_EXTENSIONS) && defined(SUN_DEFAULT_VALUES)
3893 sun_post_defaults(e);
3894#endif /* defined(SUN_EXTENSIONS) && defined(SUN_DEFAULT_VALUES) */
3895}
3896/*
3897** VENDOR_DAEMON_SETUP -- special vendor setup needed for daemon mode
3898*/

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

3978#endif /* TCPWRAPPERS */
3979
3980 if (tTd(48, 3))
3981 sm_dprintf("validate_connection(%s, %s)\n",
3982 hostname, anynet_ntoa(sap));
3983
3984 connection_rate_check(sap, e);
3985 if (rscheck("check_relay", hostname, anynet_ntoa(sap),
4046 e, RSF_RMCOMM|RSF_COUNT, 3, NULL, NOQID) != EX_OK)
3986 e, RSF_RMCOMM|RSF_COUNT, 3, NULL, NOQID, NULL) != EX_OK)
4047 {
4048 static char reject[BUFSIZ*2];
4049 extern char MsgBuf[];
4050
4051 if (tTd(48, 4))
4052 sm_dprintf(" ... validate_connection: BAD (rscheck)\n");
4053
4054 if (strlen(MsgBuf) >= 3)
3987 {
3988 static char reject[BUFSIZ*2];
3989 extern char MsgBuf[];
3990
3991 if (tTd(48, 4))
3992 sm_dprintf(" ... validate_connection: BAD (rscheck)\n");
3993
3994 if (strlen(MsgBuf) >= 3)
4055 (void) sm_strlcpy(reject, MsgBuf, sizeof reject);
3995 (void) sm_strlcpy(reject, MsgBuf, sizeof(reject));
4056 else
3996 else
4057 (void) sm_strlcpy(reject, "Access denied", sizeof reject);
3997 (void) sm_strlcpy(reject, "Access denied", sizeof(reject));
4058
4059 return reject;
4060 }
4061
4062#if TCPWRAPPERS
4063 if (hostname[0] == '[' && hostname[strlen(hostname) - 1] == ']')
4064 host = "unknown";
4065 else

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

4366 if (strcmp(maptype[nmaps], "nis") == 0 ||
4367 strcmp(maptype[nmaps], "files") == 0)
4368 break;
4369 }
4370
4371 if (nmaps >= 0)
4372 {
4373 /* try short name */
3998
3999 return reject;
4000 }
4001
4002#if TCPWRAPPERS
4003 if (hostname[0] == '[' && hostname[strlen(hostname) - 1] == ']')
4004 host = "unknown";
4005 else

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

4306 if (strcmp(maptype[nmaps], "nis") == 0 ||
4307 strcmp(maptype[nmaps], "files") == 0)
4308 break;
4309 }
4310
4311 if (nmaps >= 0)
4312 {
4313 /* try short name */
4374 if (strlen(name) > sizeof hbuf - 1)
4314 if (strlen(name) > sizeof(hbuf) - 1)
4375 {
4376 errno = save_errno;
4377 return NULL;
4378 }
4315 {
4316 errno = save_errno;
4317 return NULL;
4318 }
4379 (void) sm_strlcpy(hbuf, name, sizeof hbuf);
4319 (void) sm_strlcpy(hbuf, name, sizeof(hbuf));
4380 (void) shorten_hostname(hbuf);
4381
4382 /* if it hasn't been shortened, there's no point */
4383 if (strcmp(hbuf, name) != 0)
4384 {
4385 if (tTd(61, 10))
4386 sm_dprintf("sm_gethostbyname(%s, %d)... ",
4387 hbuf, family);

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

4423 for (i = 0; h->h_addr_list[i] != NULL; i++)
4424 {
4425 char *addr;
4426
4427#if NETINET6
4428 memmove(&ia6, h->h_addr_list[i],
4429 IN6ADDRSZ);
4430 addr = anynet_ntop(&ia6,
4320 (void) shorten_hostname(hbuf);
4321
4322 /* if it hasn't been shortened, there's no point */
4323 if (strcmp(hbuf, name) != 0)
4324 {
4325 if (tTd(61, 10))
4326 sm_dprintf("sm_gethostbyname(%s, %d)... ",
4327 hbuf, family);

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

4363 for (i = 0; h->h_addr_list[i] != NULL; i++)
4364 {
4365 char *addr;
4366
4367#if NETINET6
4368 memmove(&ia6, h->h_addr_list[i],
4369 IN6ADDRSZ);
4370 addr = anynet_ntop(&ia6,
4431 buf6, sizeof buf6);
4371 buf6, sizeof(buf6));
4432#else /* NETINET6 */
4433 memmove(&ia, h->h_addr_list[i],
4434 INADDRSZ);
4435 addr = (char *) inet_ntoa(ia);
4436#endif /* NETINET6 */
4437 if (addr != NULL)
4438 sm_dprintf("\taddr: %s\n", addr);
4439 }

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

4662
4663 /* save its cname */
4664 if (!wordinclass((char *) hp->h_name, 'w'))
4665 {
4666 setclass('w', (char *) hp->h_name);
4667 if (tTd(0, 4))
4668 sm_dprintf("\ta.k.a.: %s\n", hp->h_name);
4669
4372#else /* NETINET6 */
4373 memmove(&ia, h->h_addr_list[i],
4374 INADDRSZ);
4375 addr = (char *) inet_ntoa(ia);
4376#endif /* NETINET6 */
4377 if (addr != NULL)
4378 sm_dprintf("\taddr: %s\n", addr);
4379 }

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

4602
4603 /* save its cname */
4604 if (!wordinclass((char *) hp->h_name, 'w'))
4605 {
4606 setclass('w', (char *) hp->h_name);
4607 if (tTd(0, 4))
4608 sm_dprintf("\ta.k.a.: %s\n", hp->h_name);
4609
4670 if (sm_snprintf(hnb, sizeof hnb, "[%s]", hp->h_name) < sizeof hnb
4610 if (sm_snprintf(hnb, sizeof(hnb), "[%s]", hp->h_name) <
4611 sizeof(hnb)
4671 && !wordinclass((char *) hnb, 'w'))
4672 setclass('w', hnb);
4673 }
4674 else
4675 {
4676 if (tTd(0, 43))
4677 sm_dprintf("\ta.k.a.: %s (already in $=w)\n", hp->h_name);
4678 }
4679
4680 /* save all it aliases name */
4681 for (ha = hp->h_aliases; ha != NULL && *ha != NULL; ha++)
4682 {
4683 if (!wordinclass(*ha, 'w'))
4684 {
4685 setclass('w', *ha);
4686 if (tTd(0, 4))
4687 sm_dprintf("\ta.k.a.: %s\n", *ha);
4612 && !wordinclass((char *) hnb, 'w'))
4613 setclass('w', hnb);
4614 }
4615 else
4616 {
4617 if (tTd(0, 43))
4618 sm_dprintf("\ta.k.a.: %s (already in $=w)\n", hp->h_name);
4619 }
4620
4621 /* save all it aliases name */
4622 for (ha = hp->h_aliases; ha != NULL && *ha != NULL; ha++)
4623 {
4624 if (!wordinclass(*ha, 'w'))
4625 {
4626 setclass('w', *ha);
4627 if (tTd(0, 4))
4628 sm_dprintf("\ta.k.a.: %s\n", *ha);
4688 if (sm_snprintf(hnb, sizeof hnb,
4689 "[%s]", *ha) < sizeof hnb &&
4629 if (sm_snprintf(hnb, sizeof(hnb),
4630 "[%s]", *ha) < sizeof(hnb) &&
4690 !wordinclass((char *) hnb, 'w'))
4691 setclass('w', hnb);
4692 }
4693 else
4694 {
4695 if (tTd(0, 43))
4696 sm_dprintf("\ta.k.a.: %s (already in $=w)\n",
4697 *ha);

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

4794 numifs = MAXINTERFACES;
4795
4796 if (numifs <= 0)
4797 {
4798 (void) close(s);
4799 return;
4800 }
4801
4631 !wordinclass((char *) hnb, 'w'))
4632 setclass('w', hnb);
4633 }
4634 else
4635 {
4636 if (tTd(0, 43))
4637 sm_dprintf("\ta.k.a.: %s (already in $=w)\n",
4638 *ha);

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

4735 numifs = MAXINTERFACES;
4736
4737 if (numifs <= 0)
4738 {
4739 (void) close(s);
4740 return;
4741 }
4742
4802 len = lifc.lifc_len = numifs * sizeof (struct lifreq);
4743 len = lifc.lifc_len = numifs * sizeof(struct lifreq);
4803 buf = lifc.lifc_buf = xalloc(lifc.lifc_len);
4804# ifndef __hpux
4805 lifc.lifc_family = AF_UNSPEC;
4806 lifc.lifc_flags = 0;
4807# endif /* ! __hpux */
4808 if (ioctl(s, SIOCGLIFCONF, (char *)&lifc) < 0)
4809 {
4810 if (tTd(0, 4))

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

4851 return;
4852 }
4853
4854 /*
4855 ** If we don't have a complete ifr structure,
4856 ** don't try to use it.
4857 */
4858
4744 buf = lifc.lifc_buf = xalloc(lifc.lifc_len);
4745# ifndef __hpux
4746 lifc.lifc_family = AF_UNSPEC;
4747 lifc.lifc_flags = 0;
4748# endif /* ! __hpux */
4749 if (ioctl(s, SIOCGLIFCONF, (char *)&lifc) < 0)
4750 {
4751 if (tTd(0, 4))

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

4792 return;
4793 }
4794
4795 /*
4796 ** If we don't have a complete ifr structure,
4797 ** don't try to use it.
4798 */
4799
4859 if ((len - i) < sizeof *ifr)
4800 if ((len - i) < sizeof(*ifr))
4860 break;
4861
4862# ifdef BSD4_4_SOCKADDR
4801 break;
4802
4803# ifdef BSD4_4_SOCKADDR
4863 if (sa->sa.sa_len > sizeof ifr->lifr_addr)
4864 i += sizeof ifr->lifr_name + sa->sa.sa_len;
4804 if (sa->sa.sa_len > sizeof(ifr->lifr_addr))
4805 i += sizeof(ifr->lifr_name) + sa->sa.sa_len;
4865 else
4866# endif /* BSD4_4_SOCKADDR */
4867# ifdef DEC
4868 /* fix for IPv6 size differences */
4806 else
4807# endif /* BSD4_4_SOCKADDR */
4808# ifdef DEC
4809 /* fix for IPv6 size differences */
4869 i += sizeof ifr->ifr_name +
4810 i += sizeof(ifr->ifr_name) +
4870 max(sizeof(ifr->ifr_addr), ifr->ifr_addr.sa_len);
4871# else /* DEC */
4811 max(sizeof(ifr->ifr_addr), ifr->ifr_addr.sa_len);
4812# else /* DEC */
4872 i += sizeof *ifr;
4813 i += sizeof(*ifr);
4873# endif /* DEC */
4874
4875 if (tTd(0, 20))
4876 sm_dprintf("%s\n", anynet_ntoa(sa));
4877
4878 if (af != AF_INET && af != AF_INET6)
4879 continue;
4880

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

4918 sa->sin6.sin6_scope_id = ntohs(ia6p->s6_addr[3] |
4919 ((unsigned int)ia6p->s6_addr[2] << 8));
4920 ia6p->s6_addr[2] = ia6p->s6_addr[3] = 0;
4921 }
4922# endif /* __KAME__ */
4923 ia6 = sa->sin6.sin6_addr;
4924 if (IN6_IS_ADDR_UNSPECIFIED(&ia6))
4925 {
4814# endif /* DEC */
4815
4816 if (tTd(0, 20))
4817 sm_dprintf("%s\n", anynet_ntoa(sa));
4818
4819 if (af != AF_INET && af != AF_INET6)
4820 continue;
4821

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

4859 sa->sin6.sin6_scope_id = ntohs(ia6p->s6_addr[3] |
4860 ((unsigned int)ia6p->s6_addr[2] << 8));
4861 ia6p->s6_addr[2] = ia6p->s6_addr[3] = 0;
4862 }
4863# endif /* __KAME__ */
4864 ia6 = sa->sin6.sin6_addr;
4865 if (IN6_IS_ADDR_UNSPECIFIED(&ia6))
4866 {
4926 addr = anynet_ntop(&ia6, buf6, sizeof buf6);
4867 addr = anynet_ntop(&ia6, buf6, sizeof(buf6));
4927 message("WARNING: interface %s is UP with %s address",
4928 name, addr == NULL ? "(NULL)" : addr);
4929 continue;
4930 }
4931
4932 /* save IP address in text from */
4868 message("WARNING: interface %s is UP with %s address",
4869 name, addr == NULL ? "(NULL)" : addr);
4870 continue;
4871 }
4872
4873 /* save IP address in text from */
4933 addr = anynet_ntop(&ia6, buf6, sizeof buf6);
4874 addr = anynet_ntop(&ia6, buf6, sizeof(buf6));
4934 if (addr != NULL)
4875 if (addr != NULL)
4935 (void) sm_snprintf(ip_addr, sizeof ip_addr,
4876 (void) sm_snprintf(ip_addr, sizeof(ip_addr),
4936 "[%.*s]",
4877 "[%.*s]",
4937 (int) sizeof ip_addr - 3,
4878 (int) sizeof(ip_addr) - 3,
4938 addr);
4939 break;
4940
4941 case AF_INET:
4942 ia = sa->sin.sin_addr;
4943 if (ia.s_addr == INADDR_ANY ||
4944 ia.s_addr == INADDR_NONE)
4945 {
4946 message("WARNING: interface %s is UP with %s address",
4947 name, inet_ntoa(ia));
4948 continue;
4949 }
4950
4951 /* save IP address in text from */
4879 addr);
4880 break;
4881
4882 case AF_INET:
4883 ia = sa->sin.sin_addr;
4884 if (ia.s_addr == INADDR_ANY ||
4885 ia.s_addr == INADDR_NONE)
4886 {
4887 message("WARNING: interface %s is UP with %s address",
4888 name, inet_ntoa(ia));
4889 continue;
4890 }
4891
4892 /* save IP address in text from */
4952 (void) sm_snprintf(ip_addr, sizeof ip_addr, "[%.*s]",
4953 (int) sizeof ip_addr - 3, inet_ntoa(ia));
4893 (void) sm_snprintf(ip_addr, sizeof(ip_addr), "[%.*s]",
4894 (int) sizeof(ip_addr) - 3, inet_ntoa(ia));
4954 break;
4955 }
4956
4957 if (*ip_addr == '\0')
4958 continue;
4959
4960 if (!wordinclass(ip_addr, 'w'))
4961 {

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

5001# endif /* defined(SIOCGIFNUM) && !SIOCGIFNUM_IS_BROKEN */
5002 numifs = MAXINTERFACES;
5003
5004 if (numifs <= 0)
5005 {
5006 (void) close(s);
5007 return;
5008 }
4895 break;
4896 }
4897
4898 if (*ip_addr == '\0')
4899 continue;
4900
4901 if (!wordinclass(ip_addr, 'w'))
4902 {

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

4942# endif /* defined(SIOCGIFNUM) && !SIOCGIFNUM_IS_BROKEN */
4943 numifs = MAXINTERFACES;
4944
4945 if (numifs <= 0)
4946 {
4947 (void) close(s);
4948 return;
4949 }
5009 ifc.ifc_len = numifs * sizeof (struct ifreq);
4950 ifc.ifc_len = numifs * sizeof(struct ifreq);
5010 ifc.ifc_buf = xalloc(ifc.ifc_len);
5011 if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0)
5012 {
5013 if (tTd(0, 4))
5014 sm_dprintf("SIOCGIFCONF failed: %s\n",
5015 sm_errstring(errno));
5016 (void) close(s);
5017 return;

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

5040 char buf6[INET6_ADDRSTRLEN];
5041# endif /* NETINET6 */
5042
5043 /*
5044 ** If we don't have a complete ifr structure,
5045 ** don't try to use it.
5046 */
5047
4951 ifc.ifc_buf = xalloc(ifc.ifc_len);
4952 if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0)
4953 {
4954 if (tTd(0, 4))
4955 sm_dprintf("SIOCGIFCONF failed: %s\n",
4956 sm_errstring(errno));
4957 (void) close(s);
4958 return;

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

4981 char buf6[INET6_ADDRSTRLEN];
4982# endif /* NETINET6 */
4983
4984 /*
4985 ** If we don't have a complete ifr structure,
4986 ** don't try to use it.
4987 */
4988
5048 if ((ifc.ifc_len - i) < sizeof *ifr)
4989 if ((ifc.ifc_len - i) < sizeof(*ifr))
5049 break;
5050
5051# ifdef BSD4_4_SOCKADDR
4990 break;
4991
4992# ifdef BSD4_4_SOCKADDR
5052 if (sa->sa.sa_len > sizeof ifr->ifr_addr)
5053 i += sizeof ifr->ifr_name + sa->sa.sa_len;
4993 if (sa->sa.sa_len > sizeof(ifr->ifr_addr))
4994 i += sizeof(ifr->ifr_name) + sa->sa.sa_len;
5054 else
5055# endif /* BSD4_4_SOCKADDR */
4995 else
4996# endif /* BSD4_4_SOCKADDR */
5056 i += sizeof *ifr;
4997 i += sizeof(*ifr);
5057
5058 if (tTd(0, 20))
5059 sm_dprintf("%s\n", anynet_ntoa(sa));
5060
5061 af = ifr->ifr_addr.sa_family;
5062 if (af != AF_INET
5063# if NETINET6
5064 && af != AF_INET6

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

5093 ia.s_addr == INADDR_NONE)
5094 {
5095 message("WARNING: interface %s is UP with %s address",
5096 ifr->ifr_name, inet_ntoa(ia));
5097 continue;
5098 }
5099
5100 /* save IP address in text from */
4998
4999 if (tTd(0, 20))
5000 sm_dprintf("%s\n", anynet_ntoa(sa));
5001
5002 af = ifr->ifr_addr.sa_family;
5003 if (af != AF_INET
5004# if NETINET6
5005 && af != AF_INET6

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

5034 ia.s_addr == INADDR_NONE)
5035 {
5036 message("WARNING: interface %s is UP with %s address",
5037 ifr->ifr_name, inet_ntoa(ia));
5038 continue;
5039 }
5040
5041 /* save IP address in text from */
5101 (void) sm_snprintf(ip_addr, sizeof ip_addr, "[%.*s]",
5102 (int) sizeof ip_addr - 3,
5042 (void) sm_snprintf(ip_addr, sizeof(ip_addr), "[%.*s]",
5043 (int) sizeof(ip_addr) - 3,
5103 inet_ntoa(ia));
5104 break;
5105
5106# if NETINET6
5107 case AF_INET6:
5108# ifdef __KAME__
5109 /* convert into proper scoped address */
5110 if ((IN6_IS_ADDR_LINKLOCAL(&sa->sin6.sin6_addr) ||

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

5117 sa->sin6.sin6_scope_id = ntohs(ia6p->s6_addr[3] |
5118 ((unsigned int)ia6p->s6_addr[2] << 8));
5119 ia6p->s6_addr[2] = ia6p->s6_addr[3] = 0;
5120 }
5121# endif /* __KAME__ */
5122 ia6 = sa->sin6.sin6_addr;
5123 if (IN6_IS_ADDR_UNSPECIFIED(&ia6))
5124 {
5044 inet_ntoa(ia));
5045 break;
5046
5047# if NETINET6
5048 case AF_INET6:
5049# ifdef __KAME__
5050 /* convert into proper scoped address */
5051 if ((IN6_IS_ADDR_LINKLOCAL(&sa->sin6.sin6_addr) ||

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

5058 sa->sin6.sin6_scope_id = ntohs(ia6p->s6_addr[3] |
5059 ((unsigned int)ia6p->s6_addr[2] << 8));
5060 ia6p->s6_addr[2] = ia6p->s6_addr[3] = 0;
5061 }
5062# endif /* __KAME__ */
5063 ia6 = sa->sin6.sin6_addr;
5064 if (IN6_IS_ADDR_UNSPECIFIED(&ia6))
5065 {
5125 addr = anynet_ntop(&ia6, buf6, sizeof buf6);
5066 addr = anynet_ntop(&ia6, buf6, sizeof(buf6));
5126 message("WARNING: interface %s is UP with %s address",
5127 ifr->ifr_name,
5128 addr == NULL ? "(NULL)" : addr);
5129 continue;
5130 }
5131
5132 /* save IP address in text from */
5067 message("WARNING: interface %s is UP with %s address",
5068 ifr->ifr_name,
5069 addr == NULL ? "(NULL)" : addr);
5070 continue;
5071 }
5072
5073 /* save IP address in text from */
5133 addr = anynet_ntop(&ia6, buf6, sizeof buf6);
5074 addr = anynet_ntop(&ia6, buf6, sizeof(buf6));
5134 if (addr != NULL)
5075 if (addr != NULL)
5135 (void) sm_snprintf(ip_addr, sizeof ip_addr,
5076 (void) sm_snprintf(ip_addr, sizeof(ip_addr),
5136 "[%.*s]",
5077 "[%.*s]",
5137 (int) sizeof ip_addr - 3,
5078 (int) sizeof(ip_addr) - 3,
5138 addr);
5139 break;
5140
5141# endif /* NETINET6 */
5142 }
5143
5144 if (ip_addr[0] == '\0')
5145 continue;

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

5208
5209#ifdef USESYSCTL
5210# if defined(CTL_HW) && defined(HW_NCPU)
5211 size_t sz;
5212 int mib[2];
5213
5214 mib[0] = CTL_HW;
5215 mib[1] = HW_NCPU;
5079 addr);
5080 break;
5081
5082# endif /* NETINET6 */
5083 }
5084
5085 if (ip_addr[0] == '\0')
5086 continue;

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

5149
5150#ifdef USESYSCTL
5151# if defined(CTL_HW) && defined(HW_NCPU)
5152 size_t sz;
5153 int mib[2];
5154
5155 mib[0] = CTL_HW;
5156 mib[1] = HW_NCPU;
5216 sz = (size_t) sizeof nproc;
5157 sz = (size_t) sizeof(nproc);
5217 (void) sysctl(mib, 2, &nproc, &sz, NULL, 0);
5218# endif /* defined(CTL_HW) && defined(HW_NCPU) */
5219#else /* USESYSCTL */
5220# ifdef _SC_NPROCESSORS_ONLN
5221 nproc = (int) sysconf(_SC_NPROCESSORS_ONLN);
5222# else /* _SC_NPROCESSORS_ONLN */
5223# ifdef __hpux
5224# include <sys/pstat.h>

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

5384 {
5385 id = "";
5386 idlen = SyslogPrefixLen;
5387 }
5388 else
5389 idlen = strlen(id) + SyslogPrefixLen;
5390
5391 buf = buf0;
5158 (void) sysctl(mib, 2, &nproc, &sz, NULL, 0);
5159# endif /* defined(CTL_HW) && defined(HW_NCPU) */
5160#else /* USESYSCTL */
5161# ifdef _SC_NPROCESSORS_ONLN
5162 nproc = (int) sysconf(_SC_NPROCESSORS_ONLN);
5163# else /* _SC_NPROCESSORS_ONLN */
5164# ifdef __hpux
5165# include <sys/pstat.h>

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

5325 {
5326 id = "";
5327 idlen = SyslogPrefixLen;
5328 }
5329 else
5330 idlen = strlen(id) + SyslogPrefixLen;
5331
5332 buf = buf0;
5392 bufsize = sizeof buf0;
5333 bufsize = sizeof(buf0);
5393
5394 for (;;)
5395 {
5396 int n;
5397
5398 /* print log message into buf */
5399 SM_VA_START(ap, fmt);
5400 n = sm_vsnprintf(buf, bufsize, fmt, ap);

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

5414 }
5415
5416 /* clean up buf after it has been expanded with args */
5417 newstring = str2prt(buf);
5418 if ((strlen(newstring) + idlen + 1) < SYSLOG_BUFSIZE)
5419 {
5420#if LOG
5421 if (*id == '\0')
5334
5335 for (;;)
5336 {
5337 int n;
5338
5339 /* print log message into buf */
5340 SM_VA_START(ap, fmt);
5341 n = sm_vsnprintf(buf, bufsize, fmt, ap);

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

5355 }
5356
5357 /* clean up buf after it has been expanded with args */
5358 newstring = str2prt(buf);
5359 if ((strlen(newstring) + idlen + 1) < SYSLOG_BUFSIZE)
5360 {
5361#if LOG
5362 if (*id == '\0')
5422 syslog(level, "%s", newstring);
5363 {
5364 if (tTd(89, 8))
5365 sm_dprintf("%s\n", newstring);
5366 else
5367 syslog(level, "%s", newstring);
5368 }
5423 else
5369 else
5424 syslog(level, "%s: %s", id, newstring);
5370 {
5371 if (tTd(89, 8))
5372 sm_dprintf("%s: %s\n", id, newstring);
5373 else
5374 syslog(level, "%s: %s", id, newstring);
5375 }
5425#else /* LOG */
5426 /*XXX should do something more sensible */
5427 if (*id == '\0')
5428 (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT, "%s\n",
5429 newstring);
5430 else
5431 (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
5432 "%s: %s\n", id, newstring);

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

5468 end--;
5469 }
5470 /* No separator, break midstring... */
5471 if (end == begin)
5472 end = begin + SYSLOG_BUFSIZE - idlen - SL_SPLIT;
5473 save = *end;
5474 *end = 0;
5475#if LOG
5376#else /* LOG */
5377 /*XXX should do something more sensible */
5378 if (*id == '\0')
5379 (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT, "%s\n",
5380 newstring);
5381 else
5382 (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
5383 "%s: %s\n", id, newstring);

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

5419 end--;
5420 }
5421 /* No separator, break midstring... */
5422 if (end == begin)
5423 end = begin + SYSLOG_BUFSIZE - idlen - SL_SPLIT;
5424 save = *end;
5425 *end = 0;
5426#if LOG
5476 syslog(level, "%s[%d]: %s ...", id, seq++, begin);
5427 if (tTd(89, 8))
5428 sm_dprintf("%s[%d]: %s ...\n", id, seq++, begin);
5429 else
5430 syslog(level, "%s[%d]: %s ...", id, seq++, begin);
5477#else /* LOG */
5478 (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
5479 "%s[%d]: %s ...\n", id, seq++, begin);
5480#endif /* LOG */
5481 *end = save;
5482 begin = end;
5483 }
5484 if (seq >= 999)
5431#else /* LOG */
5432 (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
5433 "%s[%d]: %s ...\n", id, seq++, begin);
5434#endif /* LOG */
5435 *end = save;
5436 begin = end;
5437 }
5438 if (seq >= 999)
5439 {
5485#if LOG
5440#if LOG
5486 syslog(level, "%s[%d]: log terminated, too many parts",
5487 id, seq);
5441 if (tTd(89, 8))
5442 sm_dprintf("%s[%d]: log terminated, too many parts\n",
5443 id, seq);
5444 else
5445 syslog(level, "%s[%d]: log terminated, too many parts",
5446 id, seq);
5488#else /* LOG */
5489 (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
5490 "%s[%d]: log terminated, too many parts\n", id, seq);
5491#endif /* LOG */
5447#else /* LOG */
5448 (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
5449 "%s[%d]: log terminated, too many parts\n", id, seq);
5450#endif /* LOG */
5451 }
5492 else if (*begin != '\0')
5452 else if (*begin != '\0')
5453 {
5493#if LOG
5454#if LOG
5494 syslog(level, "%s[%d]: %s", id, seq, begin);
5455 if (tTd(89, 8))
5456 sm_dprintf("%s[%d]: %s\n", id, seq, begin);
5457 else
5458 syslog(level, "%s[%d]: %s", id, seq, begin);
5495#else /* LOG */
5496 (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
5497 "%s[%d]: %s\n", id, seq, begin);
5498#endif /* LOG */
5459#else /* LOG */
5460 (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
5461 "%s[%d]: %s\n", id, seq, begin);
5462#endif /* LOG */
5463 }
5499 if (buf != buf0)
5500 sm_free(buf);
5501 errno = save_errno;
5502}
5503/*
5504** HARD_SYSLOG -- call syslog repeatedly until it works
5505**
5506** Needed on HP-UX, which apparently doesn't guarantee that

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

5529 va_dcl
5530# endif /* __STDC__ */
5531{
5532 int i;
5533 char buf[SYSLOG_BUFSIZE];
5534 SM_VA_LOCAL_DECL
5535
5536 SM_VA_START(ap, msg);
5464 if (buf != buf0)
5465 sm_free(buf);
5466 errno = save_errno;
5467}
5468/*
5469** HARD_SYSLOG -- call syslog repeatedly until it works
5470**
5471** Needed on HP-UX, which apparently doesn't guarantee that

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

5494 va_dcl
5495# endif /* __STDC__ */
5496{
5497 int i;
5498 char buf[SYSLOG_BUFSIZE];
5499 SM_VA_LOCAL_DECL
5500
5501 SM_VA_START(ap, msg);
5537 (void) sm_vsnprintf(buf, sizeof buf, msg, ap);
5502 (void) sm_vsnprintf(buf, sizeof(buf), msg, ap);
5538 SM_VA_END(ap);
5539
5540 for (i = MAXSYSLOGTRIES; --i >= 0 && syslog(pri, CAST "%s", buf) < 0; )
5541 continue;
5542}
5543
5544# undef CAST
5545#endif /* defined(__hpux) && !defined(HPUX11) */

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

5787 "SASLv2",
5788# else /* SASL >= 20000 */
5789 "SASL",
5790# endif /* SASL >= 20000 */
5791#endif /* SASL */
5792#if SCANF
5793 "SCANF",
5794#endif /* SCANF */
5503 SM_VA_END(ap);
5504
5505 for (i = MAXSYSLOGTRIES; --i >= 0 && syslog(pri, CAST "%s", buf) < 0; )
5506 continue;
5507}
5508
5509# undef CAST
5510#endif /* defined(__hpux) && !defined(HPUX11) */

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

5752 "SASLv2",
5753# else /* SASL >= 20000 */
5754 "SASL",
5755# endif /* SASL >= 20000 */
5756#endif /* SASL */
5757#if SCANF
5758 "SCANF",
5759#endif /* SCANF */
5760#if SM_LDAP_ERROR_ON_MISSING_ARGS
5761 "SM_LDAP_ERROR_ON_MISSING_ARGS",
5762#endif /* SM_LDAP_ERROR_ON_MISSING_ARGS */
5795#if SMTPDEBUG
5796 "SMTPDEBUG",
5797#endif /* SMTPDEBUG */
5798#if SOCKETMAP
5799 "SOCKETMAP",
5800#endif /* SOCKETMAP */
5801#if STARTTLS
5802 "STARTTLS",

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

5881 "HASGETDTABLESIZE",
5882#endif /* HASGETDTABLESIZE */
5883#if HASGETUSERSHELL
5884 "HASGETUSERSHELL",
5885#endif /* HASGETUSERSHELL */
5886#if HASINITGROUPS
5887 "HASINITGROUPS",
5888#endif /* HASINITGROUPS */
5763#if SMTPDEBUG
5764 "SMTPDEBUG",
5765#endif /* SMTPDEBUG */
5766#if SOCKETMAP
5767 "SOCKETMAP",
5768#endif /* SOCKETMAP */
5769#if STARTTLS
5770 "STARTTLS",

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

5849 "HASGETDTABLESIZE",
5850#endif /* HASGETDTABLESIZE */
5851#if HASGETUSERSHELL
5852 "HASGETUSERSHELL",
5853#endif /* HASGETUSERSHELL */
5854#if HASINITGROUPS
5855 "HASINITGROUPS",
5856#endif /* HASINITGROUPS */
5857#if HASLDAPGETALIASBYNAME
5858 "HASLDAPGETALIASBYNAME",
5859#endif /* HASLDAPGETALIASBYNAME */
5889#if HASLSTAT
5890 "HASLSTAT",
5891#endif /* HASLSTAT */
5892#if HASNICE
5893 "HASNICE",
5894#endif /* HASNICE */
5895#if HASRANDOM
5896 "HASRANDOM",

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

5953 "IDENTPROTO",
5954#endif /* IDENTPROTO */
5955#if IP_SRCROUTE
5956 "IP_SRCROUTE",
5957#endif /* IP_SRCROUTE */
5958#if O_EXLOCK && HASFLOCK && !BOGUS_O_EXCL
5959 "LOCK_ON_OPEN",
5960#endif /* O_EXLOCK && HASFLOCK && !BOGUS_O_EXCL */
5860#if HASLSTAT
5861 "HASLSTAT",
5862#endif /* HASLSTAT */
5863#if HASNICE
5864 "HASNICE",
5865#endif /* HASNICE */
5866#if HASRANDOM
5867 "HASRANDOM",

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

5924 "IDENTPROTO",
5925#endif /* IDENTPROTO */
5926#if IP_SRCROUTE
5927 "IP_SRCROUTE",
5928#endif /* IP_SRCROUTE */
5929#if O_EXLOCK && HASFLOCK && !BOGUS_O_EXCL
5930 "LOCK_ON_OPEN",
5931#endif /* O_EXLOCK && HASFLOCK && !BOGUS_O_EXCL */
5932#if MILTER_NO_NAGLE
5933 "MILTER_NO_NAGLE ",
5934#endif /* MILTER_NO_NAGLE */
5961#if NEEDFSYNC
5962 "NEEDFSYNC",
5963#endif /* NEEDFSYNC */
5964#if NEEDLINK
5965 "NEEDLINK",
5966#endif /* NEEDLINK */
5967#if NEEDLOCAL_HOSTNAME_LENGTH
5968 "NEEDLOCAL_HOSTNAME_LENGTH",

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

6055 /* DefaultAuthInfo can be specified by user. */
6056 /* DefaultAuthInfo doesn't really work in 8.13 anymore. */
6057 "_FFR_ALLOW_SASLINFO",
6058#endif /* _FFR_ALLOW_SASLINFO */
6059#if _FFR_BESTMX_BETTER_TRUNCATION
6060 /* Better truncation of list of MX records for dns map. */
6061 "_FFR_BESTMX_BETTER_TRUNCATION",
6062#endif /* _FFR_BESTMX_BETTER_TRUNCATION */
5935#if NEEDFSYNC
5936 "NEEDFSYNC",
5937#endif /* NEEDFSYNC */
5938#if NEEDLINK
5939 "NEEDLINK",
5940#endif /* NEEDLINK */
5941#if NEEDLOCAL_HOSTNAME_LENGTH
5942 "NEEDLOCAL_HOSTNAME_LENGTH",

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

6029 /* DefaultAuthInfo can be specified by user. */
6030 /* DefaultAuthInfo doesn't really work in 8.13 anymore. */
6031 "_FFR_ALLOW_SASLINFO",
6032#endif /* _FFR_ALLOW_SASLINFO */
6033#if _FFR_BESTMX_BETTER_TRUNCATION
6034 /* Better truncation of list of MX records for dns map. */
6035 "_FFR_BESTMX_BETTER_TRUNCATION",
6036#endif /* _FFR_BESTMX_BETTER_TRUNCATION */
6063#if _FFR_BLOCK_PROXIES
6064 /*
6065 ** Try to deal with open HTTP proxies that are used to send spam
6066 ** by recognizing some commands from them.
6067 */
6068
6069 "_FFR_BLOCK_PROXIES",
6070#endif /* _FFR_BLOCK_PROXIES */
6071#if _FFR_CATCH_BROKEN_MTAS
6072 /* Deal with MTAs that send a reply during the DATA phase. */
6073 "_FFR_CATCH_BROKEN_MTAS",
6074#endif /* _FFR_CATCH_BROKEN_MTAS */
6037#if _FFR_CATCH_BROKEN_MTAS
6038 /* Deal with MTAs that send a reply during the DATA phase. */
6039 "_FFR_CATCH_BROKEN_MTAS",
6040#endif /* _FFR_CATCH_BROKEN_MTAS */
6075#if _FFR_CHECK_EOM
6076 /* Enable check_eom ruleset */
6077 "_FFR_CHECK_EOM",
6078#endif /* _FFR_CHECK_EOM */
6079#if _FFR_CHK_QUEUE
6080 /* Stricter checks about queue directory permissions. */
6081 "_FFR_CHK_QUEUE",
6082#endif /* _FFR_CHK_QUEUE */
6083#if _FFR_CLIENT_SIZE
6084 /* Don't try to send mail if its size exceeds SIZE= of server. */
6085 "_FFR_CLIENT_SIZE",
6086#endif /* _FFR_CLIENT_SIZE */
6041#if _FFR_CHK_QUEUE
6042 /* Stricter checks about queue directory permissions. */
6043 "_FFR_CHK_QUEUE",
6044#endif /* _FFR_CHK_QUEUE */
6045#if _FFR_CLIENT_SIZE
6046 /* Don't try to send mail if its size exceeds SIZE= of server. */
6047 "_FFR_CLIENT_SIZE",
6048#endif /* _FFR_CLIENT_SIZE */
6087#if _FFR_CONTROL_MSTAT
6088 /* Extended daemon status. */
6089 "_FFR_CONTROL_MSTAT",
6090#endif /* _FFR_CONTROL_MSTAT */
6091#if _FFR_CRLPATH
6092 /* CRLPath; needs documentation; Al Smith */
6093 "_FFR_CRLPATH",
6094#endif /* _FFR_CRLPATH */
6095#if _FFR_DAEMON_NETUNIX
6096 /* Allow local (not just TCP) socket connection to server. */
6097 "_FFR_DAEMON_NETUNIX",
6098#endif /* _FFR_DAEMON_NETUNIX */

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

6104 /* deliver first TA in background, then queue */
6105 "_FFR_DM_ONE",
6106#endif /* _FFR_DM_ONE */
6107#if _FFR_DIGUNIX_SAFECHOWN
6108 /* Properly set SAFECHOWN (include/sm/conf.h) for Digital UNIX */
6109/* Problem noted by Anne Bennett of Concordia University */
6110 "_FFR_DIGUNIX_SAFECHOWN",
6111#endif /* _FFR_DIGUNIX_SAFECHOWN */
6049#if _FFR_CRLPATH
6050 /* CRLPath; needs documentation; Al Smith */
6051 "_FFR_CRLPATH",
6052#endif /* _FFR_CRLPATH */
6053#if _FFR_DAEMON_NETUNIX
6054 /* Allow local (not just TCP) socket connection to server. */
6055 "_FFR_DAEMON_NETUNIX",
6056#endif /* _FFR_DAEMON_NETUNIX */

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

6062 /* deliver first TA in background, then queue */
6063 "_FFR_DM_ONE",
6064#endif /* _FFR_DM_ONE */
6065#if _FFR_DIGUNIX_SAFECHOWN
6066 /* Properly set SAFECHOWN (include/sm/conf.h) for Digital UNIX */
6067/* Problem noted by Anne Bennett of Concordia University */
6068 "_FFR_DIGUNIX_SAFECHOWN",
6069#endif /* _FFR_DIGUNIX_SAFECHOWN */
6112#if _FFR_DM_PER_DAEMON
6113 /* DeliveryMode per DaemonPortOptions: 'D' */
6114 "_FFR_DM_PER_DAEMON",
6115#endif /* _FFR_DM_PER_DAEMON */
6116#if _FFR_DNSMAP_ALIASABLE
6117 /* Allow dns map type to be used for aliases. */
6118/* Don Lewis of TDK */
6119 "_FFR_DNSMAP_ALIASABLE",
6120#endif /* _FFR_DNSMAP_ALIASABLE */
6070#if _FFR_DNSMAP_ALIASABLE
6071 /* Allow dns map type to be used for aliases. */
6072/* Don Lewis of TDK */
6073 "_FFR_DNSMAP_ALIASABLE",
6074#endif /* _FFR_DNSMAP_ALIASABLE */
6121#if _FFR_DNSMAP_BASE
6122 /* Specify a "base" domain for DNS lookups. */
6123 "_FFR_DNSMAP_BASE",
6124#endif /* _FFR_DNSMAP_BASE */
6125#if _FFR_DNSMAP_MULTI
6126 /* Allow multiple return values for DNS map. */
6127 "_FFR_DNSMAP_MULTI",
6128# if _FFR_DNSMAP_MULTILIMIT
6129 /* Limit number of return values for DNS map. */
6130 "_FFR_DNSMAP_MULTILIMIT",
6131# endif /* _FFR_DNSMAP_MULTILIMIT */
6132#endif /* _FFR_DNSMAP_MULTI */
6133#if _FFR_DONTLOCKFILESFORREAD_OPTION
6134 /* Enable DontLockFilesForRead option. */
6135 "_FFR_DONTLOCKFILESFORREAD_OPTION",
6136#endif /* _FFR_DONTLOCKFILESFORREAD_OPTION */
6137#if _FFR_DOTTED_USERNAMES
6138 /* Allow usernames with '.' */
6139 "_FFR_DOTTED_USERNAMES",
6140#endif /* _FFR_DOTTED_USERNAMES */
6075#if _FFR_DONTLOCKFILESFORREAD_OPTION
6076 /* Enable DontLockFilesForRead option. */
6077 "_FFR_DONTLOCKFILESFORREAD_OPTION",
6078#endif /* _FFR_DONTLOCKFILESFORREAD_OPTION */
6079#if _FFR_DOTTED_USERNAMES
6080 /* Allow usernames with '.' */
6081 "_FFR_DOTTED_USERNAMES",
6082#endif /* _FFR_DOTTED_USERNAMES */
6083#if _FFR_DPO_CS
6084 /*
6085 ** Make DaemonPortOptions case sensitive.
6086 ** For some unknown reasons the code converted every option
6087 ** to uppercase (first letter only, as that's the only one that
6088 ** is actually checked). This prevented all new lower case options
6089 ** from working...
6090 ** The documentation doesn't say anything about case (in)sensitivity,
6091 ** which means it should be case sensitive by default,
6092 ** but it's not a good idea to change this within a patch release,
6093 ** so let's delay this to 8.15.
6094 */
6095
6096 "_FFR_DPO_CS",
6097#endif /* _FFR_DPO_CS */
6141#if _FFR_DROP_TRUSTUSER_WARNING
6142 /*
6143 ** Don't issue this warning:
6144 ** "readcf: option TrustedUser may cause problems on systems
6145 ** which do not support fchown() if UseMSP is not set.
6146 */
6147
6148 "_FFR_DROP_TRUSTUSER_WARNING",
6149#endif /* _FFR_DROP_TRUSTUSER_WARNING */
6098#if _FFR_DROP_TRUSTUSER_WARNING
6099 /*
6100 ** Don't issue this warning:
6101 ** "readcf: option TrustedUser may cause problems on systems
6102 ** which do not support fchown() if UseMSP is not set.
6103 */
6104
6105 "_FFR_DROP_TRUSTUSER_WARNING",
6106#endif /* _FFR_DROP_TRUSTUSER_WARNING */
6107#if _FFR_EIGHT_BIT_ADDR_OK
6108 /* EightBitAddrOK: allow 8-bit e-mail addresses */
6109 "_FFR_EIGHT_BIT_ADDR_OK",
6110#endif /* _FFR_EIGHT_BIT_ADDR_OK */
6150#if _FFR_EXTRA_MAP_CHECK
6151 /* perform extra checks on $( $) in R lines */
6152 "_FFR_EXTRA_MAP_CHECK",
6153#endif /* _FFR_EXTRA_MAP_CHECK */
6111#if _FFR_EXTRA_MAP_CHECK
6112 /* perform extra checks on $( $) in R lines */
6113 "_FFR_EXTRA_MAP_CHECK",
6114#endif /* _FFR_EXTRA_MAP_CHECK */
6115#if _FFR_GETHBN_ExFILE
6116 /*
6117 ** According to Motonori Nakamura some gethostbyname()
6118 ** implementations (TurboLinux?) may (temporarily) fail
6119 ** due to a lack of file discriptors. Enabling this FFR
6120 ** will check errno for EMFILE and ENFILE and in case of a match
6121 ** cause a temporary error instead of a permanent error.
6122 ** The right solution is of course to file a bug against those
6123 ** systems such that they actually set h_errno = TRY_AGAIN.
6124 */
6125
6126 "_FFR_GETHBN_ExFILE",
6127#endif /* _FFR_GETHBN_ExFILE */
6154#if _FFR_FIX_DASHT
6155 /*
6156 ** If using -t, force not sending to argv recipients, even
6157 ** if they are mentioned in the headers.
6158 */
6159
6160 "_FFR_FIX_DASHT",
6161#endif /* _FFR_FIX_DASHT */
6162#if _FFR_FORWARD_SYSERR
6163 /* Cause a "syserr" if forward file isn't "safe". */
6164 "_FFR_FORWARD_SYSERR",
6165#endif /* _FFR_FORWARD_SYSERR */
6166#if _FFR_GEN_ORCPT
6167 /* Generate a ORCPT DSN arg if not already provided */
6168 "_FFR_GEN_ORCPT",
6169#endif /* _FFR_GEN_ORCPT */
6128#if _FFR_FIX_DASHT
6129 /*
6130 ** If using -t, force not sending to argv recipients, even
6131 ** if they are mentioned in the headers.
6132 */
6133
6134 "_FFR_FIX_DASHT",
6135#endif /* _FFR_FIX_DASHT */
6136#if _FFR_FORWARD_SYSERR
6137 /* Cause a "syserr" if forward file isn't "safe". */
6138 "_FFR_FORWARD_SYSERR",
6139#endif /* _FFR_FORWARD_SYSERR */
6140#if _FFR_GEN_ORCPT
6141 /* Generate a ORCPT DSN arg if not already provided */
6142 "_FFR_GEN_ORCPT",
6143#endif /* _FFR_GEN_ORCPT */
6170#if _FFR_LOG_GREET_PAUSE
6171 /* log time for greet_pause delay; from Nik Clayton */
6172 "_FFR_LOG_GREET_PAUSE",
6173#endif /* _FFR_LOG_GREET_PAUSE */
6174#if _FFR_GROUPREADABLEAUTHINFOFILE
6175 /* Allow group readable DefaultAuthInfo file. */
6176 "_FFR_GROUPREADABLEAUTHINFOFILE",
6177#endif /* _FFR_GROUPREADABLEAUTHINFOFILE */
6178#if _FFR_HANDLE_ISO8859_GECOS
6179 /*
6180 ** Allow ISO 8859 characters in GECOS field: replace them
6181 ** ith ASCII "equivalent".
6182 */
6183
6184/* Peter Eriksson of Linkopings universitet */
6185 "_FFR_HANDLE_ISO8859_GECOS",
6186#endif /* _FFR_HANDLE_ISO8859_GECOS */
6144#if _FFR_GROUPREADABLEAUTHINFOFILE
6145 /* Allow group readable DefaultAuthInfo file. */
6146 "_FFR_GROUPREADABLEAUTHINFOFILE",
6147#endif /* _FFR_GROUPREADABLEAUTHINFOFILE */
6148#if _FFR_HANDLE_ISO8859_GECOS
6149 /*
6150 ** Allow ISO 8859 characters in GECOS field: replace them
6151 ** ith ASCII "equivalent".
6152 */
6153
6154/* Peter Eriksson of Linkopings universitet */
6155 "_FFR_HANDLE_ISO8859_GECOS",
6156#endif /* _FFR_HANDLE_ISO8859_GECOS */
6187#if _FFR_HDR_TYPE
6188 /* Set 'h' in {addr_type} for headers. */
6189 "_FFR_HDR_TYPE",
6190#endif /* _FFR_HDR_TYPE */
6191#if _FFR_HELONAME
6192 /* option to set heloname; Nik Clayton of FreeBSD */
6193 "_FFR_HELONAME",
6194#endif /* _FFR_HELONAME */
6195#if _FFR_HPUX_NSSWITCH
6196 /* Use nsswitch on HP-UX */
6197 "_FFR_HPUX_NSSWITCH",
6198#endif /* _FFR_HPUX_NSSWITCH */
6199#if _FFR_IGNORE_BOGUS_ADDR
6200 /* Ignore addresses for which prescan() failed */
6201 "_FFR_IGNORE_BOGUS_ADDR",
6202#endif /* _FFR_IGNORE_BOGUS_ADDR */

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

6215 "_FFR_MAXDATASIZE",
6216#endif /* _FFR_MAXDATASIZE */
6217#if _FFR_MAX_FORWARD_ENTRIES
6218 /* Try to limit number of .forward entries */
6219 /* (doesn't work) */
6220/* Randall S. Winchester of the University of Maryland */
6221 "_FFR_MAX_FORWARD_ENTRIES",
6222#endif /* _FFR_MAX_FORWARD_ENTRIES */
6157#if _FFR_HPUX_NSSWITCH
6158 /* Use nsswitch on HP-UX */
6159 "_FFR_HPUX_NSSWITCH",
6160#endif /* _FFR_HPUX_NSSWITCH */
6161#if _FFR_IGNORE_BOGUS_ADDR
6162 /* Ignore addresses for which prescan() failed */
6163 "_FFR_IGNORE_BOGUS_ADDR",
6164#endif /* _FFR_IGNORE_BOGUS_ADDR */

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

6177 "_FFR_MAXDATASIZE",
6178#endif /* _FFR_MAXDATASIZE */
6179#if _FFR_MAX_FORWARD_ENTRIES
6180 /* Try to limit number of .forward entries */
6181 /* (doesn't work) */
6182/* Randall S. Winchester of the University of Maryland */
6183 "_FFR_MAX_FORWARD_ENTRIES",
6184#endif /* _FFR_MAX_FORWARD_ENTRIES */
6223#if _FFR_MAXKEY
6224 /* increase key size for LDAP lookups, see conf.h */
6225 "_FFR_MAXKEY",
6226#endif /* _FFR_MAXKEY */
6227#if _FFR_MAXNOOPCOMMANDS
6228 /* runtime option for "MaxNOOPCommands" */
6229 "_FFR_MAXNOOPCOMMANDS",
6230#endif /* _FFR_MAXNOOPCOMMANDS */
6231#if _FFR_MAX_SLEEP_TIME
6232 /* Limit sleep(2) time in libsm/clock.c */
6233 "_FFR_MAX_SLEEP_TIME",
6234#endif /* _FFR_MAX_SLEEP_TIME */
6235#if _FFR_MEMSTAT
6236 /* Check free memory */
6237 "_FFR_MEMSTAT",
6238#endif /* _FFR_MEMSTAT */
6185#if _FFR_MAX_SLEEP_TIME
6186 /* Limit sleep(2) time in libsm/clock.c */
6187 "_FFR_MAX_SLEEP_TIME",
6188#endif /* _FFR_MAX_SLEEP_TIME */
6189#if _FFR_MEMSTAT
6190 /* Check free memory */
6191 "_FFR_MEMSTAT",
6192#endif /* _FFR_MEMSTAT */
6239#if _FFR_MILTER_NAGLE
6240 /* milter: turn off Nagle ("cork" on Linux) */
6241 /* John Gardiner Myers of Proofpoint */
6242 "_FFR_MILTER_NAGLE ",
6243#endif /* _FFR_MILTER_NAGLE */
6244#if _FFR_MILTER_NOHDR_RESP
6245 /* milter: no response expected when sending headers */
6246 /* John Gardiner Myers of Proofpoint */
6247 "_FFR_MILTER_NOHDR_RESP",
6248#endif /* _FFR_MILTER_NOHDR_RESP */
6193#if _FFR_MILTER_CHECK
6194 "_FFR_MILTER_CHECK",
6195#endif /* _FFR_MILTER_CHECK */
6196#if _FFR_MILTER_CONVERT_ALL_LF_TO_CRLF
6197 /*
6198 ** milter_body() uses the same conversion algorithm as putbody()
6199 ** to translate the "local" df format (\n) to SMTP format (\r\n).
6200 ** However, putbody() and mime8to7() use different conversion
6201 ** algorithms.
6202 ** If the input date does not follow the SMTP standard
6203 ** (e.g., if it has "naked \r"s), then the output from putbody()
6204 ** and mime8to7() will most likely be different.
6205 ** By turning on this FFR milter_body() will try to "imitate"
6206 ** mime8to7().
6207 ** Note: there is no (simple) way to deal with both conversions
6208 ** in a consistent manner. Moreover, as the "GiGo" principle applies,
6209 ** it's not really worth to fix it.
6210 */
6211
6212 "_FFR_MILTER_CONVERT_ALL_LF_TO_CRLF",
6213#endif /* _FFR_MILTER_CONVERT_ALL_LF_TO_CRLF */
6214#if _FFR_MILTER_CHECK_REJECTIONS_TOO
6215 /*
6216 ** Also send RCPTs that are rejected by check_rcpt to a milter
6217 ** (if requested during option negotiation).
6218 */
6219
6220 "_FFR_MILTER_CHECK_REJECTIONS_TOO",
6221#endif /* _FFR_MILTER_CHECK_REJECTIONS_TOO */
6249#if _FFR_MIME7TO8_OLD
6250 /* Old mime7to8 code, the new is broken for at least one example. */
6251 "_FFR_MIME7TO8_OLD",
6252#endif /* _FFR_MAX_SLEEP_TIME */
6253#if _FFR_MSG_ACCEPT
6254 /* allow to override "Message accepted for delivery" */
6255 "_FFR_MSG_ACCEPT",
6256#endif /* _FFR_MSG_ACCEPT */

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

6262#if _FFR_NO_PIPE
6263 /* Disable PIPELINING, delay client if used. */
6264 "_FFR_NO_PIPE",
6265#endif /* _FFR_NO_PIPE */
6266#if _FFR_LOG_NTRIES
6267 /* log ntries=, from Nik Clayton of FreeBSD */
6268 "_FFR_LOG_NTRIES",
6269#endif /* _FFR_LOG_NTRIES */
6222#if _FFR_MIME7TO8_OLD
6223 /* Old mime7to8 code, the new is broken for at least one example. */
6224 "_FFR_MIME7TO8_OLD",
6225#endif /* _FFR_MAX_SLEEP_TIME */
6226#if _FFR_MSG_ACCEPT
6227 /* allow to override "Message accepted for delivery" */
6228 "_FFR_MSG_ACCEPT",
6229#endif /* _FFR_MSG_ACCEPT */

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

6235#if _FFR_NO_PIPE
6236 /* Disable PIPELINING, delay client if used. */
6237 "_FFR_NO_PIPE",
6238#endif /* _FFR_NO_PIPE */
6239#if _FFR_LOG_NTRIES
6240 /* log ntries=, from Nik Clayton of FreeBSD */
6241 "_FFR_LOG_NTRIES",
6242#endif /* _FFR_LOG_NTRIES */
6270#if _FFR_PRIV_NOACTUALRECIPIENT
6271 /*
6272 ** PrivacyOptions=noactualrecipient stops sendmail from putting
6273 ** X-Actual-Recipient lines in DSNs revealing the actual
6274 ** account that addresses map to. Patch from Dan Harkless.
6275 */
6276
6277 "_FFR_PRIV_NOACTUALRECIPIENT",
6278#endif /* _FFR_PRIV_NOACTUALRECIPIENT */
6243#if _FFR_QF_PARANOIA
6244 "_FFR_QF_PARANOIA",
6245#endif /* _FFR_QF_PARANOIA */
6279#if _FFR_QUEUEDELAY
6280 /* Exponential queue delay; disabled in 8.13 since it isn't used. */
6281 "_FFR_QUEUEDELAY",
6282#endif /* _FFR_QUEUEDELAY */
6283#if _FFR_QUEUE_GROUP_SORTORDER
6284 /* Allow QueueSortOrder per queue group. */
6285/* XXX: Still need to actually use qgrp->qg_sortorder */
6286 "_FFR_QUEUE_GROUP_SORTORDER",

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

6309#if _FFR_RESET_MACRO_GLOBALS
6310 /* Allow macro 'j' to be set dynamically via rulesets. */
6311 "_FFR_RESET_MACRO_GLOBALS",
6312#endif /* _FFR_RESET_MACRO_GLOBALS */
6313#if _FFR_RHS
6314 /* Random shuffle for queue sorting. */
6315 "_FFR_RHS",
6316#endif /* _FFR_RHS */
6246#if _FFR_QUEUEDELAY
6247 /* Exponential queue delay; disabled in 8.13 since it isn't used. */
6248 "_FFR_QUEUEDELAY",
6249#endif /* _FFR_QUEUEDELAY */
6250#if _FFR_QUEUE_GROUP_SORTORDER
6251 /* Allow QueueSortOrder per queue group. */
6252/* XXX: Still need to actually use qgrp->qg_sortorder */
6253 "_FFR_QUEUE_GROUP_SORTORDER",

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

6276#if _FFR_RESET_MACRO_GLOBALS
6277 /* Allow macro 'j' to be set dynamically via rulesets. */
6278 "_FFR_RESET_MACRO_GLOBALS",
6279#endif /* _FFR_RESET_MACRO_GLOBALS */
6280#if _FFR_RHS
6281 /* Random shuffle for queue sorting. */
6282 "_FFR_RHS",
6283#endif /* _FFR_RHS */
6317#if _FFR_SELECT_SHM
6318 /* Auto-select of shared memory key */
6319 "_FFR_SELECT_SHM",
6320#endif /* _FFR_SELECT_SHM */
6321#if _FFR_SHM_STATUS
6322 /* Donated code (unused). */
6323 "_FFR_SHM_STATUS",
6324#endif /* _FFR_SHM_STATUS */
6325#if _FFR_LDAP_SINGLEDN
6326 /*
6327 ** The LDAP database map code in Sendmail 8.12.10, when
6328 ** given the -1 switch, would match only a single DN,

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

6344#if _FFR_SKIP_DOMAINS
6345 /* process every N'th domain instead of every N'th message */
6346 "_FFR_SKIP_DOMAINS",
6347#endif /* _FFR_SKIP_DOMAINS */
6348#if _FFR_SLEEP_USE_SELECT
6349 /* Use select(2) in libsm/clock.c to emulate sleep(2) */
6350 "_FFR_SLEEP_USE_SELECT ",
6351#endif /* _FFR_SLEEP_USE_SELECT */
6284#if _FFR_SHM_STATUS
6285 /* Donated code (unused). */
6286 "_FFR_SHM_STATUS",
6287#endif /* _FFR_SHM_STATUS */
6288#if _FFR_LDAP_SINGLEDN
6289 /*
6290 ** The LDAP database map code in Sendmail 8.12.10, when
6291 ** given the -1 switch, would match only a single DN,

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

6307#if _FFR_SKIP_DOMAINS
6308 /* process every N'th domain instead of every N'th message */
6309 "_FFR_SKIP_DOMAINS",
6310#endif /* _FFR_SKIP_DOMAINS */
6311#if _FFR_SLEEP_USE_SELECT
6312 /* Use select(2) in libsm/clock.c to emulate sleep(2) */
6313 "_FFR_SLEEP_USE_SELECT ",
6314#endif /* _FFR_SLEEP_USE_SELECT */
6352#if _FFR_SOFT_BOUNCE
6353 /* Turn all errors into temporary errors. */
6354 "_FFR_SOFT_BOUNCE",
6355#endif /* _FFR_SOFT_BOUNCE */
6356#if _FFR_SPT_ALIGN
6357 /*
6358 ** It looks like the Compaq Tru64 5.1A now aligns argv and envp to 64
6359 ** bit alignment, so unless each piece of argv and envp is a multiple
6360 ** of 8 bytes (including terminating NULL), initsetproctitle() won't
6361 ** use any of the space beyond argv[0]. Be sure to set SPT_ALIGN_SIZE
6362 ** if you use this FFR.
6363 */

--- 36 unchanged lines hidden ---
6315#if _FFR_SPT_ALIGN
6316 /*
6317 ** It looks like the Compaq Tru64 5.1A now aligns argv and envp to 64
6318 ** bit alignment, so unless each piece of argv and envp is a multiple
6319 ** of 8 bytes (including terminating NULL), initsetproctitle() won't
6320 ** use any of the space beyond argv[0]. Be sure to set SPT_ALIGN_SIZE
6321 ** if you use this FFR.
6322 */

--- 36 unchanged lines hidden ---