text
stringlengths
0
234
the id of the key that is to be instantiated.
.ip [3]
the filesystem uid of the caller of
.br request_key ().
.ip [4]
the filesystem gid of the caller of
.br request_key ().
.ip [5]
the id of the thread keyring of the caller of
.br request_key ().
this may be zero if that keyring hasn't been created.
.ip [6]
the id of the process keyring of the caller of
.br request_key ().
this may be zero if that keyring hasn't been created.
.ip [7]
the id of the session keyring of the caller of
.br request_key ().
.re
.ip
.ir note :
each of the command-line arguments that is a key id is encoded in
.ir decimal
(unlike the key ids shown in
.ir /proc/keys ,
which are shown as hexadecimal values).
.ip d)
the program spawned in the previous step:
.rs
.ip * 3
assumes the authority to instantiate the key u using the
.br keyctl (2)
.br keyctl_assume_authority
operation (typically via the
.br keyctl_assume_authority (3)
function).
.ip *
obtains the callout data from the payload of the authorization key v
(using the
.br keyctl (2)
.br keyctl_read
operation (or, more commonly, the
.br keyctl_read (3)
function) with a key id value of
.br key_spec_reqkey_auth_key ).
.ip *
instantiates the key
(or execs another program that performs that task),
specifying the payload and destination keyring.
(the destination keyring that the requestor specified when calling
.br request_key ()
can be accessed using the special key id
.br key_spec_requestor_keyring .)
.\" should an instantiating program be using key_spec_requestor_keyring?
.\" i couldn't find a use in the keyutils git repo.
.\" according to david howells:
.\" * this feature is provided, but not used at the moment.
.\" * a key added to that ring is then owned by the requester
instantiation is performed using the
.br keyctl (2)
.br keyctl_instantiate
operation (or, more commonly, the
.br keyctl_instantiate (3)
function).
at this point, the
.br request_key ()
call completes, and the requesting program can continue execution.
.re
.pp
if these steps are unsuccessful, then an
.br enokey
error will be returned to the caller of
.br request_key ()
and a temporary, negatively instantiated key will be installed
in the keyring specified by
.ir dest_keyring .
this will expire after a few seconds, but will cause subsequent calls to
.br request_key ()
to fail until it does.
the purpose of this negatively instantiated key is to prevent
(possibly different) processes making repeated requests
(that require expensive
.br request\-key (8)
upcalls) for a key that can't (at the moment) be positively instantiated.
.pp
once the key has been instantiated, the authorization key
.rb ( key_spec_reqkey_auth_key )
is revoked, and the destination keyring
.rb ( key_spec_requestor_keyring )
is no longer accessible from the
.br request\-key (8)
program.
.pp
if a key is created, then\(emregardless of whether it is a valid key or
a negatively instantiated key\(emit will displace any other key with
the same type and description from the keyring specified in
.ir dest_keyring .
.sh return value
on success,
.br request_key ()