From: stangen@RHEA.INFORMATIK.UNI-BONN.DE (Gregor von Stangen)
Newsgroups: comp.os.vms
Subject: DwShutdown - Bug in DWSHUTDOWN$CONFIG.COM
Date: 1 Sep 92 03:55:17 GMT
Organization: The Internet

Hi Folks,

unfortunately there is a little bug in the configuration procedure
DWSHUTDOWN$CONFIG.COM for DECwindows/Motif Shutdown. Since today
updated versions are available via anonymous ftp and fileserv. If
you don't want to get a new kit you may simply use the updated
configuration procedure posted below or - if you already have
installed DECwindows/Motif Shutdown - execute the following NCP
commands on all nodes in the cluster:

	$ MCR NCP
	NCP> DEFINE OBJECT SHUTDWN_SRV PROXY BOTH
	NCP> SET OBJECT SHUTDWN_SRV PROXY BOTH
	NCP> EXIT

I don't know why DECnet behaves in an unexpected way, but if the object
is set up with incoming proxy access only, the DECnet default account is
used instead of a privileged account, which of course causes Shutdown to
fail.

Gregor

++++++++++++++++++++++++++ CUT HERE +++++++++++++++++++++++++++++++++++++++++++
$!
$!			DECwindows/Motif Shutdown
$!
$!			  DWSHUTDOWN$CONFIG.COM
$!
$!			    Copyright (c) 1992
$!			    University of Bonn
$!			Dept. of Computer Science
$!			      D-5300 Bonn 1
$!			         Germany
$!
$!	22-Aug-1992	V1.0	G.von Stangen	Initial release
$!	31-Aug-1992	V1.0.1	G.von Stangen	Incoming proxy bug fix
$!
$!
$ sv = f$verify (0)
$ say		:= write sys$output
$ netnonpriv	 = "F"
$!
$ req_privs = "OPER,SYSPRV,SYSNAM"
$ old_privs = f$setprv (req_privs)
$ if .not. f$privilege (req_privs) then goto no_priv
$!
$ on error then goto err_exit
$ on control_y then goto err_exit
$!
$ scratch_dir = f$trnlnm ("SYS$SCRATCH")
$ if scratch_dir .eqs. "" then goto no_scratch
$!
$ type sys$input

	      DECwindows/Motif Shutdown configuration produre

This procedure will help you to get DECwindows/Motif Shutdown running on your
system. It will setup the required network object and the proxies for remote
access.

$!
$ gosub get_decnet_default
$ if .not. netnonpriv then gosub create_decnet_default
$!
$ gosub define_netobject
$!
$ if f$getsyi ("CLUSTER_MEMBER") then gosub define_proxies
$!
$ type sys$input

All required steps have been executed. Have fun running Motif-Shutdown.

$ old_privs = f$setprv (old_privs)
$ sv = f$verify (sv)
$ exit
$!
$!	Privilege violation handler
$!
$ no_priv:
$	say "No privilege to run configuration procedure."
$	say "Requires ''req_privs' privileges."
$	goto err_exit
$!
$!	Scratch directory missing handler
$!
$ no_scratch:
$	say "Scratch directory is missing."
$	goto err_exit
$!
$!	General error handler
$!
$ err_exit:
$	say ""
$	say "Configuration procedure aborted due to an error."
$	old_privs = f$setprv (old_privs)
$	sv = f$verify (sv)
$	exit
$!
$!	Check for existence of DECnet default account
$!
$ get_decnet_default:
$	ncp := $ncp
$	ncp list exec char to 'scratch_dir'execchar.tmp
$	set prot=(g,w) 'scratch_dir'execchar.tmp
$	open/read tmp 'scratch_dir'execchar.tmp
$ gdd_loop:
$	read/end=gdd_close tmp userline
$	if f$locate ("Nonprivileged user id", userline) .eq. f$length (userline) then goto gdd_loop
$	netnonpriv = "T"
$	goto gdd_found
$ gdd_close:
$	close tmp
$	delete/nolog 'scratch_dir'execchar.tmp;*
$	return
$ gdd_found:
$	read tmp pswdline
$	username = f$edit (f$element (1, "=", userline), "COLLAPSE")
$	password = f$edit (f$element (1, "=", pswdline), "COLLAPSE")
$	goto gdd_close
$!
$!	Create DECnet default account
$!
$ create_decnet_default:
$	type sys$input

There is no DECnet default account present on your system. For security
reasons this procedure will create this account now.

$ cdd_getusr:
$	inquire username "Please enter username for default account     [DECNET]"
$	if username .eqs. "" then username = "DECNET"
$	if f$length (username) .gt. 12
$	then
$		say "Illegal username format - Please retry"
$		goto cdd_getusr
$	endif
$	gosub generate_pwd
$	password = pwd'pwdn'
$	open/write tmp 'scratch_dir'add_dnet.tmp
$	if f$trnlnm ("SYSUAF") .eqs. "" then write tmp "$ define/user sysuaf sys$system:sysuaf.dat"
$	if f$trnlnm ("RIGHTSLIST") .eqs. "" then write tmp "$ define/user rightslist sys$system:rightslist.dat"
$	write tmp "$ run sys$system:authorize"
$	write tmp "add ''username' -"
$	write tmp " /owner=""DECNET DEFAULT"" -"
$	write tmp " /password=''password' -"
$	write tmp " /uic=[376,376] -"
$	write tmp " /account=decnet -"
$	write tmp " /device=sys$specific: -"
$	write tmp " /directory=[''username'] -"
$	write tmp " /privilege=(tmpmbx,netmbx) -"
$	write tmp " /defprivilege=(tmpmbx,netmbx) -"
$	write tmp " /flags=(nocaptive,restricted,nodisuser) -"
$	write tmp " /lgicmd=nl: -"
$	write tmp " /nobatch/nointeractive"
$	write tmp "modify ''username'/password=''password'"
$	close tmp
$	set prot=(g,w) 'scratch_dir'add_dnet.tmp
$	@'scratch_dir'add_dnet.tmp
$	delete/nolog 'scratch_dir'add_dnet.tmp;*
$	open/write tmp 'scratch_dir'dir_dnet.tmp
$	write tmp "$ run sys$system:sysman"
$	write tmp "set env/cluster"
$	write tmp "set prof/priv=(sysprv,oper)"
$	write tmp "do create/directory sys$specific:[''username']/own=[''username']"
$	close tmp
$	@'scratch_dir'dir_dnet.tmp
$	delete/nolog 'scratch_dir'dir_dnet.tmp;*
$	return
$!
$!	Generate random password
$!
$ generate_pwd:
$	define/user sys$output 'scratch_dir'dnetpsw.tmp
$	set password/gen=8
ILLEGAL
$	set prot=(g,w) 'scratch_dir'dnetpsw.tmp
$	pwd1 = ""
$	pwd2 = ""
$	pwd3 = ""
$	pwd4 = ""
$	pwd5 = ""
$	pwdn = 1
$	open/read tmp 'scratch_dir'dnetpsw.tmp
$ gp_loop:
$	read/end=gp_close tmp genline
$	pwd = f$element (0, " ", genline)
$	if pwd .eqs. "" then goto gp_loop
$	pwd'pwdn' = pwd
$	pwdn = pwdn + 1
$	if pwdn .le. 5 then goto gp_loop
$ gp_close:
$	close tmp
$	delete/nolog 'scratch_dir'dnetpsw.tmp;*
$	pwdn = 1
$	return
$!
$!	Define DECnet object for shutdown
$!
$ define_netobject:
$	if f$getsyi ("CLUSTER_MEMBER")
$	then
$		open/write tmp 'scratch_dir'def_shutobj.tmp
$		write tmp "$ run sys$system:sysman"
$		write tmp "set env/cluster"
$		write tmp "set prof/priv=(sysprv,oper)"
$		write tmp "do mc ncp define object shutdwn_srv number 0 file sys$system:dwshutdown_server.exe user ''username' password ''password' proxy both"
$		write tmp "do mc ncp set object shutdwn_srv number 0 file sys$system:dwshutdown_server.exe user ''username' password ''password' proxy both"
$		close tmp
$		set prot=(g,w) 'scratch_dir'def_shutobj.tmp
$		@'scratch_dir'def_shutobj.tmp
$		delete/nolog 'scratch_dir'def_shutobj.tmp;*
$	else
$		ncp := $ncp
$		ncp define object shutdwn_srv number 0 file sys$system:dwshutdown_server.exe user 'username' password 'password' proxy incoming
$		ncp set object shutdwn_srv number 0 file sys$system:dwshutdown_server.exe user 'username' password 'password' proxy incoming
$	endif
$	return
$!
$!	Define proxies for users who will use Shutdowm
$!
$ define_proxies:
$	proxyname = f$trnlnm ("NETPROXY")
$	if proxyname .eqs. "" then proxyname = "SYS$SYSTEM:NETPROXY.DAT"
$	if f$search ("''proxyname'") .nes. "" then goto dp_present
$	type sys$input

Node network proxy database is present on this node. For DECwindows/Motif
Shutdown to work a network proxy database is required once in the cluster
or once per node.

$	inquire procomm "Create a cluster common proxy database    [YES]"
$	if procomm .eqs. "" then procomm = "YES"
$	procomm = f$edit (procomm, "COLLAPSE")
$	if f$extract (0, 1, procomm) .eqs. "N" then goto dp_inqspec
$	uaf := $authorize
$	run sys$system:sysman
set env/cluster
set prof/priv=(oper,sysprv,sysnam)
do define/system/exec netproxy sys$common:[sysexe]netproxy.dat
$	uaf create/proxy
$	goto dp_present
$ dp_inqspec:
$	inquire prospec "Create a system specific proxy database   [YES]"
$	if prospec .eqs. "" then prospec = "YES"
$	prospec = f$edit (prospec, "COLLAPSE")
$	if f$extract (0, 1, prospec) .eqs. "Y" then goto dp_crespec
$	say ""
$	say "Cannot add proxies without proxy database"
$	say ""
$	return
$ dp_crespec:
$	open/write tmp1 'scratch_dir'cre_proxy.tmp
$	write tmp1 "$ run sys$system:sysman"
$	write tmp1 "set env/cluster"
$	write tmp1 "set prof/priv=(oper,sysprv,sysnam)"
$	write tmp1 "do @''scracth_dir'cre_proxy.tmp_2"
$	close tmp1
$	open/write tmp2 'scratch_dir'cre_proxy.tmp_2
$	write tmp2 "$ set noon"
$	write tmp2 "$ uaf := $authorize"
$	write tmp2 "$ define/system/exec netproxy sys$system:netproxy.dat"
$	write tmp2 "$ uaf create/proxy"
$	close tmp2
$	@'scratch_dir'cre_proxy
$	delete/nolog 'scratch_dir'cre_proxy.tmp*;*
$ dp_present:
$	type sys$input

All setup has been done so far. You may now setup DECnet proxies for users who
will use DECwindows/Motif Shutdown frequently. Enter a list of username(s) and
terminate the list with <RETURN>

$ dp_loop:
$	inquire proxyuser "Enter node and user <rem-node>,<rem-user>,<loc-user>"
$	if proxyuser .eqs. "" then goto dp_end
$	remotenode = f$edit (f$element (0, ",", proxyuser), "COLLAPSE") - "::"
$	remoteuser = f$edit (f$element (1, ",", proxyuser), "COLLAPSE")
$	localuser = f$edit (f$element (2, ",", proxyuser), "COLLAPSE")
$	if (remoteuser .eqs. "") .or. (remotenode .eqs. "") .or. (localuser .eqs. "")
$	then
$		say "Parameters are missing - Please supply all values"
$		goto dp_loop
$	endif
$	if (f$length (remoteuser) .gt. 12) .or. (f$length (remotenode) .gt. 6) .or. (f$length (localuser) .gt. 12)
$	then
$		say "Illegal username/node format - Please retry"
$		goto dp_loop
$	endif
$	open/write tmp2 'scratch_dir'add_proxy.tmp_2
$	write tmp2 "$ uaf := $authorize"
$	write tmp2 "$ set noon
$	write tmp2 "$ uaf add/proxy ''remotenode'::''remoteuser' ''localuser'/default"
$	close tmp2
$	open/write tmp1 'scratch_dir'add_proxy.tmp
$	write tmp1 "$ run sys$system:sysman"
$	write tmp1 "set env/cluster"
$	write tmp1 "set prof/priv=(sysprv,oper)"
$	write tmp1 "do @''scratch_dir'add_proxy.tmp_2"
$	close tmp1
$	@'scratch_dir'add_proxy.tmp
$	delete/nolog 'scratch_dir'add_proxy.tmp*;*
$	goto dp_loop
$ dp_end:
$	return
++++++++++++++++++++++++++ CUT HERE +++++++++++++++++++++++++++++++++++++++++++

-------------------------------------------------------------------------------
Gregor von Stangen, Syst. Mgr. | HEPnet:   13581::49252::STANGEN
Uni Bonn, Inst. f. Informatik  | Internet: stangen@rhea.informatik.uni-bonn.de
Roemerstr. 164, D-5300 Bonn 1  | P.S.I.:   45050211251::STANGEN
-------------------------------------------------------------------------------
Newsgroups: comp.os.vms