Functions | |
ssize_t | keySetOwner (Key *key, const char *userDomain) |
Set the user domain of a key. | |
ssize_t | keyGetOwnerSize (const Key *key) |
Return the size of the user domain of the Key. | |
ssize_t | keyGetOwner (const Key *key, char *returned, size_t maxSize) |
Return the user domain of the key. | |
char * | keyStealOwner (const Key *key) |
Return a pointer to the real internal key owner or user domain. | |
ssize_t | keySetComment (Key *key, const char *newComment) |
Set a comment for a key. | |
ssize_t | keyGetCommentSize (const Key *key) |
Calculates number of bytes needed to store a key comment, including final NULL. | |
ssize_t | keyGetComment (const Key *key, char *returnedDesc, size_t maxSize) |
Get the key comment. | |
char * | keyStealComment (const Key *key) |
Return a pointer to the real internal key comment. | |
uid_t | keyGetUID (const Key *key) |
Get the user ID of a key. | |
int | keySetUID (Key *key, uid_t uid) |
Set the user ID of a key. | |
gid_t | keyGetGID (const Key *key) |
Get the system's group ID of a key. | |
int | keySetGID (Key *key, gid_t gid) |
Set the system's group ID of a key. | |
mode_t | keyGetAccess (const Key *key) |
Return the key filesystem-like access permissions. | |
int | keySetAccess (Key *key, mode_t mode) |
Set the key filesystem-like access permissions. | |
time_t | keyGetMTime (const Key *key) |
Get last modification time of the key on disk. | |
time_t | keyGetATime (const Key *key) |
Get last time the key data was read from disk. | |
time_t | keyGetCTime (const Key *key) |
Get last time the key was stated from disk. | |
int | keySetFlag (Key *key) |
Set a general flag in the Key. | |
int | keyClearFlag (Key *key) |
Clear the general flag in the Key. | |
int | keyGetFlag (const Key *key) |
Get the flag from the Key. |
To use them:
#include <kdb.h>
Key metainfo are:
The comment can contain userdata which directly belong to that key.
User domain is the user that owns the key. It only works for the user/ hierachy.
Every user and group of your System has a uniqe ID. These values are used in the keys too. They are very important for the access. See man 2 chown.
With the access mode you can choose if a user, group or the world can access your key. See man 2 chmod.
|
Set the user domain of a key. A user domain is a user name. A private copy is stored, so the passed parameter can be freed after the call.
Definition at line 1946 of file key.c. References _Key::flags, KEY_SWITCH_DOMAIN, strblen(), and _Key::userDomain. |
|
Return the size of the user domain of the Key.
Definition at line 1997 of file key.c. References strblen(), and _Key::userDomain. |
|
Return the user domain of the key.
Only Although usually the same, the user domain of a key is not related to its UID. User domains are related to WHERE the key is stored on disk, while UIDs are related to access controls of a key.
Definition at line 2034 of file key.c. References strblen(), and _Key::userDomain. |
|
Return a pointer to the real internal This is a much more efficient version of keyGetOwner() and you should use it if you are responsible enough to not mess up things.
Definition at line 2066 of file key.c. References _Key::userDomain. |
|
Set a comment for a key. A key comment is like a configuration file comment. It has no size limit. A private copy will be stored.
Definition at line 2092 of file key.c. References _Key::comment, _Key::commentSize, _Key::flags, KEY_SWITCH_COMMENT, and strblen(). Referenced by commandSet(), keyDup(), and keyNew(). |
|
Calculates number of bytes needed to store a key comment, including final NULL. Use this method to allocate memory to retrieve a key comment.
Definition at line 2138 of file key.c. References _Key::comment, and strblen(). Referenced by commandGet(). |
|
Get the key comment. A Key comment is pretty much as a comment in a text configuration file.
Definition at line 2165 of file key.c. References _Key::comment, and strblen(). Referenced by commandGet(). |
|
Return a pointer to the real internal This is a much more efficient version of keyGetComment() and you should use it if you are responsible enough to not mess up things.
Definition at line 2197 of file key.c. References _Key::comment. |
|
Get the user ID of a key. Although usually the same, the UID of a key is not related to its user domain.
Definition at line 2282 of file key.c. References _Key::uid. |
|
Set the user ID of a key. Although usually the same, the UID of a key is not related to its user domain.
Definition at line 2305 of file key.c. References _Key::flags, KEY_SWITCH_UID, and _Key::uid. Referenced by commandSet(), and keyNew(). |
|
Get the system's group ID of a key.
Definition at line 2324 of file key.c. References _Key::gid. |
|
Set the system's group ID of a key.
Definition at line 2344 of file key.c. References _Key::flags, _Key::gid, and KEY_SWITCH_GID. Referenced by commandSet(), and keyNew(). |
|
Return the key filesystem-like access permissions.
Definition at line 2361 of file key.c. References _Key::access. |
|
Set the key filesystem-like access permissions.
Definition at line 2381 of file key.c. References _Key::access, _Key::flags, and KEY_SWITCH_MODE. Referenced by commandSet(), and keyNew(). |
|
Set a general flag in the Key. The flag has no semantics to the library, only to your application. It is just a simple marker that you may use to put the key on a special state that makes sense to your application.
Definition at line 2875 of file key.c. References _Key::flags. |
|
Clear the general flag in the Key. The flag has no semantics to the library, only to your application. It is just a simple marker that you may use to put the key on a special state that makes sense to your application.
Definition at line 2899 of file key.c. References _Key::flags. |
|
Get the flag from the Key. The flag has no semantics to the library, only to your application. It is just a simple marker that you may use to put the key on a special state that makes sense to your application.
Definition at line 2924 of file key.c. References _Key::flags. |