home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / vmsnet / mail / pmdf / 2641 / text0000.txt < prev   
Encoding:
Text File  |  1992-11-20  |  13.3 KB  |  345 lines

  1. > I have been using a widely available patch for MAILSHR.EXE that allows
  2. > it to accept most rfc822 type mail addresses and surround them by IN%"".
  3. > This patch worked up to VMS 5.5-1.  After we installed VMS 5.5-2 this
  4. > patch no longer works.  I suspect the internal addressing of MAILSHR have
  5. > changed.
  6. >
  7. > Has anyone gotten this to work on 5.5-2?
  8.  
  9.   The following has been _lightly_ tested here (I answered this message with
  10. it 8-). Use at your own risk...
  11.  
  12.     Terry Kennedy        Operations Manager, Academic Computing
  13.     terry@spcvxa.bitnet    St. Peter's College, Jersey City, NJ USA
  14.     terry@spcvxa.spc.edu    +1 201 915 9381
  15.  
  16. !----------------------  MAILSHR_PATCH_FOR_AT_03.COM -----------------
  17. MAILSHR.EXE
  18. !
  19. ! 20-Nov-1992 - tmk - Fix this patch to apply to VMS V5.5-2 with CSCPAT_0232
  20. !        V1.6. Also set ECO 97 (1st user bit). terry@spcvxa.spc.edu
  21. !
  22. ! This patch will be of interest to any VAX/VMS system (more especially if it
  23. ! is running PMDF) since it lets TO: or CC: addresses such as
  24. ! user%machine@site.co.org to be accepted without the IN% prefix and without
  25. ! surrounding double quotes.  Yes, let's admit it, it lets VMS mail accept Un*x
  26. ! type addresses.  In addition to its original goal, the format of this
  27. ! modification is also original by the fact of the straight macro code that
  28. ! can easily be modified/expanded or altered (ie IN% could become M_INTERNET::
  29. ! in the case of most Schlumberger VMS nodes)
  30. ! If the address is "similar" (see algorithm below) to user%machine@site.co.org
  31. ! it is simply rewritten as IN%"user%machine@site.co.org" and passed along.
  32. ! At the same time, user@machine will be accepted and rewritten as machine::user
  33. ! If the IN% prefix is not the one in use on your VAX/VMS system, but XYZ% is,
  34. ! then all you have to do is $ DEFINE/SYSTEM/EXECUTIVE -
  35. !    MAIL$PROTOCOL_IN -
  36. !    XYZ_ROOT:[EXE]XYZ_MAILSHR    ! or wherever the XYZ overlay for MAIL
  37. !                    ! might be located and installed from
  38. !
  39. ! See additional impact remarks below.
  40. !
  41. ! This patch applies to SYS$LIBRARY:MAILSHR.EXE (usually SYS$COMMON:[SYSLIB])
  42. ! from VMS 5.0 to 5.5-2 as of November 1992
  43. !
  44. !    We recommend:
  45. !
  46. !    $ SET DEFAULT SYS$COMMON:[SYSLIB]
  47. !    $ INSTALL:= $INSTALL/COMMAND
  48. !    $ PATCH @ this_file.COM
  49. !    $ INSTALL REPLACE SYS$COMMON:[SYSLIB]MAILSHR.EXE
  50. !
  51. ! Claude Barbe - Schlumberger-Doll Research - Ridgefield, CT - USA
  52. ! (Internet) barbe@sdr.slb.com (a happy hacker of MAIL and PMDF for over 3yr)
  53. !
  54. ! 3-Jul-1990
  55. !
  56. ! No warranty implied.  This can be freely copied and altered.  Use it at
  57. ! your own risks.  It is probably pure chance if it ever worked on a
  58. ! particular system.
  59. !
  60. ! Additional remarks on the impact of this patch
  61. !
  62. ! 1) With this patch in place we hope to make addressing unique in the VMS world
  63. !    whether a message is sent via DECnet or via a foreign protocol (such as
  64. !    the successful/affordable PMDF) without forcing any one to use prefixes
  65. !    and/or quotes.  Quotes are to be avoided by all means since MAIL and DEC's
  66. !    MRGATE interface have no mechanisms to imbed quoted addresses between
  67. !    quotes (ie MRGATE and PMDF cannot carry the same message!)
  68. ! 2) There are risks of confusion for new users who will learn that the Un*x
  69. !    addressing format works on a patched VMS system and who will never bother
  70. !    to know the DEC way to send mail with double colons between node and
  71. !    username until they use a non patched VMS system
  72. ! 3) The patch will certainly break when DECnet node names will contain dots
  73. !    but this is in DECnet phase V and we still have to see a field test
  74. !    for this product.  By that time a better patch will be developped or
  75. !    whatever foreign protocol is used (PMDF by default) will just handle
  76. !    these deliveries that could have gone also more simply across DECnet
  77. ! 4) The patch is far from being fully RFC822 compliant and there are risks
  78. !    that some users will be confused by the lack of completeness.  This
  79. !    in some case will be due to the approach taken in this patch where,
  80. !    instead of redoing the address parsing that DEC is doing in MAIL, we
  81. !    simply hacked a string filter on a "DEC approved string" which has already
  82. !    been pruned of commas and exclamation points.  Users familiar with "bang"
  83. !    addresses will still have to say IN%"node!node!user@relay.somewhere"
  84. ! 5) After a few extra weeks of testing on a larger scale, this patch will be
  85. !    submitted to DEC as an SPR for improvement.  Hopefully, then DEC will
  86. !    support the de facto standard (or at least the most commonly used part
  87. !    of it).  In the mean time let's try to let our users access Internet
  88. !    addresses in the most natural way.  At last!
  89. !
  90. ! Validity of this patch
  91. !
  92. ! It has been tested on every release starting w/ 5.3-1.  This part of the code
  93. ! is the same for all these versions of VMS 5, only the addresses changed after
  94. ! 5.0.  For VMS 4.6/4.7, unfortunately the code was different and it was not
  95. ! found worth the effort to retrofit this patch for a version of VMS that was
  96. ! replaced 23 months ago.
  97. !
  98. ! For VMS 5.0 only, uncomment the following 6 lines and comment another 6 lines
  99. ! below.
  100. !
  101. ! If you patch, VMS 5.0, it is different from the following VMS versions
  102. !                          MAIL$$ADD_ADDR     is located at 000049C2 and
  103. !                          ADD_ADDR           is located at 000048EF
  104. !
  105. !DEF
  106. !MAIL$$ADD_ADDR
  107. !000049C2
  108. !ADD_ADDR
  109. !000048EF
  110. !EXI
  111. !
  112. ! If you patch any versions from VMS 5.1 to V5.5-1 including 5.1 and 5.2, all
  113. ! appear to have identical MAIL$$ADD_ADDR always located at 000049D2 and
  114. ! calling                  ADD_ADDR       always located at 000048FF
  115. !
  116. !DEF
  117. !MAIL$$ADD_ADDR
  118. !000049D2
  119. !ADD_ADDR
  120. !000048FF
  121. !EXI
  122. !
  123. ! For VMS 5.5-2 (with patch CSCPAT_0232016), the addresses change yet again:
  124. !                          MAIL$$ADD_ADDR     is located at 000049DA and
  125. !                          ADD_ADDR           is located at 00004907
  126. !
  127. DEF
  128. MAIL$$ADD_ADDR
  129. 000049DA
  130. ADD_ADDR
  131. 00004907
  132. EXI
  133. ! Now make sure that we have a patch area
  134. !
  135. ALI/B PATAREA
  136. ! And now enter instruction mode
  137. !
  138. SE M
  139. I
  140. EXI
  141. !    Start implementing the ALTER_TO subroutine
  142. !    It was first developped and tested as a MACRO-32 program
  143. !    and changed into the body of this patch.com file by
  144. !    a MACRO_TO_PATCH.COM procedure developped for that purpose
  145. DEP /PAT
  146. PATAREA
  147.        !;    ALTER_TO is called with the same 2 arguments used by
  148.        !;    MAIL$$SEND_ADD_ADDR in calling MAIL$$ADD_ADDR and will call
  149.        !;    ADD_ADDR itself with or without a rewrite. There is no rewrite
  150.        !;    if SYS$FAO fails.  The original address is never modified and
  151.        !;    will still appear unmodified in the "published" TO: field.
  152.        !;
  153.        !;    At this point when MAIL$$ADD_ADDR calls ALTER_TO, 4(AP) points
  154.        !;    to a string descriptor which MAIL has already parsed to be one
  155.        !;    of a single recipient (we don't have to look for commas or for
  156.        !;    an @ sign preceding a distribution list).  Because of the
  157.        !;    location of this patch, floating/unquoted "!"s seem unlikely.
  158.        !;
  159.        !;    The principle of this patch is to allow plain RFC addresses
  160.        !;    to be acceptable by mail.  We never anticipated to fully deal
  161.        !;    with the full RFC822 format but simply to lrt forms such as
  162.        !;    user@site.org or user%machine@site.company.org with all atoms
  163.        !;    being alphanumerics and the whole address void of double quotes
  164.        !;
  165.        !;    At the same time STRAIGHTFORWARD phase IV DECnet mail addresses
  166.        !;    are also allowed in an RFC822 like format: USERNAME@NODENAME
  167.        !;    is being transformed into NODENAME::USERNAME.  Note well that
  168.        !;    the code will NOT transform any address with an "@" into
  169.        !;    a more complex DECnet mail address such as AAA::BBB::USER.
  170.        !;
  171.        !;    The parsing is an adhoc scanning of the string looking for
  172.        !;    no more than one "@", checking the absence of " and for the
  173.        !;    A and B parts of A@B distinguish between A-Z,0-9,a-z,$,%,.,-
  174.        !;    and other characters (in case MAIL's parser would any slip thru)
  175.        !;
  176.        !;    More exactly the algorithm is:
  177.        !;
  178.        !;    input string might look like A@B with A and B containing no "
  179.        !;    if " or not A@B, pass the string to ADD_ADDR unchanged    ! Case 1
  180.        !;    else if A or B has any character not in A-Z,0-9,a-z,$,%,.,-
  181.        !;            pass IN%"A@B"                ! Case 2
  182.        !;         else
  183.        !;         if B has no dots (pure DECnet) pass B::A    ! Case 3
  184.        !;         else pass IN%"A@B"                ! Case 2
  185.        !;
  186.        'alter_to: .word    7C            ' ! ; entry mask save R2-R6
  187.        '    movq    @B^4(ap),r0'
  188.        '    movzwl    r0,r0'
  189.        '    clrl    r2'
  190.        'cdblp1:    cmpb    #^x22,(r1)'
  191.        '    beql    cdbcs1'
  192.        '    cmpb    #^x40,(r1)+'
  193.        '    beql    cdbl1x'
  194.        '    incl    r2            ' ! ; length of A in A@B
  195.        '    sobgtr    r0,cdblp1'
  196.        'cdbcs1: movab    @B^4(ap),r2'
  197.        '    jmp    cdbcom            ' ! ; no changes - case 1
  198.        'cdbl1x:    decl    r0            ' ! ; count "@"
  199.        '    bleq    cdbcs1            ' ! ; branch if at end
  200.        '    tstl    r2'
  201.        '    beql    cdbcs1            ' ! ; branch if @B with no A
  202.        '    clrl    r3            ' ! ; now parse after "@"
  203.        'cdblp2:    cmpb    #^x22,(r1)'
  204.        '    beql    cdbcs1'
  205.        '    cmpb    #^x40,(r1)+'
  206.        '    beql    cdbcs1'
  207.        '    incl    r3            ' ! ; length of B in A@B
  208.        '    sobgtr  r0,cdblp2'
  209.        !; passed test 1 - we have A@B - Now check A
  210.        '    movq    @B^4(ap),r0'
  211.        !; allocate room on stack for 2 descriptors (for A and B)
  212.        '    pushl    r1'
  213.        '    pushl    r2'
  214.        '    movl    sp,r5        ' ! ; r5 points to desc(A)
  215.        '    movl    r2,r0'
  216.        '    beql    cdbcs1'
  217.        '    jsb    cdbck1'
  218.        '    tstl    r0'
  219.        '    bneq    cdbcs2'
  220.        '    incl    r1'
  221.        '    pushl    r1'
  222.        '    pushl    r3'
  223.        '    movl    sp,r6        ' ! ; r6 points to desc(B)
  224.        '    movl    r3,r0'
  225.        '    beql    cdbcs1'
  226.        '    jsb    cdbck1'
  227.        '    tstl    r0'
  228.        '    beql    cdbps2'
  229.        !                        ; build IN%"A@B" for case 2
  230.        !; use the stack this way for all $FAO
  231.        !;        outlen        initial sp    <- r3 <-r2
  232.        !;        ptr to outbuf    initial sp-264    <- r2 minus 8
  233.        !;        ......                <- r2 to beg of ptr
  234.        !;        outbuf        initial sp-4    <- r3 minus 4
  235.        !;        ......        initial sp-256  <- sp
  236.        'cdbcs2:    pushl    #22534121        ' ! ; ctrstr    #^A/!AS"/
  237.        '    pushl    #22254E49        ' ! ; ctrstr    #^A/IN%"/
  238.        '    pushl    sp            ' ! ; make desc to ctrstr
  239.        '    pushl    #8            ' ! ; make desc to ctrstr
  240.        '    movl    sp,r4            ' ! ; address of desc to ctrstr
  241.        '    subl    #4,sp            ' ! ; adjusted stack
  242.        '    movl    sp,r3            ' ! ; save stack for outlen
  243.        '    movl    sp,r2            ' ! ; end of desc to outbuf
  244.        '    subl    #108,sp        ' ! ; end of outbuf
  245.        '    movl    sp,-(r2)    ' ! ; make outbuf
  246.        '    movzwl    #100,-(r2)    ' ! ; make outbuf
  247.        '    pushl    B^4(AP)            ' ! ; #4 P1 pass what we got
  248.        '    pushl    r2            ' ! ; #3 outbuf
  249.        '    pushl    r3            ' ! ; #2 outlen
  250.        '    pushl    r4            ' ! ; #1 ctrstr
  251.        '    calls    #4,@#7FFEDF50        ' ! ; calls   #04,g^sys$fao
  252.        '    blbs    r0,N102$'
  253.        '    jmp    cdberr'
  254.        'N102$:    movw    (r3),(r2)        ' ! ; complete ptr to final text
  255.        '    jmp    cdbcom'
  256.        'cdbps2:    movq    @B^4(ap),r0'
  257.        '    addl    r2,r1'
  258.        '    incl    r1'
  259.        '    movl    r3,r0'
  260.        '    jsb    cdbck2'
  261.        '    tstl    r0'
  262.        '    bneq    cdbcs2'
  263.        !                        ; build B::A for case 3
  264.        'cdbcs3:    pushl    #5341213A        ' ! ; ctrstr    #^A/:!AS/
  265.        '    pushl    #3A534121        ' ! ; ctrstr    #^A/!AS:/
  266.        '    pushl    sp            ' ! ; make desc to ctrstr
  267.        '    pushl    #8            ' ! ; make desc to ctrstr
  268.        '    movl    sp,r4            ' ! ; address of desc to ctrstr
  269.        '    subl    #4,sp            ' ! ; adjusted stack
  270.        '    movl    sp,r3            ' ! ; save stack for outlen
  271.        '    movl    sp,r2            ' ! ; end of desc to outbuf
  272.        '    subl    #108,sp        ' ! ; end of outbuf
  273.        '    movl    sp,-(r2)    ' ! ; make outbuf
  274.        '    movzwl    #100,-(r2)    ' ! ; make outbuf
  275.        '    pushl    r5            ' ! ; #5 Second sub string A
  276.        '    pushl    r6            ' ! ; #4 first  sub string B
  277.        '    pushl    r2            ' ! ; #3 outbuf
  278.        '    pushl    r3            ' ! ; #2 outlen
  279.        '    pushl    r4            ' ! ; #1 ctrstr
  280.        '    calls    #5,@#7FFEDF50        ' ! ; calls   #05,g^sys$fao
  281.        '    blbs    r0,N103$'
  282.        '    jmp    cdberr'
  283.        'N103$:    movw    (r3),(r2)        ' ! ; complete ptr to final text
  284.        '    jmp    cdbcom'
  285.        !; check if all alpha numerical + .-_$% returns non zero
  286.        'cdbck1:    cmpb    #^x41,(r1)'
  287.        '    bgtr    cdbck11'
  288.        '    cmpb    #^x5A,(r1)'
  289.        '    bgeq    cdbck19'
  290.        'cdbck11: cmpb    #^x61,(r1)'
  291.        '    bgtr    cdbck12'
  292.        '    cmpb    #^x7A,(r1)'
  293.        '    bgeq    cdbck19'
  294.        'cdbck12: cmpb    #^x30,(r1)'
  295.        '    bgtr    cdbck13'
  296.        '    cmpb    #^x39,(r1)'
  297.        '    bgeq    cdbck19'
  298.        'cdbck13: cmpb    #^x24,(r1)'
  299.        '    beql    cdbck19'
  300.        '    cmpb    #^x25,(r1)'
  301.        '    beql    cdbck19'
  302.        '    cmpb    #^x2D,(r1)'
  303.        '    beql    cdbck19'
  304.        '    cmpb    #^x2E,(r1)'
  305.        '    beql    cdbck19'
  306.        '    cmpb    #^x5F,(r1)'
  307.        '    rsb'
  308.        'cdbck19: incl    r1'
  309.        '    sobgtr    r0,cdbck1'
  310.        '    rsb'
  311.        !; check if we have at least one dot (then r0 > 0)
  312.        'cdbck2:    cmpb    #^x2E,(r1)'
  313.        '    bneq    cdbck29'
  314.        '    rsb'
  315.        'cdbck29: incl    r1'
  316.        '    sobgtr    r0,cdbck2'
  317.        '    rsb'
  318.        !;
  319.        'cdberr: movab    @B^4(ap),r2    ' !; If SYS$FAO fails, use original addr
  320.        'cdbcom:    MOVQ    #^X00000001,-(SP)'
  321.        '    movl    B^8(ap),-(sp)'
  322.        '    pushl    r2'
  323.        '    CALLS   #04,L^ADD_ADDR'
  324.        '    ret            ' !; this is the only RET for ALTER_TO
  325. EXI
  326. ! Above was the new code
  327. ! Below is the patch in the existing code that
  328. ! will make use of the ALTER_TO new code
  329. RE
  330. MAIL$$ADD_ADDR
  331. 'MOVQ    #^X00000001,-(SP)'
  332. 'MOVQ    B^04(AP),-(SP)'
  333. 'CALLS   #04,W^ADD_ADDR'
  334. 'RET'
  335. EXIT
  336. 'MOVQ    B^04(AP),-(SP)'
  337. 'CALLS   #02,ALTER_TO'
  338. 'RET'
  339. EXIT
  340. ! Leave some footprints...
  341. SET ECO 97
  342. ! And now update if we reached this point without a single error
  343. U
  344. !---------------------- end of patch ----------------------
  345.