How to patch MAILSHR


Background

The DECwindows interface, the regular DCL MAIL interface, and the callable mail interface, all insist on opening mail files RW. There is no option to open mail files readonly. So here we present how to patch a local version of the offending file, MAILSHR, and enable it for use by HYPERMAIL.FOR. The original inspiration for doing this was Hein van den Heuvel's post to comp.os.vms.

In general, patching O/S components is a risky endeavor, and we cannot take responsibility for anything that might go wrong if you follow the instructions below. We will also need to continue patching new versions of MAILSHR which might come out with O/S upgrades, until and unless Digital gives us the option of opening mailfiles readonly.

On the plus side, we suggest enabling this patched copy of MAILSHR only on the webserver's network processes. Therefore the risk to general operations is very minimal, and it's certainly preferable to giving the webserver elevated privileges including RW to other users' mail files!

We have received expert debugger and C programming help from Chris Chiesa, who has developed a program to patch MAILSHR for Alpha V6.2 systems. Chris specifically requests that the following disclaimer appear. "Although every effort has been made to make this software operate without error, it is not guaranteed. Use at your own risk." That goes for all the patch instructions on this page, too.

Any further help patching MAILSHR to open mailfiles readonly on different versions of VMS, particularly for the Alpha, is hereby solicited. Please send comments to the author, who heartily thanks you in advance.

The following directions allow you to patch the VAX version of MAILSHR for OpenVMS V6.0, V6.2, V7.0, and V7.1. We wish to emphasize that patch has been run successfully on those versions of the O/S, but only V6.2 has actually been employed by the author.

Get a local copy of MAILSHR

Copy MAILSHR to your local webserver account's system directory. This can be done by unprivileged users with a command of the form:

$ copy sys$library:mailshr.exe [webserver.system]

Now let's patch this file in place. Don't do this to your system's only copy! For VAX/VMS V6.0, 6.1, 6.2, 7.0, and 7.1 systems, run patch as follows:

	In the patch instructions below, substitute
	the following address values for "nnnn".

	VMS   Address
	_____________
	V6.0   5c0d
	V6.1   5ce1
	V6.2   5235
	V7.0   5c8d
	V7.1   607b

$ Patch/abs/nonew mailshr.exe

  PATCH  Version 6.2    5-MAY-1994

IMAGE FILE BEING PATCHED:       "DISK:[WEBSERVER.SYSTEM]MAILSHR.EXE;1"
JOURNAL FILE:                   "DISK:[WEBSERVER.SYSTEM]MAILSHR.JNL;1"
DATE/TIME OF PATCH:              7-APR-1997 05:50:29.03

%PATCH-I-NOGBL, some or all global symbols not accessible
%PATCH-I-NOLCL, image does not contain local symbols

PATCH>ex/inst nnnn
0000nnnn:  MOVW    #0F1F,B^16(R6)
PATCH>repl/inst .
OLD>  'movw #0F1F,B^16(R6)'
OLD>  exit
NEW>  'movw #0F02,B^16(R6)'
NEW>  exit
old:    0000nnnn:  MOVW    #0F1F,B^16(R6)
new:    0000nnnn:  MOVW    #0F02,B^16(R6)
PATCH>update
%PATCH-I-WRTFIL, updating image file DISK:[WEBSERVER.SYSTEM]MAILSHR.EXE;1
PATCH>exit

And that's all there is to it. The above instructions were modified from Hein van den Heuvel's post, with a new init word corresponding to his later suggestion in private email. What we've done is swapped the 0F1F (for DEL, GET, PUT, UPD, TRN) which is the init word for the FAB in MAILSHR, and replaced it with the new init word 0F02 that will open mail files FAC=GET, SHR=PUT,GET.

Obviously, if you don't see the above old instruction in your copy of MAILSHR, then don't bother patching what is there, since it's a copy of MAILSHR from the wrong version of VMS.

The author has tried these instructions, and can attest to the fact that the Patch commands work OK on the above VMS versions, and that the patched MAILSHR works as advertised on VMS V6.2 and VMS V7.1.

Enable patched MAILSHR for use by Hypermail

Hypermail is designed to be called by WWWEXEC.COM, the DECnet task object which starts up when the OSU DECthreads webserver activates a script. Since we don't want to disable the webserver account's normal (interactive) email use, it's best to add a logical definition to LOGIN.COM that applies only to network processes. Add DCL commands to LOGIN.COM that include the following logical definition:

$ goto 'f$mode()'
$Interactive:
$ Exit
$Batch:
$ Exit
$Network:
$ Define mailshr DISK:[WEBSERVER.SYSTEM]mailshr
$ Exit
$Other:
$ Exit

and stop any surviving SERVER_nnnn network processes so that the webserver starts it again. This will cause the new SERVER_nnn to read LOGIN.COM and thus Hypermail to use our patched copy of MAILSHR.


Last updated May 13, 1997,
Jonathan Boswell, jsb@NewTrumpet.org