From 00796411c0de50cad2705a0ac714b47d421f9c9f Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Wed, 14 Jun 2017 00:02:08 +0200 Subject: [PATCH] dropbear: Patch away hard link usage Fixes #1082. --- packages/dropbear/build.sh | 1 + packages/dropbear/gensignkey.c.patch | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 packages/dropbear/gensignkey.c.patch diff --git a/packages/dropbear/build.sh b/packages/dropbear/build.sh index 8e9348776..827fc1f91 100755 --- a/packages/dropbear/build.sh +++ b/packages/dropbear/build.sh @@ -2,6 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://matt.ucc.asn.au/dropbear/dropbear.html TERMUX_PKG_DESCRIPTION="Small SSH server and client" TERMUX_PKG_DEPENDS="libutil" TERMUX_PKG_VERSION=2017.75 +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://matt.ucc.asn.au/dropbear/releases/dropbear-${TERMUX_PKG_VERSION}.tar.bz2 TERMUX_PKG_SHA256=6cbc1dcb1c9709d226dff669e5604172a18cf5dbf9a201474d5618ae4465098c TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--disable-syslog --disable-utmp --disable-utmpx --disable-wtmp" diff --git a/packages/dropbear/gensignkey.c.patch b/packages/dropbear/gensignkey.c.patch new file mode 100644 index 000000000..8e6252428 --- /dev/null +++ b/packages/dropbear/gensignkey.c.patch @@ -0,0 +1,28 @@ +diff -u -r ../dropbear-2017.75/gensignkey.c ./gensignkey.c +--- ../dropbear-2017.75/gensignkey.c 2017-05-18 16:47:01.000000000 +0200 ++++ ./gensignkey.c 2017-06-13 23:50:59.888597482 +0200 +@@ -137,6 +137,16 @@ + goto out; + } + ++#ifdef __ANDROID__ ++ /* Hard links are not possible and renam. */ ++ if (skip_exist && access(filename, F_OK) == 0) { ++ /* Ok. */ ++ } else if (rename(fn_temp, filename) < 0) { ++ dropbear_log(LOG_ERR, "Failed moving key file to %s: %s", filename, ++ strerror(errno)); ++ ret = DROPBEAR_FAILURE; ++ } ++#else + if (link(fn_temp, filename) < 0) { + /* If generating keys on connection (skipexist) it's OK to get EEXIST + - we probably just lost a race with another connection to generate the key */ +@@ -148,6 +158,7 @@ + goto out; + } + } ++#endif + + out: + if (buf) {