diff options
author | Pavel Březina <pbrezina@redhat.com> | 2011-10-10 14:50:36 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2011-12-16 14:46:17 -0500 |
commit | 0ef783e186ef1c9f60e61a4e8e54c44cb366fdfe (patch) | |
tree | a8fd358314ba410de24375aa8e9e20abce5d1f5d /src | |
parent | 75a43c7f91fcb27dee75976cc7c094dd5fa589f6 (diff) | |
download | sssd-0ef783e186ef1c9f60e61a4e8e54c44cb366fdfe.tar.gz sssd-0ef783e186ef1c9f60e61a4e8e54c44cb366fdfe.tar.bz2 sssd-0ef783e186ef1c9f60e61a4e8e54c44cb366fdfe.zip |
SUDO integration - client common interface
Diffstat (limited to 'src')
-rw-r--r-- | src/sss_client/common.c | 18 | ||||
-rw-r--r-- | src/sss_client/sss_cli.h | 6 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/sss_client/common.c b/src/sss_client/common.c index a9dc2354..94d15a52 100644 --- a/src/sss_client/common.c +++ b/src/sss_client/common.c @@ -377,6 +377,8 @@ static bool sss_cli_check_version(const char *socket_name) } else if (strcmp(socket_name, SSS_PAM_SOCKET_NAME) == 0 || strcmp(socket_name, SSS_PAM_PRIV_SOCKET_NAME) == 0) { expected_version = SSS_PAM_PROTOCOL_VERSION; + } else if (strcmp(socket_name, SSS_SUDO_SOCKET_NAME) == 0) { + expected_version = SSS_SUDO_PROTOCOL_VERSION; } else { return false; } @@ -811,6 +813,22 @@ out: return ret; } +int sss_sudo_make_request(enum sss_cli_command cmd, + struct sss_cli_req_data *rd, + uint8_t **repbuf, size_t *replen, + int *errnop) +{ + enum sss_status ret = SSS_STATUS_UNAVAIL; + + ret = sss_cli_check_socket(errnop, SSS_SUDO_SOCKET_NAME); + if (ret != SSS_STATUS_SUCCESS) { + return SSS_STATUS_UNAVAIL; + } + + ret = sss_cli_make_request_nochecks(cmd, rd, repbuf, replen, errnop); + + return ret; +} const char *ssscli_err2string(int err) { diff --git a/src/sss_client/sss_cli.h b/src/sss_client/sss_cli.h index 788112ec..33e94416 100644 --- a/src/sss_client/sss_cli.h +++ b/src/sss_client/sss_cli.h @@ -37,6 +37,7 @@ typedef int errno_t; #define SSS_NSS_PROTOCOL_VERSION 1 #define SSS_PAM_PROTOCOL_VERSION 3 +#define SSS_SUDO_PROTOCOL_VERSION 0 /** * @defgroup sss_cli_command SSS client commands @@ -445,6 +446,11 @@ int sss_pam_make_request(enum sss_cli_command cmd, uint8_t **repbuf, size_t *replen, int *errnop); +int sss_sudo_make_request(enum sss_cli_command cmd, + struct sss_cli_req_data *rd, + uint8_t **repbuf, size_t *replen, + int *errnop); + #ifndef SAFEALIGN_COPY_UINT32 static inline void safealign_memcpy(void *dest, const void *src, size_t n, size_t *counter) |