home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2847 < prev    next >
Internet Message Format  |  1991-02-23  |  35KB

  1. From: barnett@grymoire.crd.ge.com (Bruce Barnett)
  2. Newsgroups: alt.sources
  3. Subject: Ease 3.0: High Level Language for Sendmail  (Part 5 of 6)
  4. Message-ID: <BARNETT.91Feb23021815@grymoire.crd.ge.com>
  5. Date: 23 Feb 91 07:18:15 GMT
  6.  
  7. #! /bin/sh
  8. # This is a shell archive.  Remove anything before this line, then unpack
  9. # it by saving it into a file and typing "sh file".  To overwrite existing
  10. # files, type "sh file -c".  You can also feed this as standard input via
  11. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  12. # will see the following message at the end:
  13. #        "End of archive 5 (of 6)."
  14. # Contents:  doc/ease.paper
  15. # Wrapped by barnett@grymoire on Sat Feb 23 01:13:55 1991
  16. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  17. if test -f doc/ease.paper -a "${1}" != "-c" ; then 
  18.   echo shar: Will not over-write existing file \"doc/ease.paper\"
  19. else
  20. echo shar: Extracting \"doc/ease.paper\" \(32871 characters\)
  21. sed "s/^X//" >doc/ease.paper <<'END_OF_doc/ease.paper'
  22. X...
  23. X... $Header: /home/kreskin/u0/barnett/Src/Ease/ease/doc/RCS/ease.paper,v 2.0 1990/01/30 12:50:44 jeff Exp barnett $
  24. X... 
  25. X... $Log: ease.paper,v $
  26. X... Revision 2.0  1990/01/30  12:50:44  jeff
  27. X... Baseline version, corresponding to netwide release 2.0.
  28. X...
  29. X... Revision 1.6  88/06/15  10:12:36  root
  30. X... Some editorial cleanup, added Acknowledgements section.
  31. X... 
  32. X... Revision 1.5  88/01/21  17:19:35  root
  33. X... Several editorial changes. ADR.
  34. X... 
  35. X... Revision 1.4  87/12/23  11:30:47  root
  36. X... Updated list of authors. Documented extended canon() capability.
  37. X... Integrated fluke changes in a little better. ADR.
  38. X... 
  39. X... Revision 1.3  87/11/04  11:33:45  root
  40. X... Documented new keyword "while" which is equivalent to "if". ADR.
  41. X... 
  42. X... Revision 1.2  87/08/13  17:08:05  root
  43. X... Changes from Jeff Stearns, fluke!jeff, for Sun. ADR.
  44. X... 
  45. X... Revision 1.1  87/08/13  17:05:00  root
  46. X... Initial revision
  47. X... 
  48. X...
  49. X.LP
  50. X.TL
  51. XEase: A Configuration Language
  52. Xfor Sendmail
  53. X.AU
  54. XJames S. Schoner
  55. X.AI
  56. XPurdue University Computing Center
  57. XWest Lafayette, Indiana  47907
  58. X.AU
  59. XJeff P. Stearns
  60. X.AI
  61. XJohn Fluke Manufacturing Company
  62. XEverett, Washington  98206
  63. X.AU
  64. XArnold D. Robbins
  65. X.AI
  66. XEmory University Computing Center
  67. XAtlanta, Georgia  30322
  68. X.AU
  69. XBruce G. Barnett
  70. X.AI
  71. XGeneral Electric Corporate Research and Development
  72. XSchenectady, NY 12301
  73. X.sp 2
  74. X.I
  75. X.ce
  76. XABSTRACT
  77. X.R
  78. X.PP
  79. XThe rapid expansion of computer networks and ensuing variation among mailing
  80. Xaddress formats have made address interpretation an increasingly
  81. Xcomplex task.  In the UNIX* 4.2BSD operating system, a program named 
  82. X\fIsendmail\fR was introduced which provided a
  83. Xgeneral internetwork mail routing facility.  This facility has significantly
  84. Xdiminished the complexity of handling address interpretation.
  85. X.PP
  86. X\fISendmail\fR's address interpretation is based on a rewriting
  87. Xsystem composed of
  88. Xa number of rewriting rules (or productions) arranged as part of a 
  89. Xconfiguration file.  Unfortunately, the syntactical format of a
  90. Xconfiguration file for \fIsendmail\fR is both terse and rigid, making it
  91. Xrather difficult to modify.  The standard format certainly serves its 
  92. Xpurpose, but, as 
  93. Xthe need to change these configurations increases in frequency, a more 
  94. Xreadable format (i.e., one that is similar to the format 
  95. Xof modern programming languages) is required to permit reasonably 
  96. Xquick modifications to the configuration.  As a solution to this problem, 
  97. X\fBEase\fR 
  98. Xprovides a level of abstraction which eliminates most of the current
  99. Xsyntactic hindrances
  100. Xfaced by programmers who must reconfigure \fIsendmail\fR's 
  101. Xaddress parsing scheme.  
  102. X.PP
  103. XAs a high-level specification format, \fBEase\fR is proving to be an 
  104. Xexcellent alternative to \fIsendmail\fR's cryptic 
  105. Xconfiguration file syntax.  The syntactic structures of \fBEase\fR 
  106. Xare patterned after modern language constructs, making the language
  107. Xeasy to learn and easy to remember.  The format of the address rewriting
  108. Xrule is perhaps the most significant syntactical improvement.  It was 
  109. Xundoubtedly
  110. Xthe most needed improvement.  Nevertheless, every element of a configuration 
  111. Xfile is structurally enhanced through the use of \fBEase\fR. 
  112. X.FS
  113. X*  UNIX is a registered trademark of AT&T.
  114. X.FE
  115. X.sp 2
  116. X.NH
  117. XIntroduction
  118. X.PP
  119. XThe \fBEase\fR language is a high-level specification format for \fIsendmail\fR's
  120. Xconfiguration file.  The motivation for its development
  121. Xwas to fulfill a goal of providing a readable and easily modifiable 
  122. X\fIsendmail\fR configuration file format.  \fBEase\fR fulfills this goal by
  123. Xshielding the programmer from the cryptic configuration specification required
  124. Xby \fIsendmail\fR and providing a high-level language with which the programmer
  125. Xmay specify all modifications to a configuration file.  The development 
  126. Xof Ease coincided with
  127. Xthe development of an \fBEase\fR translator, \fIet\fR,
  128. Xwhich translates a configuration file written 
  129. Xin \fBEase\fR to an
  130. Xequivalent file of the standard format accepted by \fIsendmail\fR.
  131. X.NH
  132. XEase in Profile
  133. X.PP
  134. XAs will be seen in the next section, the syntax of \fBEase\fR is quite
  135. Xreadable and easy to learn.  
  136. XIn order to acquire a relevant perspective
  137. Xon this issue,
  138. Xthe reader is advised to examine a raw configuration file for \fIsendmail\fR (the 
  139. Xoutput
  140. Xof the \fBEase\fR translator, \fIet\fR, will do nicely).  The raw syntax, while
  141. Xquite fitting for quick translation, can prove to be a programmer's nightmare.  
  142. X.PP
  143. XIt is recommended that you learn \fBEase\fP by converting your current
  144. Xconfiguration file into \fBEase\fP format by using the program
  145. X\fIcfc\fP written by Arnold Robbins and modified by Bruce G. Barnett.
  146. X.PP
  147. XUndoubtedly, one of the more prominent features of \fBEase\fR is the ability 
  148. Xto attach
  149. Xnames to address fields.  When address field names are well-chosen, a distinct,
  150. Xself-documenting quality becomes a visible part of the address rewriting 
  151. Xrules.  Ostensibly, address field names provide a new level of semantic 
  152. Xabstraction.  A brief comparison of the formats can be accomplished by examining
  153. Xthe following equivalent representations of an address pattern:
  154. X.DS
  155. X    user_path@host_name            (\fBEase\fR format)
  156. X    $+@$-                    (raw format)
  157. X.DE
  158. XIn the above, \*Quser_path\*U represents a field of one or more address
  159. Xtokens, and \*Qhost_name\*U represents one address token exactly.  These
  160. Xtoken fields are represented by \*Q$+\*U and \*Q$-\*U in the raw format.  Clearly, 
  161. Xthe \fBEase\fR format is preferable, not only for increased readability, but 
  162. Xstructural comprehension as well.
  163. X.PP
  164. XOther features of \fBEase\fR include ruleset naming, long identifiers for 
  165. Xmacros and classes, flow-of-control structures, and free formatting.  In
  166. Xaddition, it supports C language preprocessor (cpp) commands, which can be used for file inclusion
  167. Xand conditionally defined code constructs.  The next section describes
  168. Xthe \fBEase\fR language in complete detail.
  169. X.NH
  170. XEase Syntax*
  171. X.FS
  172. X*  \fINo attempt is made to describe the complete semantic meaning 
  173. Xassociated with all of the constructs of a sendmail configuration file.  Items 
  174. Xnot covered in this document include the semantic distinction among rulesets, 
  175. Xthe special uses of
  176. Xpre-defined macros, and the method of building configuration files.  To
  177. Xobtain this information, the reader is advised to refer to
  178. Xthe Sendmail Installation and Operation Guide (SMM:7 in the 4.3 BSD
  179. XUNIX System Manager's Manual),
  180. Xby Eric Allman.\fR
  181. X.FE
  182. X.PP
  183. XAt its highest level, \fBEase\fR can be viewed as a collection of 
  184. Xblock-structures, where each block begins with a keyword and is followed by
  185. Xzero or more related definitions and/or declarations.  There are ten distinct 
  186. Xblock types.  The following is 
  187. Xa list containing all ten block keywords and the block type it denotes.
  188. X.TS
  189. Xcenter;
  190. Xl l .
  191. X\fIbind\fR    -ruleset identifier bindings
  192. X\fImacro\fR    -macro definitions
  193. X\fIclass\fR    -class definitions
  194. X\fIoptions\fR    -\fIsendmail\fR option definitions
  195. X\fIprecedence\fR    -precedence definitions
  196. X\fItrusted\fR    -trusted users
  197. X\fIheader\fR    -mail header definitions
  198. X\fImailer\fR    -mailer definitions
  199. X\fIfield\fR    -address field definitions
  200. X\fIruleset\fR    -address rewriting rules
  201. X.TE
  202. X.sp 1
  203. XIn general,
  204. X.TS
  205. Xcenter ;
  206. Xl .
  207. X
  208. X* Letters are distinguished by case,
  209. X
  210. XT{
  211. X* An \fBEase\fR identifier is defined to be a letter, followed by zero or 
  212. Xmore letters, digits, underscores (_), or dashes (-),
  213. XT}
  214. X
  215. XT{
  216. X* A literal newline or double quotation (") character may be included in 
  217. Xany quoted string by preceding the character with a backslash (\\\\\), and
  218. XT}
  219. X
  220. XT{
  221. X* \fBEase\fR source is preprocessed by the C language preprocessor (cpp)
  222. Xif the program is executed with an option understood by cpp.
  223. XThus source comments (i.e., text enclosed by \*Q/*\*U and \*Q*/\*U) may appear 
  224. Xanywhere as part of \fBEase\fR whitespace.
  225. XT}
  226. X.TE
  227. X.PP
  228. XFor notational convenience, this document specifies all reserved
  229. Xwords of the \fBEase\fR language in italics.  In addition, quantities
  230. Xenclosed in angle brackets (<..>) represent arbitrary 
  231. Xidentifiers, strings, or numbers.  
  232. X.NH 2
  233. XRuleset Identifier Bindings
  234. X.PP
  235. XA ruleset (a set of rewriting rules) is identified solely by an integer 
  236. Xin \fIsendmail\fR's
  237. Xconfiguration file.  \fBEase\fR, however, allows each ruleset to be named with
  238. Xa meaningful identifier.  Since a special numeric association for each 
  239. Xruleset is required by the address parsing scheme of \fIsendmail\fR, a \fIbind\fR
  240. Xblock must be present in any \fBEase\fR file which defines one or more 
  241. Xrulesets.  A
  242. X\fIbind\fR block consists of the keyword \fIbind\fR, followed by zero or more
  243. Xstatements of the form:
  244. X.TS
  245. Xcenter box;
  246. Xl .
  247. X<ruleset-id> = \fIruleset\fR <ruleset-number> ;
  248. X.TE
  249. XThe following example, 
  250. X.sp 1
  251. X\fIbind\fR
  252. X.PP
  253. XFINAL_RW = \fIruleset\fR 4;
  254. X.sp 1
  255. Xspecifies that FINAL_RW, the final rewriting ruleset, is \fIsendmail\fR's ruleset 
  256. Xnumber 4.
  257. X.NH 2
  258. XMacro Definitions
  259. X.PP
  260. XA macro is an identifier which, when referenced in the text of a program,
  261. Xis replaced by its value, a string of zero or more characters.  The value
  262. Xof a macro may include references to other macros, but not itself!  \fISendmail\fR
  263. Xallows a maximum of 26 user-declared macros in its configuration file.  In 
  264. Xaddition, there are a number of pre-declared macros which have special meaning
  265. Xto \fIsendmail\fR (see Appendix A).  \fBEase\fR macros are defined in 
  266. X\fImacro\fR blocks.  \fBEase\fR allows any macro to be declared 
  267. X(which is equivalent to simply referencing it) before it is defined.  A macro
  268. Xidentifier is replaced by its value when it is preceded by the character
  269. X\*Q$\*U.  In addition, a macro reference inside a quoted string must always 
  270. Xinclude braces ({}) around the macro identifier (for delimiting purposes).  
  271. X.PP
  272. XA \fImacro\fR block consists of the keyword \fImacro\fR, followed by zero
  273. Xor more statements taking either of the following forms:
  274. X.TS
  275. Xcenter box;
  276. Xl .
  277. X<macro-identifier> = "<macro-value>" ;
  278. X<macro-identifier> = \fBconditional-expression\fR ;
  279. X.TE
  280. XThe \fBconditional-expression\fR format will be discussed 
  281. Xlater.  
  282. X.sp 1
  283. XThe following example,
  284. X.sp 1
  285. X\fImacro\fR
  286. X.PP
  287. Xfirst_name = "James";
  288. X.PP
  289. Xlast_name = "Schoner";
  290. X.PP
  291. Xwhole_name = "${first_name} ${last_name}";
  292. X.sp 1
  293. Xdefines the macros first_name, last_name, and whole_name, where whole_name
  294. Xis the string, "James Schoner".
  295. X.NH 2
  296. XClass definitions
  297. X.PP
  298. XA class is denoted by an identifier representing a logical grouping of zero 
  299. Xor more names.  Classes are used to represent the range of values a token
  300. Xmay assume in the pattern matching of an address.  Further discussion on the
  301. Xuse of classes will be deferred until address fields are described.
  302. X.PP
  303. XOne identifier may be used to distinctly represent both a macro
  304. Xand class (i.e., the set of macro identifiers and the set of class identifiers
  305. Xmay form a non-empty intersection).  A name, or class element, may 
  306. Xbe an identifier or any quoted word.
  307. X.PP
  308. XA \fIclass\fR block consists of the keyword \fIclass\fR, followed by zero
  309. Xor more statements taking any of the following forms:
  310. X.TS
  311. Xcenter box;
  312. Xl .
  313. X<class-identifier> = { <name1>, <name2>, <name3>, ... } ;
  314. X<class-identifier> = \fIreadclass\fR ( "<file-name>" ) ;
  315. X<class-identifier> = \fIreadclass\fR ( "<file-name>", "<read-format>" ) ;
  316. X.TE
  317. XThe second and third forms cause \fIsendmail\fR to read the names of the class 
  318. Xfrom the named
  319. Xfile.  The third form contains a read format, which should be a \fIscanf\fR(3)
  320. Xpattern yielding a single string.
  321. X.sp 1
  322. XThe following example,
  323. X.sp 1
  324. X\fIclass\fR
  325. X.PP
  326. Xcampus_hosts = { statistics, engineering, chemistry, physics, physics-2 } ;
  327. X.PP
  328. Xversions     = { "1.0", "1.1", "4.0", "4.2", latest-and-greatest } ;
  329. X.PP
  330. Xphone_hosts  = \fIreadclass\fR ( "/tmp/phonenet.list" ) ;
  331. X.sp 1
  332. Xdefines the classes campus_hosts, versions, and phone_hosts.
  333. X.NH 2
  334. XSendmail option definitions
  335. X.PP
  336. XA number of options to the \fIsendmail\fR program may be specified in 
  337. Xan \fIoptions\fR
  338. Xblock.  For a description of the various \fIsendmail\fR options and their 
  339. Xvalues, see Appendix B.  
  340. X.PP
  341. XAn
  342. X\fIoptions\fR block consists of the keyword \fIoptions\fR, followed by zero
  343. Xor more statements taking any of the following forms:
  344. X.TS
  345. Xcenter box;
  346. Xl l .
  347. X<option-identifier>    = "<option-value>" ;
  348. X\fIo_delivery\fR    = \fBspecial-value\fR ;
  349. X\fIo_handling\fR    = \fBspecial-value\fR ;
  350. X.TE
  351. XAll but two options (\fIo_delivery\fR and \fIo_handling\fR) use the first 
  352. Xform.  To specify an option without a value, simply assign to it the null 
  353. Xstring ("").  The \fBspecial-value\fR field of the second and third form
  354. Xrefers to special values (non-quoted) which are specified in Appendix B.
  355. X.sp 1
  356. XThe following example,
  357. X.sp 1
  358. X\fIoptions\fR
  359. X.PP
  360. X\fIo_alias\fR = "/usr/lib/aliases" ;
  361. X.PP
  362. X\fIo_tmode\fR = "0600" ;
  363. X.PP
  364. X\fIo_delivery\fR = \fId_background\fR ;
  365. X.sp 1
  366. Xsets the options \fIo_alias\fR, \fIo_tmode\fR, and \fIo_delivery\fR.
  367. X.NH 2
  368. XPrecedence definitions
  369. X.PP
  370. XMessage headers may contain a \*QPrecedence:\*U field describing the precedence
  371. Xof the message class.  Identifiers which may appear in the precedence field of
  372. Xa message are given precedence values in a configuration file \fIprecedence\fR 
  373. Xdefinition.  This association will be illustrated below in an example.
  374. X.PP
  375. XA \fIprecedence\fR block consists of the keyword \fIprecedence\fR, followed 
  376. Xby zero or more statements of the form:
  377. X.KS
  378. X.TS
  379. Xcenter box;
  380. Xl .
  381. X<precedence-identifier> = <precedence-integer> ;
  382. X.TE
  383. X.KE
  384. XThe following example,
  385. X.sp 1
  386. X\fIprecedence\fR
  387. X.PP
  388. Xspecial-delivery = 100;
  389. X.PP
  390. Xjunk = -100;
  391. X.sp 1
  392. Xdefines the precedence level for the names \*Qspecial-delivery\*U and 
  393. X\*Qjunk\*U.  Thus, whenever the name \*Qjunk\*U appears in 
  394. Xa \*QPrecedence:\*U field, the corresponding message class will be set to -100.
  395. X.NH 2
  396. XTrusted users
  397. X.PP
  398. X\fISendmail\fR's \fB\-f\fR flag allows trusted users to override the sender's
  399. Xmachine address.  Trusted users are listed in \fItrusted\fR blocks.  A 
  400. X\fItrusted\fR block consists of the keyword \fItrusted\fR, followed 
  401. Xby zero or more sets of users taking the form:
  402. X.TS
  403. Xcenter box;
  404. Xl .
  405. X{ <user1>, <user2>, <user3>, ... } ;
  406. X.TE
  407. XThe following example,
  408. X.sp 1
  409. X\fItrusted\fR
  410. X.PP
  411. X{ root, uucp, network } ;
  412. X.PP
  413. X{ acu, kcs, jss } ;
  414. X.sp 1
  415. Xspecifies that the users root, uucp, network, acu, kcs, and jss can be trusted 
  416. Xto use the \fIsendmail\fR flag, \fB\-f\fR.
  417. X.NH 2
  418. XMail header definitions
  419. X.PP
  420. XThe format of the message headers inserted by \fIsendmail\fR is defined in one
  421. Xor more \fIheader\fR blocks in the configuration file.  A \fIheader\fR block
  422. Xconsists of the keyword \fIheader\fR, followed by zero or more statements
  423. Xtaking any of the following forms:
  424. X.TS
  425. Xcenter box;
  426. Xl 
  427. Xl
  428. Xl
  429. Xl
  430. Xl
  431. Xl
  432. Xl
  433. Xl
  434. Xl
  435. Xl
  436. Xl .
  437. X\fIfor\fR ( <mailer-flag1>, <mailer-flag2>, ... )
  438. X       \fIdefine\fR ( "<header-title>" , \fBheader-value\fR ) ;
  439. X
  440. X\fIfor\fR ( <mailer-flag1>, <mailer-flag2>, ... ) {
  441. X       \fIdefine\fR ( "<header-title>" , \fBheader-value\fR ) ;
  442. X       \fIdefine\fR ( "<header-title>" , \fBheader-value\fR ) ;
  443. X       .
  444. X       .
  445. X} ;
  446. X
  447. X\fIdefine\fR ( "<header-title>" , \fBheader-value\fR ) ;
  448. X.TE
  449. XThe first form is used to define one header for one or more mailer
  450. Xflags.  The second form differs from the first in that more than one
  451. Xheader may be defined for a given set of flags.  The third form is used to 
  452. Xdefine a header,
  453. Xregardless of mailer flags.  Refer to Appendix C for a list of \fBEase\fR 
  454. Xidentifiers representing mailer flags.  The header title is a simple
  455. Xstring of characters (no macro references), whereas the \fBheader-value\fR
  456. Xis a series of one or more strings and
  457. X\fBconditional-expressions\fP (discussed later).
  458. XConcatenation is implicit (as in \fIawk\fP).
  459. X.sp 1
  460. XThe following example,
  461. X.DS
  462. X\fIheader\fR
  463. X
  464. X    \fIdefine\fR ( "Subject:", "") ;
  465. X
  466. X    \fIfor\fR ( \fIf_return\fR )
  467. X        \fIdefine\fR ( "Return-Path:", "<${\fIm_sreladdr\fR}>" ) ;
  468. X
  469. X    \fIfor\fR ( \fIf_date\fR ) {
  470. X        \fIdefine\fR ( "Resent-Date:", "${\fIm_odate\fR}" ) ;
  471. X        \fIdefine\fR ( "Date:", "${\fIm_odate\fR}" );
  472. X    } ;
  473. X.DE
  474. Xdefines a \*QSubject\*U field for all mailers, regardless of their flags, a
  475. X\*QReturn-Path\*U field for mailers whose definition specifies
  476. Xthe flag, \fIf_return\fR, and the headers, \*QResent-Date\*U and \*QDate\*U,
  477. Xfor mailers whose definition specifies the flag, \fIf_date\fR.
  478. X.NH 2
  479. XMailer Definitions
  480. X.PP
  481. X\fISendmail\fR's definition of a mailer (or an interface to one) occurs in a
  482. X\fImailer\fR block.  A \fImailer\fR block consists of the keyword \fImailer\fR,
  483. Xfollowed by zero or more statements of the form:
  484. X.TS
  485. Xcenter box;
  486. Xl .
  487. X<mailer-identifier> { \fBmailer-spec\fR } ;
  488. X.TE
  489. XThe field, \fBmailer-spec\fR, is a list of zero or more of the
  490. Xfollowing attribute assignments (where successive assignment statements are
  491. Xseparated by commas):
  492. X.TS
  493. Xcenter ;
  494. Xl l 
  495. Xl l
  496. Xl l
  497. Xl l
  498. Xl l
  499. Xl l
  500. Xl l .
  501. X\fIPath\fR    = \fBstring-attribute\fR
  502. X\fIArgv\fR    = \fBstring-attribute\fR
  503. X\fIEol\fR    = \fBstring-attribute\fR
  504. X\fIMaxsize\fR    = \fBstring-attribute\fR
  505. X\fIFlags\fR    = { <mailer-flag1>, <mailer-flag2>, ... } 
  506. X\fISender\fR    = <sender-ruleset-id>
  507. X\fIRecipient\fR    = <recipient-ruleset-id>
  508. X.TE
  509. XThe \fBstring-attribute\fR value can take the form of a quoted string
  510. X(possibly containing macro references) or a \fBconditional-expression\fR 
  511. X(discussed later).
  512. X.sp 1
  513. XThe following example,
  514. X.sp 1
  515. X\fImailer\fR
  516. X.DS
  517. X    local {
  518. X        \fIPath\fR        = "/bin/mail",
  519. X        \fIFlags\fR        = { \fIf_from\fR, \fIf_locm\fR },
  520. X        \fISender\fR    = Sender_RW,
  521. X        \fIRecipient\fR    = Recip_RW,
  522. X        \fIArgv\fR        = "mail -d ${\fIm_ruser\fR}",
  523. X        \fIMaxsize\fR    = "200000"
  524. X    } ;
  525. X.DE
  526. Xdefines a mailer named \*Qlocal\*U.
  527. X.NH 2
  528. XAddress field definitions
  529. X.PP
  530. X\fISendmail\fR's address parsing scheme treats an address as a group of tokens
  531. X(an address token is precisely defined in the Arpanet protocol RFC822).  In
  532. Xgeneral, \fIsendmail\fR divides an address into tokens based on a list of
  533. Xcharacters assigned as a string to the special macro \fIm_addrops\fR.  These
  534. Xcharacters will individually be considered as tokens and will separate tokens
  535. Xwhen parsing is performed. 
  536. X.PP
  537. XFor
  538. Xthe \fBEase\fR language, there is a distinct set of address tokens (defined
  539. Xbelow) which are used in combination to represent generic forms of 
  540. Xaddresses.  In 
  541. Xaddition to literal address tokens, the pattern to be matched in a rewriting 
  542. Xrule (often referred to as the LHS) may
  543. Xinclude field identifiers which match one of five possibilities:
  544. X.DS
  545. X    - zero or more tokens
  546. X    - one or more tokens
  547. X    - one token exactly
  548. X    - one token which is an element of an arbitrary class \fBX\fR
  549. X    - one token which is not an element of an arbitrary class \fBX\fR
  550. X.DE
  551. XA particular field type may be assigned to one or more identifiers.  Each
  552. Xfield identifier is associated with (or defined to be) a field type in
  553. Xa \fIfield\fR declarations block.  A \fIfield\fR declarations block consists
  554. Xof the keyword \fIfield\fR, followed by zero or more field definitions of
  555. Xthe form:
  556. X.TS
  557. Xcenter box;
  558. Xl .
  559. X\fBfield-id-list\fR : \fBfield-type\fR ;
  560. X.TE
  561. XA \fBfield-id-list\fR is a list of one or more identifiers, each separated by
  562. Xa comma.  A \fBfield-type\fR, on the other hand, is a representation of 
  563. Xone of the five fields 
  564. Xdescribed above.  The syntax for each of the five forms follows:
  565. X.DS
  566. X    \fImatch\fR ( 0* )
  567. X    \fImatch\fR ( 1* )
  568. X    \fImatch\fR ( 1 )
  569. X    \fImatch\fR ( 1 ) \fIin\fR <class-X>
  570. X    \fImatch\fR ( 0 ) \fIin\fR <class-X>
  571. X.DE
  572. XThe star in the first two forms means: "or more".  Thus, the first
  573. Xform would read: "match zero or more tokens".  The fourth form describes
  574. Xa field where one token is matched from an arbitrary class (class-X), whereas
  575. Xthe fifth form describes a field where one token is matched if it is not of the
  576. Xgiven class (class-X).
  577. X.sp 1
  578. XIn addition, the Sun release 3.0 version of \fIsendmail\fR supports several
  579. Xnew pattern matching operations represented by the following forms:
  580. X.DS
  581. X    \fImatch\fR ( 0 ) \fImap\fR <macro-identifier-X>
  582. X    \fImatch\fR ( 1 ) \fImap\fR <macro-identifier-X>
  583. X    \fImatch host\fR
  584. X.DE
  585. XThe macro \*Qmacro-identifier-X\*U should be assigned the name of the
  586. Xrelevant YP map.
  587. X.sp 1
  588. XThe following example,
  589. X.sp 1
  590. X.DS
  591. X\fIfield\fR
  592. X    anypath        : \fImatch\fR ( 0* );
  593. X    recipient_host    : \fImatch\fR ( 1 );
  594. X    local_site        : \fImatch\fR ( 1 ) \fIin m_sitename\fR;
  595. X    remote_site        : \fImatch\fR ( 0 ) \fIin m_sitename\fR;
  596. X.DE
  597. Xdefines the fields anypath, recipient_host, local_site, and remote_site.
  598. X.NH 2
  599. XAddress rewriting rules
  600. X.PP
  601. XAddress rewriting rules are grouped according to the function they perform.  For
  602. Xexample, it is desirable to form a distinct group for those rewriting rules 
  603. Xwhich perform transformations on recipient addresses.
  604. X.PP
  605. XSets of rewriting rules are defined in \fIruleset\fR blocks.  A \fIruleset\fR
  606. Xblock consists of the keyword \fIruleset\fR, followed by zero or more
  607. Xruleset definitions of the form:
  608. X.TS
  609. Xcenter box;
  610. Xl .
  611. X<ruleset-id> { <rewriting-rule1> <rewriting-rule2> ... }
  612. X.TE
  613. XThe ruleset identifier, ruleset-id, must be defined in a \fIbind\fR block, as
  614. Xdescribed earlier.  The rewriting rules have the form:
  615. X.DS
  616. X    \fIif\fR ( <match-pattern> )
  617. X        <match-action> ( <rewriting-pattern> ) ;
  618. X.DE
  619. Xwhere match-pattern, rewriting-pattern, and match-action are described below.
  620. XAn alternative form is available:
  621. X.DS
  622. X    \fIwhile\fR ( <match-pattern> )
  623. X        <match-action> ( <rewriting-pattern> ) ;
  624. X.DE
  625. Xwhich is somewhat more useful when the \*Qmatch-action\*U is \fIretry\fP
  626. X(see below).
  627. X.NH 3
  628. XMatch-patterns
  629. X.PP
  630. XA match-pattern is a sequence of Ease address elements representing an
  631. Xaddress format.  If the address being rewritten matches the pattern
  632. X\*Qmatch-pattern\*U,
  633. Xthen the address is reformatted using the pattern \*Qrewriting-pattern\*U, and 
  634. Xthe corresponding
  635. Xaction (\*Qmatch-action\*U) is performed.  The five distinct Ease address
  636. Xelements which may constitute a match-pattern are as follows:
  637. X.TS
  638. Xcenter ;
  639. Xl .
  640. X1. Field Identifiers (refer to previous section)
  641. XT{
  642. X2. Non-alphanumeric characters (the exception is the case for literal 
  643. Xdouble quotes, which must be preceded by a backslash (\\\\\)
  644. XT}
  645. X3. Macro references
  646. X4. Quoted strings ("...")
  647. X5. \fBConditional-expressions\fR (discussed later)
  648. X.TE
  649. XBelow are two sample match-patterns, each describing the same address format:
  650. X.DS
  651. X    user-id @ hostname . $arpa_suffix
  652. X    user-id @ hostname ".ARPA"
  653. X.DE
  654. Xwhere user-id and hostname are field identifiers, and arpa_suffix is a 
  655. Xuser-defined macro with the value \*QARPA\*U.
  656. X.NH 3
  657. XRewriting-patterns
  658. X.PP
  659. XA rewriting-pattern specifies the form in which to rewrite a matched 
  660. Xaddress.  The seven distinct elements which may be used to form 
  661. Xa rewriting-pattern are as follows:
  662. X.TS
  663. Xcenter ;
  664. Xl .
  665. X
  666. XT{
  667. X1. Non-alphanumeric characters (the exception is the case for literal
  668. Xdouble quotes, left parentheses, or right parentheses, each of which 
  669. Xmust be preceded by a backslash (\\\\\). 
  670. XT}
  671. X
  672. XT{
  673. X2. A call to another ruleset.  This is used to perform rewrites
  674. Xon a suffix of the rewriting-pattern.  The proper use of this
  675. Xfeature will be demonstrated by example below. 
  676. XT}
  677. X
  678. X3. Quoted strings ("...").
  679. X
  680. X4. \fBConditional-expressions\fR (discussed later).
  681. X
  682. X5. A macro reference.
  683. X
  684. XT{
  685. X6. A positional reference in the matched address.  A positional 
  686. Xreference takes the form: $<integer-position>.  For example, 
  687. X$3 references the value of the third \fBEase\fR address 
  688. Xelement in the matched address.
  689. XT}
  690. X
  691. XT{
  692. X7. Canonicalized host names of the form \fIcanon\fR (<id-token-list>),
  693. Xwhere \*Qid-token-list\*U is a list of one or more \*Qid-tokens.\*U
  694. XAn \*Qid-token\*U is a regular identifier, a quoted identifier (with
  695. Xdouble quotes), a macro reference yielding an identifier,
  696. Xa numeric internet specification (see below),
  697. Xa literal character (such as a \*Q.\*U or a \*Q[\*U), or a 
  698. Xpositional reference in the matched address.  The canonicalization of 
  699. Xa host name is simply a mapping to its canonical (or official) form.
  700. XT}
  701. X
  702. X.TE
  703. XBelow are two sample rewriting-patterns:
  704. X.DS
  705. X    $1 % $2 < @ $3 ".ARPA" >
  706. X    OLDSTYLE_RW ( $1 )
  707. X.DE
  708. XThe first form specifies an address such as a%b<@c.ARPA>, where a, b, and c
  709. Xrepresent matched identifiers or paths.  The second form specifies a call to
  710. Xthe ruleset \*QOLDSTYLE_RW\*U, for old-style rewriting on the parameter 
  711. X$1, which probably references the entire matched address.  This will become 
  712. Xclear in later examples.
  713. X.NH 3
  714. XMatch-actions
  715. X.PP
  716. XWhen a ruleset is called, the address to be rewritten is compared (or matched)
  717. Xsequentially against the match-address of each rewriting rule.  When a
  718. Xmatch-address describes the address \fIsendmail\fR is attempting to rewrite, the
  719. Xaddress is rewritten (or reformatted) using the rule's 
  720. Xrewriting-pattern.  Following this rewrite, the corresponding match-action
  721. Xis performed.  There are four match-actions:
  722. X.TS
  723. Xcenter ;
  724. Xl l .
  725. X\fIretry\fR    T{
  726. X-a standard action which causes the rewritten address
  727. Xto be again compared to the match-address of the current rule. 
  728. XT}
  729. X
  730. X\fInext\fR    T{
  731. X-an action which causes the rewritten address to be
  732. Xcompared to the match-address of the next rewriting rule of the current 
  733. Xruleset.  If the end of the list is reached, the ruleset returns the 
  734. Xrewritten address.
  735. XT}
  736. X
  737. X\fIreturn\fR    T{
  738. X-an action which causes an immediate return of the 
  739. Xruleset with the current rewritten address.
  740. XT}
  741. X
  742. X\fIresolve\fR    T{
  743. X-an action which specifies that the address has been
  744. Xcompletely resolved (i.e., no further rewriting is necessary).  The 
  745. X\fIresolve\fR action is described in more detail below. 
  746. XT}
  747. X.TE
  748. X.PP
  749. XThe match-action, \fIresolve\fR, is special in that it terminates
  750. Xthe address rewriting altogether.  The semantic structure of \fIsendmail\fR's
  751. Xrewriting scheme requires that a \fIresolve\fR action appear only in the 
  752. Xruleset whose numerical binding is to the number zero.  The \fIresolve\fR action
  753. Xmust specify three parameters: \fImailer\fR, \fIhost\fR, and \fIuser\fR.  If
  754. Xthe \fImailer\fR is local, the \fIhost\fR parameter may be omitted.  The
  755. X\fImailer\fR argument must be specified as a single word, macro, or positional
  756. Xreference in the matched address.  The \fIhost\fR argument may be specified as 
  757. Xa single word or as an expression which expands to a single word (e.g.,
  758. X\fIhost\fR ($1 ".ARPA")).  In addition, the \fIhost\fR argument may be a
  759. Xcanonicalization (as described above) or a numeric internet specification.  The
  760. Xkeyword \fIhostnum\fR is used for numeric internet specifications, as in 
  761. X\fIhostnum\fR ("128.61.1.1") or \fIhostnum\fR ( $2 ).  The \fIuser\fR 
  762. Xspecification is a rewriting-pattern, as described above.  
  763. X.PP
  764. XIn general, the format of a \fIresolve\fR action will be as follows:
  765. X.DS
  766. X    \fIresolve\fR (    \fImailer\fR ( <mailer-name> ),
  767. X            \fIhost\fR   ( <host-name> ),
  768. X            \fIuser\fR   ( <user-address>)   );
  769. X.DE
  770. XExamples of the match-action statement are shown below:
  771. X.DS
  772. X\fIfield\fR
  773. X    anypath    : \fImatch\fR (0*);
  774. X    usr, path    : \fImatch\fR (1*);
  775. X    hostname    : \fImatch\fR (1);
  776. X    phone_host    : \fImatch\fR (1) \fIin\fR phonehosts;
  777. X.DE
  778. X.DS
  779. X\fIruleset\fR
  780. X
  781. X    EXAMPLE_RW {
  782. X    
  783. X        \fIif\fR ( anypath < path > anypath )   /* basic RFC821/822 parse */
  784. X            \fIretry\fR ( $2 );
  785. X        \fIif\fR ( usr " at " path )        /* \*Qat\*U -> \*Q@\*U */
  786. X            \fInext\fR ( $1 @ $2 );
  787. X        \fIif\fR ( @path: usr )
  788. X            \fIreturn\fR ( LOCAL_RW ( < @$1 > : $2 ) );
  789. X        \fIif\fR ( anypath < @phone_host".ARPA" > anypath )
  790. X            \fIresolve\fR (    \fImailer\fR ( tcp ),
  791. X                    \fIhost\fR ( relay.cs.net ),
  792. X                    \fIuser\fR ( $1 % $2 < @"relay.cs.net" > $3 ) );
  793. X    }
  794. X.DE
  795. X.PP
  796. XThe example above defines the ruleset \*QEXAMPLE_RW\*U, which contains four
  797. Xrewriting rules.  The first rewriting rule discards all tokens of an address
  798. Xwhich lie on either side of a pair of angle brackets (<>), thereby 
  799. Xrewriting the address as
  800. Xthe sequence of tokens contained within the angle brackets ($2).  Following the
  801. Xaddress rewrite, the rule is applied again (\fIretry\fR).  When the first rule
  802. Xfails to match the address being rewritten, the second rule is applied.  
  803. X.PP
  804. XThe second 
  805. Xrule simply replaces the word \*Qat\*U by the symbol \*Q@\*U.  The \*Q\fInext\fR\*U
  806. Xaction specifies that if a match is made, a rewrite is performed and 
  807. Xmatching continues at the next (or following) rule.  
  808. X.PP
  809. XThe third rule illustrates
  810. Xthe use of the \*Q\fIreturn\fR\*U action, which is executed if the 
  811. Xpattern \*Q@path: usr\*U
  812. Xdescribes the current format of the address being rewritten.  In this example,
  813. Xthe \fIreturn\fR action returns the result of a call to ruleset \*QLOCAL_RW\*U,
  814. Xwhich rewrites the address \*Q<@$1>:$2\*U, where $1 and $2 are substituted
  815. Xwith the token(s) matched respectively by \*Qpath\*U and \*Qusr\*U.
  816. X.PP
  817. XThe fourth (and final) rule signals a resolution (and termination) of the
  818. Xrewriting process if the given pattern is matched.  The resolution specifies
  819. Xthat the mailer \*Qtcp\*U will be used to deliver the message to the host
  820. X\*Qrelay.cs.net\*U.
  821. XThe \fIuser\fR parameter specifies the final form of the address
  822. Xwhich \fIsendmail\fR has just resolved.
  823. X.sp 2
  824. X.PP
  825. XThe \fBEase\fR construct which remains to be examined is the 
  826. X\fBconditional-expression\fR.  The \fBconditional-expression\fR provides a 
  827. Xmethod for
  828. Xconstructing strings based on the condition that some test macro is (or is not)
  829. Xset.  The general form begins with the concatenation of a string and a
  830. X\fBstring-conditional\fR:
  831. X.DS
  832. X    \fIconcat\fR ( <quoted-string>, \fBstring-conditional\fR )
  833. X    \fIconcat\fR ( \fBstring-conditional\fR, <quoted-string> )
  834. X.DE
  835. XA \fBstring-conditional\fR assumes either of the following forms:
  836. X.DS
  837. X    \fIifset\fR ( <macro-name>, <ifset-string> )
  838. X    \fIifset\fR ( <macro-name>, <ifset-string>, <notset-string> )
  839. X.DE
  840. XA \fBstring-conditional\fR of the first form evaluates to \*Qifset-string\*U 
  841. Xif the macro \*Qmacro-name\*U has been assigned a value; otherwise it
  842. Xevaluates to the null string.  The second form behaves similarly, except
  843. Xthat the \fBstring-conditional\fR evaluates to \*Qnotset-string\*U, instead
  844. Xof the null string, if the macro \*Qmacro-name\*U has no value.
  845. X.sp 1
  846. XThe following \fBconditional-expression\fR,
  847. X.DS
  848. X    \fIconcat\fR ( "New ", \fIifset\fR ( city, "York", "Jersey" ) )
  849. X.DE
  850. Xevaluates to the string "New York", if the macro \*Qcity\*U is set.  Otherwise,
  851. Xthe \fBconditional-expression\fR evaluates to the string "New Jersey".
  852. X.NH 2
  853. XLatest Changes
  854. XThe first two releases of \fBEase\fP provided a good starting point
  855. Xfor managing \fIsendmail\fP  files. However, the translation wasn't
  856. Xperfect. Some editing needed to be done before \fBEase\fB could be
  857. Xused.
  858. XBruce G. Barnett made modifications to Arnold Robbin's \fBEase\fP to
  859. Xsendmail convertor \fIcfc\fP and tested these changes to verify a
  860. X\fIsendmail\fP configuration fle could be translated into \fBEase\fP
  861. Xand back with no errors: at least for the more common versions of
  862. X\fIsendmail\fP.
  863. XIn case this translation is not perfect, \fBEase\fP version 3 supports
  864. Xthe \fIasm("...")\fP command, which passes the contents of the string
  865. Xdirectly to the \fIsendmail.cf\fP file.
  866. XAlso - support for SunOS and Ultrix sendmail were added.
  867. XNew options and flags were added, and well as the \fIypmap\fP (SunOS),
  868. X\fIypalias\fP and \fIyppasswd\fP (Ultrix) functions.
  869. X.NH
  870. XEase Translation
  871. X.PP
  872. XIt is important to note that \fBEase\fR is translated by a stand-alone
  873. Xtranslator to the raw configuration file format.  No modifications were
  874. Xmade to the \fIsendmail\fR program itself.  As a result, syntactical verification
  875. Xof a configuration file can be performed without invoking \fIsendmail\fR.
  876. X.PP
  877. XThe \fBEase\fR language is translated by invoking 
  878. Xthe \fBEase\fR translator (\fIet\fR). If the command line options include a flag understood by the C language preprocessor (cpp), \fIet\fP automatically 
  879. Xpipes input through \fIcpp\fP.
  880. XThe \fBEase\fR
  881. Xtranslator may be invoked on the command line in one of four ways:
  882. X.TS
  883. Xcenter box ;
  884. Xl l .
  885. X\fIet\fR <options>  <input-file>  <output-file>    [read from a file, write to a file]
  886. X\fIet\fR  <options> <input-file>    [read from a file, write to standard output]
  887. X\fIet\fR  <options> -  <output-file>    [read from standard input, write to a file]
  888. X\fIet\fR <options>    [read from standard input, write to standard output]
  889. X.TE
  890. X.NH
  891. XConclusion
  892. X.PP
  893. X\fBEase\fR is [ed - this information is old] currently in use at the
  894. XPurdue University Computing Center.  Source code for the \fBEase\fR
  895. Xtranslator (\fIet\fR) may be obtained on request by writing to:
  896. X.DS
  897. XU.S. Mail:
  898. X        James S. Schoner
  899. X        c/o Kevin S. Braunsdorf
  900. X        Purdue University Computing Center
  901. X        Purdue University
  902. X        West Lafayette, Indiana  47907
  903. X
  904. XElectronic Mail:
  905. X        ksb@j.cc.purdue.edu
  906. X.DE
  907. X.PP
  908. XMuch of the success of this project is attributable to the constant support 
  909. Xand insight offered by Mark Shoemaker.  To him, I owe a debt of gratitude.  In 
  910. Xaddition, I would like to thank Kevin Smallwood, Paul Albitz, and Rich Kulawiec
  911. Xfor their many notable suggestions and valuable insight.
  912. X.NH
  913. XAcknowledgements
  914. X.PP
  915. XArnold Robbins would like to acknowledge contributions from
  916. XStephen Schaefer of Bowling Green State University,
  917. XJeff Stearns of John Fluke Manufacturing Company,
  918. XRaymond A. Schnitzler of Bellcore,
  919. XAndrew Partan of the Corporation for Open Systems,
  920. Xand
  921. XBruce G. Barnett, of General Electric.
  922. XThe good intentions of Rich Salz, of Bolt Beranak, and Newman,
  923. Xare also acknowledged.
  924. X.PP
  925. XThe most up to date version of \fBEase\fR should be gotten from the
  926. Xnearest USENET \fBcomp.sources.unix\fR archive site.
  927. X# Local variables:
  928. X# mode: nroff
  929. X# end:
  930. END_OF_doc/ease.paper
  931. if test 32871 -ne `wc -c <doc/ease.paper`; then
  932.     echo shar: \"doc/ease.paper\" unpacked with wrong size!
  933. fi
  934. # end of overwriting check
  935. fi
  936. echo shar: End of archive 5 \(of 6\).
  937. cp /dev/null ark5isdone
  938. MISSING=""
  939. for I in 1 2 3 4 5 6 ; do
  940.     if test ! -f ark${I}isdone ; then
  941.     MISSING="${MISSING} ${I}"
  942.     fi
  943. done
  944. if test "${MISSING}" = "" ; then
  945.     echo You have unpacked all 6 archives.
  946.     rm -f ark[1-9]isdone
  947. else
  948.     echo You still need to unpack the following archives:
  949.     echo "        " ${MISSING}
  950. fi
  951. ##  End of shell archive.
  952. exit 0
  953. --
  954. Bruce G. Barnett    barnett@crd.ge.com    uunet!crdgw1!barnett
  955.