mail_pipe(1M) (Essential Utilities) mail_pipe(1M)
NAME
mail_pipe - invoke recipient command for incoming mail
SYNOPSIS
mail_pipe [ -x debug_level ] -r recipient -R path_to_sender -c
content_type -S subject
DESCRIPTION
When a new mail message arrives, the mail command first checks if the
recipient's mailbox indicates that the message is to be forwarded
elsewhere (to some other recipient or as the input to some command).
If the message is to be piped into a recipient-specified command,
mail invokes mail_pipe to do some validation and then execute the
command in the context of the recipient.
Command-line arguments are:
-x debug_level Turn on debugging for this invocation. See the
description of the -x option for the mail command
for details.
-r recipient The recipient's login id.
-R path_to_sender The return address to the message's originator.
-c content_type The value of the Content-Type: header line in the
message.
-S subject The value of the Subject: header line in the
message if present.
mail_pipe is installed as a setuid-to-root process, thus enabling
itself to change it's user and group ids to that of the recipient as
necessary.
When invoked, mail_pipe performs the following steps (if a step
fails, the exit code is noted as [N]):
- Validate invocation arguments [1].
- Verify that recipient name is < 14 characters long [2].
- Verify that the setgid flag for the recipient mailbox is set [3].
- Open /var/mail/recipient [4].
- Verify that recipient's mailbox starts with the string Forward to
[5].
- Find pipe symbol indicating start of command string in recipient
mailbox [6].
- Find entry for recipient in /etc/passwd [7].
- Set gid to recipient's gid [8].
- Set uid to recipient's uid [9].
- Change current directory to recipient's login directory [10].
- Allocate space to hold newly exec'ed environment for recipient
command [11].
- Parse the recipient command, performing any %keyword expansions
required. See the `Forwarding mail' section of mail(1), for more
information regarding %keyword substitutions [12].
7/91 Page 1
mail_pipe(1M) (Essential Utilities) mail_pipe(1M)
- Execute recipient command [13 if exec fails, otherwise exit code
from recipient command itself].
FILES
/etc/passwd to identify sender and locate recipients
/var/mail/recipient
incoming mail for recipient; that is, the mail file
/tmp/MLDBG* debug trace file
/usr/lib/mail/mail_pipe
mail_pipe program
SEE ALSO
mail(1), notify(1), vacation(1)
Page 2 7/91