Blame SOURCES/0188-fill_id-fix-LE-BE-issue-with-wrong-data-type.patch

905b4d
From d5c7e81dac95073613c8f8b12280ed001d4ed3b1 Mon Sep 17 00:00:00 2001
905b4d
From: Sumit Bose <sbose@redhat.com>
905b4d
Date: Thu, 29 Jan 2015 20:31:19 +0100
905b4d
Subject: [PATCH 188/188] fill_id() fix LE/BE issue with wrong data type
905b4d
905b4d
Related to https://fedorahosted.org/sssd/ticket/1588
905b4d
905b4d
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
905b4d
(cherry picked from commit 866ab45027c83fafb7f7f45d34d3e1e7721b77dc)
905b4d
---
905b4d
 src/responder/nss/nsssrv_cmd.c | 10 ++++++----
905b4d
 1 file changed, 6 insertions(+), 4 deletions(-)
905b4d
905b4d
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
905b4d
index da24ce1730999518b2e1bc52604940ee979072e3..c03e5db846ec5b889cab5c2c37a40ef2ae229306 100644
905b4d
--- a/src/responder/nss/nsssrv_cmd.c
905b4d
+++ b/src/responder/nss/nsssrv_cmd.c
905b4d
@@ -4867,18 +4867,20 @@ static errno_t fill_id(struct sss_packet *packet,
905b4d
     uint8_t *body;
905b4d
     size_t blen;
905b4d
     size_t pctr = 0;
905b4d
-    uint64_t id;
905b4d
+    uint64_t tmp_id;
905b4d
+    uint32_t id;
905b4d
 
905b4d
     if (id_type == SSS_ID_TYPE_GID) {
905b4d
-        id = ldb_msg_find_attr_as_uint64(msg, SYSDB_GIDNUM, 0);
905b4d
+        tmp_id = ldb_msg_find_attr_as_uint64(msg, SYSDB_GIDNUM, 0);
905b4d
     } else {
905b4d
-        id = ldb_msg_find_attr_as_uint64(msg, SYSDB_UIDNUM, 0);
905b4d
+        tmp_id = ldb_msg_find_attr_as_uint64(msg, SYSDB_UIDNUM, 0);
905b4d
     }
905b4d
 
905b4d
-    if (id == 0 || id >= UINT32_MAX) {
905b4d
+    if (tmp_id == 0 || tmp_id >= UINT32_MAX) {
905b4d
         DEBUG(SSSDBG_CRIT_FAILURE, "Invalid POSIX ID.\n");
905b4d
         return EINVAL;
905b4d
     }
905b4d
+    id = (uint32_t) tmp_id;
905b4d
 
905b4d
     ret = sss_packet_grow(packet, 4 * sizeof(uint32_t));
905b4d
     if (ret != EOK) {
905b4d
-- 
905b4d
2.1.0
905b4d