add_key.2: Empty payloads are not allowed in user-defined keys

iBoth add_key and the utility "keyctl add" return EINVAL when
attempting to add a user key with an empty or NULL payload.

The manpage implies that this should be valid.

From my reading of the kernel source, this has not been possible
since at least linux kernel commit 1da177e4 (2.6.12-rc2 on
2005-04-16).

Until kernel commit cf7f601c,
security/keys/user_defined.c:user_instantiate returned -EINVAL
if datalen <= 0.  That commit only moved this behavior to a new
user_preparse function, where it remains today in b562e44f
(4.5.0 on 2016-03-13).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Mitch Walker 2016-06-08 11:56:58 +02:00 committed by Michael Kerrisk
parent 9787e2b681
commit 7f891e5db7
1 changed files with 0 additions and 3 deletions

View File

@ -74,9 +74,6 @@ may be any valid string, though it is preferred that the description be
prefixed with a string representing the service to which the key is of interest
and a colon (for instance
.RB \*(lq afs:mykey \*(rq).
The
.I payload
may be empty or NULL for keys of this type.
.TP
.B \*(lqkeyring\*(rq
Keyrings are special key types that may contain links to sequences of other