aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2005-06-24 01:00:51 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 03:05:18 -0400
commit7888e7ff4ee579442128d7d12a9c9dbf2cf7de6a (patch)
treeabe428ecb966e1dae07fce17f38e3e0c0ab4f134 /include
parent76d8aeabfeb1c42641a81c44280177b9a08670d8 (diff)
[PATCH] Keys: Pass session keyring to call_usermodehelper()
The attached patch makes it possible to pass a session keyring through to the process spawned by call_usermodehelper(). This allows patch 3/3 to pass an authorisation key through to /sbin/request-key, thus permitting better access controls when doing just-in-time key creation. Signed-Off-By: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/key.h10
-rw-r--r--include/linux/kmod.h13
2 files changed, 21 insertions, 2 deletions
diff --git a/include/linux/key.h b/include/linux/key.h
index 2c24ffaca86f..2bfbf88d2740 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -273,14 +273,22 @@ extern void key_fsuid_changed(struct task_struct *tsk);
273extern void key_fsgid_changed(struct task_struct *tsk); 273extern void key_fsgid_changed(struct task_struct *tsk);
274extern void key_init(void); 274extern void key_init(void);
275 275
276#define __install_session_keyring(tsk, keyring) \
277({ \
278 struct key *old_session = tsk->signal->session_keyring; \
279 tsk->signal->session_keyring = keyring; \
280 old_session; \
281})
282
276#else /* CONFIG_KEYS */ 283#else /* CONFIG_KEYS */
277 284
278#define key_validate(k) 0 285#define key_validate(k) 0
279#define key_serial(k) 0 286#define key_serial(k) 0
280#define key_get(k) NULL 287#define key_get(k) ({ NULL; })
281#define key_put(k) do { } while(0) 288#define key_put(k) do { } while(0)
282#define alloc_uid_keyring(u) 0 289#define alloc_uid_keyring(u) 0
283#define switch_uid_keyring(u) do { } while(0) 290#define switch_uid_keyring(u) do { } while(0)
291#define __install_session_keyring(t, k) ({ NULL; })
284#define copy_keys(f,t) 0 292#define copy_keys(f,t) 0
285#define copy_thread_group_keys(t) 0 293#define copy_thread_group_keys(t) 0
286#define exit_keys(t) do { } while(0) 294#define exit_keys(t) do { } while(0)
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 95d0e4b0814d..e4a231549407 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -19,6 +19,7 @@
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 20 */
21 21
22#include <linux/stddef.h>
22#include <linux/config.h> 23#include <linux/config.h>
23#include <linux/errno.h> 24#include <linux/errno.h>
24#include <linux/compiler.h> 25#include <linux/compiler.h>
@@ -34,7 +35,17 @@ static inline int request_module(const char * name, ...) { return -ENOSYS; }
34#endif 35#endif
35 36
36#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) 37#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x)))
37extern int call_usermodehelper(char *path, char *argv[], char *envp[], int wait); 38
39struct key;
40extern int call_usermodehelper_keys(char *path, char *argv[], char *envp[],
41 struct key *session_keyring, int wait);
42
43static inline int
44call_usermodehelper(char *path, char **argv, char **envp, int wait)
45{
46 return call_usermodehelper_keys(path, argv, envp, NULL, wait);
47}
48
38extern void usermodehelper_init(void); 49extern void usermodehelper_init(void);
39 50
40#endif /* __LINUX_KMOD_H__ */ 51#endif /* __LINUX_KMOD_H__ */