$ !Date: Fri, 07 Jun 1991 15:16:12 EDT6 !From: Rick Westerman <westerm@bchm1.aclcb.purdue.edu> !To: madison@vms.ecs.rpi.edu= !Message-ID: <00949c63.09e86e60.15127@bchm1.aclcb.purdue.edu> ) !Subject: Re: user@node patch for vmsmail  !  ! N !>Ugh... I'm not really too keen on supporting something like that, especiallyJ !>seeing as I don't have VMS sources.  However, I would be glad to put theJ !>patch up for FTP so that others can make use of it.  Can someone who has !>it mail it to me?  ! E !I've been meaning to send it to you since it seems to be working for # !everyone. Here is what I send out:  ! G !This posting contains a patch to MAIL that elimiates the need to put a L !MX%" in front of a mail address. E.g, instead of 'MX%"user@site"', a personJ !using mail can simply use 'user@site' for the mail address. This patch is< !not originally mine; I merely updated it for the MX mailer. !  !  !-- Rick ! K !Rick Westerman                System Manager of the AIDS Center Laboratory K !westerm@aclcb.purdue.edu      for Computational Biochemistry (ACLCB), BCHM O !(317) 494-0505                bldg., Purdue University, W. Lafayette, IN 47907  !  !  ! * !There are three sections in this posting: !  !       1) The patch= !       2) Comments on how my modifications to the patch work 1 !       3) Comments on a bug in some UNIX systems  !  !  ! 8 !------------ Cut here for first section --------------- ! K !                                                               16-May-1991  ! I !I talked to the original author (Claude Barbe) today; there have been no # !changes to the patch since Jul-90.  !  ! F !----------------------  MAILSHR_PATCH_FOR_AT_02.COM ----------------- MAILSHR.EXE  ! I ! Modifed Nov, 1990, RPW to replace IN%"  with  MX%" and to make the form H !    user@system translate into mx%"user@system" instead of system::user ! M ! This patch will be of interest to any VAX/VMS system (more especially if it = ! is running PMDF) since it lets TO: or CC: addresses such as L ! user%machine@site.co.org to be accepted without the IN% prefix and withoutO ! surrounding double quotes.  Yes, let's admit it, it lets VMS mail accept Un*x G ! type addresses.  In addition to its original goal, the format of this K ! modification is also original by the fact of the straight macro code that N ! can easily be modified/expanded or altered (ie IN% could become M_INTERNET::- ! in the case of most Schlumberger VMS nodes) O ! If the address is "similar" (see algorithm below) to user%machine@site.co.org K ! it is simply rewritten as IN%"user%machine@site.co.org" and passed along. P ! At the same time, user@machine will be accepted and rewritten as machine::user  N ! If the IN% prefix is not the one in use on your VAX/VMS system, but XYZ% is,8 ! then all you have to do is $ DEFINE/SYSTEM/EXECUTIVE - !       MAIL$PROTOCOL_IN -N !       XYZ_ROOT:[EXE]XYZ_MAILSHR       ! or wherever the XYZ overlay for MAILM !                                       ! might be located and installed from  ! & ! See additional impact remarks below. ! M ! This patch applies to SYS$LIBRARY:MAILSHR.EXE (usually SYS$COMMON:[SYSLIB]) ; ! from VMS 5.0 to Field Test version of 5.4 as of June 1990  !  !       We recommend:  ! ) !       $ SET DEFAULT SYS$COMMON:[SYSLIB] $ !       $ INSTALL:= $INSTALL/COMMAND !       $ PATCH @ this_file.COM 8 !       $ INSTALL REPLACE SYS$COMMON:[SYSLIB]MAILSHR.EXE ! B ! Claude Barbe - Schlumberger-Doll Research - Ridgefield, CT - USAM ! (Internet) barbe@sdr.slb.com (a happy hacker of MAIL and PMDF for over 3yr)  !  ! 3-Jul-1990 ! I ! No warranty implied.  This can be freely copied and altered.  Use it at D ! your own risks.  It is probably pure chance if it ever worked on a ! particular system. ! 0 ! Additional remarks on the impact of this patch ! P ! 1) With this patch in place we hope to make addressing unique in the VMS world  L !    whether a message is sent via DECnet or via a foreign protocol (such asL !    the successful/affordable PMDF) without forcing any one to use prefixesO !    and/or quotes.  Quotes are to be avoided by all means since MAIL and DEC's J !    MRGATE interface have no mechanisms to imbed quoted addresses between? !    quotes (ie MRGATE and PMDF cannot carry the same message!) L ! 2) There are risks of confusion for new users who will learn that the Un*xN !    addressing format works on a patched VMS system and who will never botherI !    to know the DEC way to send mail with double colons between node and 5 !    username until they use a non patched VMS system L ! 3) The patch will certainly break when DECnet node names will contain dotsH !    but this is in DECnet phase V and we still have to see a field testI !    for this product.  By that time a better patch will be developped or I !    whatever foreign protocol is used (PMDF by default) will just handle I !    these deliveries that could have gone also more simply across DECnet K ! 4) The patch is far from being fully RFC822 compliant and there are risks H !    that some users will be confused by the lack of completeness.  ThisH !    in some case will be due to the approach taken in this patch where,I !    instead of redoing the address parsing that DEC is doing in MAIL, we O !    simply hacked a string filter on a "DEC approved string" which has already N !    been pruned of commas and exclamation points.  Users familiar with "bang"I !    addresses will still have to say IN%"node!node!user@relay.somewhere" M ! 5) After a few extra weeks of testing on a larger scale, this patch will be J !    submitted to DEC as an SPR for improvement.  Hopefully, then DEC willK !    support the de facto standard (or at least the most commonly used part I !    of it).  In the mean time let's try to let our users access Internet 1 !    addresses in the most natural way.  At last!  !  ! Validity of this patch ! P ! It has only been tested on VMS 5.3-1 but is expected to work on VMS 5.0 to 5.4  N ! (well, 5.4 is not out yet, so at least up to T5.4-4).  This part of the codeO ! is the same for all these versions of VMS 5, only the addresses changed after L ! 5.0.  For VMS 4.6/4.7, unfortunately the code was different and it was notM ! found worth the effort to retrofit this patch for a version of VMS that was  ! replaced 23 months ago.  ! O ! For VMS 5.0 only, uncomment the following 6 lines and comment another 6 lines  ! below. ! H ! If you patch, VMS 5.0, it is different from the following VMS versionsH !                          MAIL$$ADD_ADDR     is located at 000049C2 andD !                          ADD_ADDR           is located at 000048EFO !    then uncomment the following 6 lines and comment out 6 similar lines below  !DEF !MAIL$$ADD_ADDR 	 !000049C2 	 !ADD_ADDR 	 !000048EF  !EXI ! M ! If you patch any versions from VMS 5.1 to T5.4-4 including 5.1 and 5.2, all H ! appear to have identical MAIL$$ADD_ADDR always located at 000049D2 andD ! calling                  ADD_ADDR       always located at 000048FFK ! For VMS 5.0 comment out the following 6 lines and uncomment 6 lines above  !  !DEF !MAIL$$ADD_ADDR 	 !000049D2 	 !ADD_ADDR 	 !000048FF  !EXI ! O ! For V5.5-2, it looks like MAIL$$ADD_ADDR is at 000049DA, so modify the patch:  !  !DEF !MAIL$$ADD_ADDR 	 !000049DA 	 !ADD_ADDR 	 !00004907  !EXI ! 3 ! For V6.0 MAIL$$ADD_ADDR appears to be at 00004AE2 I !       David L. Cathey, Montagar Software Concepts (davidc@montagar.com)  !  DEF  MAIL$$ADD_ADDR 00004AE2 ADD_ADDR 00004A0F EXI  ! ) ! Now make sure that we have a patch area  ! 
 ALI/B PATAREA   ! And now enter instruction mode !  SE M I  EXI 2 !       Start implementing the ALTER_TO subroutine@ !       It was first developped and tested as a MACRO-32 program; !       and changed into the body of this patch.com file by B !       a MACRO_TO_PATCH.COM procedure developped for that purpose DEP /PAT PATAREA D        !;       ALTER_TO is called with the same 2 arguments used byK        !;       MAIL$$SEND_ADD_ADDR in calling MAIL$$ADD_ADDR and will call N        !;       ADD_ADDR itself with or without a rewrite. There is no rewriteM        !;       if SYS$FAO fails.  The original address is never modified and J        !;       will still appear unmodified in the "published" TO: field.	        !; N        !;       At this point when MAIL$$ADD_ADDR calls ALTER_TO, 4(AP) pointsN        !;       to a string descriptor which MAIL has already parsed to be oneN        !;       of a single recipient (we don't have to look for commas or forI        !;       an @ sign preceding a distribution list).  Because of the M        !;       location of this patch, floating/unquoted "!"s seem unlikely. 	        !; K        !;       The principle of this patch is to allow plain RFC addresses M        !;       to be acceptable by mail.  We never anticipated to fully deal K        !;       with the full RFC822 format but simply to lrt forms such as M        !;       user@site.org or user%machine@site.company.org with all atoms O        !;       being alphanumerics and the whole address void of double quotes 	        !; O        !;       At the same time STRAIGHTFORWARD phase IV DECnet mail addresses L        !;       are also allowed in an RFC822 like format: USERNAME@NODENAMEM        !;       is being transformed into NODENAME::USERNAME.  Note well that H        !;       the code will NOT transform any address with an "@" intoJ        !;       a more complex DECnet mail address such as AAA::BBB::USER.	        !; J        !;       The parsing is an adhoc scanning of the string looking forK        !;       no more than one "@", checking the absence of " and for the L        !;       A and B parts of A@B distinguish between A-Z,0-9,a-z,$,%,.,-P        !;       and other characters (in case MAIL's parser would any slip thru)	        !; .        !;       More exactly the algorithm is:	        !; M        !;       input string might look like A@B with A and B containing no " P        !;       if " or not A@B, pass the string to ADD_ADDR unchanged  ! Case 1K        !;       else if A or B has any character not in A-Z,0-9,a-z,$,%,.,- P        !;                       pass IN%"A@B"                           ! Case 2        !;            else P        !;                if B has no dots (pure DECnet) pass B::A       ! Case 3P        !;                else pass IN%"A@B"                             ! Case 2	        !; K        'alter_to: .word 7C                      ' ! ; entry mask save R2-R6 $        '        movq    @B^4(ap),r0'        '        movzwl  r0,r0'        '        clrl    r2' #        'cdblp1: cmpb    #^x22,(r1)'         '        beql    cdbcs1' $        '        cmpb    #^x40,(r1)+'        '        beql    cdbl1x' H        '        incl    r2                      ' ! ; length of A in A@B"        '        sobgtr  r0,cdblp1'$        'cdbcs1: movab   @B^4(ap),r2'I        '        jmp     cdbcom                  ' ! ; no changes - case 1 ?        'cdbl1x: decl    r0                      ' ! ; count "@" F        '        bleq    cdbcs1                  ' ! ; branch if at end        '        tstl    r2' L        '        beql    cdbcs1                  ' ! ; branch if @B with no AI        '        clrl    r3                      ' ! ; now parse after "@" #        'cdblp2: cmpb    #^x22,(r1)'         '        beql    cdbcs1' $        '        cmpb    #^x40,(r1)+'        '        beql    cdbcs1' H        '        incl    r3                      ' ! ; length of B in A@B"        '        sobgtr  r0,cdblp2'3        !; passed test 1 - we have A@B - Now check A $        '        movq    @B^4(ap),r0'@        !; allocate room on stack for 2 descriptors (for A and B)        '        pushl   r1'         '        pushl   r2' B        '        movl    sp,r5           ' ! ; r5 points to desc(A)        '        movl    r2,r0'        '        beql    cdbcs1'         '        jsb     cdbck1'         '        tstl    r0'         '        bneq    cdbcs2'         '        incl    r1'         '        pushl   r1'         '        pushl   r3' B        '        movl    sp,r6           ' ! ; r6 points to desc(B)        '        movl    r3,r0'        '        beql    cdbcs1'         '        jsb     cdbck1'         '        tstl    r0'         '        beql    cdbps2' O        !                                            ; build IN%"A@B" for case 2 -        !; use the stack this way for all $FAO B        !;               outlen          initial sp      <- r3 <-r2E        !;               ptr to outbuf   initial sp-264  <- r2 minus 8 K        !;               ......                          <- r2 to beg of ptr E        !;               outbuf          initial sp-4    <- r3 minus 4 =        !;               ......          initial sp-256  <- sp I        'cdbcs2: pushl   #22534121               ' ! ; ctrstr    #^A/!AS"/ I        '        pushl   #2225584D               ' ! ; ctrstr    #^A/MX%"/ I        '        pushl   sp                      ' ! ; make desc to ctrstr I        '        pushl   #8                      ' ! ; make desc to ctrstr O        '        movl    sp,r4                   ' ! ; address of desc to ctrstr D        '        subl    #4,sp                   ' ! ; adjusted stackK        '        movl    sp,r3                   ' ! ; save stack for outlen K        '        movl    sp,r2                   ' ! ; end of desc to outbuf ;        '        subl    #108,sp         ' ! ; end of outbuf 9        '        movl    sp,-(r2)        ' ! ; make outbuf 9        '        movzwl  #100,-(r2)      ' ! ; make outbuf L        '        pushl   B^4(AP)                 ' ! ; #4 P1 pass what we got?        '        pushl   r2                      ' ! ; #3 outbuf ?        '        pushl   r3                      ' ! ; #2 outlen ?        '        pushl   r4                      ' ! ; #1 ctrstr K        '        calls   #4,@#7FFEDF50           ' ! ; calls   #04,g^sys$fao !        '        blbs    r0,N102$'         '        jmp     cdberr' P        'N102$:  movw    (r3),(r2)               ' ! ; complete ptr to final text        '        jmp     cdbcom' $        'cdbps2: movq    @B^4(ap),r0'        '        addl    r2,r1'        '        incl    r1'         '        movl    r3,r0'        '        jsb     cdbck2'         '        tstl    r0' 5        '        bneq    cdbcs2                  ' ! ;         !K        !                                            ; build B::A for case 3 I        'cdbcs3: pushl   #5341213A               ' ! ; ctrstr    #^A/:!AS/ I        '        pushl   #3A534121               ' ! ; ctrstr    #^A/!AS:/ I        '        pushl   sp                      ' ! ; make desc to ctrstr I        '        pushl   #8                      ' ! ; make desc to ctrstr O        '        movl    sp,r4                   ' ! ; address of desc to ctrstr D        '        subl    #4,sp                   ' ! ; adjusted stackK        '        movl    sp,r3                   ' ! ; save stack for outlen K        '        movl    sp,r2                   ' ! ; end of desc to outbuf ;        '        subl    #108,sp         ' ! ; end of outbuf 9        '        movl    sp,-(r2)        ' ! ; make outbuf 9        '        movzwl  #100,-(r2)      ' ! ; make outbuf L        '        pushl   r5                      ' ! ; #5 Second sub string AL        '        pushl   r6                      ' ! ; #4 first  sub string B?        '        pushl   r2                      ' ! ; #3 outbuf ?        '        pushl   r3                      ' ! ; #2 outlen ?        '        pushl   r4                      ' ! ; #1 ctrstr K        '        calls   #5,@#7FFEDF50           ' ! ; calls   #05,g^sys$fao !        '        blbs    r0,N103$'         '        jmp     cdberr' P        'N103$:  movw    (r3),(r2)               ' ! ; complete ptr to final text        '        jmp     cdbcom' ?        !; check if all alpha numerical + .-_$% returns non zero #        'cdbck1: cmpb    #^x41,(r1)'          '        bgtr    cdbck11'#        '        cmpb    #^x5A,(r1)'          '        bgeq    cdbck19'#        'cdbck11: cmpb   #^x61,(r1)'          '        bgtr    cdbck12'#        '        cmpb    #^x7A,(r1)'          '        bgeq    cdbck19'#        'cdbck12: cmpb   #^x30,(r1)'          '        bgtr    cdbck13'#        '        cmpb    #^x39,(r1)'          '        bgeq    cdbck19'#        'cdbck13: cmpb   #^x24,(r1)'          '        beql    cdbck19'#        '        cmpb    #^x25,(r1)'e         '        beql    cdbck19'#        '        cmpb    #^x2D,(r1)'s         '        beql    cdbck19'#        '        cmpb    #^x2E,(r1)'          '        beql    cdbck19'#        '        cmpb    #^x5F,(r1)'S        '        rsb'        'cdbck19: incl   r1'a"        '        sobgtr  r0,cdbck1'        '        rsb'9        !; check if we have at least one dot (then r0 > 0)t#        'cdbck2: cmpb    #^x2E,(r1)'          '        bneq    cdbck29'        '        rsb'        'cdbck29: incl   r1'h"        '        sobgtr  r0,cdbck2'        '        rsb'	        !;aP        'cdberr: movab   @B^4(ap),r2     ' !; If SYS$FAO fails, use original addr*        'cdbcom: MOVQ    #^X00000001,-(SP)'&        '        movl    B^8(ap),-(sp)'        '        pushl   r2' '        '        CALLS   #04,L^ADD_ADDR' N        '        ret                     ' !; this is the only RET for ALTER_TO EXIr ! Above was the new code. ! Below is the patch in the existing code that( ! will make use of the ALTER_TO new code RE MAIL$$ADD_ADDR 'MOVQ    #^X00000001,-(SP)'n 'MOVQ    B^04(AP),-(SP)' 'CALLS   #04,W^ADD_ADDR' 'RET't EXIT 'MOVQ    B^04(AP),-(SP)' 'CALLS   #02,ALTER_TO' 'RET't EXIT@ ! And now update if we reached this point without a single error Ur; !---------------------- end of patch ----------------------  !  ! 9 !------------ Cut here for second section ---------------e !iI !                                                             17-May-1991c !iD !    I have sent the mail patch to over 10 people yesterday. I had aF !question from one of you which I thought would be of general interest
 !to everyone:h !XD !>Thanks for the patch. I've applied it and it seems to work nicely.@ !>The patch suggests that an address of the form: user@host will? !>be rewritten as "host::user" but I cannot seem to obtain this) !>behaviour. !:L !    The original patch did rewrite 'user@host' to 'host::user' but I didn'tC !like this so I made it rewrite 'user@host' to 'mx%"user@host"' (asaL !documented in the first line of the patch code).  I did this because I haveI !a homogeneous  VAXcluster without any other DECnet nodes to connect withfF !(my campus is mainly  UN*X with scattered VAX/VMS systems; the campusF !routers that connect the buildings on campus only allow TCP/IP to getI !through them, no DECnet -- sigh).  My Name Resolver (not MX) config fileoJ !appends ".purdue.edu" to the user-given address thereby creating a properK !Internet address which is then tested by the name resolver to see if it ise !valid.r !e@ !     Thus by not having the mail patch writing 'user@host' intoJ !'host::user',  my users can send to other Purdue sites (mainly UNIX) such? !as 'user@ecn' or  'user@psych'  without manually appending theXF !'.purdue.edu'. Mail within my VAXcluster is usually sent via InternetK !address 'user@aclcb' although people can say 'user' and  the mail will get D !send via local mail. For me, this presents an even easier method ofH !training people. Now all I have to tell them is "all address are in the+ !form 'user@host' at Purdue and in the form E !'user@host.sub-organization.organization.type' for people outside of H !Purdue" without confusing them with local (ACLCB) versus non-local (theL !rest of Purdue and the outside world) mail. The additional machine overheadC !of having most local mail go through Internet not a concern to me.b !mG !   In other words, the only DECnet traffic my mail system gets is when J !someone specifically mails to 'host::user' which no-one ever does becauseJ !all the machines share the same mail system. Therefore, I didn't need theM !original re-writing portion of the patch (called 'case 3' within the patch).t !hG !   To have the patch revert back to it's original behaviour of writing K !addresses of the form of 'user@host' into 'host::user', find the line that  !looks like: !! !o= !   '    beql  cdbcs2              ' ! ; RPW mod: always jumpo !u !sI !   Delete this line and then apply the patch to a fresh copy of MAILSHR.  !e !   The line that follows: !e> !   '    bneq  cdbcs2               ' ! ;   old statement here !cF !   Can be re-commented to say something like: "if not in in form A@B" !h !i !l= !------------------ Cut here for third section --------------M !yK !                                                               20-May-1991u ! I !   Sigh. Sending out a patch or program to the net always generates suchsK !interesting differences in the way computers around the world operate. The L !following is *not* a bug in the mail patch; rather it is a bug that resides !on some Unix machines.  !tH !   It turns out that a very few Unix machines are case-sensitive to theF !mail receipent's name. Pre-patch, the MX mailer would not convert theK !receipent's name into upper case; post-patch, the name is always convertedr> !into upper case when the MX%"..." form is not used. Examples: !e !e4 !   MX%"name@site"            <-- remains lower case4 !   MX%"NAME@SITE"            <-- remains upper case9 !   name@site                 <-- converted to upper casea4 !   NAME@SITE                 <-- remains upper case !a !rI !   Mail is *not* suppose to be case sensitive, so the Unix machines thatoK !are case sensitive are buggy. I don't know how many Unix machines are thiswL !way, but I suspect almost zero since I've never run across this bug before.K !As far as I can tell, there is no easy way to modify the patch to keep thetH !case because it is VMS, not the patch, that is converting everything toK !upper case. Dave Crawford (system@VAX.CSUN.EDU) was the person to discover & !this problem. He wrote the following: ! I !   > I talked to our local Unix guru, and he confirmed that mail systems H !   > aren't supposed to be case sensitive.  This is a notable exceptionL !   > to the case sensitivity usually found in Unix, and it was incorporatedI !   > for precisely the reason we are seeing here: many non-Unix machiness( !   > will put everything in upper case. !   >.I !   > He also said that we've had a lot of trouble with our AT&T 3B15 and I !   > its Wollongong TCP/IP package.  A lot of mail from elsewhere on the K !   > Internet gets bounced back because of the machine's case sensitivity. J !   > Rather than doing development work on it, he's going to try to solveL !   > the problem by making one of our Sun machines a mail front-end for it. !$K !   I should point out that I've mailed to AT&T 3b2s with Wollongong TCP/IP G !software without any problems, so evidently the bug is very limited. Ie' !don't have any 3b15s to do tests with.  !FL !   To repeat: this is not a bug in the mail patch, but rather a "gotcha" in4 !that the patch reveals a bug on some Unix machines. !5 ! 7 !------------------ end of third section --------------c