DataMuseum.dk

Presents historical artifacts from the history of:

Regnecentalen RC-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Regnecentalen RC-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T u

⟦dc154cd69⟧ TextFile

    Length: 1296 (0x510)
    Types: TextFile
    Names: »usr/admin/unixadmin «

Derivation

└─⟦3d8f416b2⟧ Bits:30004042/core2.imd SW95705I 386/ix Multi-user Release 1.2
    └─⟦this⟧ »usr/admin/unixadmin « 

TextFile

#ident	"@(#)sadmin:admin/unixadmin	2.3"
#	General purpose hook into administrative logins used as commands,
#	so that the commands can have passwords on them.

set -f
PATH=${PATH:-/bin:/usr/bin}:/usr/lbin
export PATH
cmd=`basename $0`
if  grep "^${cmd}:" /etc/passwd >/dev/null
then
	# Magic here!
	# The problem is that we want the commands to (potentially) have a
	# password, so that they can be restricted if the user likes, and
	# to be within the restricted shell so that the user can not break out
	# and become super-user.  The complication is that we want the command
	# to have arguments, but /bin/su will not permit arguments to something
	# that has /bin/rsh as its login shell and /bin/su clears out the
	# environment when the - argument is used.  So we open another File
	# Descriptor and ship the arguments in via a pipe.
	#	make File Descriptor 4 the same as 0 (standard input)
	exec 4<&0
	#	echo the arguments down a pipe.  On the receiving end,
	#	connect the pipe to File Descriptor 3 and connect the original
	#	standard input, available on FD 4, to FD 0.  Lastly, close FD 4.
	#	See the .profile file (admin profile.dot) for how the arguments
	#	are read.
	echo $*  |  3<&0 0<&4 4<&- /bin/su - ${cmd}
else
	admerr $0 Command ${cmd} does not exist in /etc/passwd.
	exit 1
fi