summaryrefslogtreecommitdiffstats
path: root/sss_client
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2009-03-19 14:50:17 +0100
committerSimo Sorce <ssorce@redhat.com>2009-03-20 11:14:56 -0400
commit7cf16d5930031d07a59a9d4741a49dac4409f695 (patch)
tree7bfc8eec97cd2259fd58b2eab1019101a42b5a67 /sss_client
parent6a3ca34ec2ff7ecaa3b2ddac041ab49dd6a1b17c (diff)
downloadsssd-7cf16d5930031d07a59a9d4741a49dac4409f695.tar.gz
sssd-7cf16d5930031d07a59a9d4741a49dac4409f695.tar.xz
sssd-7cf16d5930031d07a59a9d4741a49dac4409f695.zip
added response type PAM_ENV_ITEM and integrated response data into dbus messages
Diffstat (limited to 'sss_client')
-rw-r--r--sss_client/pam_sss.c32
-rw-r--r--sss_client/sss_cli.h3
2 files changed, 35 insertions, 0 deletions
diff --git a/sss_client/pam_sss.c b/sss_client/pam_sss.c
index 7f854f956..d919c1cf1 100644
--- a/sss_client/pam_sss.c
+++ b/sss_client/pam_sss.c
@@ -36,7 +36,9 @@ struct pam_items {
static int eval_response(pam_handle_t *pamh, int buflen, uint8_t *buf)
{
+ int ret;
int p=0;
+ char *env_item;
int32_t *c;
int32_t *type;
int32_t *len;
@@ -61,6 +63,36 @@ static int eval_response(pam_handle_t *pamh, int buflen, uint8_t *buf)
case PAM_DOMAIN_NAME:
D(("domain name: [%s]", &buf[p]));
break;
+ case ENV_ITEM:
+ case PAM_ENV_ITEM:
+ case ALL_ENV_ITEM:
+ if (buf[p + (*len -1)] != '\0') {
+ D(("env item does not end with \\0.\n"));
+ break;
+ }
+
+ D(("env item: [%s]", &buf[p]));
+ if (*type == PAM_ENV_ITEM || *type == ALL_ENV_ITEM) {
+ ret = pam_putenv(pamh, &buf[p]);
+ if (ret != PAM_SUCCESS) {
+ D(("pam_putenv failed.\n"));
+ break;
+ }
+ }
+
+ if (*type == ENV_ITEM || *type == ALL_ENV_ITEM) {
+ env_item = strdup(&buf[p]);
+ if (env_item == NULL) {
+ D(("strdup failed\n"));
+ break;
+ }
+ ret = putenv(env_item);
+ if (ret == -1) {
+ D(("putenv failed.\n"));
+ break;
+ }
+ }
+ break;
}
p += *len;
diff --git a/sss_client/sss_cli.h b/sss_client/sss_cli.h
index d0eec991b..17749af88 100644
--- a/sss_client/sss_cli.h
+++ b/sss_client/sss_cli.h
@@ -157,6 +157,9 @@ enum sss_status {
enum response_type {
PAM_USER_INFO = 0x01,
PAM_DOMAIN_NAME,
+ PAM_ENV_ITEM, /* only pam environment */
+ ENV_ITEM, /* only user environment */
+ ALL_ENV_ITEM, /* pam and user environment */
};
enum nss_status sss_nss_make_request(enum sss_cli_command cmd,