home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Previous Section Next Section

15.6 Pitfalls

  • Prior to V8 sendmail, if the list of recipients contained an address that began with any of the prescanned switches, sendmail would wrongly view that recipient as a switch during its prescan phase. For example, mail to joe, bill, -Cool caused sendmail to try to use a file named ool as its configuration file.

  • Command-line switches must precede recipient addresses. Switches that are mixed in with recipient names are treated as recipient addresses.

  • Old versions of sendmail (including IDA and some versions of BSD) would syslog(3) a warning if the old frozen configuration file didn't exist. The V8 and SunOS versions of sendmail no longer check for a frozen configuration file, so nothing is ever logged about this.

  • Prior to V8 sendmail, unknown command-line switches were silently ignored. Therefore, sending mail from a shell script could fail for reasons that were difficult to find. For example, specifying the preliminary hop count wrongly with -j, instead of correctly with -h, caused your presetting of the hop count to be silently ignored.

  • Some old BSD and SunOS versions of sendmail set the default sender's full name from the environment variable NAME even when running as a daemon or when processing the queue. This can lead to the superuser's full name occasionally showing up wrongly as a sender's full name. IDA and V8 sendmail clear the full name in -bd and -q modes but use different methods. To prevent this problem under other versions of sendmail, the env(1) program can be used to clean up the environment passed to sendmail:

    # env - /usr/sbin/sendmail -bd -q1h
  • V8 sendmail uses getopt(3) to parse its command-line arguments so that a switch and its argument can have whitespace between them without harm:

    -C configfile

    But, for bizarre historical reasons, the -d and -q switches differ from all other command-line switches. There can never be space between the -d and its arguments, nor between the -q and its arguments:

    -d 4
    -q 4

    If there is space between them, the argument (here, 4) is taken to be a recipient name. This is true for all versions of sendmail.

    Previous Section Next Section