summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2011-10-10 14:50:36 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-12-16 14:46:17 -0500
commit0ef783e186ef1c9f60e61a4e8e54c44cb366fdfe (patch)
treea8fd358314ba410de24375aa8e9e20abce5d1f5d
parent75a43c7f91fcb27dee75976cc7c094dd5fa589f6 (diff)
downloadsssd-0ef783e186ef1c9f60e61a4e8e54c44cb366fdfe.tar.gz
sssd-0ef783e186ef1c9f60e61a4e8e54c44cb366fdfe.tar.xz
sssd-0ef783e186ef1c9f60e61a4e8e54c44cb366fdfe.zip
SUDO integration - client common interface
-rw-r--r--Makefile.am1
-rw-r--r--configure.ac5
-rw-r--r--src/sss_client/common.c18
-rw-r--r--src/sss_client/sss_cli.h6
4 files changed, 30 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index b8fb9e094..116b26a79 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 b371ad132..61256a728 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 a9dc2354b..94d15a529 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 788112ec2..33e944166 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)