Patchwork added package sftpserver

login
register
mail settings
Submitter Kiril Maler
Date June 1, 2012, 2:35 p.m.
Message ID <CABJxTWEP8Y3bBzQQ29y3ZYyOUEUXY5jnC45SU2Xx8ZoF0kMgJA@mail.gmail.com>
Download mbox | patch
Permalink /patch/162323/
State Rejected
Headers show

Comments

Kiril Maler - June 1, 2012, 2:35 p.m.
From 25b7ef12385efc5d7d908787e1ab93873f7e7438 Mon Sep 17 00:00:00 2001
From: Kiril Maler <kiril.maler@gmail.com>
Date: Fri, 1 Jun 2012 15:11:06 +0200
Subject: [Buildroot][PATCH] added package sftpserver


Signed-off-by: Kiril Maler <kiril.maler@gmail.com>
---
 package/Config.in                                  |    1 +
 package/sftpserver/Config.in                       |   14 ++
 .../sftpserver-just-sftp-server-from-openssh.patch |  129 ++++++++++++++++++++
 package/sftpserver/sftpserver.mk                   |   21 +++
 4 files changed, 165 insertions(+), 0 deletions(-)
 create mode 100644 package/sftpserver/Config.in
 create mode 100644
package/sftpserver/sftpserver-just-sftp-server-from-openssh.patch
 create mode 100644 package/sftpserver/sftpserver.mk
Thomas Petazzoni - June 1, 2012, 2:57 p.m.
Hello,

Le Fri, 1 Jun 2012 16:35:31 +0200,
Kiril Maler <kiril.maler@gmail.com> a écrit :

> +++ b/package/sftpserver/Config.in
> @@ -0,0 +1,14 @@
> +config BR2_PACKAGE_SFTPSERVER
> +	bool "sftpserver"
> +	depends on BR2_PACKAGE_DROPBEAR
> +	select BR2_PACKAGE_ZLIB
> +	help
> +	  sftp-server only from openssh suite. It allows mounting
> +	  the rootfs of embedded board through sshfs, for example
> +	  sshfs root@192.168.2.1:/ /mnt/board-rootfs
> +
> +	  Unmount with 'fusermount -u -z /mnt/board-rootfs'

> +OPENSSH_VERSION = 5.9p1
> +SFTPSERVER_SITE = http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable
> +SFTPSERVER_SOURCE=openssh-$(OPENSSH_VERSION).tar.gz
> +SFTPSERVER_VERSION=openssh-$(OPENSSH_VERSION)

We already have a package for openssh. Since this is also using the
same source tarball, I think it should rather be integrated as options
to the openssh package.

Regards,

Thomas

Patch

diff --git a/package/Config.in b/package/Config.in
index ca8fc96..b694a25 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -508,6 +508,7 @@  endif
 source "package/dhcpdump/Config.in"
 source "package/dnsmasq/Config.in"
 source "package/dropbear/Config.in"
+source "package/sftpserver/Config.in"
 source "package/ebtables/Config.in"
 source "package/ethtool/Config.in"
 source "package/heirloom-mailx/Config.in"
diff --git a/package/sftpserver/Config.in b/package/sftpserver/Config.in
new file mode 100644
index 0000000..5e61cb1
--- /dev/null
+++ b/package/sftpserver/Config.in
@@ -0,0 +1,14 @@ 
+config BR2_PACKAGE_SFTPSERVER
+	bool "sftpserver"
+	depends on BR2_PACKAGE_DROPBEAR
+	select BR2_PACKAGE_ZLIB
+	help
+	  sftp-server only from openssh suite. It allows mounting
+	  the rootfs of embedded board through sshfs, for example
+	  sshfs root@192.168.2.1:/ /mnt/board-rootfs
+
+	  Unmount with 'fusermount -u -z /mnt/board-rootfs'
+
+	  NOTE: Do not enable this package if 'openssh' is also compiled.
+
+	  http://www.openssh.com/
diff --git a/package/sftpserver/sftpserver-just-sftp-server-from-openssh.patch
b/package/sftpserver/sftpserver-just-sftp-server-from-openssh.patch
new file mode 100644
index 0000000..8e3729d
--- /dev/null
+++ b/package/sftpserver/sftpserver-just-sftp-server-from-openssh.patch
@@ -0,0 +1,129 @@ 
+--- a/configure.ac
++++ b/configure.ac
+@@ -2024,10 +2024,10 @@
+ 		fi
+ 		CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
+ 		AC_CHECK_HEADER([openssl/opensslv.h], ,
+-		    [AC_MSG_ERROR([*** OpenSSL headers missing - please install
first or check config.log ***])])
++		    [AC_MSG_WARN([*** OpenSSL headers missing ***])])
+ 		AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
+ 			[
+-				AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see
config.log for details) ***])
++				AC_MSG_WARN([*** Can't find recent OpenSSL libcrypto (see
config.log for details) ***])
+ 			]
+ 		)
+ 	]
+--- a/openbsd-compat/Makefile.in
++++ b/openbsd-compat/Makefile.in
+@@ -31,8 +31,10 @@
+ $(OPENBSD): ../config.h
+ $(PORTS): ../config.h
+
+-libopenbsd-compat.a:  $(COMPAT) $(OPENBSD) $(PORTS)
+-	$(AR) rv $@ $(COMPAT) $(OPENBSD) $(PORTS)
++SFTPSERVERONLY=getopt.o vis.o strmode.o strlcat.o strlcpy.o
strtonum.o bsd-misc.o pwcache.o fmt_scaled.o port-tun.o
++
++libopenbsd-compat.a:  $(SFTPSERVERONLY)
++	$(AR) rv $@ $(SFTPSERVERONLY)
+ 	$(RANLIB) $@
+
+ clean:
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -59,7 +59,7 @@
+ EXEEXT=@EXEEXT@
+ MANFMT=@MANFMT@
+
+-TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT)
ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT}
ssh-pkcs11-helper$(EXEEXT) ssh-agent$(EXEEXT) scp$(EXEEXT)
sftp-server$(EXEEXT) sftp$(EXEEXT)
++TARGETS=sftp-server$(EXEEXT)
+
+ LIBSSH_OBJS=acss.o authfd.o authfile.o bufaux.o bufbn.o buffer.o \
+ 	canohost.o channels.o cipher.o cipher-acss.o cipher-aes.o \
+@@ -119,7 +119,14 @@
+
+ FIXPATHSCMD	= $(SED) $(PATHSUBS)
+
+-all: $(CONFIGFILES) $(MANPAGES) $(TARGETS)
++all: openssl $(TARGETS)
++
++openssl:
++	if [ ! -d $@ ]; then\
++        mkdir openssl;\
++        touch openssl/opensslv.h;\
++        echo "#define BIGNUM unsigned int" > openssl/bn.h;\
++    fi
+
+ $(LIBSSH_OBJS): Makefile.in config.h
+ $(SSHOBJS): Makefile.in config.h
+@@ -164,8 +171,8 @@
+ ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o roaming_dummy.o
+ 	$(LD) -o $@ ssh-keyscan.o roaming_dummy.o $(LDFLAGS) -lssh
-lopenbsd-compat -lssh $(LIBS)
+
+-sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o
sftp-server.o sftp-server-main.o
+-	$(LD) -o $@ sftp-server.o sftp-common.o sftp-server-main.o
$(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
++sftp-server$(EXEEXT): $(LIBCOMPAT) sftp.o sftp-common.o
sftp-server.o sftp-server-main.o buffer.o xmalloc.o bufaux.o log.o
misc.o fatal.o
++	$(LD) -o $@ sftp-server.o sftp-common.o sftp-server-main.o buffer.o
xmalloc.o bufaux.o log.o misc.o fatal.o -lopenbsd-compat $(LDFLAGS)
+
+ sftp$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-client.o
sftp-common.o sftp-glob.o progressmeter.o
+ 	$(LD) -o $@ progressmeter.o sftp.o sftp-client.o sftp-common.o
sftp-glob.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) $(LIBEDIT)
+@@ -197,6 +204,7 @@
+ clean:	regressclean
+ 	rm -f *.o *.a $(TARGETS) logintest config.cache config.log
+ 	rm -f *.out core survey
++	rm -rf openssl
+ 	(cd openbsd-compat && $(MAKE) clean)
+
+ distclean:	regressclean
+@@ -231,7 +239,7 @@
+ 	$(AUTORECONF)
+ 	-rm -rf autom4te.cache
+
+-install: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files
install-sysconf host-key check-config
++install: $(TARGETS) install-files
+ install-nokeys: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files
install-sysconf
+ install-nosysconf: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files
+
+@@ -239,43 +247,8 @@
+ 	-$(DESTDIR)$(sbindir)/sshd -t -f $(DESTDIR)$(sysconfdir)/sshd_config
+
+ install-files:
+-	$(srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
+-	$(srcdir)/mkinstalldirs $(DESTDIR)$(sbindir)
+-	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)
+-	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)1
+-	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)5
+-	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)8
+ 	$(srcdir)/mkinstalldirs $(DESTDIR)$(libexecdir)
+-	(umask 022 ; $(srcdir)/mkinstalldirs $(DESTDIR)$(PRIVSEP_PATH))
+-	$(INSTALL) -m 0755 $(STRIP_OPT) ssh$(EXEEXT) $(DESTDIR)$(bindir)/ssh$(EXEEXT)
+-	$(INSTALL) -m 0755 $(STRIP_OPT) scp$(EXEEXT) $(DESTDIR)$(bindir)/scp$(EXEEXT)
+-	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-add$(EXEEXT)
$(DESTDIR)$(bindir)/ssh-add$(EXEEXT)
+-	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-agent$(EXEEXT)
$(DESTDIR)$(bindir)/ssh-agent$(EXEEXT)
+-	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-keygen$(EXEEXT)
$(DESTDIR)$(bindir)/ssh-keygen$(EXEEXT)
+-	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-keyscan$(EXEEXT)
$(DESTDIR)$(bindir)/ssh-keyscan$(EXEEXT)
+-	$(INSTALL) -m 0755 $(STRIP_OPT) sshd$(EXEEXT)
$(DESTDIR)$(sbindir)/sshd$(EXEEXT)
+-	$(INSTALL) -m 4711 $(STRIP_OPT) ssh-keysign$(EXEEXT)
$(DESTDIR)$(SSH_KEYSIGN)$(EXEEXT)
+-	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-pkcs11-helper$(EXEEXT)
$(DESTDIR)$(SSH_PKCS11_HELPER)$(EXEEXT)
+-	$(INSTALL) -m 0755 $(STRIP_OPT) sftp$(EXEEXT)
$(DESTDIR)$(bindir)/sftp$(EXEEXT)
+ 	$(INSTALL) -m 0755 $(STRIP_OPT) sftp-server$(EXEEXT)
$(DESTDIR)$(SFTP_SERVER)$(EXEEXT)
+-	$(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
+-	$(INSTALL) -m 644 scp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
+-	$(INSTALL) -m 644 ssh-add.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
+-	$(INSTALL) -m 644 ssh-agent.1.out
$(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1
+-	$(INSTALL) -m 644 ssh-keygen.1.out
$(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1
+-	$(INSTALL) -m 644 ssh-keyscan.1.out
$(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1
+-	$(INSTALL) -m 644 moduli.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/moduli.5
+-	$(INSTALL) -m 644 sshd_config.5.out
$(DESTDIR)$(mandir)/$(mansubdir)5/sshd_config.5
+-	$(INSTALL) -m 644 ssh_config.5.out
$(DESTDIR)$(mandir)/$(mansubdir)5/ssh_config.5
+-	$(INSTALL) -m 644 sshd.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
+-	$(INSTALL) -m 644 sftp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
+-	$(INSTALL) -m 644 sftp-server.8.out
$(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
+-	$(INSTALL) -m 644 ssh-keysign.8.out
$(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8
+-	$(INSTALL) -m 644 ssh-pkcs11-helper.8.out
$(DESTDIR)$(mandir)/$(mansubdir)8/ssh-pkcs11-helper.8
+-	-rm -f $(DESTDIR)$(bindir)/slogin
+-	ln -s ./ssh$(EXEEXT) $(DESTDIR)$(bindir)/slogin
+-	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
+-	ln -s ./ssh.1 $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
+
+ install-sysconf:
+ 	if [ ! -d $(DESTDIR)$(sysconfdir) ]; then \
diff --git a/package/sftpserver/sftpserver.mk b/package/sftpserver/sftpserver.mk
new file mode 100644
index 0000000..2c5c2fd
--- /dev/null
+++ b/package/sftpserver/sftpserver.mk
@@ -0,0 +1,21 @@ 
+#############################################################
+#
+# sftpserver
+#
+#############################################################
+
+OPENSSH_VERSION = 5.9p1
+SFTPSERVER_SITE = http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable
+SFTPSERVER_SOURCE=openssh-$(OPENSSH_VERSION).tar.gz
+SFTPSERVER_VERSION=openssh-$(OPENSSH_VERSION)
+SFTPSERVER_CONF_ENV = LD="$(TARGET_CC)" LDFLAGS="$(TARGET_CFLAGS)"
+SFTPSERVER_CONF_OPT = --libexecdir=/usr/libexec --disable-lastlog
--disable-utmp \
+		--disable-utmpx --disable-wtmp --disable-wtmpx --disable-strip \
+		--disable-etc-default-login --without-bsd-auth
--without-openssl-header-check \
+		--without-ssl-dir
+
+SFTPSERVER_AUTORECONF = YES
+
+SFTPSERVER_DEPENDENCIES = zlib
+
+$(eval $(call AUTOTARGETS))