[0001]
[0002]
[0003]
[0004]
[0005]
[0006]
[0007]
[0008]
[0009]
[0010]
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047]
[0048]
[0049]
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061]
[0062]
[0063]
[0064]
[0065]
[0066]
[0067]
[0068]
[0069]
[0070]
[0071]
[0072]
[0073]
[0074]
[0075]
[0076]
[0077]
[0078]
[0079]
[0080]
[0081]
[0082]
[0083]
[0084]
[0085]
[0086]
[0087]
[0088]
[0089]
[0090]
[0091]
[0092]
[0093]
[0094]
[0095]
[0096]
[0097]
[0098]
[0099]
[0100]
[0101]
[0102]
[0103]
[0104]
[0105]
[0106]
[0107]
[0108]
[0109]
[0110]
[0111]
[0112]
[0113]
[0114]
[0115]
[0116]
[0117]
[0118]
[0119]
[0120]
[0121]
[0122]
[0123]
[0124]
[0125]
[0126]
[0127]
[0128]
[0129]
[0130]
[0131]
[0132]
[0133]
[0134]
[0135]
[0136]
[0137]
[0138]
[0139]
[0140]
[0141]
[0142]
[0143]
[0144]
[0145]
[0146]
[0147]
[0148]
[0149]
[0150]
[0151]
[0152]
[0153]
[0154]
[0155]
[0156]
[0157]
[0158]
[0159]
[0160]
[0161]
[0162]
[0163]
[0164]
[0165]
[0166]
[0167]
[0168]
[0169]
[0170]
[0171]
[0172]
[0173]
[0174]
[0175]
[0176]
[0177]
[0178]
[0179]
[0180]
[0181]
[0182]
[0183]
[0184]
[0185]
[0186]
[0187]
[0188]
[0189]
[0190]
[0191]
[0192]
[0193]
[0194]
[0195]
[0196]
[0197]
[0198]
[0199]
[0200]
[0201]
[0202]
[0203]
[0204]
[0205]
[0206]
[0207]
[0208]
[0209]
[0210]
[0211]
[0212]
[0213]
[0214]
[0215]
[0216]
[0217]
[0218]
[0219]
[0220]
[0221]
[0222]
[0223]
[0224]
[0225]
[0226]
[0227]
[0228]
[0229]
[0230]
[0231]
[0232]
[0233]
[0234]
[0235]
[0236]
[0237]
[0238]
[0239]
[0240]
[0241]
[0242]
[0243]
[0244]
[0245]
[0246]
[0247]
[0248]
[0249]
[0250]
[0251]
[0252]
[0253]
[0254]
[0255]
[0256]
[0257]
[0258]
[0259]
[0260]
[0261]
[0262]
[0263]
[0264]
[0265]
[0266]
[0267]
[0268]
[0269]
[0270]
[0271]
[0272]
[0273]
[0274]
[0275]
[0276]
[0277]
[0278]
[0279]
[0280]
[0281]
[0282]
[0283]
[0284]
[0285]
[0286]
[0287]
[0288]
[0289]
[0290]
[0291]
[0292]
[0293]
[0294]
[0295]
[0296]
[0297]
[0298]
[0299]
[0300]
[0301]
[0302]
[0303]
[0304]
[0305]
[0306]
[0307]
[0308]
[0309]
[0310]
[0311]
[0312]
[0313]
[0314]
[0315]
[0316]
[0317]
[0318]
[0319]
[0320]
[0321]
[0322]
[0323]
[0324]
[0325]
[0326]
[0327]
[0328]
[0329]
[0330]
[0331]
[0332]
[0333]
[0334]
[0335]
[0336]
[0337]
[0338]
[0339]
[0340]
[0341]
[0342]
[0343]
[0344]
[0345]
[0346]
[0347]
[0348]
[0349]
[0350]
[0351]
[0352]
[0353]
[0354]
[0355]
[0356]
[0357]
[0358]
[0359]
[0360]
[0361]
[0362]
[0363]
[0364]
[0365]
[0366]
[0367]
[0368]
[0369]
[0370]
[0371]
[0372]
[0373]
[0374]
[0375]
[0376]
[0377]
[0378]
[0379]
[0380]
[0381]
[0382]
[0383]
[0384]
[0385]
[0386]
[0387]
[0388]
[0389]
[0390]
[0391]
[0392]
[0393]
[0394]
[0395]
[0396]
[0397]
[0398]
[0399]
[0400]
[0401]
[0402]
[0403]
[0404]
[0405]
[0406]
[0407]
[0408]
[0409]
[0410]
[0411]
[0412]
[0413]
[0414]
[0415]
[0416]
[0417]
[0418]
[0419]
[0420]
[0421]
[0422]
[0423]
[0424]
[0425]
[0426]
[0427]
[0428]
[0429]
[0430]
[0431]
[0432]
[0433]
[0434]
[0435]
[0436]
[0437]
[0438]
[0439]
[0440]
[0441]
[0442]
[0443]
[0444]
[0445]
[0446]
[0447]
[0448]
[0449]
[0450]
[0451]
[0452]
[0453]
[0454]
[0455]
[0456]
[0457]
[0458]
[0459]
[0460]
[0461]
[0462]
[0463]
[0464]
[0465]
[0466]
[0467]
[0468]
[0469]
[0470]
[0471]
[0472]
[0473]
[0474]
[0475]
[0476]
[0477]
[0478]
[0479]
[0480]
[0481]
[0482]
[0483]
[0484]
[0485]
[0486]
[0487]
[0488]
[0489]
[0490]
[0491]
[0492]
[0493]
[0494]
[0495]
[0496]
[0497]
[0498]
[0499]
[0500]
[0501]
[0502]
[0503]
[0504]
[0505]
[0506]
[0507]
[0508]
[0509]
[0510]
[0511]
[0512]
[0513]
[0514]
[0515]
[0516]
[0517]
[0518]
[0519]
[0520]
[0521]
[0522]
[0523]
[0524]
[0525]
[0526]
[0527]
[0528]
[0529]
[0530]
[0531]
[0532]
[0533]
[0534]
[0535]
[0536]
[0537]
[0538]
[0539]
[0540]
[0541]
[0542]
[0543]
[0544]
[0545]
[0546]
[0547]
[0548]
[0549]
[0550]
[0551]
[0552]
[0553]
[0554]
[0555]
[0556]
[0557]
[0558]
[0559]
[0560]
[0561]
[0562]
[0563]
[0564]
[0565]
[0566]
[0567]
[0568]
[0569]
[0570]
[0571]
[0572]
[0573]
[0574]
[0575]
[0576]
[0577]
[0578]
[0579]
[0580]
[0581]
[0582]
[0583]
[0584]
[0585]
[0586]
[0587]
[0588]
[0589]
[0590]
[0591]
[0592]
[0593]
[0594]
[0595]
[0596]
[0597]
[0598]
[0599]
[0600]
[0601]
[0602]
[0603]
[0604]
[0605]
[0606]
[0607]
[0608]
[0609]
[0610]
[0611]
$!-----------------------------------------------------------------------------
$! STARTUP.COM
$!
$! Example WASD HTTPd server startup procedure.
$! This does most of what is needed for the average installation.
$! Using startup symbols (see below) this procedure should not need to be
$! modified.  The objective of course is to make future upgrades as simple
$! as possible with minimum hard-wiring changes.
$!
$! DO NOT MODIFY THIS PROCEDURE!
$! *****************************
$!
$! Startup options are provided by either by supplying symbol values on the
$! command-line or by explicitly assigning the symbols before calling this
$! procedure.  Reasonable defaults apply if these symbols do not exist.
$!
$!   WASD_ACCOUNT ..... account server runs under (default is HTTP$SERVER)
$!   WASD_BATCH_LOG ... if true log the batch job (for problem resolution)
$!   WASD_BATCH_QUEUE ... startup batch queue (default is SYS$BATCH)
$!   WASD_CACHE_ROOT .. location for defining the WASD_CACHE_ROOT logical
$!   WASD_CONFIG ...... location of WASD config files (can be a search list)
$!   WASD_DECNET ...... if true DECnet scripting should be started
$!   WASD_ENV ......... integer sets autonomous WASD environment
$!   WASD_HT_ROOT ..... explicit location for the HT_ROOT logical (deprecated)
$!   WASD_HT_CACHE_ROOT ... location for HT_ROOT_CACHE logical (deprecated)
$!   WASD_HTTPD_GMT ... if not using SYS$TIMEZONE_DIFFERENTIAL (e.g. "+09:30")
$!   WASD_HTTPD_LOG ... if supplied defines a corresponding HTTPD$LOG logical
$!   WASD_NETWORK ..... run server (including detached scripts) in network mode
$!   WASD_NO_SERVER ... do NOT start the server image
$!   WASD_NON_SSL ..... if true the non-SSL image should be used 
$!   WASD_OSSL ........ if true use the SSL image and OpenSSL (OSSL$) images 
$!   WASD_SSL ......... if true the SSL image should be used 
$!   WASD_SSL_CAFILE ... file location for client certificate CA verification
$!   WASD_SSL_CERT .... file location for the server certificate
$!   WASD_STARTUP ..... parameters/qualifiers applied to the server image
$!   WASD_TABLE ....... by default use WASD_TABLE, otherwise WASD_TABLE=0
$!   WASD_VMS_SSL ..... if true use the SSL image and VMS OpenSSL libraries 
$!   WASD_WASD_ROOT ... explicit location for defining the WASD_ROOT logical
$!
$! As in the following examples:
$!
$!   $! command-line example
$!   $ @DKA0:[WASD_ROOT.LOCAL]STARTUP WASD_DECNET=1 WASD_SSL=1 -
$!   WASD_SSL_CERT="WASD_ROOT:[LOCAL]SITE.PEM"
$!
$!   $! symbol assignment example
$!   $ WASD_DECNET = 1
$!   $ WASD_SSL = 1
$!   $ WASD_SSL_CERT = "WASD_ROOT:[LOCAL]SITE.PEM"
$!   $ @DKA0:[WASD_ROOT.LOCAL]STARTUP
$!
$!   $! specifying an alternate batch queue
$!   $ @DKA0:[WASD_ROOT.LOCAL]STARTUP WASD_DECNET=1 WASD_BATCH_QUEUE="THISONE" 
$!
$! If an SSL image is available that is used unless explicitly set.
$! Detects VMS V7.n and uses SYS$TIMEZONE_DIFFERENTIAL for GMT unless set.
$! By default WASD_ROOT logical is generated from location of this procedure.
$!
$! If the procedure STARTUP_LOCAL.COM exists in the same directory as this
$! procedure then it is executed after all this procedure's setup and
$! immediately before the server is actually started.  Local setup can be
$! customized in that procedure leaving this one completely untouched.
$! For instance, the local startup should be used for defining local logicals,
$! installing local scripts, etc.
$!
$! Server process startup is provided via STARTUP_SERVER.COM,
$! STARTUP_SERVER_nodename.COM, STARTUP_SERVER_nodename_port.COM,
$! see STARTUP_SERVER.COM and the Technical Overview for details.
$!
$! Copyright (C) 1996-2021 Mark G.Daniel.
$!
$! Licensed under the Apache License, Version 2.0 (the "License");
$! you may not use this file except in compliance with the License.
$! You may obtain a copy of the License at
$!
$!    http://www.apache.org/licenses/LICENSE-2.0
$!
$! Unless required by applicable law or agreed to in writing, software
$! distributed under the License is distributed on an "AS IS" BASIS,
$! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
$! See the License for the specific language governing permissions and
$! limitations under the License.
$!
$! VERSION HISTORY
$! ---------------
$! 12-SEP-2021  MGD  X86 support, VAX obsolete
$!                   OPER required for v12.0
$! 15-AUG-2020  MGD  remove default WASD_SSL_CERT as "WASD_CONFIG:HTTPD.PEM"
$! 22-JUL-2019  MGD  ensure VAX SYS$SHARE:CMA$RTL.EXE is INSTALLed
$! 16-NOV-2017  MGD  WASD_NO_SERVER=[0|1] do not execute the server image
$!                   define WASD_ROOT_<env> logical name as required
$! 21-JUN-2017  MGD  use /INSTANCE=CONFIG to ensure startup use config values
$! 07-AUG-2016  MGD  allow use of OpenSSL v1.1.0 (OSSL$..) shareable libraries
$!                     with WASD_OSSL startup option symbol
$! 15-SEP-2013  MGD  privilege set and check
$! 31-AUG-2013  MGD  ensure GNV$LIBZSHR32 is INSTALLed
$! 10-JUN-2011  MGD  proc_dir = f$edit(,"upcase") for extended parsing (per EW)
$! 15-DEC-2009  MGD  bugfix; f$search("WASD_CONFIG:HTTPD$SERVICE.CONF")
$! 10-OCT-2009  MGD  SECURITY privilege required for v10 VMS/SYSUAF ACME
$! 11-JUL-2009  MGD  v10 and pre-v10 logical names
$!                   WASD autonomous environments
$! 06-JUN-2007  MGD  bugfix; CREATE /DIR /OWN='WASD_ACCOUNT' (mg eds.com)
$! 05-JUL-2006  MGD  bugfix; 'if WASD_STARTUP' to 'if WASD_STARTUP .nes. ""'
$! 05-FEB-2006  MGD  change procedure message to "%WASD-.."
$! 22-DEC-2004  MGD  modify handling of WASD_VMS_VERSION (system logical name)
$! 27-NOV-2004  MGD  install LIBZ sharable image if necessary,
$!                   check for the sharable image and define WASD_CGILIBSHR32
$!                   WASD_STARTUP symbol for defining HTTPD$STARTUP_SERVER
$! 22-DEC-2003  MGD  support for IA64,
$!                   CMKRNL required for v8.4,
$!                   WASD_NETWORK to run server (and scripts) in network mode
$! 30-DEC-2002  MGD  bugfix; batch startup endless loop
$! 15-OCT-2002  MGD  WASD 8.1 and later detects it's own startup procedure,
$!                   new logicals and revised locations for post-8.1
$! 10-AUG-2002  MGD  allow for using VMS OpenSSL v1.0-A
$! 03-NOV-2001  MGD  PERSONA_MACRO for pre-VMS 6.2 VAX
$! 13-JUL-2001  MGD  define SSL_CAFILE only if it exists
$! 12-MAY-2001  MGD  install PRMGBL,SYSGBL,SHMEM for monitor global section,
$!                   add wildcards to F$SEARCH to prevent "run-aways"
$! 26-JAN-2001  MGD  v7.2, add WASD_SSL_CAFILE and HTTPD$SSL_CAFILE
$! 07-DEC-2000  MGD  add HT_SCRATCH
$! 01-JUL-2000  MGD  v7.1, add WORLD,SYSLCK privileges,
$!                         CGI-BIN changed to "CGI-BIN" for VMS V5.5-2,
$!                         conditional definition of HTTP$SERVICE logical,
$!                         WASD_BATCH_QUEUE allows non-default SYS$BATCH,
$!                         allow for a STARTUP_SERVER_LOCAL.COM
$! 31-OCT-1999  MGD  v6.1, remove NETLIB support
$! 15-JAN-1999  MGD  v6.0, proxy cache directory
$! 04-DEC-1998  MGD  bugfix; to above commentary, provide WASD_HTTPD_LOG
$! 01-NOV-1998  MGD  v5.3, (better support for virtual services)
$! 27-JUN-1998  MGD  v5.1
$! 07-FEB-1998  MGD  v5.0
$! ??-???-????  MGD  long unrecorded pre-history :^)
$!-----------------------------------------------------------------------------
$!
$ set on
$ say = "write sys$output"
$ procedure = f$environment("procedure")
$ proc_device = f$parse(procedure,,,"device","no_conceal")
$ proc_dir = f$edit(f$parse(procedure,,,"directory","no_conceal"),"upcase")
$ arch_name = f$getsyi("arch_name")
$ if f$edit(arch_name,"upcase") .eqs. "ALPHA" then arch_name = "AXP"
$ vms_version = f$integer(f$extract(1,1,f$getsyi("version"))) * 10 +-
                f$integer(f$extract(3,1,f$getsyi("version")))
$!
$ required_privs = "CMKRNL,DETACH,SYSNAM,SYSPRV"
$ orig_privs = f$setprv(required_privs)
$ if .not. f$privilege(required_privs)
$ then
$     discard = f$setprv(orig_privs)
$     write sys$output "%WASD-E-STARTUP, requires ''required_privs' privileges"
$     exit %X00000024
$ endif
$!
$!
$ say "%WASD-I-STARTUP, begin"
$!
$! ---------------
$! STARTUP SYMBOLS
$! ---------------
$!
$ on warning then exit
$ if P1 .nes. "" then 'P1'
$ if P2 .nes. "" then 'P2'
$ if P3 .nes. "" then 'P3'
$ if P4 .nes. "" then 'P4'
$ if P5 .nes. "" then 'P5'
$ if P6 .nes. "" then 'P6'
$ if P7 .nes. "" then 'P7'
$ if P8 .nes. "" then 'P8'
$ on warning then continue
$!
$!(careful to evaluate these in the specific order)
$ if f$type(wasd_wasd_root) .eqs. "" then wasd_wasd_root = ""
$ if wasd_wasd_root .eqs. "" then -
     if f$type(wasd_ht_root) .eqs. "" then -
        wasd_wasd_root = ""
$!
$!(careful to evaluate these in the specific order)
$ if f$type(wasd_cache_root) .eqs. "" then wasd_cache_root = ""
$ if wasd_cache_root .eqs. "" then -
     if f$type(wasd_ht_cache_root) .eqs. "" then -
        wasd_cache_root = ""
$!
$ if f$type(wasd_account) .eqs. "" then wasd_account = "HTTP$SERVER"
$ if f$type(wasd_batch_queue) .eqs. "" then wasd_batch_queue = "SYS$BATCH"
$ if f$type(wasd_batch_log) .eqs. "" then wasd_batch_log = 0
$ if f$type(wasd_config) .eqs. "" then wasd_config = "WASD_ROOT:[LOCAL]"
$ if f$type(wasd_decnet) .eqs. "" then wasd_decnet = 0
$ if f$type(wasd_env) .eqs. "" then wasd_env = 1
$ if f$type(wasd_env) .eqs. "STRING" then wasd_env = 1
$ if f$type(wasd_httpd_gmt) .eqs. "" then wasd_httpd_gmt = ""
$ if f$type(wasd_table) .eqs. "" then wasd_table = 1
$ if f$type(wasd_table) .eqs. "STRING" then wasd_table = 1
$ if f$type(wasd_network) .eqs. "" then wasd_network = 0
$ if f$type(wasd_non_ssl) .eqs. "" then wasd_non_ssl = 0
$ if f$type(wasd_no_server) .eqs. "" then wasd_no_server = 0
$ if f$type(wasd_ssl) .eqs. "" then wasd_ssl = 0
$ if f$type(wasd_ssl_cafile) .eqs. "" then -
     wasd_ssl_cafile = "WASD_CONFIG:CA-BUNDLE_CRT.TXT"
$ if f$type(wasd_startup) .eqs. "" then wasd_startup = ""
$ if f$type(wasd_ossl) .eqs. "" then wasd_ossl = 0
$ if f$type(wasd_vms_ssl) .eqs. "" then wasd_vms_ssl = 0
$!
$!(specify this using a $ DEFINE /SYSTEM WASD_VMS_VERSION "Vn.n")
$ wasd_vms_version = f$trnlnm("wasd_vms_version")
$ if wasd_vms_version .nes. "" -
     then vms_version = f$integer(f$extract(1,1,wasd_vms_version)) * 10 +-
                        f$integer(f$extract(3,1,wasd_vms_version))
$ delete /symbol wasd_vms_version
$!
$! ---------
$! WASD ENV?
$! ---------
$!
$ if wasd_env .gt. 15
$ then
$    write sys$output "%WASD-E-STARTUP, environment out-of-range"
$    discard = f$setprv(orig_privs)
$    exit %X10000014
$ endif
$!
$! ---------
$! WASD ROOT
$! ---------
$!
$ if wasd_wasd_root .eqs. ""
$ then
$!   (derive from location of procedure)
$    root_dir = f$extract(f$locate("HT_ROOT",proc_dir),999,proc_dir)
$    if root_dir .eqs. "" then -
        root_dir = f$extract(f$locate("WASD_ROOT",proc_dir),999,proc_dir)
$    if root_dir .eqs. ""
$    then
$       write sys$output "%WASD-E-STARTUP, must be WASD_ROOT.DIR or HT_ROOT.DIR"
$       discard = f$setprv(orig_privs)
$       exit %X10000014
$    endif
$    root_dir = f$extract(f$locate(".",root_dir),999,root_dir)
$    root_dir = proc_dir - root_dir
$    wasd_root = proc_device + root_dir + ".]"
$ else
$    wasd_root = wasd_wasd_root
$ endif
$!
$! ----------------
$! WASD NAME TABLE?
$! ----------------
$!
$ if wasd_table .ge. 1 .or. wasd_env .ge. 2 
$ then
$    if wasd_env .ge. 2
$    then
$       wasd_table = "WASD_TABLE_" + f$string(wasd_env)
$       wasd_file_dev = "WASD_FILE_DEV_" + f$string(wasd_env)
$    else
$       wasd_table = "WASD_TABLE"
$       wasd_file_dev = "WASD_FILE_DEV"
$    endif
$    create /name_table /executive /log -
            /protection=(S:RWCD,O:RWCD,G:R,W:R) -
            /parent=LNM$SYSTEM_DIRECTORY 'wasd_table'
$!   (root directory is the only location with universal read access!)
$    env_root = wasd_root - ".]" + "]"
$    define /system /executive 'wasd_file_dev' 'env_root'WASD_FILE_DEV.COM
$!   (insert the new table into the default process table)
$    if wasd_env .ge. 2
$       then @'wasd_file_dev' 'wasd_env'
$       else @'wasd_file_dev'
$    endif
$ else
$    wasd_table = "LNM$SYSTEM"
$ endif
$ deflognam = "define /nolog /executive /table=" + wasd_table
$!
$! ---------------------
$! DEFINE HTTPd LOGICALS
$! ---------------------
$!
$ if wasd_env .ge. 2
$ then
$    deflognam /trans=concealed wasd_root 'wasd_root'
$    define /system /executive /trans=concealed wasd_root_'wasd_env' 'wasd_root'
$ else
     define /system /executive /trans=concealed wasd_root 'wasd_root'
$ endif
$ if f$search("WASD_ROOT:[STARTUP]STARTUP.COM") .eqs. ""
$ then
$    say "%WASD-E-STARTUP, problem with WASD_ROOT logical"
$    show logical /full wasd_root
$    discard = f$setprv(orig_privs)
$    exit %X10000014
$ endif
$!(though deprecated, provide HT_ROOT for backward-compability)
$ if wasd_env .ge. 2
$    then deflognam /trans=concealed ht_root 'wasd_root'
$    else define /system /executive /trans=concealed ht_root 'wasd_root'
$ endif
$!
$ if wasd_cache_root .nes. ""
$ then
$    deflognam /translation=concealed wasd_cache_root 'wasd_cache_root'
$!   (though deprecated, provide HT_CACHE_ROOT for backward-compability)
$    deflognam /translation=concealed ht_cache_root 'wasd_cache_root'
$    dir /nooutput WASD_CACHE_ROOT:[000000]
$    if .not. $status .and. $status .ne. %x10018290
$    then
$       create_wasd_cache_root = wasd_cache_root - ".]" + "]"
$       say "%WASD-I-STARTUP, creating proxy cache directory " +-
            create_wasd_cache_root
$       create /dir /own='wasd_account' /prot=(s:rwed,o:rwed,g:rwed,w) -
               'create_wasd_cache_root'
$       dir /nooutput WASD_CACHE_ROOT:[000000]
$       if .not. $status .and. $status .ne. %x10018290
$       then
$          say "%WASD-E-STARTUP, problem with WASD_CACHE_ROOT logical"
$          show logical /full wasd_cache_root
$          discard = f$setprv(orig_privs)
$          exit %X10000014
$       endif
$    endif
$    set on
$ endif
$!
$ if wasd_env .ge. 2 then deflognam WASD_ENV 'wasd_env'
$!
$ deflognam WASD_CONFIG 'wasd_config'
$ if f$search("WASD_CONFIG:WASD_CONFIG_AUTH.CONF") .nes. ""
$    then deflognam WASD_CONFIG_AUTH WASD_CONFIG:WASD_CONFIG_AUTH.CONF
$    else deflognam WASD_CONFIG_AUTH WASD_CONFIG:HTTPD$AUTH.CONF
$ endif
$ if f$search("WASD_CONFIG:WASD_CONFIG_GLOBAL.CONF") .nes. ""
$    then deflognam WASD_CONFIG_GLOBAL WASD_CONFIG:WASD_CONFIG_GLOBAL.CONF
$    else deflognam WASD_CONFIG_GLOBAL WASD_CONFIG:HTTPD$CONFIG.CONF
$ endif
$ if f$search("WASD_CONFIG:WASD_CONFIG_MAP.CONF") .nes. ""
$    then deflognam WASD_CONFIG_MAP WASD_CONFIG:WASD_CONFIG_MAP.CONF
$    else deflognam WASD_CONFIG_MAP WASD_CONFIG:HTTPD$MAP.CONF
$ endif
$ if f$search("WASD_CONFIG:WASD_CONFIG_MSG.CONF") .nes. ""
$    then deflognam WASD_CONFIG_MSG WASD_CONFIG:WASD_CONFIG_MSG.CONF
$    else deflognam WASD_CONFIG_MSG WASD_CONFIG:HTTPD$MSG.CONF
$ endif
$!(service is slightly different in that traditionally its been optional)
$ if f$search("WASD_CONFIG:WASD_CONFIG_SERVICE.CONF") .nes. ""
$ then
$    deflognam WASD_CONFIG_SERVICE WASD_CONFIG:WASD_CONFIG_SERVICE.CONF
$ else
$    if f$search("WASD_CONFIG:HTTPD$SERVICE.CONF") .nes. "" -
        then deflognam WASD_CONFIG_SERVICE WASD_CONFIG:HTTPD$SERVICE.CONF
$ endif
$ if f$type(wasd_httpd_log) .nes. "" then -
     deflognam WASD_CONFIG_LOG 'wasd_httpd_log'
$!
$ deflognam WASD_AUTH WASD_ROOT:[LOCAL]
$ deflognam WASD_LOCAL WASD_ROOT:[LOCAL]
$ deflognam WASD_LOGS WASD_ROOT:[LOG]
$!(though deprecated, provide HT_LOGS for backward-compability)
$ deflognam HT_LOGS WASD_ROOT:[LOG]
$ deflognam WASD_SCRATCH WASD_ROOT:[SCRATCH]
$!(though deprecated, provide HT_SCRATCH for backward-compability)
$ deflognam HT_SCRATCH WASD_ROOT:[SCRATCH]
$ deflognam WASD_SERVER_LOGS WASD_ROOT:[LOG_SERVER]
$ deflognam WASD_STARTUP WASD_ROOT:[STARTUP]
$!
$ deflognam WASD_AXP WASD_ROOT:[AXP]
$ deflognam WASD_IA64 WASD_ROOT:[IA64]
$ deflognam WASD_X86 WASD_ROOT:[X86_64]
$ deflognam WASD_EXE WASD_ROOT:['arch_name']
$!(for local startup use)
$ define/process WASD_EXE WASD_ROOT:['arch_name']
$!(though deprecated, provide HT_EXE for backward-compability)
$ deflognam HT_EXE WASD_ROOT:['arch_name']
$!
$ deflognam CGI_BIN WASD_ROOT:[CGI-BIN]
$ deflognam CGI_EXE WASD_ROOT:['ARCH_NAME'-BIN]
$ deflognam WASD_CGI_BIN WASD_ROOT:[CGI-BIN]
$ deflognam WASD_CGI_AXP WASD_ROOT:[AXP-BIN]
$ deflognam WASD_CGI_IA64 WASD_ROOT:[IA64-BIN]
$ deflognam WASD_CGI_X86 WASD_ROOT:[X86_64-BIN]
$ deflognam WASD_CGI_EXE WASD_ROOT:['arch_name'-BIN]
$ cgi_bin = wasd_root - ".]" + ".CGI-BIN.]"
$ cgi_exe = wasd_root - ".]" + ".''arch_name'-BIN.]"
$ deflognam /translation=concealed "CGI-BIN" 'cgi_bin','cgi_exe'
$!
$ deflognam wasd_script WASD_ROOT:[SCRIPT]
$ script_local_root = wasd_root - ".]" + ".SCRIPT_LOCAL.]"
$ deflognam WASD_SCRIPT_LOCAL WASD_ROOT:[SCRIPT_LOCAL]
$ java_root = wasd_root - ".]" + ".JAVA.]"
$ deflognam WASD_JAVA WASD_ROOT:[JAVA]
$!
$ if wasd_httpd_gmt .eqs. ""
$ then
$    if vms_version .lt. 70
$    then
$       say "%WASD-E-STARTUP, unreliable UTC time (set WASD_HTTPD_GMT symbol)"
$       discard = f$setprv(orig_privs)
$       exit %X10000014
$    endif
$ else
$    deflognam WASD_CONFIG_GMT "''wasd_httpd_gmt'"
$ endif
$!
$ if wasd_network
$   then slash_network = "/network"
$   else slash_network = ""
$ endif
$!
$! --------------------
$! DECNET/OSU SCRIPTING
$! --------------------
$!
$ if wasd_decnet
$ then
$!
$    say "%WASD-I-STARTUP, providing DECnet/OSU scripting"
$!
$!   (derive from the location of this procedure)
$    startup_decnet = proc_device + proc_dir + "STARTUP_DECNET.COM"
$    @'startup_decnet' 'wasd_env'
$!
$ endif
$!
$! ------------------------
$! INSTALL PRIVILEGED IMAGE
$! ------------------------
$!
$ if wasd_vms_ssl then wasd_ssl = 1
$ if wasd_non_ssl then wasd_ssl = 0
$ if .not. wasd_ssl .and. .not. wasd_non_ssl
$ then
$    if f$search("WASD_EXE:HTTPD_SSL.EXE") .eqs. ""
$       then wasd_ssl = 0
$       else wasd_ssl = 1
$    endif
$ endif
$ if wasd_ssl
$    then say "%WASD-I-STARTUP, using SSL image"
$    else say "%WASD-I-STARTUP, using non-SSL image"
$ endif
$ if wasd_vms_ssl then -
     say "%WASD-I-VMSOPENSSL, using VMS OpenSSL shareable images"
$!
$ httpd_exe = "WASD_EXE:HTTPD"
$ if wasd_ssl then httpd_exe = httpd_exe + "_SSL"
$ httpd_exe = httpd_exe + ".EXE"
$ httpd = "$''httpd_exe'"
$!
$ sechan = "$WASD_EXE:SECHAN"
$ sechan /asif=startup 'httpd_exe'
$!
$ install = "$SYS$SYSTEM:INSTALL/COMMAND_MODE"
$ instprv = "ALTPRI,CMKRNL,DETACH,OPER,PRMGBL,PRMMBX,PSWAPM," +-
            "SECURITY,SYSGBL,SYSLCK,SYSPRV,SYSNAM,WORLD"
$ define /user sys$output nl:
$ define /user sys$error nl:
$ install remove 'httpd_exe'
$ install add 'httpd_exe' /privilege=('instprv')
$!
$ deflognam WASD_HTTPD_EXE 'httpd_exe'
$!
$! -----------
$! CGILIBSHR32
$! -----------
$!
$ if f$search("CGI_EXE:CGILIBSHR32.EXE") .nes. "" then -
     deflognam WASD_CGILIBSHR32 CGI_EXE:CGILIBSHR32.EXE
$!
$! ------------
$! INSTALL LIBZ
$! ------------
$!
$ if f$trnlnm("LIBZ_SHR32") .nes. "" then -
     if .not. f$file("LIBZ_SHR32","known") then -
        install add /open /header /share LIBZ_SHR32
$!
$ if f$trnlnm("GNV$LIBZSHR32") .nes. "" then -
     if .not. f$file("GNV$LIBZSHR32","known") then -
        install add /open /header /share GNV$LIBZSHR32
$!
$! ----------------
$! SSL REQUIREMENTS
$! ----------------
$!
$ if wasd_ssl
$ then
$    if f$search("''wasd_ssl_cert'") .nes. "" then -
        deflognam WASD_SSL_CERT 'wasd_ssl_cert'
$    if f$search("''wasd_ssl_cafile'") .nes. "" then -
        deflognam WASD_SSL_CAFILE 'wasd_ssl_cafile'
$    if wasd_ossl
$    then
$!      (ensure OpenSSL v1.1.0 or later shareable images are INSTALLed)
$       if .not. f$file("OSSL$LIBCRYPTO_SHR32","known") -
           then install add /open /header /share OSSL$LIBCRYPTO_SHR32
$       if .not. f$file("OSSL$LIBSSL_SHR32","known") -
           then install add /open /header /share OSSL$LIBSSL_SHR32
$    endif
$    if wasd_vms_ssl
$    then
$!      (ensure VMS OpenSSL shareable images are INSTALLed)
$       if .not. f$file("SYS$LIBRARY:SSL$LIBCRYPTO_SHR32.EXE","known") -
           then install add /open /header /share SYS$LIBRARY:SSL$LIBCRYPTO_SHR32.EXE
$       if .not. f$file("SYS$LIBRARY:SSL$LIBSSL_SHR32.EXE","known") -
           then install add /open /header /share SYS$LIBRARY:SSL$LIBSSL_SHR32.EXE
$    endif
$ endif
$!
$ if wasd_no_server
$ then
$    say "%WASD-I-STARTUP, end (server not started)"
$    exit
$ endif
$!
$!
$! -------------
$! LOCAL STARTUP
$! -------------
$!
$!(note that this value must have any quotes escaped)
$ if wasd_startup .nes. "" then deflognam WASD_STARTUP_SERVER "''wasd_startup'"
$!
$!(derive from the location of this procedure)
$ startup_local = proc_device + proc_dir + "STARTUP_LOCAL.COM"
$ if f$search(startup_local) .nes. "" then @'startup_local'
$!
$! ------------------
$! START HTTPd SERVER
$! ------------------
$!
$ startup_procedure = ""
$ if vms_version .ge. 62
$ then
$!   (look for version 8.n or later of the server)
$    define /user sys$output nl:
$    define /user sys$error nl:
$    search 'httpd_exe' "[STARTUP]"
$    if $severity .eqs. "1" then startup_procedure = "[STARTUP]"
$    startup_server = ""
$ endif
$ if startup_procedure .eqs. ""
$ then
$!   (look for STARTUP_SERVER_nodename_port.COM)
$    startup_server = proc_device + proc_dir + "startup_server_" + -
                      f$edit(f$getsyi("scsnode"),"collapse") + "_*.COM;0"
$    startup_procedure = f$search(startup_server)
$    startup_server = ""
$ endif
$ if startup_procedure .eqs. ""
$ then
$!   (look for STARTUP_SERVER_nodename.COM)
$    startup_server = proc_device + proc_dir + "startup_server_" + -
                      f$edit(f$getsyi("scsnode"),"collapse") + ".C%M;0"
$    startup_procedure = f$search(startup_server)
$    startup_server = ""
$ endif
$ if startup_procedure .eqs. ""
$ then
$!   (nothing node/port specific look for a local, site-specific startup file)
$    startup_server = proc_device + proc_dir +-
                      "STARTUP_SERVER_LOCAL.C%M;0"
$    startup_procedure = f$search(startup_server)
$    startup_server = ""
$ endif
$ if startup_procedure .eqs. ""
$ then
$!   (nothing node/port/local specific, look for post-v5.3 startup)
$    startup_server = proc_device + proc_dir + "STARTUP_SERVER.C%M;0"
$    startup_procedure = f$search(startup_server)
$    startup_server = ""
$ endif
$ if startup_procedure .eqs. ""
$ then
$!   (none was found, pre-v5.3 startup)
$    startup_procedure = "WASD_ROOT:[HTTP$SERVER]HTTPD_BATCH.C%M"
$ endif
$! (ensure configuration file values are used by reseting global section values)
$ httpd /instance=config
$ startup_server_loop:
$    if startup_procedure .eqs. "" then goto end_startup_server_loop
$    startup_name = f$parse(startup_procedure,,,"name")
$    show symbol startup_procedure
$    if vms_version .ge. 62
$    then
$       if startup_procedure .eqs. "[STARTUP]" then startup_procedure = ""
$       if wasd_env .ge. 2
$          then httpd /detach /env='wasd_env' /user='wasd_account' -
                      'startup_procedure' 'slash_network'
$          else httpd /detach /user='wasd_account' -
                      'startup_procedure' 'slash_network'
$       endif
$    else
$       if wasd_batch_log
$          then batchlog = "/log=WASD_SERVER_LOGS:" + startup_name + ".LOG"
$          else batchlog = "/nolog"
$       endif
$       submit 'startup_procedure' /queue='wasd_batch_queue' -
               /param=("''slash_network'") /user='wasd_account' -
               'batchlog' /noprint
$    endif
$    if startup_procedure .eqs. "" then goto end_startup_server_loop
$    startup_procedure = f$search(startup_server)
$    goto startup_server_loop
$ end_startup_server_loop:
$!
$ deassign/process WASD_EXE
$ discard = f$setprv(orig_privs)
$!
$ say "%WASD-I-STARTUP, end"
$!
$!-----------------------------------------------------------------------------