1RECURSIVE_KEY_SCAN(3)       Linux Key Utility Calls      RECURSIVE_KEY_SCAN(3)
2
3
4

NAME

6       recursive_key_scan - Apply a function to all keys in a keyring tree
7       recursive_session_key_scan  -  Apply a function to all keys in the ses‐
8       sion keyring tree
9

SYNOPSIS

11       #include <keyutils.h>
12
13       typedef int (*recursive_key_scanner_t)(key_serial_t parent,
14           key_serial_t key, char *desc, int desc_len, void *data);
15
16       long recursive_key_scan(key_serial_t keyring,
17           recursive_key_scanner_t func, void *data);
18       long recursive_session_key_scan(recursive_key_scanner_t func,
19           void *data);
20

DESCRIPTION

22       recursive_key_scan() performs a depth-first recursive scan of the spec‐
23       ified keyring tree and applies func to every link found in the accessi‐
24       ble keyrings in that tree.  data is passed to each invocation of func.
25
26       The return values of func are summed and returned as the overall return
27       value.  Errors are ignored.  Inaccessible keyrings are not scanned, but
28       links to them are still passed to func.
29
30       recursive_session_key_scan() works  exactly  like  recursive_key_scan()
31       with the caller's session keyring specified as the starting keyring.
32
33       The callback function is called for each link found in all the keyrings
34       in the nominated tree and so may be called multiple times for a partic‐
35       ular key if that key has multiple links to it.
36
37       The callback function is passed the following parameters:
38
39       parent The keyring containing the link or 0 for the initial key.
40
41       key    The key to which the link points.
42
43       desc and desc_len
44              A  pointer  to  the  raw description and its length as retrieved
45              with keyctl_describe_alloc().  These will be NULL and -1 respec‐
46              tively  if  the description couldn't be retrieved and errno will
47              retain the error from keyctl_describe_alloc().
48
49       data   The data passed to the scanner function.
50

RETURN VALUE

52       These functions return the sum of the results of the callback functions
53       they invoke.
54

ERRORS

56       Ignored.
57

LINKING

59       When linking, -lkeyutils should be specified to the linker.
60

SEE ALSO

62       keyctl(3), keyctl_describe_alloc(3)
63
64
65
66Linux                             10 Mar 2011            RECURSIVE_KEY_SCAN(3)
Impressum