diff options
author | Sumit Bose <sbose@redhat.com> | 2009-09-11 11:45:19 +0200 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2009-09-14 12:08:57 -0400 |
commit | c0393b68aaf02a16d2d7aad50cb0d4cfd18b4f66 (patch) | |
tree | 828dde750013c914456197fb468e912a48878f0d /server/responder/pam/pamsrv_cmd.c | |
parent | 30cd03bbbb9e5d8ca6b2014c4b1daceaf75a7397 (diff) | |
download | sssd-c0393b68aaf02a16d2d7aad50cb0d4cfd18b4f66.tar.gz sssd-c0393b68aaf02a16d2d7aad50cb0d4cfd18b4f66.tar.bz2 sssd-c0393b68aaf02a16d2d7aad50cb0d4cfd18b4f66.zip |
Let the PAM client send its PID
- the client sends the PID as uint32_t and sssd will use uint32_t too
- fix a possible type issue where a uint32_t is sent as int32 in internal
dbus communication
Diffstat (limited to 'server/responder/pam/pamsrv_cmd.c')
-rw-r--r-- | server/responder/pam/pamsrv_cmd.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/server/responder/pam/pamsrv_cmd.c b/server/responder/pam/pamsrv_cmd.c index 1204e325..62cd2a50 100644 --- a/server/responder/pam/pamsrv_cmd.c +++ b/server/responder/pam/pamsrv_cmd.c @@ -71,6 +71,20 @@ static int extract_string(char **var, uint8_t *body, size_t blen, size_t *c) { return EOK; } +static int extract_uint32_t(uint32_t *var, uint8_t *body, size_t blen, size_t *c) { + uint32_t size; + + if (blen-(*c) < 2*sizeof(uint32_t)) return EINVAL; + + size = ((uint32_t *)&body[*c])[0]; + *c += sizeof(uint32_t); + + *var = ((uint32_t *)&body[*c])[0]; + *c += sizeof(uint32_t); + + return EOK; +} + static int pam_parse_in_data_v2(struct sss_names_ctx *snctx, struct pam_data *pd, uint8_t *body, size_t blen) @@ -119,6 +133,11 @@ static int pam_parse_in_data_v2(struct sss_names_ctx *snctx, ret = extract_string(&pd->rhost, body, blen, &c); if (ret != EOK) return ret; break; + case PAM_ITEM_CLI_PID: + ret = extract_uint32_t(&pd->cli_pid, + body, blen, &c); + if (ret != EOK) return ret; + break; case PAM_ITEM_AUTHTOK: ret = extract_authtok(&pd->authtok_type, &pd->authtok_size, &pd->authtok, body, blen, &c); |