DEVEL15-linux-keytype-exports-20080130

LICENSE IPL10

try to work even if key_type_keyring isn't exported


(cherry picked from commit 9751c68faaff4ab5e4fae7aaad082073ca4daebf)
This commit is contained in:
Simon Wilkinson 2008-01-30 17:30:38 +00:00 committed by Derrick Brashear
parent a78a5e3637
commit f5dcf2aa13
3 changed files with 33 additions and 2 deletions

View File

@ -607,8 +607,8 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
[LINUX_BUILD_VNODE_FROM_INODE(${srcdir}/src/config,src/afs/LINUX,${srcdir}/src/afs/LINUX)]
)
LINUX_KERNEL_COMPILE_WORKS
LINUX_KBUILD_USES_EXTRA_CFLAGS
LINUX_KERNEL_COMPILE_WORKS
LINUX_HAVE_CURRENT_KERNEL_TIME
LINUX_KMEM_CACHE_INIT
LINUX_HAVE_KMEM_CACHE_T
@ -676,6 +676,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
LINUX_REFRIGERATOR
LINUX_LINUX_KEYRING_SUPPORT
LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK
LINUX_EXPORTS_KEY_TYPE_KEYRING
LINUX_DO_SYNC_READ
LINUX_GENERIC_FILE_AIO_READ
LINUX_INIT_WORK_HAS_DATA
@ -1202,7 +1203,7 @@ AC_HEADER_DIRENT
AC_CHECK_HEADERS(stdlib.h string.h unistd.h poll.h fcntl.h sys/time.h sys/file.h)
AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h)
AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h sys/fstyp.h)
AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h)
AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h poll.h)
AC_CHECK_HEADERS(windows.h malloc.h winsock2.h direct.h io.h sys/user.h)
AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h ucontext.h regex.h values.h)

View File

@ -223,7 +223,11 @@ __setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag,
}
#ifdef LINUX_KEYRING_SUPPORT
#ifdef EXPORTS_KEY_TYPE_KEYRING
static struct key_type *__key_type_keyring = &key_type_keyring;
#else
static struct key_type *__key_type_keyring;
#endif
static int
install_session_keyring(struct task_struct *task, struct key *keyring)
@ -623,6 +627,7 @@ extern rwlock_t tasklist_lock __attribute__((weak));
void osi_keyring_init(void)
{
#ifndef EXPORTS_KEY_TYPE_KEYRING
struct task_struct *p;
#ifdef EXPORTED_TASKLIST_LOCK
if (&tasklist_lock)
@ -646,6 +651,7 @@ void osi_keyring_init(void)
else
#endif
rcu_read_unlock();
#endif
#endif
register_key_type(&key_type_afs_pag);

View File

@ -767,6 +767,30 @@ request_key(NULL, NULL, NULL);
AC_DEFINE([LINUX_KEYRING_SUPPORT], 1, [define if your kernel has keyring support])
fi])
AC_DEFUN([LINUX_EXPORTS_KEY_TYPE_KEYRING], [
AC_MSG_CHECKING([for exported key_type_keyring])
AC_CACHE_VAL([ac_cv_linux_exports_key_type_keyring], [
AC_TRY_KBUILD(
[
#include <linux/kernel.h>
#include <linux/rwsem.h>
#ifdef KEY_TYPE_H_EXISTS
#include <linux/key-type.h>
#endif
#include <linux/key.h>
],
[
printk("%x\n", key_type_keyring);
],
ac_cv_linux_exports_key_type_keyring=yes,
ac_cv_linux_exports_key_type_keyring=no)])
AC_MSG_RESULT($ac_cv_linux_exports_key_type_keyring)
if test "x$ac_cv_linux_exports_key_type_keyring" = "xyes"; then
AC_DEFINE([EXPORTS_KEY_TYPE_KEYRING], 1, [define if key_type_keyring is exported])
fi])
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], [