Ticket #9711: 0002-use-ssh-t-for-commands-run-on-target-via-sudo.patch

File 0002-use-ssh-t-for-commands-run-on-target-via-sudo.patch, 1.2 KB (added by mingwandroid, 6 years ago)
  • libexec/on-target

    From c38cc7fb2f030d9e856afe92f9ee2a53ac18dee2 Mon Sep 17 00:00:00 2001
    From: Ray Donnelly <mingw.android@gmail.com>
    Date: Sun, 13 Oct 2013 18:40:41 +0100
    Subject: [PATCH] use ssh -t for commands run 'on-target' via 'sudo'
    
    .. to allocate a pseudo terminal in-case a password
    is needed.
    
    We can't enable ssh -t by default as it'd cause any
    binary communication to fail, so make an assumption
    that sudo is not used in such operations. Obviously
    this could easily bite me in the backside later.
    ---
     libexec/on-target |    6 +++++-
     1 file changed, 5 insertions(+), 1 deletion(-)
    
    diff --git a/libexec/on-target b/libexec/on-target
    index 331e262..3251cf6 100755
    a b fi 
    4444#fi
    4545
    4646if [ -z "$USE_LXC" ]; then
    47     ssh -oConnectTimeout=30 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_dsa -p $VM_SSH_PORT $TUSER@localhost $*
     47    PSEUDOTTY=
     48    if [ ! "$(echo $* | sed -e 's/sudo//g')" = "$*" ]; then
     49        PSEUDOTTY=-t
     50    fi
     51    ssh $PSEUDOTTY -oConnectTimeout=30 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_dsa -p $VM_SSH_PORT $TUSER@localhost $*
    4852else
    4953    config-lxc
    5054    #if [ $TUSER = "root" ]; then