Index of Section 2 Manual Pages
| Interix / SUA | getsecret.2 | Interix / SUA |
getsecret(2) getsecret(2)
getsecret
NAME
getsecret(), setsecret - store and retrieve data in Windows LSA secret
area
SYNOPSIS
#include
int getsecret(char *keyname, void *keyvalue, int valuelen);
int setsecret(char *keyname, void *keyvalue, int keyvaluelen);
DESCRIPTION
The setsecret(2) function stores user-specified data in the Windows Local
Security Authority (LSA) secret area. The keyvaluelen argument specifies
the number of bytes in keyvalue to be stored in the secret area, and
keyname identifies the area for subsequent retrieval. If the LSA secret
area already has data identified by keyname, the data is overwritten if
the call to setsecret() is successful.
The getsecret(2) function retrieves the value previously stored in the
area identified by keyname and stores it in the buffer referenced by the
keyvalue argument. The valuelen argument specifies the length of the
keyvalue buffer.
The maximum length of the keyname buffer is 128 bytes. Also, when
retrieving a value, the key passed to getsecret() must match exactly the
key passed to setsecret() when storing the value, including case.
Both of these functions must be called by users with local or domain
administrator rights or system rights.
RETURN VALUES
The setsecret() function returns 0 on success. The getsecret() function
returns the number of bytes returned in keyvalue. On failure, both
functions return -1 and set errno to indicate the error.
ERRORS
Both of these functions can fail for the following reasons:
[EFAULT]
The system detected an invalid address when attempting to use an
argument of a call.
[ENOMEM]
Not enough memory is available to perform the operation.
[E2SMALL]
The data stored in the area identified by keyname is larger than the
buffer referenced by keyvalue.
The getsecret() function can fail for the following reason:
[E2BIG]
The keyname or keyvalue buffer is larger than allowed.
The setsecret() function can fail for the following reason:
[ENOENT]
The LSA secret area does not have data stored in an area identified by
the string in keyname.
USAGE NOTES
All of these functions are thread safe.
None of these functions are async-signal safe.