home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / vmsnet / misc / 669 < prev    next >
Encoding:
Internet Message Format  |  1992-07-28  |  3.0 KB

  1. Path: sparky!uunet!stanford.edu!rutgers!ub!acsu.buffalo.edu!ubvmsb.cc.buffalo.edu!masmummy
  2. From: masmummy@ubvmsb.cc.buffalo.edu (William Brennessel)
  3. Newsgroups: vmsnet.misc
  4. Subject: Re: How to determin a rightsidentifier in FORTRAN?
  5. Message-ID: <Bs4urI.Lnu@acsu.buffalo.edu>
  6. Date: 29 Jul 92 05:21:00 GMT
  7. References: <1992Jul28.231632.16827@wega.rz.uni-ulm.de>
  8. Sender: nntp@acsu.buffalo.edu
  9. Organization: University at Buffalo
  10. Lines: 80
  11. News-Software: VAX/VMS VNEWS 1.41
  12. Nntp-Posting-Host: ubvmsb.cc.buffalo.edu
  13.  
  14. In article <1992Jul28.231632.16827@wega.rz.uni-ulm.de>, ORAKEL@rzmain.rz.uni-ulm.de (Framstag) writes...
  15. >I want to check in a FORTRAN program the existens of a VMS rights
  16. >identifier, which are listed as "Process rights" in SHOW PROCESS/PRIV.
  17. >A simple example would be fine ... or a hint where to look in which fine
  18. >manual :-)
  19. >thanx - Ulli
  20.  
  21. Since this is not the first time someone has asked, I will post a FORTRAN
  22. function that performs this operation.
  23.  
  24. The following is a logical function that will return true if a user
  25. possesses a specific rights identifier.
  26.  
  27. As far as I know these item codes are not in the manual...
  28.  
  29. Thanks,
  30. Bill
  31.  
  32. -------------------------------------CUT HERE-----------------------------------
  33.  
  34. * This function returns true if a person has the identifier passed in
  35. * set in his/her process rightslist.
  36.  
  37.       logical *4 function id_set (ident)
  38.       implicit none
  39.  
  40. * Parameter lsize set to 512 will allow for the first 256 (approximately)
  41. * identifiers of a process.  Should a user have more than 256 identifiers
  42. * set, then this number should be increased.
  43.  
  44.       parameter lsize = 512
  45.       character *(*) ident
  46.       character *31 name
  47.       integer *4 status,rights_size,rights_len,sys$getjpi,i,context
  48.       integer *4 rights(lsize),name_dsc(2)/31,0/,sys$idtoasc,length
  49.       structure /item_list_3/
  50.         union
  51.           map
  52.             integer *2 buf_len,it_code
  53.             integer *4 buf_adr,ret_len
  54.           end map
  55.           map
  56.             integer *4 end,%fill
  57.           end map
  58.         end union
  59.       end structure
  60.       record /item_list_3/ list(2)
  61.  
  62.       list(1).buf_len = 16
  63. * Parameter JPI$_RIGHTS_SIZE (value 817) is not currently in FORSYSDEF.TLB.
  64.       list(1).it_code = 817
  65.       list(1).buf_adr = %loc(rights_size)
  66.       list(1).ret_len = 0
  67.       list(2).end = 0
  68.       status = sys$getjpi(,,,list,,,)
  69.       if (.not.status) call lib$signal(%val(status))
  70.  
  71.       list(1).buf_len = rights_size
  72. * Parameter JPI$_PROCESS_RIGHTS (value 814) is not currently in FORSYSDEF.TLB.
  73.       list(1).it_code = 814
  74.       list(1).buf_adr = %loc(rights)
  75.       list(1).ret_len = %loc(rights_len)
  76.       list(2).end = 0
  77.       status = sys$getjpi(,,,list,,,)
  78.       if (.not.status) call lib$signal(%val(status))
  79.  
  80.       name_dsc(2) = %loc(name)
  81.       id_set = .false.
  82.       context = 0
  83.  
  84.       do i = 1,lsize
  85.         status = sys$idtoasc(%val(rights(i)),length,name_dsc,,,context)
  86.         if (name.eq.ident) id_set = .true.
  87.       enddo
  88.  
  89.       end
  90.  
  91. -----------------------------------END OF CUT-----------------------------------
  92.