diff options
author | Sumit Bose <sbose@redhat.com> | 2011-05-13 18:41:16 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2012-06-21 15:30:21 -0400 |
commit | e589442117002ab72e4e129232cde8b31eb71f92 (patch) | |
tree | 253beb98fefdb41def5624be78c9e0fadd6a32e2 | |
parent | 33f8decd07d4364a7bfbb051e8dc2da2424b0d01 (diff) | |
download | sssd-e589442117002ab72e4e129232cde8b31eb71f92.tar.gz sssd-e589442117002ab72e4e129232cde8b31eb71f92.tar.bz2 sssd-e589442117002ab72e4e129232cde8b31eb71f92.zip |
PAC client: add basic support in common client code
-rw-r--r-- | src/sss_client/common.c | 33 | ||||
-rw-r--r-- | src/sss_client/sss_cli.h | 5 |
2 files changed, 38 insertions, 0 deletions
diff --git a/src/sss_client/common.c b/src/sss_client/common.c index 9fbb5887..da7d1f95 100644 --- a/src/sss_client/common.c +++ b/src/sss_client/common.c @@ -398,6 +398,8 @@ static bool sss_cli_check_version(const char *socket_name) expected_version = SSS_AUTOFS_PROTOCOL_VERSION; } else if (strcmp(socket_name, SSS_SSH_SOCKET_NAME) == 0) { expected_version = SSS_SSH_PROTOCOL_VERSION; + } else if (strcmp(socket_name, SSS_PAC_SOCKET_NAME) == 0) { + expected_version = SSS_PAC_PROTOCOL_VERSION; } else { return false; } @@ -730,6 +732,37 @@ enum nss_status sss_nss_make_request(enum sss_cli_command cmd, } } +int sss_pac_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; + char *envval; + + /* avoid looping in the nss daemon */ + envval = getenv("_SSS_LOOPS"); + if (envval && strcmp(envval, "NO") == 0) { + return NSS_STATUS_NOTFOUND; + } + + ret = sss_cli_check_socket(errnop, SSS_PAC_SOCKET_NAME); + if (ret != SSS_STATUS_SUCCESS) { + return NSS_STATUS_UNAVAIL; + } + + ret = sss_cli_make_request_nochecks(cmd, rd, repbuf, replen, errnop); + switch (ret) { + case SSS_STATUS_TRYAGAIN: + return NSS_STATUS_TRYAGAIN; + case SSS_STATUS_SUCCESS: + return NSS_STATUS_SUCCESS; + case SSS_STATUS_UNAVAIL: + default: + return NSS_STATUS_UNAVAIL; + } +} + errno_t check_server_cred(int sockfd) { #ifdef HAVE_UCRED diff --git a/src/sss_client/sss_cli.h b/src/sss_client/sss_cli.h index 483b809b..077111c5 100644 --- a/src/sss_client/sss_cli.h +++ b/src/sss_client/sss_cli.h @@ -47,6 +47,7 @@ typedef int errno_t; #define SSS_SUDO_PROTOCOL_VERSION 0 #define SSS_AUTOFS_PROTOCOL_VERSION 1 #define SSS_SSH_PROTOCOL_VERSION 0 +#define SSS_PAC_PROTOCOL_VERSION 1 #ifdef LOGIN_NAME_MAX #define SSS_NAME_MAX LOGIN_NAME_MAX @@ -484,6 +485,10 @@ int sss_pam_make_request(enum sss_cli_command cmd, struct sss_cli_req_data *rd, uint8_t **repbuf, size_t *replen, int *errnop); +int sss_pac_make_request(enum sss_cli_command cmd, + struct sss_cli_req_data *rd, + uint8_t **repbuf, size_t *replen, + int *errnop); int sss_sudo_make_request(enum sss_cli_command cmd, struct sss_cli_req_data *rd, |