Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
request_key.c File Reference
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/kmod.h>
#include <linux/err.h>
#include <linux/keyctl.h>
#include <linux/slab.h>
#include "internal.h"

Go to the source code of this file.

Macros

#define key_negative_timeout   60 /* default timeout on a negative key's existence */
 

Functions

void complete_request_key (struct key_construction *cons, int error)
 
 EXPORT_SYMBOL (complete_request_key)
 
struct keyrequest_key_and_link (struct key_type *type, const char *description, const void *callout_info, size_t callout_len, void *aux, struct key *dest_keyring, unsigned long flags)
 
int wait_for_key_construction (struct key *key, bool intr)
 
 EXPORT_SYMBOL (wait_for_key_construction)
 
struct keyrequest_key (struct key_type *type, const char *description, const char *callout_info)
 
 EXPORT_SYMBOL (request_key)
 
struct keyrequest_key_with_auxdata (struct key_type *type, const char *description, const void *callout_info, size_t callout_len, void *aux)
 
 EXPORT_SYMBOL (request_key_with_auxdata)
 
struct keyrequest_key_async (struct key_type *type, const char *description, const void *callout_info, size_t callout_len)
 
 EXPORT_SYMBOL (request_key_async)
 
struct keyrequest_key_async_with_auxdata (struct key_type *type, const char *description, const void *callout_info, size_t callout_len, void *aux)
 
 EXPORT_SYMBOL (request_key_async_with_auxdata)
 

Macro Definition Documentation

#define key_negative_timeout   60 /* default timeout on a negative key's existence */

Definition at line 22 of file request_key.c.

Function Documentation

void complete_request_key ( struct key_construction *  cons,
int  error 
)

complete_request_key - Complete the construction of a key. : The key construction record. : The success or failute of the construction.

Complete the attempt to construct a key. The key will be negated if an error is indicated. The authorisation key will be revoked unconditionally.

Definition at line 51 of file request_key.c.

EXPORT_SYMBOL ( complete_request_key  )
EXPORT_SYMBOL ( wait_for_key_construction  )
EXPORT_SYMBOL ( request_key  )
EXPORT_SYMBOL ( request_key_with_auxdata  )
EXPORT_SYMBOL ( request_key_async  )
EXPORT_SYMBOL ( request_key_async_with_auxdata  )
struct key* request_key ( struct key_type *  type,
const char description,
const char callout_info 
)
read

request_key - Request a key and wait for construction : Type of key. : The searchable description of the key. : The data to pass to the instantiation upcall (or NULL).

As for request_key_and_link() except that it does not add the returned key to a keyring if found, new keys are always allocated in the user's quota, the callout_info must be a NUL-terminated string and no auxiliary data can be passed.

Furthermore, it then works as wait_for_key_construction() to wait for the completion of keys undergoing construction with a non-interruptible wait.

Definition at line 599 of file request_key.c.

struct key* request_key_and_link ( struct key_type *  type,
const char description,
const void callout_info,
size_t  callout_len,
void aux,
struct key dest_keyring,
unsigned long  flags 
)
read

request_key_and_link - Request a key and cache it in a keyring. : The type of key we want. : The searchable description of the key. : The data to pass to the instantiation upcall (or NULL). : The length of callout_info. : Auxiliary data for the upcall. : Where to cache the key. : Flags to key_alloc().

A key matching the specified criteria is searched for in the process's keyrings and returned with its usage count incremented if found. Otherwise, if callout_info is not NULL, a key will be allocated and some service (probably in userspace) will be asked to instantiate it.

If successfully found or created, the key will be linked to the destination keyring if one is provided.

Returns a pointer to the key if successful; -EACCES, -ENOKEY, -EKEYREVOKED or -EKEYEXPIRED if an inaccessible, negative, revoked or expired key was found; -ENOKEY if no key was found and no was given; -EDQUOT if insufficient key quota was available to create a new key; or -ENOMEM if insufficient memory was available.

If the returned key was created, then it may still be under construction, and wait_for_key_construction() should be used to wait for that to complete.

Definition at line 508 of file request_key.c.

struct key* request_key_async ( struct key_type *  type,
const char description,
const void callout_info,
size_t  callout_len 
)
read

Definition at line 672 of file request_key.c.

struct key* request_key_async_with_auxdata ( struct key_type *  type,
const char description,
const void callout_info,
size_t  callout_len,
void aux 
)
read

Definition at line 697 of file request_key.c.

struct key* request_key_with_auxdata ( struct key_type *  type,
const char description,
const void callout_info,
size_t  callout_len,
void aux 
)
read

request_key_with_auxdata - Request a key with auxiliary data for the upcaller : The type of key we want. : The searchable description of the key. : The data to pass to the instantiation upcall (or NULL). : The length of callout_info. : Auxiliary data for the upcall.

As for request_key_and_link() except that it does not add the returned key to a keyring if found and new keys are always allocated in the user's quota.

Furthermore, it then works as wait_for_key_construction() to wait for the completion of keys undergoing construction with a non-interruptible wait.

Definition at line 636 of file request_key.c.

int wait_for_key_construction ( struct key key,
bool  intr 
)

wait_for_key_construction - Wait for construction of a key to complete : The key being waited for. : Whether to wait interruptibly.

Wait for a key to finish being constructed.

Returns 0 if successful; -ERESTARTSYS if the wait was interrupted; -ENOKEY if the key was negated; or -EKEYREVOKED or -EKEYEXPIRED if the key was revoked or expired.

Definition at line 570 of file request_key.c.