Please note... If you are not running LISTSERV 1.8a, the code I'm
posting should *not* be used. Instead, search the LSTSRV-L archives
for 1993 for the sample I previously posted.
As has been pointed out, the sample LSV$DNT exit I posted last year
needs some minor tweaking to work with LISTSERV 1.8a. So, if you are
using that code, please extract the following example and update the
copy your LISTSERV is using. If you have modified the sample to suit
your local needs, or have written your own, you might want to make sure
the code you are using can deal with the new DOMAIN NAMESUM records.
Again someone else has already posted a description of the change.
The records contain only a domain and a NJE nodename now.
-jj
---- Sample LSV$DNT EXEC for LISTSERV 1.8a follows:
/* ----------
* -- LSV$DNT:
*
* *** If you are running LISTSERV 1.7f or older *DO*NOT* install ***
* *** this exit! A sample exit suitable for pre-1.8a sites can ***
* *** be found in the LSTSRV-L archives. ***
*
* Sample LISTSERV exit (version 1.8a and later) to modify the table
* used to route "domain style" addresses. LISTSERV calls LSV$DNT
* after building a file called DOMAIN NAMESUM from the information
* in DOMAIN NAMES. This exit encorporates local additions into
* DOMAIN NAMESUM, if any are found in the "override file". The file
* file holding the local routes is defined in the 'override_file'
* variable. The default name is DOMAIN OVERRIDE for consistency
* with LMAIL. The entries in the file should look like exactly
* like the lines in DOMAIN NAMESUM, that is:
*
* .DOMAIN.NAME.HERE.EDU NJE-GATEWAY-NODE
*
* for example,
*
* .DECNET.JHU.EDU JHMAIL
*
* and they will be sorted properly by the exit routine. Blank lines
* and lines beginning with '*' are ignored. The only validity checking
* done is a simple check to make sure at least 2 blank delimited words
* are found on each line. So be careful, you can shoot yourself in the
* foot if you put garbage in the override file.
*
* This exit will also change all routes for INTERBIT so that all such
* traffic will be sent to whatever gateway is defined in the variable
* 'INTERBIT_gateway'. If you want INTERBIT traffic re-routed, set
* 'INTERBIT_substitute' to 1. If the default value for the default
* gateway isn't appropriate, your local-host is the default, then
* set the'INTERBIT_gateway' variable to the proper node. For example,
*
* INTERBIT_substitute = 1
* INTERBIT_gateway = 'JHUVM'
*
* would direct all INTERBIT traffic to JHUVM (using the information
* in BITEARN NODES for JHUVM to determine the mailer userid)
*
* The idea here is that you'll never need to change DOMAIN NAMES each
* month and can still customize the behavior of your LISTSERV with
* regard to the routing of "domain style" names.
*
* From: Jim Jones <[log in to unmask]> (3/16/93)
* -- modified 7/94 for use with LISTSERV 1.8a
*/
trace o
address command
INTERBIT_substitute = 0 /* 1 to re-route INTERBIT, 0 to leave alone */
INTERBIT_gateway = ''
override_file = "DOMAIN OVERRIDE A"
/* I don't think you'll have to change anything below this line */
INTERBIT_addr = 'INTERBIT'
Normal = 0
Err$ReadFailed = 101
Err$WriteFailed = 102
Err$RenameFailed = 103
Err$IdentFailed = 104
Err$BadSyntax = 105
Err$Unknown = 106
domain_file = "DOMAIN NAMESUM A"
work_file = "LSV$DNT CMSUT1 A"
sep = 'ff'x
prev_list = sep
say date() time() '-- Invoking local exit to modify "'domain_file'"'
/* If we're supposed to do re-routing, and no gateway was explicitly
* defined, then find the local host name and construct the default
*/
if INTERBIT_substitute & INTERBIT_gateway = '' then do
"MAKEBUF"
nbuf = rc
"IDENTIFY ( LIFO"
if rc ^= Normal then call err_exit Err$IdentFailed, rc
parse pull . 'AT' local_host .
"DROPBUF" nb
INTERBIT_gateway = local_host
say date() time() '-- Sending INTERBIT mail to node 'local_host'.'
end
"ESTATE" work_file
if rc = normal then "ERASE" work_file
call get_overrides
next_over = 1
"EXECIO * DISKR" domain_file "( FINIS STEM DTABLE."
if rc ^= Normal then call err_exit Err$ReadFailed, rc, domain_file
n_domain = DTABLE.0
do ii= 1 to n_domain
parse var DTABLE.ii domain host .
dlen = length( domain)
/* while the next line in DOMAIN NAMESUM is shorter than the current
* override entry, write out the override lines and save the domain
* names to avoid duplicates
*/
do while dlen <= sortlen.next_over
if sortlen.next_over = dlen then ,
prev_list = prev_list || word( sorted.next_over, 1) || sep
else prev_list = sep
"EXECIO 1 DISKW" work_file "( VAR SORTED."next_over
if rc ^= Normal then call err_exit Err$WriteFailed, rc, work_file
next_over = next_over + 1
end
/* If the line doesn't duplicate an override entry, we'll keep it */
if index( prev_list, sep || domain || sep) = 0 then do
/* We might have to change the line if it's an INTERBIT route */
if INTERBIT_substitute & host = INTERBIT_addr then ,
DTABLE.ii = domain INTERBIT_gateway
"EXECIO 1 DISKW" work_file "( VAR DTABLE."ii
if rc ^= Normal then call err_exit Err$WriteFailed, rc, work_file
end
end
/* If there's any override lines left, write them out */
do ii= next_over to n_over
"EXECIO 1 DISKW" work_file "( VAR SORTED."ii
if rc ^= Normal then call err_exit Err$WriteFailed, rc, work_file
end
"FINIS" work_file
"ERASE" domain_file
"RENAME" work_file domain_file
if rc ^= Normal then call err_exit Err$RenameFailed, rc
exit Normal
/* ------ */
get_overrides:
"ESTATE" override_file
if rc = normal then do
/* Read in the override file... */
"EXECIO * DISKR" override_file "( FINIS STEM ADDS."
if rc ^= Normal then call err_exit Err$ReadFailed, rc, override_file
len_ref. = ""
max_len = 0
min_len = 9999
n_over = ADDS.0
/* Group the entries together by the length of the domains */
do ii= 1 to n_over
parse var ADDS.ii domain node ignore
if left( ADDS.ii, 1) ^= '*' & ADDS.ii ^= ' ' then do
if node = '' then call err_exit Err$BadSyntax, ii, ADDS.ii
else do
if ignore ^= '' then say date() time() '**Warning** Line' ,
ii': Ignoring string "'ignore'".'
dlen = length( strip( domain))
len_ref.dlen = len_ref.dlen ii
if dlen > max_len then max_len = dlen
if dlen < min_len then min_len = dlen
end
end
end
/* Construct a sorted list, and save the domain lengths... */
n_over = 0
do ii= max_len to min_len by -1
next = len_ref.ii
do while next ^= ''
n_over = n_over + 1
parse var next rec next
sorted.n_over = ADDS.rec
sortlen.n_over = ii
end
end
drop ADDS. len_ref.
end
else n_over = 0
ii = n_over + 1
sortlen.ii = -1
return
/* ------ */
err_exit:
parse arg code, comm_err, info
select
when code = Err$ReadFailed then do
if info ^= '' then info = ', filename is "'info'"'
say '**Error('code')** Read failed with RC='comm_err || info'.'
end
when code = Err$WriteFailed then do
if info ^= '' then info = ', filename is "'info'"'
errmsg = 'Write failed with RC='comm_err || info'.'
end
when code = Err$RenameFailed then do
errmsg = 'Rename of work file failed, RC='comm_err'.'
end
when code = Err$IdentFailed then do
errmsg = 'IDENTIFY command failed, RC='comm_err'.'
end
when code = Err$BadSyntax then do
errmsg = 'Less than 2 args on line #'comm_err ,
'of "'override_file'"'
end
otherwise do
if info ^= '' then info = ', other info "'info'"'
errmsg = 'Unknown error type, RC='comm_err || info'.'
code = Err$Unknown
end
end
say date() time() '**Error('code')**' errmsg
exit code
|