openssh: fix hardcoded paths
authorLeonid Plyushch <leonid.plyushch@gmail.com>
Thu, 14 Sep 2017 13:35:29 +0000 (16:35 +0300)
committerFredrik Fornwall <fredrik@fornwall.net>
Thu, 14 Sep 2017 14:20:41 +0000 (16:20 +0200)
packages/openssh/build.sh
packages/openssh/fix-hardcoded-paths.patch [new file with mode: 0644]

index 19c683d..b33e4e4 100755 (executable)
@@ -1,7 +1,7 @@
 TERMUX_PKG_HOMEPAGE=https://www.openssh.com/
 TERMUX_PKG_DESCRIPTION="Secure shell for logging into a remote machine"
 TERMUX_PKG_VERSION=7.5p1
-TERMUX_PKG_REVISION=4
+TERMUX_PKG_REVISION=5
 TERMUX_PKG_SRCURL=http://mirrors.evowise.com/pub/OpenBSD/OpenSSH/portable/openssh-${TERMUX_PKG_VERSION}.tar.gz
 TERMUX_PKG_SHA256=9846e3c5fab9f0547400b4d2c017992f914222b3fd1f8eee6c7dc6bc5e59f9f0
 TERMUX_PKG_DEPENDS="libandroid-support, ldns, openssl, libedit, libutil"
@@ -25,6 +25,7 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
 --without-stackprotect
 --with-pid-dir=$TERMUX_PREFIX/var/run
 --with-privsep-path=$TERMUX_PREFIX/var/empty
+--with-xauth=$TERMUX_PREFIX/bin/xauth
 ac_cv_func_endgrent=yes
 ac_cv_func_fmt_scaled=no
 ac_cv_func_getlastlogxbyname=no
@@ -39,6 +40,10 @@ TERMUX_PKG_RM_AFTER_INSTALL="bin/slogin share/man/man1/slogin.1"
 termux_step_pre_configure() {
        autoreconf
 
+    ## Configure script require this variable to set
+    ## prefixed path to program 'passwd'
+    export PATH_PASSWD_PROG="${TERMUX_PREFIX}/bin/passwd"
+
        CPPFLAGS+=" -DHAVE_ATTRIBUTE__SENTINEL__=1"
        LD=$CC # Needed to link the binaries
        LDFLAGS+=" -llog" # liblog for android logging in syslog hack
diff --git a/packages/openssh/fix-hardcoded-paths.patch b/packages/openssh/fix-hardcoded-paths.patch
new file mode 100644 (file)
index 0000000..c73a1d3
--- /dev/null
@@ -0,0 +1,81 @@
+diff -uNr openssh-7.5p1/contrib/ssh-copy-id openssh-7.5p1.mod/contrib/ssh-copy-id
+--- openssh-7.5p1/contrib/ssh-copy-id  2017-03-20 04:39:27.000000000 +0200
++++ openssh-7.5p1.mod/contrib/ssh-copy-id      2017-09-14 16:47:08.682854653 +0300
+@@ -36,7 +36,7 @@
+ # check that we have something mildly sane as our shell, or try to find something better
+ if false ^ printf "%s: WARNING: ancient shell, hunting for a more modern one... " "$0"
+ then
+-  SANE_SH=${SANE_SH:-/usr/bin/ksh}
++  SANE_SH=${SANE_SH:-@TERMUX_PREFIX@/bin/bash}
+   if printf 'true ^ false\n' | "$SANE_SH"
+   then
+     printf "'%s' seems viable.\n" "$SANE_SH"
+diff -uNr openssh-7.5p1/defines.h openssh-7.5p1.mod/defines.h
+--- openssh-7.5p1/defines.h    2017-03-20 04:39:27.000000000 +0200
++++ openssh-7.5p1.mod/defines.h        2017-09-14 16:25:44.422855572 +0300
+@@ -434,7 +434,7 @@
+ #endif
+ #ifndef _PATH_NOLOGIN
+-# define _PATH_NOLOGIN "/etc/nologin"
++# define _PATH_NOLOGIN "@TERMUX_PREFIX@/etc/nologin"
+ #endif
+ /* Define this to be the path of the xauth program. */
+@@ -447,7 +447,7 @@
+ #  ifdef __hpux
+ #    define X_UNIX_PATH "/var/spool/sockets/X11/%u"
+ #  else
+-#    define X_UNIX_PATH "/tmp/.X11-unix/X%u"
++#    define X_UNIX_PATH "@TERMUX_PREFIX@/tmp/.X11-unix/X%u"
+ #  endif
+ #endif /* X_UNIX_PATH */
+ #define _PATH_UNIX_X X_UNIX_PATH
+diff -uNr openssh-7.5p1/pathnames.h openssh-7.5p1.mod/pathnames.h
+--- openssh-7.5p1/pathnames.h  2017-03-20 04:39:27.000000000 +0200
++++ openssh-7.5p1.mod/pathnames.h      2017-09-14 16:30:10.012855382 +0300
+@@ -113,7 +113,7 @@
+  * ~/.rhosts and /etc/hosts.equiv if rhosts authentication is enabled.
+  */
+ #define _PATH_SSH_HOSTS_EQUIV         SSHDIR "/shosts.equiv"
+-#define _PATH_RHOSTS_EQUIV            "/etc/hosts.equiv"
++#define _PATH_RHOSTS_EQUIV            "@TERMUX_PREFIX@/etc/hosts.equiv"
+ /*
+  * Default location of askpass
+@@ -134,12 +134,12 @@
+ /* xauth for X11 forwarding */
+ #ifndef _PATH_XAUTH
+-#define _PATH_XAUTH                   "/usr/X11R6/bin/xauth"
++#define _PATH_XAUTH                   "@TERMUX_PREFIX@/bin/xauth"
+ #endif
+ /* UNIX domain socket for X11 server; displaynum will replace %u */
+ #ifndef _PATH_UNIX_X
+-#define _PATH_UNIX_X "/tmp/.X11-unix/X%u"
++#define _PATH_UNIX_X "@TERMUX_PREFIX@/tmp/.X11-unix/X%u"
+ #endif
+ /* for scp */
+@@ -159,7 +159,7 @@
+ /* for passwd change */
+ #ifndef _PATH_PASSWD_PROG
+-#define _PATH_PASSWD_PROG             "/usr/bin/passwd"
++#define _PATH_PASSWD_PROG             "@TERMUX_PREFIX@/bin/passwd"
+ #endif
+ #ifndef _PATH_LS
+diff -uNr openssh-7.5p1/ssh-agent.c openssh-7.5p1.mod/ssh-agent.c
+--- openssh-7.5p1/ssh-agent.c  2017-03-20 04:39:27.000000000 +0200
++++ openssh-7.5p1.mod/ssh-agent.c      2017-09-14 16:28:32.912855451 +0300
+@@ -89,7 +89,7 @@
+ #endif
+ #ifndef DEFAULT_PKCS11_WHITELIST
+-# define DEFAULT_PKCS11_WHITELIST "/usr/lib*/*,/usr/local/lib*/*"
++# define DEFAULT_PKCS11_WHITELIST "/usr/lib*/*,/usr/local/lib*/*,@TERMUX_PREFIX@/lib*/*"
+ #endif
+ typedef enum {