From b6b22a2dd6f005b6ad692d25288cec07a634fa5d Mon Sep 17 00:00:00 2001 From: David Howells Date: Wed, 2 Oct 2013 16:31:59 +0100 Subject: [PATCH] Version 1.5.7 - Provide a utility function to find a key by type and name. - Allow keyctl commands to take a type+name arg instead of a key-id arg. - Add per-UID get_persistent keyring function. - Fix lib versioning [BZ 1012043] --- .gitignore | 9 +---- get-persist.patch | 101 ---------------------------------------------- keyutils.spec | 12 +++--- sources | 2 +- 4 files changed, 8 insertions(+), 116 deletions(-) delete mode 100644 get-persist.patch diff --git a/.gitignore b/.gitignore index 182aab3..51e11dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1 @@ -keyutils-1.1.tar.bz2 -keyutils-1.2.tar.bz2 -keyutils-1.5.tar.bz2 -/keyutils-1.5.1.tar.bz2 -/keyutils-1.5.2.tar.bz2 -/keyutils-1.5.4.tar.bz2 -/keyutils-1.5.5.tar.bz2 -/keyutils-1.5.6.tar.bz2 +/keyutils-1.5.7.tar.bz2 diff --git a/get-persist.patch b/get-persist.patch deleted file mode 100644 index bae1451..0000000 --- a/get-persist.patch +++ /dev/null @@ -1,101 +0,0 @@ -commit 91252c4e97c19cb6a4cfd2b62980402274cef607 -Author: David Howells -Date: Thu Aug 1 15:12:30 2013 +0100 - - Add per-UID get-persistent keyring function - -diff --git a/keyctl.c b/keyctl.c -index a137e08..dd481a4 100644 ---- a/keyctl.c -+++ b/keyctl.c -@@ -63,6 +63,7 @@ static int act_keyctl_reject(int argc, char *argv[]); - static int act_keyctl_reap(int argc, char *argv[]); - static int act_keyctl_purge(int argc, char *argv[]); - static int act_keyctl_invalidate(int argc, char *argv[]); -+static int act_keyctl_get_persistent(int argc, char *argv[]); - - const struct command commands[] = { - { act_keyctl___version, "--version", "" }, -@@ -73,6 +74,7 @@ const struct command commands[] = { - { act_keyctl_describe, "describe", "" }, - { act_keyctl_instantiate, "instantiate"," " }, - { act_keyctl_invalidate,"invalidate", "" }, -+ { act_keyctl_get_persistent, "get_persistent", " []" }, - { act_keyctl_link, "link", " " }, - { act_keyctl_list, "list", "" }, - { act_keyctl_negate, "negate", " " }, -@@ -1575,6 +1577,38 @@ static int act_keyctl_invalidate(int argc, char *argv[]) - - /*****************************************************************************/ - /* -+ * Get the per-UID persistent keyring -+ */ -+static int act_keyctl_get_persistent(int argc, char *argv[]) -+{ -+ key_serial_t dest, ret; -+ uid_t uid = -1; -+ char *q; -+ -+ if (argc != 2 && argc != 3) -+ format(); -+ -+ dest = get_key_id(argv[1]); -+ -+ if (argc > 2) { -+ uid = strtoul(argv[2], &q, 0); -+ if (*q) { -+ fprintf(stderr, "Unparsable uid: '%s'\n", argv[2]); -+ exit(2); -+ } -+ } -+ -+ ret = keyctl_get_persistent(uid, dest); -+ if (ret < 0) -+ error("keyctl_get_persistent"); -+ -+ /* print the resulting key ID */ -+ printf("%d\n", ret); -+ return 0; -+} -+ -+/*****************************************************************************/ -+/* - * parse a key identifier - */ - static key_serial_t get_key_id(const char *arg) -diff --git a/keyutils.c b/keyutils.c -index 329bfae..060674e 100644 ---- a/keyutils.c -+++ b/keyutils.c -@@ -229,6 +229,11 @@ long keyctl_invalidate(key_serial_t id) - return keyctl(KEYCTL_INVALIDATE, id); - } - -+long keyctl_get_persistent(uid_t uid, key_serial_t id) -+{ -+ return keyctl(KEYCTL_GET_PERSISTENT, uid, id); -+} -+ - /*****************************************************************************/ - /* - * fetch key description into an allocated buffer -diff --git a/keyutils.h b/keyutils.h -index 3ddaeae..49126f7 100644 ---- a/keyutils.h -+++ b/keyutils.h -@@ -97,6 +97,7 @@ typedef uint32_t key_perm_t; - #define KEYCTL_REJECT 19 /* reject a partially constructed key */ - #define KEYCTL_INSTANTIATE_IOV 20 /* instantiate a partially constructed key */ - #define KEYCTL_INVALIDATE 21 /* invalidate a key */ -+#define KEYCTL_GET_PERSISTENT 22 /* get a user's persistent keyring */ - - /* - * syscall wrappers -@@ -150,6 +151,7 @@ extern long keyctl_instantiate_iov(key_serial_t id, - unsigned ioc, - key_serial_t ringid); - extern long keyctl_invalidate(key_serial_t id); -+extern long keyctl_get_persistent(uid_t uid, key_serial_t id); - - /* - * utilities diff --git a/keyutils.spec b/keyutils.spec index f836c0e..f1c9367 100644 --- a/keyutils.spec +++ b/keyutils.spec @@ -1,5 +1,5 @@ %define vermajor 1 -%define verminor 5.6 +%define verminor 5.7 %define version %{vermajor}.%{verminor} %define libdir /%{_lib} %define usrlibdir %{_prefix}/%{_lib} @@ -11,14 +11,13 @@ Summary: Linux Key Management Utilities Name: keyutils Version: %{version} -Release: 2%{?buildid}%{?dist} +Release: 1%{?buildid}%{?dist} License: GPLv2+ and LGPLv2+ Group: System Environment/Base ExclusiveOS: Linux Url: http://people.redhat.com/~dhowells/keyutils/ Source0: http://people.redhat.com/~dhowells/keyutils/keyutils-%{version}.tar.bz2 -Patch1: get-persist.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: glibc-kernheaders >= 2.4-9.1.92 @@ -47,7 +46,6 @@ This package provides headers and libraries for building key utilities. %prep %setup -q -%patch1 -p1 %build make \ @@ -97,8 +95,10 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man3/* %changelog -* Mon Sep 23 2013 David Howells - 1.5.6-2 -- Add provisional support for persistent keyrings. +* Wed Oct 2 2013 David Howells - 1.5.7-1 +- Provide a utility function to find a key by type and name. +- Allow keyctl commands to take a type+name arg instead of a key-id arg. +- Add per-UID get_persistent keyring function. * Thu Aug 29 2013 David Howells - 1.5.6-1 - Fix the request-key.conf.5 manpage. diff --git a/sources b/sources index 9527e9e..2e4d83f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -2a459462c7ebdff0ce2eb398b92ced9c keyutils-1.5.6.tar.bz2 +94eed05b7dad06e2e7e3ac079e9e76c5 keyutils-1.5.7.tar.bz2