diff options
author | David Howells | 2019-05-20 21:51:50 +0100 |
---|---|---|
committer | David Howells | 2019-05-30 22:44:48 +0100 |
commit | ed0ac5c7ec3763e3261c48e3c5d4b7528b60fd85 (patch) | |
tree | 865eac3b9b967b974e23190e4e8bccab8f2b87bf /security/keys/compat.c | |
parent | df593ee23e05cdda16c8c995e5818779431bb29f (diff) |
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>
Diffstat (limited to 'security/keys/compat.c')
-rw-r--r-- | security/keys/compat.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/security/keys/compat.c b/security/keys/compat.c index 9482df601dc3..b326bc4f84d7 100644 --- a/security/keys/compat.c +++ b/security/keys/compat.c @@ -159,6 +159,9 @@ COMPAT_SYSCALL_DEFINE5(keyctl, u32, option, return keyctl_pkey_verify(compat_ptr(arg2), compat_ptr(arg3), compat_ptr(arg4), compat_ptr(arg5)); + case KEYCTL_MOVE: + return keyctl_keyring_move(arg2, arg3, arg4, arg5); + default: return -EOPNOTSUPP; } |