summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sss_client/pam_message.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sss_client/pam_message.c b/src/sss_client/pam_message.c
index b8104c680..b239f6f53 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' ?