SUMMARY: $3 in Ruleset - anybody remembers?

From: Jochen Bern (bern@kleopatra.Uni-Trier.DE)
Date: Fri Feb 04 1994 - 20:52:37 CST


[My Aide handeled this, I'm just sending the Summary
for him. I'll set the Reply-To Address accordingly.]

To our question

>we're currently trying to get sendmail 8.6.4 to work, and hang at the
>Config. More precisely, in Ruleset 3 which reads

>S3
># handle "from:<>" special case
>R$*<>$* $@@ turn into magic token

># basic textual canonicalization
>R$*<$+>$* $2 basic RFC822 parsing
># make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
>R@$+,$+:$+ @$1:$2:$3 change all "," to ":"
>R@$+:$+ $@$>6<@$1>:$2 src route canonical
 
>R$+:$*;@$+ $@$1:$2;@$3 list syntax (*)
>R$+@$+ $:$1<@$2> focus on domain (*)
>R$+<$+@$+> $1$2<@$3> move gaze right (*)
>R$+<@$+> $@$>6$1<@$2> already canonical

>etc. etc.. In one of the Lines marked (*), sendmail freaks out saying
>"replacement $3 out of bounds", then dies. I faintly remember that there
>were special Complications with $3 on Sun(O?)s ... Can anybody help my
>Memory? (We're experimenting on a dataless ELC, with private /usr/lib
>mounted over the standard /usr, running 4.1.2.):

Many almost identical help came over. A summary of the answers:

>From page 699: The new O'Reilly sendmail book.

rewrite: ruleset out of bounds
A $digit operator in the RHS of a rule references operators
in the LHS by position. Unfortunately, the mere presence
of a $ prefix does not necessarily indicate an operator.
Defined macros are expanded when the config file is read,
so do not count when specifying position. For example:

   R$A.$B.$c.$- $1

Here, the $1 in the RHS specifies the $- in the LHS because
$A, $B, and $c are expanded when the config file is read and
becomes ordinary text. Referencing an operator that doesn't
exist (such as wrongly using $4 in place of $1 above)
causes sendmail to print the following error message:

"replacement $3 out of bounds"

So, what is matching on the left does not have 3 tokens.
The middle $* specifies 0 or more occurences and it must
be 0 -- ergo the $3 is out of bounds... ???

------------------------------------------------------------------------

 Somewhere (not in the rules you gave you have a line that says
something like:
R$*<@$%y>$* ...

Since sendmails other than suns don't understand $%
there are only TWO things that can match in this line, and
any reference to $3 is bogus.

8.6.4 uses the $( $) database constructs instead of $%
to get to NIS maps. (As does the current sendmail 8.6.5)

------------------------------------------------------------------------

        R$+:$* $@$1:$2;@$3 list syntax (*)
only two match expressions on the left hand side and at least three replacements
on the right.

------------------------------------------------------------------------

SunOs supports a $3 parameter but sendmail 8.6.4 does not
and that is what it is choking on. In the contrib directory
of the 8.6.4 distribution there is a file called
"converting.sun.configs"
that discusses this and gives some hints as to how to work
around this.

------------------------------------------------------------------------

This is a frequently asked (and answered) question on the
 comp.mail.sendmail newsgroup, which I recomend you
subscribe to if you are going to be doing any thing in sendmail.

This is also covered in detail in the O'Reilly Sendmail book
  sendmail - by Bryan Csotales with Eric Allman and Neil Rickert
which I highly recomend. It covers (in the database
chapter) the details of how to use the maps.

Distributed with the current sendmail (8.6.5) is an article on
converting SUN sendmail.cf files to the 8.x.x flavor.
The distribution is availiable via anonymous ftp from
ftp.cs.berkeley.edu and has lots of usefull stuff with it.

------------------------------------------------------------------------

Try running sendmail like this:

sendmail -d0.15 -bt

This should print out all the rules that sendmail read from the config
file.

Thanks to

Dave Curado davec@cs.ust.hk
Dallas N Antley dna@clas.ufl.edu
Larry Chin Larry_Chin@cchtor.cch.com
Phil Green pgreen@aoc.nrao.edu
John Halleck NAHAJ@CC.UTAH.EDU
Don Lewis gdonl@gv.ssi1.com
Brett Lymn blymn@mulga.awadi.com.AU
Jerzy js@iok.unit.no

who promptly answered to our not just simple question.

-- 
__/\_____________________________________________   ___________________________
 /  \                                            \ /                        /\
/ J. \ EMail: bern@[TI.]Uni-Trier.DE / ham: DD0KZ X  More Infos on me from /  \
\Bern/ X.400: S=BERN; P=Uni-Trier; A=d400; C=de  / \  the X.500 Directory; \  /
 \  /  Zurmaiener Str. 98-100, D-54292 Trier    /   \  PGP PubKey via finger\/
__\/___________________________________________/ EOF \_________________________



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:08:55 CDT