Sophie

Sophie

distrib > Mageia > 7 > armv7hl > by-pkgid > 7ae1326686fcee9e8495e4e7a232d717 > files > 2

openafs-1.8.3-1.mga7.src.rpm

From 02d82275c17284d04629282aa374bb39f511c989 Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Thu, 8 Aug 2019 16:53:13 -0600
Subject: [PATCH] LINUX 5.3.0: Check for 'recurse' arg in keyring_search

Linux 5.3.0 commit dcf49dbc8077e278ddd1bc7298abc781496e8a08 "keys: Add a
'recurse' flag for keyring searches" adds a new parameter to
Linux kernel keyring_search function.

Update the call to keyring_search to include the recurse parameter if
available. Setting the parameter to true (1) maintains the current
search behavior.

Change-Id: I54b7ed686bf1fb4c42789e5d251ae76789e9fc88
Reviewed-on: https://gerrit.openafs.org/13752
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
---
 src/afs/LINUX/osi_compat.h      |    6 ++++++
 src/cf/linux-kernel-assorted.m4 |    1 +
 src/cf/linux-test4.m4           |   13 +++++++++++++
 3 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h
index abe6b71..d236081 100644
--- a/src/afs/LINUX/osi_compat.h
+++ b/src/afs/LINUX/osi_compat.h
@@ -222,9 +222,15 @@ afs_linux_search_keyring(afs_ucred_t *cred, struct key_type *type)
     key_ref_t key_ref;
 
     if (afs_session_keyring(cred)) {
+#  if defined(KEYRING_SEARCH_TAKES_RECURSE)
+	key_ref = keyring_search(
+		      make_key_ref(afs_session_keyring(cred), 1),
+		      type, "_pag", 1);
+#  else
 	key_ref = keyring_search(
 		      make_key_ref(afs_session_keyring(cred), 1),
 		      type, "_pag");
+#  endif
 	if (IS_ERR(key_ref))
 	    return ERR_CAST(key_ref);
 
diff --git a/src/cf/linux-kernel-assorted.m4 b/src/cf/linux-kernel-assorted.m4
index 191b603..6fa6051 100644
--- a/src/cf/linux-kernel-assorted.m4
+++ b/src/cf/linux-kernel-assorted.m4
@@ -55,6 +55,7 @@ LINUX_DOP_D_REVALIDATE_TAKES_UNSIGNED
 LINUX_IOP_LOOKUP_TAKES_UNSIGNED
 LINUX_D_INVALIDATE_IS_VOID
 LINUX_KERNEL_READ_OFFSET_IS_LAST
+LINUX_KEYRING_SEARCH_TAKES_RECURSE
 ])
 
 
diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
index cf82056..f7699ce 100644
--- a/src/cf/linux-test4.m4
+++ b/src/cf/linux-test4.m4
@@ -836,3 +836,16 @@ AC_DEFUN([LINUX_KERNEL_READ_OFFSET_IS_LAST], [
                        [define if your kernel_read has offset as the last argument],
                        [])
 ])
+
+AC_DEFUN([LINUX_KEYRING_SEARCH_TAKES_RECURSE], [
+  AC_CHECK_LINUX_BUILD([whether keyring_search has the recurse parameter],
+                       [ac_cv_linux_func_keyring_search_takes_recurse],
+                       [#include <linux/key.h>
+                       key_ref_t tkey;],
+                       [
+                       keyring_search(tkey, NULL, NULL, 0);
+                       ],
+                       [KEYRING_SEARCH_TAKES_RECURSE],
+                       [define if your keyring_search has the recurse parameter],
+                       [])
+])
-- 
1.7.1