Elektra
0.8.16
|
Obsolete owner methods. More...
Functions | |
const char * | keyOwner (const Key *key) |
Return a pointer to the real internal key owner. More... | |
ssize_t | keyGetOwnerSize (const Key *key) |
Return the size of the owner of the Key with concluding 0. More... | |
ssize_t | keyGetOwner (const Key *key, char *returnedOwner, size_t maxSize) |
Return the owner of the key. More... | |
ssize_t | keySetOwner (Key *key, const char *newOwner) |
Set the owner of a key. More... | |
Obsolete owner methods.
ssize_t keyGetOwner | ( | const Key * | key, |
char * | returnedOwner, | ||
size_t | maxSize | ||
) |
Return the owner of the key.
user:someuser/
..... return someuser
user:some.user/
.... return some.user
user/
.... return the current userOnly user/
... keys have a owner. For system/
... keys (that doesn't have a key owner) an empty string ("") is returned.
Although usually the same, the owner of a key is not related to its UID. Owner are related to WHERE the key is stored on disk, while UIDs are related to mode controls of a key.
key | the object to work with |
returnedOwner | a pre-allocated space to store the owner |
maxSize | maximum number of bytes that fit returned |
1 | if there is no owner |
-1 | on NULL pointers |
-1 | when maxSize is 0, larger than SSIZE_MAX or too small for ownername |
ssize_t keyGetOwnerSize | ( | const Key * | key | ) |
Return the size of the owner of the Key with concluding 0.
The returned number can be used to allocate a string. 1 will returned on an empty owner to store the concluding 0 on using keyGetOwner().
key | the key object to work with |
1 | if there is no owner |
-1 | on NULL pointer |
const char* keyOwner | ( | const Key * | key | ) |
Return a pointer to the real internal key
owner.
This is a much more efficient version of keyGetOwner() and you should use it if you are responsible enough to not mess up things. You are not allowed to modify the returned string in any way. If you need a copy of the string, consider to use keyGetOwner() instead.
keyOwner() returns "" when there is no keyOwner. The reason is
key | the key object to work with |
"" | when there is no (a empty) owner |
0 | iff key is a NULL pointer |
ssize_t keySetOwner | ( | Key * | key, |
const char * | newOwner | ||
) |
Set the owner of a key.
A owner is a name of a system user related to a UID. The owner decides on which location on the disc the key goes.
A private copy is stored, so the passed parameter can be freed after the call.
key | the key object to work with |
newOwner | the string which describes the owner of the key |
1 | when owner is freed (by setting 0 or "") |
-1 | on null pointer or memory problems |