Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!rpi!rpi.edu!ault From: ault@pawl.rpi.edu (Jim Ault) Newsgroups: comp.mail.sendmail Subject: Re: A quick question. Message-ID: <7347@rpi.edu> Date: 15 Sep 89 15:46:43 GMT References: <220@digi.UUCP> Sender: usenet@rpi.edu Organization: Rensselaer Polytechnic Institute, Troy NY Lines: 157 In-reply-to: kcantrel@digi.UUCP's message of 14 Sep 89 17:43:30 GMT Try this script. If you have egrep, this works great. I use it constantly, along with another small script that feeds addresses in and grabs the output, so I can test a whole list of addresses by putting the process in the background. Let me know if it is helpful to you. ---Jim Ault, ITS Postmaster, Rensselaer Polytechnic Inst, Troy NY, 12180 Postmaster@rpi.edu Jim_Ault@rpitsmts.BITNET Jim_Ault@mts.rpi.edu 518-276-2750 (voice) ...uunet!rpi.edu!ault 518-276-2809 (fax) ------ cut the GREEN wire first! ------ No, cut the RED wire f>>BOOM<< ------ #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'cfdebug' <<'END_OF_FILE' X#! /bin/sh X# X# This shell script runs sendmail in address test mode and converts the X# debugging output to something more intelligible for helping debug sendmail.cf X# files. X# X# Pass the config file to use as $1 - /usr/lib/sendmail.cf by default X# X# Enter input of the form (same as for "sendmail -bt"): X# X# 0 address1 X# 0 address2 X# ... X# (eof) X# X# Xif [ $# -eq 0 ] Xthen X cf="/usr/lib/sendmail.cf" Xelse X cf=$1 Xfi Xif [ ! -r $cf ] Xthen X echo "File '$cf' not readable, exiting..." X exit Xfi Xsudo /usr/lib/sendmail -bt -C$cf -d21.12 |\ Xgrep -v -e '----- rule fails' |\ Xsed -e 's/-----trying rule:/R/' \ X -e 's/"^P"/$*/g' \ X -e 's/"^Q"/$+/g' \ X -e 's/"^R"/$-/g' \ X -e 's/"^S\([A-Za-z]\)"/$=\1/g' \ X -e 's/"^T\([0-9]\)"/$\1/g' \ X -e 's/"^U"/$#/' \ X -e 's/"^V"/$\&/g' \ X -e 's/"^W"/$:/g' \ X -e 's/"^X"/$>/g' \ X -e 's/"//g' |\ Xsed -e '/^R/s/[ ]//g' \ X -e '/matches:/s/[ ]//g' -e 's/rulematches:/rule matches: /' \ X -e '/rewritten as:/s/[ ]//g' -e 's/rewrittenas:/rewritten as: /' \ X -e '/returns:/s/[ ]//g' \ X -e 's/.*ruleset\([0-9]\)returns:/ruleset \1 returns: /' \ X -e '/input:/s/[ ]//g' \ X -e 's/.*ruleset\(.*\)input:/ruleset \1 input: /' X# X# Compliments of the author: Dan Long X# CSNET Technical Staff X# long@sh.cs.net END_OF_FILE if test 1343 -ne `wc -c <'cfdebug'`; then echo shar: \"'cfdebug'\" unpacked with wrong size! fi chmod +x 'cfdebug' # end of 'cfdebug' fi if test -f 'cftest' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'cftest'\" else echo shar: Extracting \"'cftest'\" \(293 characters\) sed "s/^X//" >'cftest' <<'END_OF_FILE' X#!/bin/sh X# A script to put debug input a line at a time through cfdebug. JRA 05/10/89 X# call like this (with the file sendmail.cf in the current directory): X# cftest < debug.in > debug.out & Xwhile read line ; do X echo $line X echo $line | cfdebug sendmail.cf | grep '0 returns: $#' Xdone END_OF_FILE if test 293 -ne `wc -c <'cftest'`; then echo shar: \"'cftest'\" unpacked with wrong size! fi chmod +x 'cftest' # end of 'cftest' fi if test -f 'debug.in' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'debug.in'\" else echo shar: Extracting \"'debug.in'\" \(573 characters\) sed "s/^X//" >'debug.in' <<'END_OF_FILE' X0 user@bit.BITNET X0 bit.BITNET!user X0 some.random.domain!user X0 user@LOCAL X0 site!user@uunet.uu.net X0 <@host1,@host2,@host3:a@b.com> X0 uunet!site1!site2 X0 user@itsgw.rpi.edu X0 user@blah.its.rpi.edu X0 user@rpi.edu X0 user@pawl.rpi.edu X0 userxxxx@mts.rpi.edu X0 blah!nyser!user X0 uunet!itsgw!user X0 uunet!rpi!postmaster X0 uunet!itsgw!mts!userfred@some.where.edu X0 itsgw!user@uunet.uu.net X0 adobe!someone@decwrl.dec.com END_OF_FILE if test 573 -ne `wc -c <'debug.in'`; then echo shar: \"'debug.in'\" unpacked with wrong size! fi # end of 'debug.in' fi echo shar: End of archive 1 \(of 1\). cp /dev/null ark1isdone MISSING="" for I in 1 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have the archive. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 --------------end of shar file -------------- -- ---Jim Ault, ITS Postmaster, Rensselaer Polytechnic Inst, Troy NY, 12180 Postmaster@rpi.edu Jim_Ault@rpitsmts.BITNET Jim_Ault@mts.rpi.edu 518-276-2750 (voice) ...uunet!rpi.edu!ault 518-276-2809 (fax)