libsss_sudo provides a mechanism to for a SUDO plugin to communicate with the sudo responder of SSSD.
More...
Macros |
#define | SSS_SUDO_ERROR_OK 0 |
| The value returned when the communication with SUDO is successful and the user was found in one of the domains.
|
Functions |
int | sss_sudo_send_recv (uid_t uid, const char *username, const char *domainname, uint32_t *_error, struct sss_sudo_result **_result) |
| Send a request to SSSD to retreive all SUDO rules for a given user.
|
int | sss_sudo_send_recv_defaults (uid_t uid, const char *username, uint32_t *_error, char **_domainname, struct sss_sudo_result **_result) |
| Send a request to SSSD to retrieve the default options, commonly stored in the "cn=defaults" record,.
|
void | sss_sudo_free_result (struct sss_sudo_result *result) |
| Free the sss_result structure returned by sss_sudo_send_recv.
|
int | sss_sudo_get_values (struct sss_sudo_rule *e, const char *attrname, char ***values) |
| Get all values for a given attribute in a sss_rule.
|
void | sss_sudo_free_values (char **values) |
| Free the values returned by sss_sudo_get_values.
|
Detailed Description
libsss_sudo provides a mechanism to for a SUDO plugin to communicate with the sudo responder of SSSD.
Function Documentation
Free the sss_result structure returned by sss_sudo_send_recv.
- Parameters
-
[in] | result | The sss_result structure to free. The structure was previously returned by sss_sudo_get_values(). |
void sss_sudo_free_values |
( |
char ** |
values | ) |
|
Free the values returned by sss_sudo_get_values.
- Parameters
-
int sss_sudo_get_values |
( |
struct sss_sudo_rule * |
e, |
|
|
const char * |
attrname, |
|
|
char *** |
values |
|
) |
| |
Get all values for a given attribute in a sss_rule.
- Parameters
-
[in] | e | The sss_rule to get values from |
[in] | attrname | The name of the attribute to query from the rule |
[out] | values | A newly allocated list of values the attribute has in rule. On success, this parameter is an array of NULL-terminated strings, the last element is a NULL pointer. On failure (including when the attribute is not found), the pointer address is not changed. |
- Returns
- 0 on success, ENOENT in case the attribute is not found and other errno values on failure.
- Note
- the returned values should be freed using sss_sudo_free_values()
int sss_sudo_send_recv |
( |
uid_t |
uid, |
|
|
const char * |
username, |
|
|
const char * |
domainname, |
|
|
uint32_t * |
_error, |
|
|
struct sss_sudo_result ** |
_result |
|
) |
| |
Send a request to SSSD to retreive all SUDO rules for a given user.
- Parameters
-
[in] | uid | The uid of the user to retreive the rules for. |
[in] | username | The username to retreive the rules for |
[in] | domainname | The domain name the user is a member of. |
[out] | _error | The result of the search in SSSD's domains. If the user was present in the domain, the _error code is SSS_SUDO_ERROR_OK and the _result structure is returned even if it was empty (in other words _result->num_rules == 0). Other problems are returned as errno codes. Most prominently these are ENOENT (the user was not found with SSSD), EIO (SSSD encountered an internal problem) and EINVAL (malformed query). |
[out] | _result | Newly allocated structure sss_result that contains the rules for the user. If no rules were found but the user was valid, this structure is "empty", which means that the num_rules member is 0. |
- Returns
- 0 on success and other errno values on failure. The return value denotes whether communication with SSSD was successful. It does not tell whether the result contains any rules or whether SSSD knew the user at all. That information is transferred in the _error parameter.
int sss_sudo_send_recv_defaults |
( |
uid_t |
uid, |
|
|
const char * |
username, |
|
|
uint32_t * |
_error, |
|
|
char ** |
_domainname, |
|
|
struct sss_sudo_result ** |
_result |
|
) |
| |
Send a request to SSSD to retrieve the default options, commonly stored in the "cn=defaults" record,.
- Parameters
-
[in] | uid | The uid of the user to retreive the rules for. |
[in] | username | The username to retreive the rules for. |
[out] | _error | The result of the search in SSSD's domains. If the options were present in the domain, the _error code is SSS_SUDO_ERROR_OK and the _result structure is returned even if it was empty (in other words _result->num_rules == 0). Other problems are returned as errno codes. |
[out] | _domainname | The domain name the user is a member of. |
[out] | _result | Newly allocated structure sss_result that contains the options. If no options were found this structure is "empty", which means that the num_rules member is 0. |
- Returns
- 0 on success and other errno values on failure. The return value denotes whether communication with SSSD was successful. It does not tell whether the result contains any rules or whether SSSD knew the user at all. That information is transferred in the _error parameter.
- Note
- The _domainname should be freed using free().