add openssh to Android

This build still needs some work to look in $HOME/.ssh
rather than relying on pwent info.
This commit is contained in:
Joey Hess 2013-02-18 18:50:28 -04:00
parent eb0e5be62f
commit 15fd867398
6 changed files with 375 additions and 8 deletions

1
debian/changelog vendored
View file

@ -4,6 +4,7 @@ git-annex (3.20130217) UNRELEASED; urgency=low
always using git's pseudosymlink files in such repositories.
* webapp: Allow creating repositories on filesystems that lack support for
symlinks.
* Android: Bundle now includes openssh.
-- Joey Hess <joeyh@debian.org> Sun, 17 Feb 2013 16:42:16 -0400

View file

@ -1,11 +1,25 @@
# Cross-compiles utilities needed for git-annex on Android.
# Add Android cross-compiler to PATH (as installed by ghc-android)
# (This directory also needs to have a cc that is a symlink to the prefixed
# gcc cross-compiler executable.)
PATH:=$(HOME)/.ghc/android-14/arm-linux-androideabi-4.7/bin:$(PATH)
build: source
mkdir -p git-annex-bundle/bin
cd source/openssl && CC=$$(which cc) ./Configure android
cd source/openssl && $(MAKE)
cd source/rsync && git reset --hard origin/master
cd source/openssh && ./configure --host=arm-linux-androideabi --with-ssl-dir=../openssl --without-openssl-header-check
cd source/openssh && patch < ../../openssh.patch
cp openssh.config.h source/openssh/config.h
cd source/openssh && sed -i -e 's/getrrsetbyname.o //' openbsd-compat/Makefile
cd source/openssh && sed -i -e 's/auth-passwd.o //' Makefile
cd source/openssh && $(MAKE) ssh ssh-keygen
cp -a source/openssh/ssh source/openssh/ssh-keygen git-annex-bundle/bin/
cp busybox_config source/busybox/.config
cd source/busybox && yes '' | $(MAKE) oldconfig
cd source/busybox && $(MAKE)
@ -14,12 +28,6 @@ build: source
cd source/git && $(MAKE) install NO_OPENSSL=1 NO_GETTEXT=1 NO_GECOS_IN_PWENT=1 NO_GETPASS=1 NO_NSEC=1 NO_MKDTEMP=1 NO_PTHREADS=1 NO_PERL=1 NO_CURL=1 NO_EXPAT=1 NO_TCLTK=1 NO_ICONV=1 prefix= DESTDIR=../../git-annex-bundle
rm -f git-annex-bundle/bin/git-cvsserver
cd source/dropbear && git reset --hard origin/master && git am < ../../dropbear.patch
cp source/automake/lib/config.sub source/automake/lib/config.guess source/dropbear/
cd source/dropbear && ./configure --host=arm-linux-androideabi --disable-lastlog --disable-utmp --disable-utmpx --disable-wtmp --disable-wtmpx
cd source/dropbear && $(MAKE) dbclient
cp -a source/dropbear/dbclient git-annex-bundle/bin/ssh
cd source/rsync && git reset --hard origin/master && git am < ../../rsync.patch
cp source/automake/lib/config.sub source/automake/lib/config.guess source/rsync/
cd source/rsync && ./configure --host=arm-linux-androideabi --disable-locale --disable-iconv-open --disable-iconv --disable-acl-support --disable-xattr-support
@ -36,14 +44,16 @@ source:
mkdir -p source
git clone git://git.savannah.gnu.org/automake.git source/automake
git clone git://git.debian.org/git/d-i/busybox source/busybox
git clone git://github.com/android/platform_external_dropbear source/dropbear
git clone git://git.kernel.org/pub/scm/git/git.git source/git
git clone git://git.samba.org/rsync.git source/rsync
git clone git://git.gnupg.org/gnupg.git source/gnupg
git clone git://git.openssl.org/openssl source/openssl
git clone git://github.com/CyanogenMod/android_external_openssh.git source/openssh
clean:
cd source/busybox && $(MAKE) clean
cd source/dropbear && $(MAKE) clean
cd source/openssl && $(MAKE) clean
cd source/openssh && $(MAKE) clean
cd source/git && $(MAKE) clean
cd source/rsync && $(MAKE) clean
cd source/gnupg && $(MAKE) clean

View file

@ -0,0 +1,23 @@
--- Makefile 2013-02-18 17:28:38.189581030 -0400
+++ /home/joey/Makefile.compat 2013-02-18 17:25:58.649438699 -0400
@@ -9,16 +9,16 @@
CC=arm-linux-androideabi-gcc
LD=arm-linux-androideabi-gcc
CFLAGS=-g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -fno-builtin-memset -fstack-protector-all
-CPPFLAGS=-I. -I.. -I$(srcdir) -I$(srcdir)/.. -I/home/joey/src/git-annex/standalone/android/source/openssh/../openssl/include -DHAVE_CONFIG_H
+CPPFLAGS=-I. -I.. -I$(srcdir) -I$(srcdir)/.. -I/home/joey/src/git-annex/standalone/android/source/android_external_openssh/../openssl/include -DHAVE_CONFIG_H
LIBS=-lcrypto -lz
AR=/usr/bin/ar
RANLIB=arm-linux-androideabi-ranlib
INSTALL=/usr/bin/install -c
-LDFLAGS=-L. -L/home/joey/src/git-annex/standalone/android/source/openssh/../openssl -fstack-protector-all
+LDFLAGS=-L. -L/home/joey/src/git-annex/standalone/android/source/android_external_openssh/../openssl -fstack-protector-all
-OPENBSD=base64.o basename.o bindresvport.o daemon.o dirname.o fmt_scaled.o getcwd.o getgrouplist.o getopt.o getrrsetbyname.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o pwcache.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sha2.o sigact.o strlcat.o strlcpy.o strmode.o strnlen.o strptime.o strsep.o strtonum.o strtoll.o strtoul.o timingsafe_bcmp.o vis.o
+OPENBSD=base64.o basename.o bindresvport.o daemon.o dirname.o fmt_scaled.o getcwd.o getgrouplist.o getopt.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o pwcache.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sha2.o sigact.o strlcat.o strlcpy.o strmode.o strnlen.o strptime.o strsep.o strtonum.o strtoll.o strtoul.o timingsafe_bcmp.o vis.o
-COMPAT=bsd-arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o getrrsetbyname-ldns.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xmmap.o xcrypt.o
+COMPAT=bsd-arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o getrrsetbyname-ldns.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xmmap.o
PORTS=port-aix.o port-irix.o port-linux.o port-solaris.o port-tun.o port-uw.o

View file

@ -0,0 +1,40 @@
--- Makefile 2013-02-18 17:28:37.897580763 -0400
+++ Makefile 2013-02-18 17:25:42.565424455 -0400
@@ -42,7 +42,7 @@
CC=arm-linux-androideabi-gcc
LD=arm-linux-androideabi-gcc
CFLAGS=-g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -fno-builtin-memset -fstack-protector-all
-CPPFLAGS=-I. -I$(srcdir) -I/home/joey/src/git-annex/standalone/android/source/openssh/../openssl/include $(PATHS) -DHAVE_CONFIG_H
+CPPFLAGS=-I. -I$(srcdir) -I/home/joey/src/git-annex/standalone/android/source/android_external_openssh/../openssl/include $(PATHS) -DHAVE_CONFIG_H
LIBS=-lcrypto -lz
SSHLIBS=
SSHDLIBS=
@@ -55,7 +55,7 @@
SED=/bin/sed
ENT=
XAUTH_PATH=/usr/bin/xauth
-LDFLAGS=-L. -Lopenbsd-compat/ -L/home/joey/src/git-annex/standalone/android/source/openssh/../openssl -fstack-protector-all
+LDFLAGS=-L. -Lopenbsd-compat/ -L/home/joey/src/git-annex/standalone/android/source/android_external_openssh/../openssl -fstack-protector-all
EXEEXT=
MANFMT=/usr/bin/nroff -mandoc
@@ -66,8 +66,8 @@
cipher-bf1.o cipher-ctr.o cipher-3des1.o cleanup.o \
compat.o compress.o crc32.o deattack.o fatal.o hostfile.o \
log.o match.o md-sha256.o moduli.o nchan.o packet.o \
- readpass.o rsa.o ttymodes.o xmalloc.o addrmatch.o \
- atomicio.o key.o dispatch.o kex.o mac.o uidswap.o uuencode.o misc.o \
+ readpass.o rsa.o ttymodes.o xmalloc.o addrmatch.o uidswap.o \
+ atomicio.o key.o dispatch.o kex.o mac.o uuencode.o misc.o \
monitor_fdpass.o rijndael.o ssh-dss.o ssh-ecdsa.o ssh-rsa.o dh.o \
kexdh.o kexgex.o kexdhc.o kexgexc.o bufec.o kexecdh.o kexecdhc.o \
msg.o progressmeter.o dns.o entropy.o gss-genr.o umac.o jpake.o \
@@ -77,7 +77,7 @@
sshconnect.o sshconnect1.o sshconnect2.o mux.o \
roaming_common.o roaming_client.o
-SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \
+SSHDOBJS=sshd.o auth-rhosts.o auth-rsa.o auth-rh-rsa.o \
audit.o audit-bsm.o audit-linux.o platform.o \
sshpty.o sshlogin.o servconf.o serverloop.o \
auth.o auth1.o auth2.o auth-options.o session.o \

View file

@ -0,0 +1,249 @@
#define DISABLE_SHADOW 1
#define DISABLE_UTMP 1
#define DISABLE_UTMPX 1
#define DISABLE_WTMP 1
#define DISABLE_WTMPX 1
#define ENABLE_PKCS11 /**/
#define GETPGRP_VOID 1
#define GLOB_HAS_ALTDIRFUNC 1
#define HAS_SHADOW_EXPIRE 1
#define HAVE_ADDR_IN_UTMP 1
#define HAVE_ADDR_IN_UTMPX 1
#define HAVE_ADDR_V6_IN_UTMP 1
#define HAVE_ADDR_V6_IN_UTMPX 1
#define HAVE_ASPRINTF 1
#define HAVE_ATTRIBUTE__NONNULL__ 1
#define HAVE_BASENAME 1
#define HAVE_BCOPY 1
#define HAVE_BN_IS_PRIME_EX 1
#define HAVE_CLOCK 1
#define HAVE_CLOCK_T 1
#define HAVE_CONST_GAI_STRERROR_PROTO 1
#define HAVE_CONTROL_IN_MSGHDR 1
#define HAVE_DAEMON 1
#define HAVE_DECL_GLOB_NOMATCH 1
#define HAVE_DECL_H_ERRNO 1
#define HAVE_DECL_MAXSYMLINKS 1
#define HAVE_DECL_OFFSETOF 1
#define HAVE_DECL_O_NONBLOCK 1
#define HAVE_DECL_SHUT_RD 1
#define HAVE_DECL_WRITEV 1
#define HAVE_DECL__GETLONG 0
#define HAVE_DECL__GETSHORT 0
#define HAVE_DEV_PTMX 1
#define HAVE_DIRENT_H 1
#define HAVE_DIRFD 1
#define HAVE_DIRNAME 1
#define HAVE_DSA_GENERATE_PARAMETERS_EX 1
#define HAVE_ENDIAN_H 1
#define HAVE_ENDUTENT 1
#define HAVE_ENDUTXENT 1
#define HAVE_EVP_SHA256 1
#define HAVE_EXIT_IN_UTMP 1
#define HAVE_FCHMOD 1
#define HAVE_FCHOWN 1
#define HAVE_FCNTL_H 1
#define HAVE_FEATURES_H 1
#define HAVE_FREEADDRINFO 1
#define HAVE_FSBLKCNT_T 1
#define HAVE_FSFILCNT_T 1
#define HAVE_GAI_STRERROR 1
#define HAVE_GETADDRINFO 1
#define HAVE_GETCWD 1
#define HAVE_GETNAMEINFO 1
#define HAVE_GETOPT 1
#define HAVE_GETOPT_H 1
#define HAVE_GETPAGESIZE 1
#define HAVE_GETRLIMIT 1
#define HAVE_GETTIMEOFDAY 1
#define HAVE_GETTTYENT 1
#define HAVE_GETUTENT 1
#define HAVE_GETUTID 1
#define HAVE_GETUTLINE 1
#define HAVE_GETUTXENT 1
#define HAVE_GETUTXID 1
#define HAVE_GETUTXLINE 1
#define HAVE_GLOB 1
#define HAVE_GLOB_H 1
#define HAVE_HEADER_AD 1
#define HAVE_HMAC_CTX_INIT 1
#define HAVE_HOST_IN_UTMP 1
#define HAVE_HOST_IN_UTMPX 1
#define HAVE_ID_IN_UTMP 1
#define HAVE_ID_IN_UTMPX 1
#define HAVE_INET_ATON 1
#define HAVE_INET_NTOA 1
#define HAVE_INET_NTOP 1
#define HAVE_INT64_T 1
#define HAVE_INTTYPES_H 1
#define HAVE_INTXX_T 1
#define HAVE_IN_ADDR_T 1
#define HAVE_ISBLANK 1
#define HAVE_LASTLOG_H 1
#define HAVE_LIBGEN_H 1
#define HAVE_LIBNSL 1
#define HAVE_LIBZ 1
#define HAVE_LIMITS_H 1
#define HAVE_LINUX_AUDIT_H 1
#define HAVE_LINUX_FILTER_H 1
#define HAVE_LINUX_IF_TUN_H 1
#define HAVE_LOGOUT 1
#define HAVE_LOGWTMP 1
#define HAVE_LONG_DOUBLE 1
#define HAVE_LONG_LONG 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMORY_H 1
#define HAVE_MKDTEMP 1
#define HAVE_MMAP 1
#define HAVE_MODE_T 1
#define HAVE_NANOSLEEP 1
#define HAVE_NETDB_H 1
#define HAVE_OPENSSL 1
#define HAVE_PATHS_H 1
#define HAVE_PID_IN_UTMP 1
#define HAVE_PID_T 1
#define HAVE_POLL 1
#define HAVE_POLL_H 1
#define HAVE_PRCTL 1
#define HAVE_PROC_PID 1
#define HAVE_PUTUTLINE 1
#define HAVE_PUTUTXLINE 1
#define HAVE_REALPATH 1
#define HAVE_RECVMSG 1
#define HAVE_RLIMIT_NPROC /**/
#define HAVE_RSA_GENERATE_KEY_EX 1
#define HAVE_RSA_GET_DEFAULT_METHOD 1
#define HAVE_SA_FAMILY_T 1
#define HAVE_SENDMSG 1
#define HAVE_SETEGID 1
#define HAVE_SETENV 1
#define HAVE_SETEUID 1
#define HAVE_SETGROUPS 1
#define HAVE_SETREGID 1
#define HAVE_SETRESGID 1
#define HAVE_SETRESUID 1
#define HAVE_SETREUID 1
#define HAVE_SETRLIMIT 1
#define HAVE_SETSID 1
#define HAVE_SETUTENT 1
#define HAVE_SETUTXENT 1
#define HAVE_SETVBUF 1
#define HAVE_SHA256_UPDATE 1
#define HAVE_SIGACTION 1
#define HAVE_SIGVEC 1
#define HAVE_SIG_ATOMIC_T 1
#define HAVE_SIZE_T 1
#define HAVE_SNPRINTF 1
#define HAVE_SOCKETPAIR 1
#define HAVE_SO_PEERCRED 1
#define HAVE_SSIZE_T 1
#define HAVE_SS_FAMILY_IN_SS 1
#define HAVE_STATFS 1
#define HAVE_STDDEF_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRDUP 1
#define HAVE_STRERROR 1
#define HAVE_STRFTIME 1
#define HAVE_STRICT_MKSTEMP 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_STRNLEN 1
#define HAVE_STRPTIME 1
#define HAVE_STRSEP 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOUL 1
#define HAVE_STRUCT_ADDRINFO 1
#define HAVE_STRUCT_IN6_ADDR 1
#define HAVE_STRUCT_SOCKADDR_IN6 1
#define HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1
#define HAVE_STRUCT_SOCKADDR_STORAGE 1
#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
#define HAVE_STRUCT_TIMESPEC 1
#define HAVE_STRUCT_TIMEVAL 1
#define HAVE_SYSCONF 1
#define HAVE_SYS_CDEFS_H 1
#define HAVE_SYS_DIR_H 1
#define HAVE_SYS_ERRLIST 1
#define HAVE_SYS_MMAN_H 1
#define HAVE_SYS_MOUNT_H 1
#define HAVE_SYS_NERR 1
#define HAVE_SYS_POLL_H 1
#define HAVE_SYS_PRCTL_H 1
#define HAVE_SYS_SELECT_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_SYSMACROS_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_UN_H 1
#define HAVE_TCGETPGRP 1
#define HAVE_TCSENDBREAK 1
#define HAVE_TIME 1
#define HAVE_TIME_H 1
#define HAVE_TRUNCATE 1
#define HAVE_TV_IN_UTMP 1
#define HAVE_TV_IN_UTMPX 1
#define HAVE_TYPE_IN_UTMP 1
#define HAVE_TYPE_IN_UTMPX 1
#define HAVE_UINTXX_T 1
#define HAVE_UNISTD_H 1
#define HAVE_UNSETENV 1
#define HAVE_UNSIGNED_LONG_LONG 1
#define HAVE_UPDWTMP 1
#define HAVE_UPDWTMPX 1
#define HAVE_UTIMES 1
#define HAVE_UTIME_H 1
#define HAVE_UTMPNAME 1
#define HAVE_UTMPXNAME 1
#define HAVE_UTMP_H 1
#define HAVE_U_CHAR 1
#define HAVE_U_INT 1
#define HAVE_U_INT64_T 1
#define HAVE_U_INTXX_T 1
#define HAVE_VASPRINTF 1
#define HAVE_VA_COPY 1
#define HAVE_VSNPRINTF 1
#define HAVE_WAITPID 1
#define HAVE__GETLONG 1
#define HAVE__GETSHORT 1
#define HAVE__RES_EXTERN 1
#define HAVE___FUNCTION__ 1
#define HAVE___PROGNAME 1
#define HAVE___VA_COPY 1
#define HAVE___func__ 1
#define IPV4_IN_IPV6 1
#define LINK_OPNOTSUPP_ERRNO EPERM
#define LINUX_OOM_ADJUST 1
#define LOCKED_PASSWD_PREFIX "!"
#define LOGIN_PROGRAM_FALLBACK "/bin/login"
#define MISSING_FD_MASK 1
#define MISSING_HOWMANY 1
#define OPENSSL_HAS_ECC 1
#define OPENSSL_PRNG_ONLY 1
#define PACKAGE_BUGREPORT "openssh-unix-dev@mindrot.org"
#define PACKAGE_NAME "OpenSSH"
#define PACKAGE_STRING "OpenSSH Portable"
#define PACKAGE_TARNAME "openssh"
#define PACKAGE_URL ""
#define PACKAGE_VERSION "Portable"
#define PAM_TTY_KLUDGE 1
#define SANDBOX_RLIMIT 1
#define SECCOMP_AUDIT_ARCH AUDIT_ARCH_ARM
#define SIZEOF_CHAR 1
#define SIZEOF_INT 4
#define SIZEOF_LONG_INT 8
#define SIZEOF_LONG_LONG_INT 8
#define SIZEOF_SHORT_INT 2
#define SNPRINTF_CONST const
#define SPT_TYPE SPT_REUSEARGV
#define SSH_PRIVSEP_USER "shell"
#define SSH_TUN_COMPAT_AF 1
#define SSH_TUN_LINUX 1
#define SSH_TUN_PREPEND_AF 1
#define STDC_HEADERS 1
#define USER_PATH "/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin"
#define XAUTH_PATH "/usr/bin/xauth"
#define _PATH_BTMP "/var/log/btmp"
#define _PATH_PASSWD_PROG "/usr/bin/passwd"
#define _PATH_SSH_PIDDIR "/var/run"
#define ANDROID

View file

@ -0,0 +1,44 @@
diff --git a/openbsd-compat/getrrsetbyname.c b/openbsd-compat/getrrsetbyname.c
index d2bea21..5b5d599 100644
--- a/openbsd-compat/getrrsetbyname.c
+++ b/openbsd-compat/getrrsetbyname.c
@@ -56,8 +56,7 @@
#include <arpa/inet.h>
#include "getrrsetbyname.h"
-#include "nameser.h"
-#include "nameser_compat.h"
+#include "arpa/nameser.h"
#if defined(HAVE_DECL_H_ERRNO) && !HAVE_DECL_H_ERRNO
extern int h_errno;
diff --git a/uidswap.c b/uidswap.c
index bc6194e..5cbf5d1 100644
--- a/uidswap.c
+++ b/uidswap.c
@@ -28,7 +28,6 @@
#include "xmalloc.h"
#ifdef ANDROID
-#include <private/android_filesystem_config.h>
#include <linux/capability.h>
#include <linux/prctl.h>
#endif
@@ -230,7 +229,7 @@ permanently_set_uid(struct passwd *pw)
debug("permanently_set_uid: %u/%u", (u_int)pw->pw_uid,
(u_int)pw->pw_gid);
-#ifdef ANDROID
+#if 0
if (pw->pw_uid == AID_SHELL) {
prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);
@@ -317,7 +316,7 @@ permanently_set_uid(struct passwd *pw)
(u_int)pw->pw_uid);
}
-#ifdef ANDROID
+#if 0
if (pw->pw_uid == AID_SHELL) {
/* set CAP_SYS_BOOT capability, so "adb reboot" will succeed */
header.version = _LINUX_CAPABILITY_VERSION;