diff options
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | src/sss_client/common.c | 18 | ||||
-rw-r--r-- | src/sss_client/sss_cli.h | 6 |
4 files changed, 30 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index b8fb9e09..116b26a7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -209,6 +209,7 @@ AM_CPPFLAGS = \ -DSSS_NSS_SOCKET_NAME=\"$(pipepath)/nss\" \ -DSSS_PAM_SOCKET_NAME=\"$(pipepath)/pam\" \ -DSSS_PAM_PRIV_SOCKET_NAME=\"$(pipepath)/private/pam\" \ + -DSSS_SUDO_SOCKET_NAME=\"$(pipepath)/sudo\" \ -DLOCALEDIR=\"$(localedir)\" EXTRA_DIST = build/config.rpath diff --git a/configure.ac b/configure.ac index b371ad13..61256a72 100644 --- a/configure.ac +++ b/configure.ac @@ -219,6 +219,11 @@ AM_CONDITIONAL([HAVE_DOXYGEN], [test x$DOXYGEN != xfalse ]) AM_CONDITIONAL([HAVE_CHECK], [test x$have_check != x]) +AM_CONDITIONAL([BUILD_SUDO], [test x$build_all_experimental_features != xno]) +if test x$build_all_experimental_features != xno; then + AC_DEFINE(BUILD_SUDO, 1, [whether to build with SUDO support]) +fi + abs_build_dir=`pwd` AC_DEFINE_UNQUOTED([ABS_BUILD_DIR], ["$abs_build_dir"], [Absolute path to the build directory]) AC_SUBST([abs_builddir], $abs_build_dir) 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) |