diff options
author | David Howells <dhowells@redhat.com> | 2013-09-10 18:38:02 +0100 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2013-10-02 15:58:10 +0100 |
commit | 949159b53e688f6daa0e10dd50058a2dd929234d (patch) | |
tree | 4775421c4979f9a55af097a1460e08d62f92f417 /keyutils.h | |
parent | b59512468561ffc3f85d1e808b5d2ae6a6313276 (diff) | |
download | keyutils-949159b53e688f6daa0e10dd50058a2dd929234d.tar.gz |
Lib: Add a function to find a key by type and name, even if non-possessed
Add a function to find a key by its type and name, even if the key is not in
the process's thread, process or session keyrings (ie. it is not 'possessed'
by the process).
This looks in two places:
(1) Firstly, it looks in the processes attached keyrings so that possessed
keys are prioritised over non-possessed keys.
(2) Secondly, it scans /proc/keys, looking for a key matching the name. It
uses keyctl_describe() to check the name because the key description in
/proc/keys may have extra information appended by the type - but this
cannot be distinguished from keys that have stuff that looks like the
extra information embedded in the description.
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'keyutils.h')
-rw-r--r-- | keyutils.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -162,5 +162,7 @@ typedef int (*recursive_key_scanner_t)(key_serial_t parent, key_serial_t key, char *desc, int desc_len, void *data); extern int recursive_key_scan(key_serial_t key, recursive_key_scanner_t func, void *data); extern int recursive_session_key_scan(recursive_key_scanner_t func, void *data); +extern key_serial_t find_key_by_type_and_desc(const char *type, const char *desc, + key_serial_t destringid); #endif /* KEYUTILS_H */ |