mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 13:38:01 +00:00
DEVEL15-linux-key-alloc-changes-20090318
LICENSE IPL10 FIXES 124507 Fix the old configure test for key_alloc for the task argument - we can't just rely on the number of arguments anymore. Wish this could be done without using -Werror. Add an additional test for the struct cred argument (cherry picked from commit bf9dc554b366b08ce0bef62ce242c94371938000)
This commit is contained in:
parent
1f5ef2b86a
commit
d53e0310b3
@ -936,6 +936,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
|
||||
LINUX_REFRIGERATOR
|
||||
LINUX_LINUX_KEYRING_SUPPORT
|
||||
LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK
|
||||
LINUX_KEY_ALLOC_NEEDS_CRED
|
||||
LINUX_DO_SYNC_READ
|
||||
LINUX_GENERIC_FILE_AIO_READ
|
||||
LINUX_INIT_WORK_HAS_DATA
|
||||
|
@ -247,11 +247,16 @@ install_session_keyring(struct task_struct *task, struct key *keyring)
|
||||
not_in_quota = KEY_ALLOC_IN_QUOTA;
|
||||
sprintf(desc, "_ses.%u", task->tgid);
|
||||
|
||||
#ifdef KEY_ALLOC_NEEDS_STRUCT_TASK
|
||||
#if defined(KEY_ALLOC_NEEDS_STRUCT_TASK)
|
||||
keyring = key_alloc(__key_type_keyring, desc,
|
||||
task_uid(task), task_gid(task), task,
|
||||
(KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_ALL,
|
||||
not_in_quota);
|
||||
#elif defined(KEY_ALLOC_NEEDS_CRED)
|
||||
keyring = key_alloc(__key_type_keyring, desc,
|
||||
task_uid(task), task_gid(task), current_cred(),
|
||||
(KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_ALL,
|
||||
not_in_quota);
|
||||
#else
|
||||
keyring = key_alloc(__key_type_keyring, desc,
|
||||
task_uid(task), task_gid(task),
|
||||
@ -346,8 +351,10 @@ setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag,
|
||||
perm = KEY_POS_VIEW | KEY_POS_SEARCH;
|
||||
perm |= KEY_USR_VIEW | KEY_USR_SEARCH;
|
||||
|
||||
#ifdef KEY_ALLOC_NEEDS_STRUCT_TASK
|
||||
#if defined(KEY_ALLOC_NEEDS_STRUCT_TASK)
|
||||
key = key_alloc(&key_type_afs_pag, "_pag", 0, 0, current, perm, 1);
|
||||
#elif defined(KEY_ALLOC_NEEDS_CRED)
|
||||
key = key_alloc(&key_type_afs_pag, "_pag", 0, 0, current_cred(), perm, 1);
|
||||
#else
|
||||
key = key_alloc(&key_type_afs_pag, "_pag", 0, 0, perm, 1);
|
||||
#endif
|
||||
|
@ -781,18 +781,41 @@ request_key(NULL, NULL, NULL);
|
||||
AC_DEFUN([LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK], [
|
||||
AC_MSG_CHECKING([if key_alloc() takes a struct task *])
|
||||
AC_CACHE_VAL([ac_cv_key_alloc_needs_struct_task], [
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS -Werror"
|
||||
AC_TRY_KBUILD(
|
||||
[#include <linux/rwsem.h>
|
||||
#include <linux/key.h>
|
||||
],
|
||||
[(void) key_alloc(NULL, NULL, 0, 0, NULL, 0, 0);],
|
||||
[struct task *t;
|
||||
(void) key_alloc(NULL, NULL, 0, 0, t, 0, 0);],
|
||||
ac_cv_key_alloc_needs_struct_task=yes,
|
||||
ac_cv_key_alloc_needs_struct_task=no)])
|
||||
ac_cv_key_alloc_needs_struct_task=no)
|
||||
CPPFLAGS="$save_CPPFLAGS"])
|
||||
AC_MSG_RESULT($ac_cv_key_alloc_needs_struct_task)
|
||||
if test "x$ac_cv_key_alloc_needs_struct_task" = "xyes"; then
|
||||
AC_DEFINE([KEY_ALLOC_NEEDS_STRUCT_TASK], 1, [define if key_alloc takes a struct task *])
|
||||
fi])
|
||||
|
||||
AC_DEFUN([LINUX_KEY_ALLOC_NEEDS_CRED], [
|
||||
AC_MSG_CHECKING([if key_alloc() takes credentials])
|
||||
AC_CACHE_VAL([ac_cv_key_alloc_needs_cred], [
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS -Werror"
|
||||
AC_TRY_KBUILD(
|
||||
[#include <linux/rwsem.h>
|
||||
#include <linux/key.h>
|
||||
],
|
||||
[struct cred *c = NULL;
|
||||
(void) key_alloc(NULL, NULL, 0, 0, c, 0, 0);],
|
||||
ac_cv_key_alloc_needs_cred=yes,
|
||||
ac_cv_key_alloc_needs_cred=no)
|
||||
CPPFLAGS="$save_CPPFLAGS"])
|
||||
AC_MSG_RESULT($ac_cv_key_alloc_needs_cred)
|
||||
if test "x$ac_cv_key_alloc_needs_cred" = "xyes"; then
|
||||
AC_DEFINE([KEY_ALLOC_NEEDS_CRED], 1, [define if key_alloc takes credentials])
|
||||
fi])
|
||||
|
||||
AC_DEFUN([LINUX_DO_SYNC_READ], [
|
||||
AC_MSG_CHECKING([for linux do_sync_read()])
|
||||
AC_CACHE_VAL([ac_cv_linux_do_sync_read], [
|
||||
|
Loading…
x
Reference in New Issue
Block a user