#!/bin/csh # Copyright 10/26/99 Sun Microsystems, Inc. All Rights Reserved. # "@(#)getmachine.cgi 1.26 99/10/26 Sun Microsystems" source ./profile.csh set post_script="nf_html_main.cgi" if ( ! $?WWW_add && ! $?WWW_remove && ! $?WWW_view && ! $?WWW_endsession && ! $?WWW_nwmap) then echo 'content-type: text/html' echo '' echo '' echo '' echo '

' echo '

' echo '
' echo '' echo 'Please Go Back and Click Add or Remove Button' echo '' echo '
' echo '
' echo '

' echo '' echo '' exit endif ############################################ #Check if Add or Remove button is clicked. #Execute accordingly. ############################################ if ( $?WWW_add || $?WWW_remove) then cat <
Help


Select a System:
Add / Remove a System:

$checkVar

End session and save session info.

EOM exit endif if ( $?WWW_endsession ) then setenv WWW_func putSessionInfo setenv WWW_username "$WWW_username" setenv WWW_hostlist "$WWW_hostlist" setenv nf_html yes setenv REQUEST_METHOD POST $NF_CGIDIR/rp_util_java.cgi >& /tmp/session.$$ echo 'content-type: text/html' echo '' echo '' echo '' echo '' rm -f /tmp/session.$$ >& /dev/null exit endif # check if we had a valid View or Netware Button Clicked if ( $?WWW_view || $?WWW_nwmap) then if ( ! $?WWW_nmachine ) then set WWW_nmachine="" endif if ( ! $?WWW_machine ) then set WWW_machine="" endif if ( "$WWW_nmachine" != "" && "$WWW_machine" != "" ) then echo 'content-type: text/html' echo '' echo '' echo '' echo '
'
	echo "Don't select AND input a system in the left frame."
	echo '
' echo '' echo '' exit endif if ( "$WWW_nmachine" == "" && "$WWW_machine" == "" ) then echo 'content-type: text/html' echo '' echo '' echo '' echo '
'
	echo 'Please select OR input a system in the left frame.'
	echo '
' echo '' echo '' exit endif if ( "$WWW_machine" == "" ) then set WWW_machine="$WWW_nmachine" setenv WWW_machine "$WWW_nmachine" endif # Adding to user map for netware machine for the first time if ( "$?WWW_nwmap" ) then if ( "$WWW_nwuser" == "" ) then echo 'content-type: text/html' echo '' echo '' echo "" echo '
'
		echo "Please enter your Username on the NetWare Server"
		echo '
' echo '' echo '' exit endif if ( "$WWW_nwpass" == "" ) then echo 'content-type: text/html' echo '' echo '' echo "" echo '
'
		echo "Please enter your Password on the NetWare Server"
		echo '
' echo '' echo '' exit endif set temp=`echo $WWW_machine | tr '[a-z]' '[A-Z]'` setenv nw_server $temp set temp=`echo $WWW_nwuser | tr '[a-z]' '[A-Z]'` setenv nw_username $temp set temp=`echo $WWW_nwpass | tr '[a-z]' '[A-Z]'` setenv nw_password $temp set result=`$NF_SBIN/addnwmapuser $nw_server $WWW_username $nw_username $nw_password` if ( "$status" ) then echo 'content-type: text/html' echo '' echo '' echo "" echo '
'
		echo "Add entry failed : $result"
		echo "Check your NetWare system username/password and try again."
		echo '
' echo '' echo '' exit endif # echo '
'
#	echo Entry added. 

	echo "?NETWARE" > /tmp/type.$$ 
     else
	# check to see if we are allowed to access this system
	setenv nf_html yes
	setenv WWW_func getMachineType 
	setenv REQUEST_METHOD POST

	$NF_CGIDIR/rp_util_java.cgi >& /tmp/type.$$ 
     endif

cat <

$NF_APPLICATION


EOM set findsystem=false # If the machine type is RC this script allows the user to add the machine #and suggests to use the access menu option in NetFile Java. # RC(Remote Control) system grep -w "?RC" /tmp/type.$$ >& /dev/null if ($status == 0) then set findsystem=true cat <

Remote Control System

Use NetFile Java to access $WWW_machine
via Access Menu option

EOM exit endif grep -w "?NETWARE" /tmp/type.$$ >& /dev/null if ($status == 0) then set findsystem=true # need to check if we had the netware user map there first echo $WWW_machine > /tmp/nwmachine.$$ set ltouMach=`tr "[:lower:]" "[:upper:]" & /dev/null if ($status) then cat <

Add NetWare System User Map

NetWare System:$WWW_machine
Your Username On The System:
Your Password On The System:


EOM exit endif # Execute the following if we had the user map already cat << EOM

NetWare System

System:$WWW_machine
Volume:
Directory:


EOM endif # if we get "UNIX" back then we're going to have to # check for ftp/nfs ourselves here # This should never happen! grep -w "?UNIX" /tmp/type.$$ >& /dev/null if ($status == 0) then # need to post again to get FTP/NFS set ftp_port=21 $NF_SBIN/checkport $WWW_machine $ftp_port if ($status == 0) then echo "?FTP" > /tmp/type.$$ else set nfs_port=2049 $NF_SBIN/checkport $WWW_machine $nfs_port if ($status == 0) then echo "?NFS" > /tmp/type.$$ else echo "UNKNOWN" > /tmp/type.$$ endif endif endif # FTP system grep -w "?FTP" /tmp/type.$$ >& /dev/null if ($status == 0) then set findsystem=true cat <

FTP System

System:$WWW_machine
Password:
Directory:


EOM endif # NFS system grep -w "?NFS" /tmp/type.$$ >& /dev/null if ($status == 0) then set findsystem=true cat <

NFS System

System:$WWW_machine
Directory:


EOM endif grep -w "?WIN" /tmp/type.$$ >& /dev/null set win=$status grep -w "?NT" /tmp/type.$$ >& /dev/null set nt=$status if ( $win == 0 || $nt == 0 ) then set findsystem=true cat <

Windows Networking


System:$WWW_machine
Password:
Sharename:


EOM if ( $win == 0 ) then echo "" else echo "" endif echo "" EOM endif if ( "$findsystem" == "false" ) then echo "$WWW_machine
" echo "Unknown System Type :

" echo "

"
	cat /tmp/type.$$
	echo "
" endif cat < EOM rm /tmp/type.$$ exit endif