module Keyutils::SessionKeyring

This module contains the additional methods included in {Keyutils::Keyring::Session}.

Public Instance Methods

join(name = nil) click to toggle source

Join a different session keyring

Change the session keyring to which a process is subscribed.

If name is nil then a new anonymous keyring will be created, and the process will be subscribed to that.

If name is provided, then if a keyring of that name is available, the process will attempt to subscribe to that keyring, raising an error if that is not permitted; otherwise a new keyring of that name is created and attached as the session keyring.

To attach to an extant named keyring, the keyring must have search permission available to the calling process. @param name [String, nil] name of the keyring to join @return [Keyring] the keyring found or created @raise [Errno::ENOMEM] insufficient memory to create a key @raise [Errno::EDQUOT] the key quota for this user would be exceeded

by creating this key or linking it to the keyring

@raise [Errno::EACCES] the named keyring exists, but is not searchable

by the calling process
# File lib/keyutils/keyring.rb, line 474
def join name = nil
  Keyring.send :new, Lib.keyctl_join_session_keyring(name), name
end
to_parent() click to toggle source

Set the parent process's session keyring.

Changes the session keyring to which the calling process's parent subscribes to be the that of the calling process.

The keyring must have link permission available to the calling process, the parent process must have the same UIDs/GIDs as the calling process, and the LSM must not reject the replacement. Furthermore, this may not be used to affect init or a kernel thread.

Note that the replacement will not take immediate effect upon the parent process, but will rather be deferred to the next time it returns to userspace from kernel space.

@return [Keyring] self @raise [Errno::ENOMEM] insufficient memory to create a key. @raise [Errno::EPERM] the credentials of the parent don't match those of

the caller.

@raise [Errno::EACCES] the named keyring exists, but is not linkable by

the calling process.
# File lib/keyutils/keyring.rb, line 498
def to_parent
  Lib.keyctl_session_to_parent
  self
end