dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From 1b9a3d516341560ccf8b5f9fab0886f3d05defce Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose@redhat.com>
Date: Fri, 26 Jun 2015 14:45:21 +0200
Subject: [PATCH 32/37] pack_message_v3: allow empty name

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
---
 src/sss_client/pam_message.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/sss_client/pam_message.c b/src/sss_client/pam_message.c
index b8104c680d0e733b713c665e6206dc4b0d379237..b239f6f53da54054c52e484bdd076193709cb003 100644
--- a/src/sss_client/pam_message.c
+++ b/src/sss_client/pam_message.c
@@ -107,9 +107,10 @@ int pack_message_v3(struct pam_items *pi, size_t *size, uint8_t **buffer)
     uint8_t *buf;
     size_t rp;
 
-    len = sizeof(uint32_t) +
-          2*sizeof(uint32_t) + pi->pam_user_size +
-          sizeof(uint32_t);
+    len = sizeof(uint32_t) + sizeof(uint32_t);
+
+    len +=  *pi->pam_user != '\0' ?
+                2*sizeof(uint32_t) + pi->pam_user_size : 0;
     len += *pi->pam_service != '\0' ?
                 2*sizeof(uint32_t) + pi->pam_service_size : 0;
     len += *pi->pam_tty != '\0' ?
-- 
2.4.3