libsss_sudo  1.9.2
Data Structures | Macros | Functions
A library for communication between SUDO and SSSD

libsss_sudo provides a mechanism to for a SUDO plugin to communicate with the sudo responder of SSSD. More...

Data Structures

struct  sss_sudo_attr
 Component of a sss_rule structure. More...
struct  sss_sudo_rule
 One sudo rule. More...
struct  sss_sudo_result
 A result object returned from 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

void sss_sudo_free_result ( struct sss_sudo_result result)

Free the sss_result structure returned by sss_sudo_send_recv.

Parameters
[in]resultThe 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
[in]valuesThe list of values to free. The values were previously returned by sss_sudo_get_values()
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]eThe sss_rule to get values from
[in]attrnameThe name of the attribute to query from the rule
[out]valuesA 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]uidThe uid of the user to retreive the rules for.
[in]usernameThe username to retreive the rules for
[in]domainnameThe domain name the user is a member of.
[out]_errorThe 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]_resultNewly 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]uidThe uid of the user to retreive the rules for.
[in]usernameThe username to retreive the rules for.
[out]_errorThe 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]_domainnameThe domain name the user is a member of.
[out]_resultNewly 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().