summaryrefslogtreecommitdiff
path: root/security/keys
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2008-11-14 10:39:13 +1100
committerJames Morris <jmorris@namei.org>2008-11-14 10:39:13 +1100
commite9e349b051d98799b743ebf248cc2d986fedf090 (patch)
treed59a46ae39d81d27bcf605663ce0e24d1c6db375 /security/keys
parent76aac0e9a17742e60d408be1a706e9aaad370891 (diff)
KEYS: Disperse linux/key_ui.h
Disperse the bits of linux/key_ui.h as the reason they were put here (keyfs) didn't get in. Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: James Morris <jmorris@namei.org> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/keys')
-rw-r--r--security/keys/internal.h31
-rw-r--r--security/keys/keyring.c1
-rw-r--r--security/keys/request_key.c2
3 files changed, 33 insertions, 1 deletions
diff --git a/security/keys/internal.h b/security/keys/internal.h
index b39f5c2e2c4..a60c68138b4 100644
--- a/security/keys/internal.h
+++ b/security/keys/internal.h
@@ -13,7 +13,6 @@
#define _INTERNAL_H
#include <linux/key-type.h>
-#include <linux/key-ui.h>
static inline __attribute__((format(printf, 1, 2)))
void no_printk(const char *fmt, ...)
@@ -82,6 +81,9 @@ extern struct mutex key_construction_mutex;
extern wait_queue_head_t request_key_conswq;
+extern struct key_type *key_type_lookup(const char *type);
+extern void key_type_put(struct key_type *ktype);
+
extern int __key_link(struct key *keyring, struct key *key);
extern key_ref_t __keyring_search_one(key_ref_t keyring_ref,
@@ -118,6 +120,33 @@ extern struct key *request_key_and_link(struct key_type *type,
struct key *dest_keyring,
unsigned long flags);
+extern key_ref_t lookup_user_key(struct task_struct *context,
+ key_serial_t id, int create, int partial,
+ key_perm_t perm);
+
+extern long join_session_keyring(const char *name);
+
+/*
+ * check to see whether permission is granted to use a key in the desired way
+ */
+extern int key_task_permission(const key_ref_t key_ref,
+ struct task_struct *context,
+ key_perm_t perm);
+
+static inline int key_permission(const key_ref_t key_ref, key_perm_t perm)
+{
+ return key_task_permission(key_ref, current, perm);
+}
+
+/* required permissions */
+#define KEY_VIEW 0x01 /* require permission to view attributes */
+#define KEY_READ 0x02 /* require permission to read content */
+#define KEY_WRITE 0x04 /* require permission to update / modify */
+#define KEY_SEARCH 0x08 /* require permission to search (keyring) or find (key) */
+#define KEY_LINK 0x10 /* require permission to link */
+#define KEY_SETATTR 0x20 /* require permission to change attributes */
+#define KEY_ALL 0x3f /* all the above permissions */
+
/*
* request_key authorisation
*/
diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index a9ab8affc09..fdf75f90199 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -16,6 +16,7 @@
#include <linux/security.h>
#include <linux/seq_file.h>
#include <linux/err.h>
+#include <keys/keyring-type.h>
#include <asm/uaccess.h>
#include "internal.h"
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index a8ebc9520ca..91953c81449 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -19,6 +19,8 @@
#include <linux/slab.h>
#include "internal.h"
+#define key_negative_timeout 60 /* default timeout on a negative key's existence */
+
/*
* wait_on_bit() sleep function for uninterruptible waiting
*/