Previous Section Next Section

_PATH...

Hardcoded paths inside sendmail tune with confENVDEF

Only a few pathnames are hardcoded into sendmail. The most obvious is its configuration file because that file lists the locations of nearly all other files. For various reasons a few other file locations are also hardcoded. Here, we describe those that you can change. Note that the general form for all such changes uses the confENVDEF declaration in your Build m4 file:

APPENDDEF(`confENVDEF', `-D_PATH...="/new/path/filename"')

The new path must be surrounded by backslashed quotation marks so that the compiler will correctly interpret it as a string.

/etc/mail/sendmail.cf

The sendmail.cf file is pivotal to all of the sendmail program's operations (Section 17.1). V8.7 sendmail recommends that it always be called sendmail.cf and always be located in the /etc directory. Beginning with V8.10, sendmail recommends that it always be located in the /etc/mail directory. For testing, debugging, or other legitimate reasons you might prefer to locate that file elsewhere (at least temporarily). You do that with the _PATH_SENDMAILCF definition:

APPENDDEF(`confENVDEF', `-D_PATH_SENDMAILCF="/src/tests/test.cf"')

Beginning with V8.10 sendmail, the default location of the configuration file is the same for all versions of Unix, specifically /etc/mail/sendmail.cf. If you wish to revert to the original vendor location, you can define the USE_VENDOR_CF_PATH compile-time macro:

APPENDDEF(`confENVDEF', `-DUSE_VENDOR_CF_PATH')

This will cause sendmail to use the old location for its configuration file.

If your version of Unix is one that does not have a prior default (see the sendmail/conf.h file), you can give sendmail one by defining the _PATH_VENDOR_CF too:

APPENDDEF(`confENVDEF', `-D_PATH_VENDOR_CF="/src/tests/test.cf"')
APPENDDEF(`confENVDEF', `-DUSE_VENDOR_CF_PATH')

Beginning with V8.12 sendmail, any changes to _PATH_VENDOR_CF will not be detected if you just recompile sendmail. Instead, you need to recompile the library in libsm first:

%cd libsm 
%./Build -c -f   yoursite.m4 
...
%cd ../sendmail 
%./Build -c -f   yoursite.m4 
/etc/mail/sendmail.pid

The sendmail.pid file contains two lines of information. The first line is a text representation of the pid of the current running daemon. The second is a copy of the command line that was originally used to start sendmail. This file is handy for killing and restarting the daemon (see Section 1.7.1.2 for examples). If BSD4_4 is defined, the default becomes /var/run/sendmail.pid; otherwise, the default is /etc/mail/sendmail.pid. You can change this default in your Build m4 file:

APPENDDEF(`confENVDEF', `-D_PATH_SENDMAILPID="/src/tests/test.pid"')

Whatever value is given to this compile-time macro, it is used only as a default setting for the PidFile option (PidFile). That option determines the final location of this file.

/etc/hosts

Ordinarily, sendmail will first look for a service-switch (ServiceSwitchFile) to see how it should look up the canonical names of hosts. If it finds one and if the service hosts is listed, it uses the techniques listed with the service-switch to look up its hosts. When the technique is files, sendmail reads the file named by _PATH_HOSTS to get its canonical information. Ordinarily, that file is called /etc/hosts. If that file is different or has been customized on your system, you can redefine the location like this:

APPENDDEF(`confENVDEF', `-D_PATH_HOSTS="/etc/privatehosts"')

In general, most other techniques are preferred over the linear parse of a hosts file. However, this file is useful in determining the canonical name of the local host. Note that this compile-time macro only sets the default value for the HostsFile option (HostsFile). That option, if set, overrides this default.

/dev/kmem

The sendmail program decides when to refuse connections and when to queue mail only on the basis of its perception of the machine load average. The process of determining that average is hugely complex and varies greatly from vendor to vendor. Four pathnames that can be used in determining the load are _PATH_KMEM, _PATH_LOADAVG, _ _PATH_AVENRUN, and _PATH_UNIX. These should need to be changed only in the rare event that you are porting sendmail to a previously unsupported platform. Read the file sendmail/conf.c to see the complex way they are presently used. Also see Table 3-6 in LA_TYPE to see how to use these to find the load average.

/etc/shells

A user is not allowed to run programs from a .forward file unless that user has a valid login shell (Section 13.7.4). Nor is a user allowed to save mail directly to files without a valid shell. To determine whether the login shell is valid, sendmail calls getusershell(3). If sendmail was defined without the HASGETUSERSHELL compile-time macro defined, it instead tries to look up the shell in the /etc/shells file. If that file cannot be opened, sendmail gets valid shell names from an internal list called DefaultUserShells that is defined in sendmail/conf.c. The _PATH_SHELLS compile-time macro can be used to change the location of the /etc/shells file.

There is no debugging flag that will display the defaults for these file locations. If any are of concern, you should build sendmail yourself.

    Previous Section Next Section