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]
This commit is contained in:
David Howells 2013-10-02 16:31:59 +01:00
parent 9967c36d47
commit b6b22a2dd6
4 changed files with 8 additions and 116 deletions

9
.gitignore vendored
View File

@ -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

View File

@ -1,101 +0,0 @@
commit 91252c4e97c19cb6a4cfd2b62980402274cef607
Author: David Howells <dhowells@redhat.com>
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", "<keyring>" },
{ act_keyctl_instantiate, "instantiate","<key> <data> <keyring>" },
{ act_keyctl_invalidate,"invalidate", "<key>" },
+ { act_keyctl_get_persistent, "get_persistent", "<keyring> [<uid>]" },
{ act_keyctl_link, "link", "<key> <keyring>" },
{ act_keyctl_list, "list", "<keyring>" },
{ act_keyctl_negate, "negate", "<key> <timeout> <keyring>" },
@@ -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

View File

@ -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 <dhowells@redhat.com> - 1.5.6-2
- Add provisional support for persistent keyrings.
* Wed Oct 2 2013 David Howells <dhowells@redhat.com> - 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 <dhowells@redhat.com> - 1.5.6-1
- Fix the request-key.conf.5 manpage.

View File

@ -1 +1 @@
2a459462c7ebdff0ce2eb398b92ced9c keyutils-1.5.6.tar.bz2
94eed05b7dad06e2e7e3ac079e9e76c5 keyutils-1.5.7.tar.bz2