summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2015-01-29 20:31:19 +0100
committerJakub Hrozek <jhrozek@redhat.com>2015-01-30 15:37:04 +0100
commit866ab45027c83fafb7f7f45d34d3e1e7721b77dc (patch)
tree727146bc2f59ab3957e545292a7accfe9a7fab03
parent561ed2fd03bab04cfdddbc09c4b48563c9d9b87e (diff)
downloadsssd-866ab45027c83fafb7f7f45d34d3e1e7721b77dc.tar.gz
sssd-866ab45027c83fafb7f7f45d34d3e1e7721b77dc.tar.xz
sssd-866ab45027c83fafb7f7f45d34d3e1e7721b77dc.zip
fill_id() fix LE/BE issue with wrong data type
Related to https://fedorahosted.org/sssd/ticket/1588 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
-rw-r--r--src/responder/nss/nsssrv_cmd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index 93b220cc8..1affde874 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -4867,18 +4867,20 @@ static errno_t fill_id(struct sss_packet *packet,
uint8_t *body;
size_t blen;
size_t pctr = 0;
- uint64_t id;
+ uint64_t tmp_id;
+ uint32_t id;
if (id_type == SSS_ID_TYPE_GID) {
- id = ldb_msg_find_attr_as_uint64(msg, SYSDB_GIDNUM, 0);
+ tmp_id = ldb_msg_find_attr_as_uint64(msg, SYSDB_GIDNUM, 0);
} else {
- id = ldb_msg_find_attr_as_uint64(msg, SYSDB_UIDNUM, 0);
+ tmp_id = ldb_msg_find_attr_as_uint64(msg, SYSDB_UIDNUM, 0);
}
- if (id == 0 || id >= UINT32_MAX) {
+ if (tmp_id == 0 || tmp_id >= UINT32_MAX) {
DEBUG(SSSDBG_CRIT_FAILURE, "Invalid POSIX ID.\n");
return EINVAL;
}
+ id = (uint32_t) tmp_id;
ret = sss_packet_grow(packet, 4 * sizeof(uint32_t));
if (ret != EOK) {