Blame SOURCES/0003-Remove-n-or-r-n-from-stdin-password.patch

59dcbd
From c334771f214e6f0cc2f13edf1032389e7bf74684 Mon Sep 17 00:00:00 2001
59dcbd
From: Sumit Bose <sbose@redhat.com>
59dcbd
Date: Fri, 13 May 2016 18:05:37 +0200
59dcbd
Subject: [PATCH 3/3] Remove \n or \r\n from stdin password
59dcbd
59dcbd
https://bugs.freedesktop.org/show_bug.cgi?id=78448
59dcbd
---
59dcbd
 tools/tools.c | 7 +++++++
59dcbd
 1 file changed, 7 insertions(+)
59dcbd
59dcbd
diff --git a/tools/tools.c b/tools/tools.c
59dcbd
index 3e3435e..4b243de 100644
59dcbd
--- a/tools/tools.c
59dcbd
+++ b/tools/tools.c
59dcbd
@@ -250,6 +250,13 @@ adcli_read_password_func (adcli_login_type login_type,
59dcbd
 
59dcbd
 		} else if (res == 0) {
59dcbd
 			buffer[offset] = '\0';
59dcbd
+			/* remove new line character */
59dcbd
+			if (offset > 0 && buffer[offset - 1] == '\n') {
59dcbd
+				buffer[offset - 1] = '\0';
59dcbd
+				if (offset > 1 && buffer[offset - 2] == '\r') {
59dcbd
+					buffer[offset - 2] = '\0';
59dcbd
+				}
59dcbd
+			}
59dcbd
 			return buffer;
59dcbd
 
59dcbd
 		} else {
59dcbd
-- 
59dcbd
2.5.5
59dcbd