summaryrefslogtreecommitdiff
path: root/extra/rssh
diff options
context:
space:
mode:
authorParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
committerParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
commit415856bdd4f48ab4f2732996f0bae58595092bbe (patch)
treeede2018b591f6dfb477fe9341ba17b9bc000fab9 /extra/rssh
Tue Apr 5 14:26:38 UTC 2011
Diffstat (limited to 'extra/rssh')
-rw-r--r--extra/rssh/PKGBUILD34
-rw-r--r--extra/rssh/destdir.patch24
-rw-r--r--extra/rssh/rsync.patch57
3 files changed, 115 insertions, 0 deletions
diff --git a/extra/rssh/PKGBUILD b/extra/rssh/PKGBUILD
new file mode 100644
index 000000000..131c0ed16
--- /dev/null
+++ b/extra/rssh/PKGBUILD
@@ -0,0 +1,34 @@
+# $Id: PKGBUILD 100737 2010-11-25 18:27:36Z bisson $
+# Maintainer: Judd Vinet <jvinet@zeroflux.org>
+pkgname=rssh
+pkgver=2.3.3
+pkgrel=2
+pkgdesc='A restricted shell for use with OpenSSH, allowing only scp and/or sftp'
+arch=('i686' 'x86_64')
+url='http://www.pizzashack.org/rssh/'
+depends=('openssh' 'glibc')
+backup=('etc/rssh.conf')
+license=('custom:rssh')
+source=("http://downloads.sourceforge.net/sourceforge/rssh/rssh-$pkgver.tar.gz"
+ 'destdir.patch'
+ 'rsync.patch')
+sha1sums=('0a6dd80b5e6059e0db12c9f1276121dd966b610a'
+ '85bd1694decae5872cbeeafd578b147eb13313c6'
+ '41f32f8a77b3a2b924ede6044ab67846e06b5d20')
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ patch -p1 < ../destdir.patch
+ patch -p1 < ../rsync.patch # FS#21783, debian patch
+
+ ./configure --prefix=/usr --libexecdir=/usr/lib/rssh \
+ --mandir=/usr/share/man --sysconfdir=/etc
+ make
+}
+
+package() {
+ cd "$srcdir/$pkgname-$pkgver"
+ make DESTDIR="$pkgdir" install
+ install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/rssh/LICENSE
+}
diff --git a/extra/rssh/destdir.patch b/extra/rssh/destdir.patch
new file mode 100644
index 000000000..90fa03e6d
--- /dev/null
+++ b/extra/rssh/destdir.patch
@@ -0,0 +1,24 @@
+diff -aur old//Makefile.am new//Makefile.am
+--- old//Makefile.am 2006-12-21 23:22:37.000000000 +0100
++++ new//Makefile.am 2010-11-25 18:15:29.253376150 +0100
+@@ -16,7 +16,7 @@
+ $(CC) -c $(DEFS) $(ourdefs) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $<
+
+ install-exec-hook:
+- chmod u+s $(libexecdir)/rssh_chroot_helper
++ chmod u+s $(DESTDIR)$(libexecdir)/rssh_chroot_helper
+
+ rpm: dist
+ rpmbuild -ta --sign $(base).tar.gz
+diff -aur old//Makefile.in new//Makefile.in
+--- old//Makefile.in 2010-08-01 15:59:54.000000000 +0200
++++ new//Makefile.in 2010-11-25 18:15:29.253376150 +0100
+@@ -830,7 +830,7 @@
+ $(CC) -c $(DEFS) $(ourdefs) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $<
+
+ install-exec-hook:
+- chmod u+s $(libexecdir)/rssh_chroot_helper
++ chmod u+s $(DESTDIR)$(libexecdir)/rssh_chroot_helper
+
+ rpm: dist
+ rpmbuild -ta --sign $(base).tar.gz
diff --git a/extra/rssh/rsync.patch b/extra/rssh/rsync.patch
new file mode 100644
index 000000000..cafd6c54b
--- /dev/null
+++ b/extra/rssh/rsync.patch
@@ -0,0 +1,57 @@
+diff -aur old//util.c new//util.c
+--- old//util.c 2010-08-01 15:07:00.000000000 +0200
++++ new//util.c 2010-11-25 18:16:24.086709600 +0100
+@@ -56,6 +56,7 @@
+ #ifdef HAVE_LIBGEN_H
+ #include <libgen.h>
+ #endif /* HAVE_LIBGEN_H */
++#include <regex.h>
+
+ /* LOCAL INCLUDES */
+ #include "pathnames.h"
+@@ -187,6 +188,33 @@
+ }
+
+ /*
++ * check_rsync_e() - take the command line passed to rssh and look for a -e
++ * option. If one is found, make sure --server is provided
++ * and the option contains only the protocol information.
++ * Returns 1 if the command line is safe; 0 otherwise.
++ */
++static int check_rsync_e( char *cl )
++{
++ int status;
++ regex_t re;
++
++ /*
++ * This is more complicated than it looks because we don't want to
++ * trigger on the e in --server, but we do want to catch the common
++ * case of -ltpre.iL (which contains -e.).
++ */
++ static const char pattern[] = "[ \t\v\f]-([^-][^ ]*)?e[^.0-9]";
++
++ if ( strstr(cl, "--server") == NULL ) return 0;
++ if ( regcomp(&re, pattern, REG_EXTENDED | REG_NOSUB) != 0 ){
++ return 0;
++ }
++ status = regexec(&re, cl, 0, NULL, 0);
++ regfree(&re);
++ return (status == 0) ? 0 : 1;
++}
++
++/*
+ * check_command_line() - take the command line passed to rssh, and verify
+ * that the specified command is one the user is
+ * allowed to run. Return the path of the command
+@@ -230,9 +258,9 @@
+
+ if ( check_command(cl, opts, PATH_RSYNC, RSSH_ALLOW_RSYNC) ){
+ /* filter -e option */
+- if ( opt_exist(cl, 'e') ){
++ if ( opt_exist(cl, 'e') && !check_rsync_e(cl) ){
+ fprintf(stderr, "\ninsecure -e option not allowed.");
+- log_msg("insecure -e option in rdist command line!");
++ log_msg("insecure -e option in rsync command line!");
+ return NULL;
+ }
+