(PYVMS LOGO) Python on OpenVMS

(go to: table of contents, index, list of vms_sys, prev: FIND_HELD, next: FINISH_RDB)


FIND_HOLDER - Find Holder of Identifier


Returns the holder of a specified identifier.

Format:

    (holder,0), attrib, fnd_ctx = vms_sys.find_holder (id [,contxt])
Returns:
(holder, 0)
Holder identifier returned when FIND_HOLDER completes execution. This is a tuple. The first value is the identifier. The second value is 0 (description of OpenVMS VAX V6.1).
attrib
Mask of attributes associated with the holder record specified by holder. Bitmask values are defined in module 'vms_kgbdef'.
fnd_ctx
Context value after the call to FIND_HOLDER. This value must be fed unchanged into the 'contxt' argument on the next call. A value is always returned, even if the 'contxt' argument is omitted.
Arguments:
id
Binary identifier value whose holders are to be found by FIND_HOLDER.
contxt
Context value used when repeatedly calling FIND_HOLDER. See the system services reference manual for more information.
Examples:
UAF> add /identifier ID_1 /attributes=resource
%UAF-I-RDBADDMSG, identifier ID_1 value %X80010011 added to rights \
 database
UAF> add /identifier ID_2 /attributes=dynamic
%UAF-I-RDBADDMSG, identifier ID_2 value %X80010012 added to rights \
 database
UAF> grant /identifier ID_1 SYSTEM /attributes=resource
%UAF-I-GRANTMSG, identifier ID_1 granted to SYSTEM
UAF> grant /identifier ID_1 ZESSIN /attributes=resource
%UAF-I-GRANTMSG, identifier ID_1 granted to ZESSIN
UAF> show /identifier /full ID_1
  Name                             Value           Attributes
  ID_1                             %X80010011      RESOURCE
    Holder                           Attributes
    SYSTEM                           RESOURCE
    ZESSIN                           RESOURCE
UAF>


>>> import vms_sys

>>> def show_uic (uic_value):
...   high_word = uic_value / 65536
...   low_word  = uic_value - (high_word * 65536)
...   # Note: [1:], because octal values are preceeded by '0'
...   uic_string = \
...     '[' + oct(high_word)[1:] + ',' + oct(low_word)[1:]  + ']'
...   print uic_string
...
>>>


>>> id = 0x80010011    # identifier ID_1
>>> uic, attrib, fnd_ctx = vms_sys.find_holder (id, None)
>>> uic, attrib, fnd_ctx
((65540, 0), 1, 0)
>>> show_uic (uic[0])
[1,4]        <-- UIC of user SYSTEM
>>>
>>> # idtoasc() can be used, but a second context MUST be supplied or
>>> #  the current context is destroyed!
>>> namlen, nambuf, resid, attrib, id_ctx = vms_sys.idtoasc (uic[0],0)
>>> nambuf
'SYSTEM'
>>> fnd_ctx, id_ctx  # FIND_HELD and IDTOASC contexts
(0, 1)               # can be different if other contexts are active
>>> vms_sys.finish_rdb (id_ctx)    # clear idtoasc context
0
>>> # Note: there is no sign that 0x80010011 is granted to more
>>> #       users - a loop (as shown below) must be used

>>> vms_sys.finish_rdb (fnd_ctx)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_sys.error: (316, '%SYSTEM-F-IVCHAN, invalid I/O channel')
>>> # Note: no context was established


>>> id = 0x80010011    # identifier ID_1
>>> contxt = 0         # initialize context
>>> uic, attrib, fnd_ctx = vms_sys.find_holder (id, contxt)
>>> uic, attrib, fnd_ctx
((65540, 0), 1, 1)
>>> show_uic (uic[0])
[1,4]      <-- UIC of user SYSTEM
>>> namlen, nambuf, resid, attrib, id_ctx = vms_sys.idtoasc (uic[0], 0)
>>> nambuf
'SYSTEM'
>>> fnd_ctx, id_ctx  # FIND_HELD and IDTOASC contexts
(1, 2)               # can be different if other contexts are active
>>> vms_sys.finish_rdb (id_ctx)   # clear IDTOASC context
0
>>>
>>> import vms_kgbdef
>>> print attrib, vms_kgbdef.KGB_M_RESOURCE
1 1
>>>
>>> # next call to FIND_HOLDER
>>> contxt = fnd_ctx
>>> uic, attrib, fnd_ctx = vms_sys.find_holder (id, contxt)
>>> uic, attrib, fnd_ctx
((270532617, 0), 1, 1)
>>> show_uic (uic[0])
[10040,11]        <-- UIC of user ZESSIN
>>> # one can call vms_sys.idtoasc here,
>>> # but MUST specify a new context!
>>>
>>> # next call to FIND_HOLDER
>>> contxt = fnd_ctx
>>> uic, attrib, fnd_ctx = vms_sys.find_holder (id, contxt)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_sys.error: (8684, '%SYSTEM-F-NOSUCHID, unknown rights identifier')
>>> # SS$_NOSUCHID signals the end of the search loop
>>> # it is not necessary to call FINISH_RDB in his situation

>>> vms_sys.finish_rdb (fnd_ctx)
0                        <-- the context has been cleared


>>> id = 0x80000001        # this identifier not granted to any UIC
>>> uic, attrib, fnd_ctx = vms_sys.find_holder (id, None)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_sys.error: (8684, '%SYSTEM-F-NOSUCHID, unknown rights identifier')

>>> id = 0x80011234        # this identifier does not exist
>>> uic, attrib, fnd_ctx = vms_sys.find_holder (id, None)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_sys.error: (8684, '%SYSTEM-F-NOSUCHID, unknown rights identifier')
>>>

>>> uic_check = 0x10004        # this is a UIC
>>> uic, attrib, fnd_ctx = vms_sys.find_holder (uic_check)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_sys.error: (8684, '%SYSTEM-F-NOSUCHID, unknown rights identifier')
>>>

(go to: table of contents, index, list of vms_sys, prev: FIND_HELD, next: FINISH_RDB)

27-SEP-1998 ZE.