Here is a revised version of the command file, on a 'host' based solution
of limiting logons, that I submitted yesterday.
Regards
Paul Christidis
<<----------------------------------- Start Cut *+1
# Author: Paul Christidis e-mail: [log in to unmask]
# Version: 2001.04.06 Date: 04/05/2001
#
# This is an enhancement of the command file posted by Jeff Vance on
# the HP3000-L list. It allows a site to 'configure' the number of
# sessions allowed to logon an account using account_user_jobname,
# account_user, or account limits. It also allows the 'limit' to
# be applied to sessions orignating on the same IP address.
#
# Configuration information is stored in a flat file "joblimit" as a
# series of 'setvar' commands, for each MPE account, MPE user or Session
# name. It should adhere to the following format:
# (Using the SYS account as an example):
# SETVAR SYS_limit 1
# SETVAR SYS_MANAGER_limit 2
# SETVAR SYS_MANAGER_XTIDIS_limit 3
#
# NOTE: The suffix of '_limit' is required
#
# <---------------------------------------------------->
# Set initial / default values to some variables
#
setvar _LG_DEFAULT_LIMIT 2
setvar _lg_limits_file "joblimit.pub.sys"
setvar _lg_limit_by_ip FALSE
setvar _lg_this_limit _lg_default_limit
setvar _lg_select "!hpjobname,!hpuser.!hpaccount"
# Next flag indicates whether the 'jobname' portion of the logon
# should be used by 'JOBCNT' when 'limit' is set at the 'account'
# or the 'account_user' level.
setvar _lg_use_jobname FALSE
#
# Determine if a 'special' limit is configured for this user
#
if FINFO(_lg_limits_file,"exists") then
purge $oldpass > $null
continue
fcopy from=!_lg_limits_file &
;to=$newpass;new;subset="!["!hpaccount"+"_"]",8 > $null
#
if FINFO("$OLDPASS", "exists") AND &
FINFO("$OLDPASS", "eof" ) > 0 then
xeq $oldpass
endif
#
if BOUND(![hpaccount]_![hpuser]_![hpjobname]_limit) then
setvar _lg_this_limit ![hpaccount]_![hpuser]_![hpjobname]_limit
else
if NOT _lg_use_jobname then
setvar _lg_select _lg_select - "!hpjobname,"
endif
if BOUND(![hpaccount]_![hpuser]_limit) then
setvar _lg_this_limit ![hpaccount]_![hpuser]_limit
elseif BOUND(![hpaccount]_limit) then
setvar _lg_this_limit ![hpaccount]_limit
endif
endif
endif
#
# Find all sessions logged on as "you"
#
setvar _lg_numjobs JOBCNT("@s:!_lg_select",_lg_ses_list)
if _lg_numjobs > 1 then
# there is at least 1 other session logged on as "you"
if NOT _lg_limit_by_ip then
setvar _lg_ipcnt _lg_numjobs
else
setvar _lg_ipcnt 0
setvar _lg_i 0
while setvar(_lg_i,_lg_i+1) <= _lg_numjobs do
if JINFO(word(_lg_ses_list,,_lg_i),"ipaddr") = HPREMIPADDR then
setvar _lg_ipcnt _lg_ipcnt+1
endif
endwhile
endif
#
if _lg_ipcnt > _lg_this_limit then
echo ![chr(7)]
echo You have too many sessions logged on as: !_lg_select
if _lg_limit_by_ip then
echo from the same IP address (!HPREMIPADDR).
endif
echo ![chr(7)]
bye
endif
endif
#
# Debug / Clean Up
#
if BOUND(traceon) then
showvar _lg_@, !hpaccount@_limit
else
deletevar _lg_@, !hpaccount@_limit
endif
------------------------------------------->> End cut *-1
* To join/leave the list, search archives, change list settings, etc *
* please visit http://raven.utc.edu/archives/hp3000-l.html *
|