keys: Add a keyctl to move a key between keyrings
Add a keyctl to atomically move a link to a key from one keyring to another. The key must exist in "from" keyring and a flag can be given to cause the operation to fail if there's a matching key already in the "to" keyring. This can be done with: keyctl(KEYCTL_MOVE, key_serial_t key, key_serial_t from_keyring, key_serial_t to_keyring, unsigned int flags); The key being moved must grant Link permission and both keyrings must grant Write permission. flags should be 0 or KEYCTL_MOVE_EXCL, with the latter preventing displacement of a matching key from the "to" keyring. Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
@@ -310,6 +310,11 @@ extern int key_update(key_ref_t key,
|
||||
extern int key_link(struct key *keyring,
|
||||
struct key *key);
|
||||
|
||||
extern int key_move(struct key *key,
|
||||
struct key *from_keyring,
|
||||
struct key *to_keyring,
|
||||
unsigned int flags);
|
||||
|
||||
extern int key_unlink(struct key *keyring,
|
||||
struct key *key);
|
||||
|
||||
|
Reference in New Issue
Block a user