Name
program
Synopsis
The
program
type allows you to perform lookups via
arbitrary external programs. The form for the declaration of this
database-map type looks like this:
Kname program /path arg1 arg2 ...
The /path
must be the full pathname to the
program. Relative paths will not work, and attempts to use them will
log the following error and cause the lookup to fail:
NOQUEUE: SYSERR(user): relative name: cannot exec: No such file or directory
The program is run as the user and group specified by the
DefaultUser
option (DefaultUser),
unless the RunAsUser
option (RunAsUser) is declared, in which case it will run as the
user and group declared by that latter option.
The arguments to the program always have the key to be looked up added as a final argument:
Kname program /path arg1 arg2 ... ↑key added here
This is the only way the key can be passed to the program. The key will specifically not be piped to the program’s standard input.
The value (result of the lookup) is read from the
program’s standard output. Only the first MAXLINE-1
characters are read (where MAXLINE is defined in
conf.h, currently as 2048). The read result is
processed like an address and placed into the workspace (unless the
-m
switch is used with the K
command).
To illustrate, consider the need to look up a user’s preferred address in an external relational database:
Kilook program /usr/sbin/ingres_lookup -d users.database
This program has been custom-written to accept the key as its final argument. To prevent spurious ...
Get Sendmail, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.