jpayne@68: .\" jpayne@68: .\" Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. jpayne@68: .\" Written by David Howells (dhowells@redhat.com) jpayne@68: .\" jpayne@68: .\" This program is free software; you can redistribute it and/or jpayne@68: .\" modify it under the terms of the GNU General Public License jpayne@68: .\" as published by the Free Software Foundation; either version jpayne@68: .\" 2 of the License, or (at your option) any later version. jpayne@68: .\" jpayne@68: .TH KEYCTL_DESCRIBE 3 "4 May 2006" Linux "Linux Key Management Calls" jpayne@68: .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" jpayne@68: .SH NAME jpayne@68: keyctl_describe \- describe a key jpayne@68: .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" jpayne@68: .SH SYNOPSIS jpayne@68: .nf jpayne@68: .B #include jpayne@68: .sp jpayne@68: .BI "long keyctl_describe(key_serial_t " key ", char *" buffer , jpayne@68: .BI "size_t" buflen ");" jpayne@68: .sp jpayne@68: .BI "long keyctl_describe_alloc(key_serial_t " key ", char **" _buffer ");" jpayne@68: .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" jpayne@68: .SH DESCRIPTION jpayne@68: .BR keyctl_describe () jpayne@68: describes the attributes of a key as a NUL-terminated string. jpayne@68: .P jpayne@68: The caller must have jpayne@68: .B view jpayne@68: permission on a key to be able to get a description of it. jpayne@68: .P jpayne@68: .I buffer jpayne@68: and jpayne@68: .I buflen jpayne@68: specify the buffer into which the key description will be placed. If the jpayne@68: buffer is too small, the full size of the description will be returned, and no jpayne@68: copy will take place. jpayne@68: .P jpayne@68: .BR keyctl_describe_alloc () jpayne@68: is similar to jpayne@68: .BR keyctl_describe () jpayne@68: except that it allocates a buffer big enough to hold the description and jpayne@68: places the description in it. If successful, A pointer to the buffer is jpayne@68: placed in jpayne@68: .IR *_buffer . jpayne@68: The caller must free the buffer. jpayne@68: .P jpayne@68: The description will be a string of format: jpayne@68: .IP jpayne@68: .B "\*(lq%s;%d;%d;%08x;%s\*(rq" jpayne@68: .P jpayne@68: where the arguments are: key type name, key UID, key GID, key permissions mask jpayne@68: and key description. jpayne@68: .P jpayne@68: .B NOTE! jpayne@68: The key description will not contain any semicolons, so that should be jpayne@68: separated out by working backwards from the end of the string. This permits jpayne@68: extra information to be inserted before it by later versions of the kernel jpayne@68: simply by inserting more semicolon-terminated substrings. jpayne@68: .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" jpayne@68: .SH RETURN VALUE jpayne@68: On success jpayne@68: .BR keyctl_describe () jpayne@68: returns the amount of data placed into the buffer. If the buffer was too jpayne@68: small, then the size of buffer required will be returned, but no data will be jpayne@68: transferred. On error, the value jpayne@68: .B -1 jpayne@68: will be returned and jpayne@68: .I errno jpayne@68: will have been set to an appropriate error. jpayne@68: .P jpayne@68: On success jpayne@68: .BR keyctl_describe_alloc () jpayne@68: returns the amount of data in the buffer, less the NUL terminator. On error, the value jpayne@68: .B -1 jpayne@68: will be returned and jpayne@68: .I errno jpayne@68: will have been set to an appropriate error. jpayne@68: .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" jpayne@68: .SH ERRORS jpayne@68: .TP jpayne@68: .B ENOKEY jpayne@68: The key specified is invalid. jpayne@68: .TP jpayne@68: .B EKEYEXPIRED jpayne@68: The key specified has expired. jpayne@68: .TP jpayne@68: .B EKEYREVOKED jpayne@68: The key specified had been revoked. jpayne@68: .TP jpayne@68: .B EACCES jpayne@68: The key exists, but is not jpayne@68: .B viewable jpayne@68: by the calling process. jpayne@68: .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" jpayne@68: .SH LINKING jpayne@68: This is a library function that can be found in jpayne@68: .IR libkeyutils . jpayne@68: When linking, jpayne@68: .B \-lkeyutils jpayne@68: should be specified to the linker. jpayne@68: .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" jpayne@68: .SH SEE ALSO jpayne@68: .ad l jpayne@68: .nh jpayne@68: .BR keyctl (1), jpayne@68: .BR add_key (2), jpayne@68: .BR keyctl (2), jpayne@68: .BR request_key (2), jpayne@68: .BR keyctl (3), jpayne@68: .BR keyrings (7), jpayne@68: .BR keyutils (7)