AIX Printer Tips - Redirecting LPD Mail Messages


Contents

About This Document
Discussion
Sample Mail Message Returned to LPD
Solution 1: Redirect to a Local User
Solution 2: Delete Mail

About This Document

When a PC user who does not have mail access to the network prints to an AIX print server, the mail generated by the qdaemon when a printing error occurs is undeliverable and can get bounced around the network.

This document discusses how to get the mail for this PC user either sent to a central administrative user or deleted altogether.

This document applies to all levels of AIX.


Discussion

The qdaemon and lpd daemon have some messages that are hardcoded. Some of these messages can be directed to the print user either directly to their terminal, or through mail. There is no way to have the messages completely stopped.

Some messages can be stopped from the terminal by setting the messages to the screen off with mesg n, but there has been greater success with specifying to send these messages by mail. This can be done with the qprt -C flag during the print process.

When the user is on a system without mail capabilities this can cause considerable problems. One solution is to use the rewrite capability of sendmail to redirect the output for the PC users to a local user. The second solution redirects the mail to /dev/null, which erases the mail. The rest of this document describes the problem in more detail and outlines the fix.


Sample Mail Message Returned to LPD

From MAILER-DAEMON Tue Sep 17 18:06:17 1996
Received: from localhost (localhost) by tesch.aix.dfw.ibm.com (AIX4.2/UCB 8.
7/8.7) with internal id SAA22142; Tue, 17 Sep 1996 18:06:17 -0500 (CDT)
Date: Tue, 17 Sep 1996 18:06:17 -0500 (CDT)
From: Mail Delivery Subsystem <MAILER-DAEMON>
Subject: Warning: could not send message for past 4 hours
Message-Id: <199609172306.SAA22142@tesch.aix.dfw.ibm.com>
To: lpd
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
        boundary="SAA22142.843001577/tesch.aix.dfw.ibm.com"
Auto-Submitted: auto-generated (warning-timeout)

This is a MIME-encapsulated message

--SAA22142.843001577/tesch.aix.dfw.ibm.com

    **********************************************
    **      THIS IS A WARNING MESSAGE ONLY      **
    **  YOU DO NOT NEED TO RESEND YOUR MESSAGE  **
    **********************************************

The original message was received at Tue, 17 Sep 1996 13:49:16 -0500 (CDT)
from lpd@localhost

   ----- The following addresses have delivery notifications -----
pc-user@fahey.aix.dfw.ibm.com  (transient failure)

  --- The transcript of the session follows ---
pc-user@fahey.aix.dfw.ibm.com... Deferred: Connection refused by fahey.aix.d
fw.ibm.com.
Warning: message still undelivered after 4 hours
Will keep trying until message is 5 days old

--SAA22142.843001577/tesch.aix.dfw.ibm.com
Content-Type: message/delivery-status

Reporting-MTA: dns; tesch.aix.dfw.ibm.com
Arrival-Date: Tue, 17 Sep 1996 13:49:16 -0500 (CDT)

Final-Recipient: RFC822; pc-user@fahey.aix.dfw.ibm.com
Action: delayed
Status: 4.2.0
Remote-MTA: DNS; fahey.aix.dfw.ibm.com
Last-Attempt-Date: Tue, 17 Sep 1996 18:06:17 -0500 (CDT)
Will-Retry-Until: Sun, 22 Sep 1996 13:49:16 -0500 (CDT)

Solution 1: Redirect to a Local User

To change the rewrite rules of sendmail, the user must have root authority. The steps to make these changes are:
  1. vi /etc/sendmail.cf
  2. Find Ruleset 0. It will be in the file starting with:
  3. ######################################
    ###   Ruleset 0 -- Parse Address   ###
    ######################################
    
    S0
    
    R<@>                    $#local $: <@>          special case error msgs
    R$* : $* ; <@>          $#error $@ 5.1.3 $: "list:; syntax illegal for recipient addresses"
    R<@ $+>                 $#error $@ 5.1.1 $: "user address required"
    R$* <$* : $* > $*       $#error $@ 5.1.1 $: "colon illegal in host name part"
    R$* < @ . > $*          $#error $@ 5.1.2 $: "invalid host name"
    
  4. After the line with invalid host name, add these lines:
  5. # Can we rewrite userid pcuser to stay here
    # note the rulesets must be separated by a tab character
    Rpc-user $*             $#local $: jwtesch
                 ^ Tab ^    don't add this line.
    
    
  6. Save the changes.
  7. refresh -s sendmail.

  8. At AIX 4.2 this is all you will have to do. At earlier versions you may have to run sendmail -bz to tell sendmail to reread the config file.
Test with sendmail in ruleset test mode as follows:
> 3,0 pc-user@pchost.com
rewrite: ruleset  3   input: pc-user @ pchost . com
rewrite: ruleset 96   input: pc-user < @ pchost . com > 
rewrite: ruleset 96 returns: pc-user < @ pchost . com > 
rewrite: ruleset  3 returns: pc-user < @ pchost . com > 
rewrite: ruleset  0   input: pc-user < @ pchost . com > 
rewrite: ruleset  0 returns: $# local $: jwtesch
This will work only if the user on the remote system is identified to AIX as pc-user. This is typical for an OS/2 or Windows lpr client. However, a similar line can be added to using the individual client host name. This line would look like: In this case you need a separate line for each pchost.

Running sendmail in test mode, the results can be seen:

# sendmail -bt           
Address Test Mode (ruleset 3 is not automatically invoked)
Enter <ruleset> <address> 
> 0,3 pc-user@fahey
rewrite: ruleset  0   input: pc-user @ fahey
rewrite: ruleset  0 returns: $# local $: jwtesch
rewrite: ruleset  3   input: $# local $: jwtesch
rewrite: ruleset 96   input: $# local $: jwtesch
rewrite: ruleset 96 returns: $# local $: jwtesch
rewrite: ruleset  3 returns: $# local $: jwtesch

> 0,3 pc-user@fahey.aix.dfw.ibm.com
rewrite: ruleset  0   input: pc-user @ fahey . aix . dfw . ibm . com
rewrite: ruleset  0 returns: $# local $: jwtesch

Solution 2: Delete Mail

False attempt

Another approach is to redirect the output to a file. The line below would at first seem to work, but it did not. The corrected solution follows. This is presented as an educational exercise, based on the belief that often you learn more from understanding why things don't work than from just getting things to work.
Test:
# sendmail -bt       
Address Test Mode (ruleset 3 is not automatically invoked)
Enter <ruleset> <address>
> 3,0 pc-user@fahey.aix.dfw.ibm.com
rewrite: ruleset  3   input: pc-user @ fahey . aix . dfw . ibm . com
rewrite: ruleset 96   input: pc-user < @ fahey . aix . dfw . ibm . com >
rewrite: ruleset 96 returns: pc-user < @ fahey . aix . dfw . ibm . com . >
rewrite: ruleset  3 returns: pc-user < @ fahey . aix . dfw . ibm . com . >
rewrite: ruleset  0   input: pc-user < @ fahey . aix . dfw . ibm . com . >
rewrite: ruleset  0 returns: $# local $: / tmp / fahey . msg

There were permissions problems when this was tested, so it may be better to use a local user and .forward to a file. Of course, to make the messages disappear, use /dev/null as your file.

The corrected solution

Under S0: (in the Ruleset 0 area of sendmail.cf), add this line:
  R$* ntsrv $*          $#devnull $:  /dev/null
This says that anything sent to the server named ntsrv should be handled by the Mailer called devnull.

The next step is to create the Mailer Definition in the MAILER DEFINITION section of sendmail as follows:

Mdevnull,       P=[FILE], S=0/0, R=0/0, M=0, F=DEFMPlosu, L=0, E=\n,
                T=DNS/RFC822/X-Unix,
                A=FILE
After making these changes run the command:
  refresh -s sendmail
Now all messages sent to the users at ntsrv will be discarded.


Redirecting LPD Mail Messages: AIX Printer Tips: mailerr.html ITEM: FAX
Dated: 99/02/16~00:00 Category: zap
This HTML file was generated 99/06/24~12:42:13
Comments or suggestions? Contact us