Blob Blame History Raw
From a55000a067d68cbf7aaf201b73ba2eb14090f916 Mon Sep 17 00:00:00 2001
From: Rob Crittenden <rcritten@redhat.com>
Date: Wed, 21 Feb 2018 15:28:38 -0500
Subject: [PATCH] Remove trailing CR/LF when reading passwords from a file.

https://bugzilla.redhat.com/show_bug.cgi?id=1547641
---
 src/dogtag.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/dogtag.c b/src/dogtag.c
index 5b55b04d..871f3875 100644
--- a/src/dogtag.c
+++ b/src/dogtag.c
@@ -476,9 +476,17 @@ main(int argc, const char **argv)
 	/* Read the client password and/or PIN, if we need to. */
 	if ((pwdfile != NULL) && (pwd == NULL)) {
 		pwd = cm_submit_u_from_file(pwdfile);
+        if (pwd != NULL) {
+            pwd = talloc_strndup(ctx, pwd,
+                        strcspn(pwd, "\r\n"));
+		}
 	}
 	if ((pinfile != NULL) && (pin == NULL)) {
 		pin = cm_submit_u_from_file(pinfile);
+        if (pin != NULL) {
+            pin = talloc_strndup(ctx, pin,
+                        strcspn(pin, "\r\n"));
+		}
 	}
 
 	/* Figure out which form and arguments to use. */
-- 
2.13.6