diff options
Diffstat (limited to 'man2/keyctl.2')
-rw-r--r-- | man2/keyctl.2 | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/man2/keyctl.2 b/man2/keyctl.2 index d7c06d560..d7bd83d18 100644 --- a/man2/keyctl.2 +++ b/man2/keyctl.2 @@ -5,7 +5,7 @@ .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" -.TH keyctl 2 2023-02-05 "Linux man-pages 6.03" +.TH keyctl 2 2023-05-03 "Linux man-pages 6.05.01" .SH NAME keyctl \- manipulate the kernel's key management facility .SH LIBRARY @@ -14,7 +14,7 @@ Standard C library .PP Alternatively, Linux Key Management Utilities .RI ( libkeyutils ", " \-lkeyutils ); -see NOTES. +see VERSIONS. .SH SYNOPSIS .nf .BR "#include <linux/keyctl.h>" " /* Definition of " KEY* " constants */" @@ -1947,10 +1947,6 @@ was .B KEYCTL_DH_COMPUTE and the initialization of crypto modules has timed out. .SH VERSIONS -This system call first appeared in Linux 2.6.10. -.SH STANDARDS -This system call is a nonstandard Linux extension. -.SH NOTES A wrapper is provided in the .I libkeyutils library. @@ -1960,6 +1956,10 @@ header file.) However, rather than using this system call directly, you probably want to use the various library functions mentioned in the descriptions of individual operations above. +.SH STANDARDS +Linux. +.SH HISTORY +Linux 2.6.10. .SH EXAMPLES The program below provide subset of the functionality of the .BR request\-key (8) @@ -2010,7 +2010,7 @@ we can see the command-line arguments supplied to our example program: .EX $ \fBcat /tmp/key_instantiate.log\fP Time: Mon Nov 7 13:06:47 2016 - +\& Command line arguments: argv[0]: /sbin/request\-key operation: create @@ -2020,7 +2020,7 @@ Command line arguments: thread_keyring: 0 process_keyring: 0 session_keyring: 256e6a6 - +\& Key description: user;1000;1000;3f010000;mykey Auth key payload: somepayloaddata Destination keyring: 256e6a6 @@ -2075,7 +2075,7 @@ $ \fBcat /proc/keys | egrep \[aq]mykey|256e6a6\[aq]\fP .\" SRC BEGIN (key_instantiate.c) .EX /* key_instantiate.c */ - +\& #include <errno.h> #include <keyutils.h> #include <stdint.h> @@ -2084,11 +2084,11 @@ $ \fBcat /proc/keys | egrep \[aq]mykey|256e6a6\[aq]\fP #include <string.h> #include <sys/types.h> #include <time.h> - +\& #ifndef KEY_SPEC_REQUESTOR_KEYRING #define KEY_SPEC_REQUESTOR_KEYRING (\-8) #endif - +\& int main(int argc, char *argv[]) { @@ -2103,22 +2103,22 @@ main(int argc, char *argv[]) time_t t; key_serial_t key_to_instantiate, dest_keyring; key_serial_t thread_keyring, process_keyring, session_keyring; - +\& if (argc != 8) { fprintf(stderr, "Usage: %s op key uid gid thread_keyring " "process_keyring session_keyring\en", argv[0]); exit(EXIT_FAILURE); } - +\& fp = fopen("/tmp/key_instantiate.log", "w"); if (fp == NULL) exit(EXIT_FAILURE); - +\& setbuf(fp, NULL); - +\& t = time(NULL); fprintf(fp, "Time: %s\en", ctime(&t)); - +\& /* * The kernel passes a fixed set of arguments to the program * that it execs; fetch them. @@ -2130,7 +2130,7 @@ main(int argc, char *argv[]) thread_keyring = atoi(argv[5]); process_keyring = atoi(argv[6]); session_keyring = atoi(argv[7]); - +\& fprintf(fp, "Command line arguments:\en"); fprintf(fp, " argv[0]: %s\en", argv[0]); fprintf(fp, " operation: %s\en", operation); @@ -2145,7 +2145,7 @@ main(int argc, char *argv[]) fprintf(fp, " session_keyring: %jx\en", (uintmax_t) session_keyring); fprintf(fp, "\en"); - +\& /* * Assume the authority to instantiate the key named in argv[2]. */ @@ -2154,7 +2154,7 @@ main(int argc, char *argv[]) strerror(errno)); exit(EXIT_FAILURE); } - +\& /* * Fetch the description of the key that is to be instantiated. */ @@ -2163,9 +2163,9 @@ main(int argc, char *argv[]) fprintf(fp, "KEYCTL_DESCRIBE failed: %s\en", strerror(errno)); exit(EXIT_FAILURE); } - +\& fprintf(fp, "Key description: %s\en", dbuf); - +\& /* * Fetch the payload of the authorization key, which is * actually the callout data given to request_key(). @@ -2176,10 +2176,10 @@ main(int argc, char *argv[]) fprintf(fp, "KEYCTL_READ failed: %s\en", strerror(errno)); exit(EXIT_FAILURE); } - +\& auth_key_payload[akp_size] = \[aq]\e0\[aq]; fprintf(fp, "Auth key payload: %s\en", auth_key_payload); - +\& /* * For interest, get the ID of the authorization key and * display it. @@ -2191,9 +2191,9 @@ main(int argc, char *argv[]) strerror(errno)); exit(EXIT_FAILURE); } - +\& fprintf(fp, "Auth key ID: %jx\en", (uintmax_t) auth_key); - +\& /* * Fetch key ID for the request_key(2) destination keyring. */ @@ -2204,9 +2204,9 @@ main(int argc, char *argv[]) strerror(errno)); exit(EXIT_FAILURE); } - +\& fprintf(fp, "Destination keyring: %jx\en", (uintmax_t) dest_keyring); - +\& /* * Fetch the description of the authorization key. This * allows us to see the key type, UID, GID, permissions, @@ -2220,9 +2220,9 @@ main(int argc, char *argv[]) fprintf(fp, "KEYCTL_DESCRIBE failed: %s\en", strerror(errno)); exit(EXIT_FAILURE); } - +\& fprintf(fp, "Auth key description: %s\en", dbuf); - +\& /* * Instantiate the key using the callout data that was supplied * in the payload of the authorization key. @@ -2234,7 +2234,7 @@ main(int argc, char *argv[]) strerror(errno)); exit(EXIT_FAILURE); } - +\& exit(EXIT_SUCCESS); } .EE |