home *** CD-ROM | disk | FTP | other *** search
- Path: wupost!uunet!europa.asd.contel.com!darwin.sura.net!noc.sura.net!haven.umd.edu!mimsy!nrlvx1.nrl.navy.mil!koffley
- From: koffley@nrlvx1.nrl.navy.mil
- Newsgroups: alt.sources
- Subject: VMS UAF PROFILE part 11 of 18
- Message-ID: <1991Sep5.074543.555@nrlvx1.nrl.navy.mil>
- Date: 5 Sep 91 11:45:43 GMT
- Organization: NRL SPACE SYSTEMS DIVISION
- Lines: 417
-
- -+-+-+-+-+-+-+-+ START OF PART 11 -+-+-+-+-+-+-+-+
- X . prv$v_SETPRI, prv$v_SETPRV, prv$v_TMPMBX, prv$v_WORLD,
- X . prv$v_MOUNT, prv$v_OPER, prv$v_EXQUOTA, prv$v_NETMBX,
- X . prv$v_VOLPRO, prv$v_PHY_IO, prv$v_BUGCHK, prv$v_PRMGBL,
- X . prv$v_SYSGBL, prv$v_PFNMAP, prv$v_SHMEM, prv$v_SYSPRV,
- X . prv$v_BYPASS, prv$v_SYSLCK, prv$v_SHARE, prv$v_GRPPRV,
- X . prv$v_ACNT, prv$v_ALTPRI, prv$v_READALL, prv$v_SECURITY /
- X
- X rend_mask = smg$m_bold.or.smg$m_underline
- X
- X call smg$begin_pasteboard_update ( pasteboard )
- X
- X line = 5
- X col = 5
- XC
- XC Find out which privileges the user holds
- XC
- X do j = 1,35,6
- X do i = j,j+5
- X if (btest(def_priv(1),privs(i))) then
- X if (i .le. 35) call smg$change_rendition ( priv_board, line
- V,
- X . col, 1, 8, rend_mask )
- X else
- X if (i .le. 35) call smg$change_rendition ( priv_board, line
- V,
- X . col, 1, 8, 0 )
- X endif
- X col = col + 12
- X enddo
- X line = line + 1
- X col = 5
- X enddo
- X
- X col = 5
- X line = 14
- X
- X do j = 1,35,6
- X do i = j,j+5
- X if (btest(auth_priv(1),privs(i))) then
- X if (i .le. 35) call smg$change_rendition ( priv_board, line
- V,
- X . col, 1, 8, rend_mask )
- X else
- X if (i .le. 35) call smg$change_rendition ( priv_board, line
- V,
- X . col, 1, 8, 0 )
- X endif
- X col = col + 12
- X enddo
- X line = line + 1
- X col = 5
- X enddo
- X
- X line = line - 1
- X
- X call smg$end_pasteboard_update ( pasteboard )
- X
- X end
- X
- XC***************************************************************************
- V****
- X
- X Subroutine READ_PRIV ( priv, line )
- XC
- XC The purpose of this subroutine is to read the privilege at the
- XC cursor and enable or disable it.
- XC
- X Include 'uaf.cmn'
- X Include '($prvdef)'
- X Integer*4 i, line, privs(35)
- X Character*8 priv_names(35)
- X Character*(*) priv
- X
- X data privs
- X . /prv$v_CMKRNL, prv$v_CMEXEC, prv$v_SYSNAM,
- X . prv$v_GRPNAM, prv$v_ALLSPOOL, prv$v_DETACH, prv$v_DIAGNOSE,
- X . prv$v_LOG_IO, prv$v_GROUP, prv$v_PRMCEB, prv$v_PSWAPM,
- X . prv$v_SETPRI, prv$v_SETPRV, prv$v_TMPMBX, prv$v_WORLD,
- X . prv$v_MOUNT, prv$v_OPER, prv$v_EXQUOTA, prv$v_NETMBX,
- X . prv$v_VOLPRO, prv$v_PHY_IO, prv$v_BUGCHK, prv$v_PRMGBL,
- X . prv$v_SYSGBL, prv$v_PFNMAP, prv$v_SHMEM, prv$v_SYSPRV,
- X . prv$v_BYPASS, prv$v_SYSLCK, prv$v_SHARE, prv$v_GRPPRV,
- X . prv$v_ACNT, prv$v_ALTPRI, prv$v_READALL, prv$v_SECURITY /
- X
- X data priv_names
- X . /'CMKRNL ','CMEXEC ','SYSNAM ',
- X . 'GRPNAM ','ALLSPOOL','DETACH ','DIAGNOSE',
- X . 'LOG_IO ','GROUP ','PRMCEB ','PSWAPM ',
- X . 'SETPRI ','SETPRV ','TMPMBX ','WORLD ',
- X . 'MOUNT ','OPER ','EXQUOTA ','NETMBX ',
- X . 'VOLPRO ','PHY_IO ','BUGCHK ','PRMGBL ',
- X . 'SYSGBL ','PFNMAP ','SHMEM ','SYSPRV ',
- X . 'BYPASS ','SYSLCK ','SHARE ','GRPPRV ',
- X . 'ACNT ','ALTPRI ','READALL ','SECURITY' /
- X
- XC
- XC Read the privilege name at the cursor, determine if the cursor is in
- XC the default or authorized field, and reverse the privilege bit.
- XC
- X do i = 1,35
- X if (priv.eq.priv_names(i)) then
- X if (line.gt.13) then
- X if (btest(auth_priv(1),privs(i))) then
- X call lib$bbcci ( privs(i), auth_priv(1) )
- X else
- X call lib$bbssi ( privs(i), auth_priv(1) )
- X endif
- X else
- X if (btest(def_priv(1),privs(i))) then
- X call lib$bbcci ( privs(i), def_priv(1) )
- X else
- X call lib$bbssi ( privs(i), def_priv(1) )
- X endif
- X endif
- X endif
- X enddo
- XC
- XC Call the subroutine SCAN_PRIVS to determine the privileges.
- XC
- X call scan_privs
- X
- X end
- X
- XC************************************************************************
- X
- X Subroutine LIST_PRIVS ( line, col )
- XC
- XC The purpose of this subroutine is to write the names of the
- XC privileges to the board.
- XC
- X Include '($smgdef)'
- X Include 'uaf.cmn'
- X Integer*4 line, col, i, j
- X Character*8 priv_names(35)
- X
- X data priv_names
- X . /'CMKRNL ','CMEXEC ','SYSNAM ',
- X . 'GRPNAM ','ALLSPOOL','DETACH ','DIAGNOSE',
- X . 'LOG_IO ','GROUP ','PRMCEB ','PSWAPM ',
- X . 'SETPRI ','SETPRV ','TMPMBX ','WORLD ',
- X . 'MOUNT ','OPER ','EXQUOTA ','NETMBX ',
- X . 'VOLPRO ','PHY_IO ','BUGCHK ','PRMGBL ',
- X . 'SYSGBL ','PFNMAP ','SHMEM ','SYSPRV ',
- X . 'BYPASS ','SYSLCK ','SHARE ','GRPPRV ',
- X . 'ACNT ','ALTPRI ','READALL ','SECURITY' /
- XC
- XC Write the names of the privileges to the board.
- XC
- X do j = 1,35,6
- X do i = j,j+5
- X call smg$put_chars ( priv_board, priv_names(i),
- X . line, col )
- X col = col + 12
- X enddo
- X line = line + 1
- X col = 5
- X enddo
- X
- X line = line - 1
- X
- X end
- X
- XC************************************************************************
- X
- X Subroutine ALL_PRIV
- XC
- XC The purpose of this subroutine is to enable all privileges.
- XC
- X Include 'uaf.cmn'
- X Include '($uaidef)'
- X Include '($prvdef)'
- X
- X change = .true.
- XC
- XC Define a privilege mask to set all default privileges.
- XC
- X def_priv(1) = prv$m_tmpmbx.or.prv$m_netmbx.or.
- X . prv$m_cmkrnl.or.prv$m_cmexec.or.prv$m_sysnam.or.
- X . prv$m_grpnam.or.prv$m_allspool.or.prv$m_detach.or.
- X . prv$m_diagnose.or.prv$m_log_io.or.prv$m_group.or.
- X . prv$m_acnt.or.prv$m_prmceb.or.prv$m_prmmbx.or.
- X . prv$m_pswapm.or.prv$m_setpri.or.prv$m_setprv.or.
- X . prv$m_world.or.prv$m_mount.or.prv$m_oper.or.
- X . prv$m_exquota.or.prv$m_volpro.or.prv$m_phy_io.or.
- X . prv$m_bugchk.or.prv$m_prmgbl.or.prv$m_sysgbl.or.
- X . prv$m_pfnmap.or.prv$m_shmem.or.prv$m_sysprv.or.
- X . prv$m_bypass.or.prv$m_syslck.or.prv$m_share.or.
- X . prv$m_altpri
- X def_priv(2) = 0
- X call lib$bbssi ( prv$v_security, def_priv(1) )
- X call lib$bbssi ( prv$v_readall, def_priv(1) )
- X call lib$bbssi ( prv$v_grpprv, def_priv(1) )
- XC
- XC Define a privilege mask to set all authorized privileges.
- XC
- X auth_priv(1) = prv$m_tmpmbx.or.prv$m_netmbx.or.
- X . prv$m_cmkrnl.or.prv$m_cmexec.or.prv$m_sysnam.or.
- X . prv$m_grpnam.or.prv$m_allspool.or.prv$m_detach.or.
- X . prv$m_diagnose.or.prv$m_log_io.or.prv$m_group.or.
- X . prv$m_acnt.or.prv$m_prmceb.or.prv$m_prmmbx.or.
- X . prv$m_pswapm.or.prv$m_setpri.or.prv$m_setprv.or.
- X . prv$m_world.or.prv$m_mount.or.prv$m_oper.or.
- X . prv$m_exquota.or.prv$m_volpro.or.prv$m_phy_io.or.
- X . prv$m_bugchk.or.prv$m_prmgbl.or.prv$m_sysgbl.or.
- X . prv$m_pfnmap.or.prv$m_shmem.or.prv$m_sysprv.or.
- X . prv$m_bypass.or.prv$m_syslck.or.prv$m_share.or.
- X . prv$m_altpri
- X auth_priv(2) = 0
- X call lib$bbssi ( prv$v_security, auth_priv(1) )
- X call lib$bbssi ( prv$v_readall, auth_priv(1) )
- X call lib$bbssi ( prv$v_grpprv, auth_priv(1) )
- XC
- XC Call the subroutine SCAN_PRIVS to determine which privileges
- XC are enabled.
- XC
- X call scan_privs
- X
- X end
- X
- XC************************************************************************
- X
- X Subroutine NORMAL_PRIV
- XC
- XC The purpose of this subroutine is to enable normal privileges only.
- XC
- X Include 'uaf.cmn'
- X Include '($prvdef)'
- X
- X change = .true.
- XC
- XC Define a privilege mask to set normal default privileges.
- XC
- X def_priv(1) = prv$m_tmpmbx.or.prv$m_netmbx
- X def_priv(2) = 0
- XC
- XC Define a privilege mask to set normal authorized privileges.
- XC
- X auth_priv(1) = prv$m_tmpmbx.or.prv$m_netmbx
- X auth_priv(2) = 0
- XC
- XC Call the subroutine SCAN_PRIVS to determine which privileges are
- XC enabled.
- XC
- X call scan_privs
- X
- X end
- X
- XC************************************************************************
- X
- X Subroutine NEXT_FREE_UIC ( string )
- XC
- XC The purpose of this subroutine is to determine the next free uic member
- XC in a group, if only a group entity is given, and expand the uic to
- XC include both group and member, or to return an error if the group is
- XC full.
- XC
- XC This routine was modified from a program posted to comp.os.vms
- XC (aka INFO-VAX).
- XC
- XC Modified 4-DEC-1989 to check for logical name RIGHTSLIST in case
- XC it resides somewhere other than SYS$SYSTEM: - JMH
- XC
- X Include '($lnmdef)'
- X Integer*4 group_num, keynum, member_num, next_uic, sts
- X Integer*4 group_len, len, lib$sys_trnlog
- X Character*50 rights_file
- X Character*6 member
- X Character*(*) string
- X
- X group_len = index(string,' ')-1
- X
- X sts = lib$sys_trnlog ( 'RIGHTSLIST', len, rights_file,
- X . 'LNM$SYSTEM_TABLE' ,, lnm$m_case_blind )
- X if (sts .ne. 1) rights_file = 'SYS$SYSTEM:RIGHTSLIST.DAT'
- X
- X open(unit=1,file=rights_file,shared,readonly,
- X . access='keyed',status='old',form='unformatted')
- XC
- XC Convert the ascii string 'group' octal
- XC
- X call ots$cvt_to_l ( string(1:group_len), group_num )
- X
- X keynum = group_num * '10000'x
- X member_num = keynum
- X
- X read (1,keyge=keynum,keyid=0,err=900) next_uic
- X
- X300 if ((next_uic/'10000'x) .ne. group_num) go to 900
- X if (iand(next_uic,'FFFF'x) .eq. 'FFFF'x) go to 900
- X member_num = next_uic
- X read(1,err=900) next_uic
- X go to 300
- X
- X900 member_num = member_num + 1
- X
- X sts = lib$sys_fao ( '!%U', len, string, %val(member_num) )
- X if (.not.sts) call lib$signal ( %val(sts) )
- X
- X close (unit=1)
- X
- X end
- X
- XC************************************************************************
- X
- X Subroutine SPAWN_DCL ( owner, tables, defcli, defdev,
- X . defdir, lgicmd )
- XC
- XC If the user is to be added to the system, then spawn a short DCL
- XC command file to add the user via AUTHORIZE. Unfortunately, $SETUAI
- XC cannot be used to add a user. Also, we can add a diskquota entry
- XC for the user (defaulted at 1000 with an overdraft default at 100,
- XC change them to suit your purposes).
- XC
- X Include 'uaf.cmn'
- X Include '($smgdef)'
- X Include '($lnmdef)'
- X Include '($uaidef)'
- X Include '($clidef)'
- X Include '($prvdef)'
- X Integer*4 sts, flag_mask, priv_mask, icontext, istat
- X Integer*4 spec_len, offset, name_len
- X Integer*4 lib$sys_trnlog
- X Logical quotas_enabled, directory_exists
- X Byte enbflg /1/
- X Character*80 dcl_command, dir_spec, main_dev
- X Character*8 quota /'1000'/ ! change to suit your needs
- X Character*8 overdraft /'100'/! change to suit your needs
- X Character*(*) owner, tables, defcli, defdev, defdir, lgicmd
- XC
- XC Set up a flag mask so that the spawn will be quick. No symbols or
- XC logical names will be inherited from the parent process. Note that
- XC it is important that you have SYSPRV or SETPRV as an authorized
- XC privilege in order to effectively do this. Also set up a privilege
- XC mask in case special privileges need to be enabled to create a
- XC user directory (if not run from SYSTEM account).
- XC
- X flag_mask = cli$m_noclisym.or.cli$m_nolognam
- X priv_mask = prv$m_bypass.or.prv$m_exquota.or.prv$m_sysprv
- XC
- XC Define an initial dcl command for insertion in the command file.
- XC
- XC If the account is to be added:
- XC
- X if (.not.user_exists) then
- X dcl_command = 'ADD '//username(1:username_len)//
- X . '/PASSWORD='//password(1:password_len)//
- X . '/ACCOUNT='//account(1:account_len)//'/UIC='//uic
- X endif
- XC
- XC If the account already exists but the password has been changed:
- XC
- X if (user_exists.and.pwd_change) then
- X dcl_command = 'MOD '//username(1:username_len)//
- X . '/PASSWORD='//password(1:password_len)//'/NOPWDEXPIRED'
- X endif
- XC
- XC If the account already exists but it has been renamed:
- XC
- X if (user_exists.and.rename) then
- X dcl_command = 'RENAME '//orig_uname(1:uname_len)//
- X . ' '//username(1:username_len)//'/PASSWORD='//
- X . password(1:password_len)
- X endif
- XC
- XC Open a new temporary dcl command file and write some info to it.
- XC
- X open (unit=1,file='DCL.TMP',status='new')
- X write (1,'(a)') '$ DELETE DCL.TMP;*'
- X write (1,'(a)') '$ PREVPRIV = F$SETPRV("ALL")'
- X write (1,'(a)') '$ DEFINE/USER SYSUAF SYS$SYSTEM:SYSUAF'
- X write (1,'(a)') '$ RUN SYS$SYSTEM:AUTHORIZE'
- X write (1,'(a)') dcl_command
- X write (1,'(a)') 'EXIT'
- XC
- XC If adding diskquota is not desirable, delete the following lines
- XC of code:
- XC
- XC First check to see if the disk has diskquotas enabled. Translate the
- XC device logical name in case it is a concealed device (i.e. SYS$SYSROOT).
- XC If the device is not concealed or the device is not a logical name, the
- XC translation success or failure will not matter.
- XC
- X if (.not.user_exists) then
- X call lib$sys_trnlog ( defdev(1:defdev_len), name_len,
- X . main_dev, 'LNM$SYSTEM_TABLE' ,, lnm$m_case_blind )
- X offset = index(main_dev,':')
- X if (offset .eq. 0) offset = index(main_dev,' ')
- X inquire (file=main_dev(1:offset-1)//
- X . ':`5B0,0`5DQUOTA.SYS',exist=quotas_enabled)
- X if (quotas_enabled) then
- X write (1,'(a)') '$ RUN SYS$SYSTEM:DISKQUOTA'
- X dcl_command = 'USE '//main_dev(1:offset)
- X write (1,'(a)') dcl_command
- X dcl_command = 'ADD '//uic//'/PERMQUOTA='//quota
- X . //'/OVERDRAFT='//overdraft
- X write (1,'(a)') dcl_command
- X write (1,'(a)') 'EXIT'
- X endif
- X endif
- XC
- XC Close the temporary file.
- XC
- X close (1)
- XC
- XC Spawn a quick dcl command.
- XC
- X sts = lib$spawn ( , 'DCL.TMP', 'NL:', flag_mask )
- X if (.not.sts) call lib$signal ( %val(sts) )
- X
- +-+-+-+-+-+-+-+- END OF PART 11 +-+-+-+-+-+-+-+-
- --
- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
- < Joe Koffley KOFFLEY@NRLVAX.NRL.NAVY.MIL >
- < Naval Research Laboratory KOFFLEY@CCF.NRL.NAVY.MIL >
- < Space Systems Division AT&T : 202-767-0894 >
- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
-