Add basic credential support and splat tests.

The previous credential implementation simply provided the needed types and
a couple of dummy functions needed.  This update correctly ties the basic
Solaris credential API in to one of two Linux kernel APIs.

Prior to 2.6.29 the linux kernel embeded all credentials in the task
structure.  For these kernels, we pass around the entire task struct as if
it were the credential, then we use the helper functions to extract the
credential related bits.

As of 2.6.29 a new credential type was added which we can and do fairly
cleanly layer on top of.  Once again the helper functions nicely hide
the implementation details from all callers.

Three tests were added to the splat test framework to verify basic
correctness.  They should be extended as needed when need credential
functions are added.
This commit is contained in:
Brian Behlendorf
2009-07-27 17:18:59 -07:00
parent 3d0cb2d31d
commit ec7d53e99a
13 changed files with 839 additions and 56 deletions
+33
View File
@@ -64,6 +64,8 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
SPL_AC_ZONE_STAT_ITEM_FIA
SPL_AC_2ARGS_VFS_UNLINK
SPL_AC_4ARGS_VFS_RENAME
SPL_AC_CRED_STRUCT
SPL_AC_GROUPS_SEARCH
])
AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
@@ -1099,3 +1101,34 @@ AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME],
AC_MSG_RESULT(no)
])
])
dnl #
dnl # 2.6.29 API change,
dnl # check whether 'struct cred' exists
dnl #
AC_DEFUN([SPL_AC_CRED_STRUCT], [
AC_MSG_CHECKING([whether struct cred exists])
SPL_LINUX_TRY_COMPILE([
#include <linux/cred.h>
],[
struct cred *cr;
cr = NULL;
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CRED_STRUCT, 1, [struct cred exists])
],[
AC_MSG_RESULT(no)
])
])
dnl #
dnl # Custom SPL patch may export this symbol
dnl #
AC_DEFUN([SPL_AC_GROUPS_SEARCH], [
SPL_CHECK_SYMBOL_EXPORT(
[groups_search],
[],
[AC_DEFINE(HAVE_GROUPS_SEARCH, 1,
[groups_search() is available])],
[])
])