[apache2] 02/03: ask-for-passphrase: bug fixes

Stefan Fritsch sf at moszumanska.debian.org
Mon Dec 22 20:55:14 UTC 2014


This is an automated email from the git hooks/post-receive script.

sf pushed a commit to branch master
in repository apache2.

commit 5e0a02b0fc6f1928dcf4dc8fc7b984ba3b8d1f7c
Author: Stefan Fritsch <sf at sfritsch.de>
Date:   Mon Dec 22 21:39:18 2014 +0100

    ask-for-passphrase: bug fixes
    
    - systemd cannot cope with a newline in the prompt, giving this error:
    
      [/run/systemd/ask-password/ask.RrrIbU:7] Missing '='.
      Failed to parse password file /run/systemd/ask-password/ask.RrrIbU:
      Bad message
      Failed to show password: Bad message
    
    - print newline when not using systemd / plymouth
    
    - remove broken handling for case where stdin is already a tty
---
 debian/ask-for-passphrase | 45 +++++++++++++++++++++++----------------------
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/debian/ask-for-passphrase b/debian/ask-for-passphrase
index e7ad3e3..de66d52 100755
--- a/debian/ask-for-passphrase
+++ b/debian/ask-for-passphrase
@@ -21,27 +21,28 @@
 sitename=$1
 keytype=$2
 
-prompt="Apache needs to decrypt your SSL Keys for $sitename ($keytype)
-Please enter passphrase:"
-tty=`tty`
+log="logger -p daemon.err -t apache2"
+
+prompt="Enter passphrase for SSL/TLS keys for $sitename ($keytype):"
+
+# Apache gives us a pipe for stdin, but we want to
+# talk to apache's terminal.
+tty=`tty < /proc/${PPID}/fd/0`
 if [ "$tty" = "not a tty" ] ; then
-    # Apache gives us a pipe for stdin, but we want to
-    # talk to apache's terminal.
-    tty=`tty < /proc/${PPID}/fd/0`
-    if [ "$tty" = "not a tty" ] ; then
-        if [ -x /bin/systemd-ask-password ] ; then
-            exec /bin/systemd-ask-password --timeout=0 "$prompt"
-        elif [ -x /bin/plymouth ] && plymouth --ping ; then
-            echo $prompt | logger
-            exec plymouth ask-for-password --prompt="$prompt"
-        else
-            logger -p daemon.err -t apache2 "No way to ask user for passphrase"
-            exit 1
-        fi
-        logger -p daemon.err -t apache2 "Passphrase prompt failed"
-        exit 1
-    fi
-    # We must not print anything on stdout except the passphrase
-    read -s -p "$prompt" passphrase > $tty 2>&1 < $tty
-    echo "$passphrase"
+	if [ -x /bin/systemd-ask-password ] ; then
+		exec /bin/systemd-ask-password --timeout=0 "$prompt"
+	elif [ -x /bin/plymouth ] && plymouth --ping ; then
+		echo $prompt | logger
+		exec plymouth ask-for-password --prompt="$prompt"
+	else
+		$log "No way to ask user for passphrase"
+		exit 1
+	fi
+	$log "Passphrase prompt failed"
+	exit 1
 fi
+
+# We must not print anything on stdout except the passphrase
+read -s -p "$prompt" passphrase > $tty 2>&1 < $tty
+echo > $tty
+echo "$passphrase"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-apache/apache2.git



More information about the Pkg-apache-commits mailing list