[kup] 01/01: kup: Backport changes needed to work with kernel.org in future (Closes: #859143)

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Sun Apr 9 03:07:14 UTC 2017


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch jessie
in repository kup.

commit 1b1276bbee7b23fb1650c9538693c3fd6aaae956
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Sun Apr 9 02:19:21 2017 +0100

    kup: Backport changes needed to work with kernel.org in future (Closes: #859143)
---
 debian/changelog                                   |   9 ++
 .../add-support-for-subcmd-config-option.patch     | 116 +++++++++++++++++++++
 .../make-sure-we-use-sanitized-kup_subcmd.patch    |  24 +++++
 debian/patches/series                              |   2 +
 4 files changed, 151 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 123aaf1..3ad98ad 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+kup (0.3.2-2) jessie; urgency=medium
+
+  * kup: Backport changes needed to work with kernel.org in future
+    (Closes: #859143):
+    - Add support for subcmd config option
+    - Make sure we use sanitized KUP_SUBCMD
+
+ -- Ben Hutchings <ben at decadent.org.uk>  Sun, 09 Apr 2017 03:57:47 +0100
+
 kup (0.3.2-1) unstable; urgency=low
 
   * Initial release (Closes: #648896)
diff --git a/debian/patches/add-support-for-subcmd-config-option.patch b/debian/patches/add-support-for-subcmd-config-option.patch
new file mode 100644
index 0000000..5ff0419
--- /dev/null
+++ b/debian/patches/add-support-for-subcmd-config-option.patch
@@ -0,0 +1,116 @@
+From: Konstantin Ryabitsev <konstantin at linuxfoundation.org>
+Date: Tue, 14 Mar 2017 16:30:43 -0400
+Subject: Add support for subcmd config option
+Origin: https://git.kernel.org/pub/scm/utils/kup/kup.git/commit?id=f91f3ef0affcfcd96cc8882c10f988d5ef0e79a7
+Bug-Debian: https://bugs.debian.org/859143
+
+It is possible to use kup in conjunction with another authorization
+system that already relies on ssh for authentication (e.g. gitolite),
+in which case we need to be able to specify a subcommand to specifically
+invoke the kup server.
+
+If no subcmd is specified, the default standalone kup behaviour is used.
+
+Signed-off-by: Konstantin Ryabitsev <konstantin at linuxfoundation.org>
+[bwh: Backported to 0.3.2: adjust context]
+---
+ kup   | 30 +++++++++++++++++++++++++-----
+ kup.1 |  7 +++++++
+ 2 files changed, 32 insertions(+), 5 deletions(-)
+
+--- a/kup
++++ b/kup
+@@ -28,6 +28,7 @@ my $blksiz = 1024*1024;
+ my %opt = (
+ 	'rsh'	 => 'ssh -a -x -k -T',
+ 	'host'	=> 'kup.kernel.org',
++	'subcmd'  => undef,
+ 	'batch'   => 0,
+ 	'verbose' => 0,
+ 	);
+@@ -37,13 +38,17 @@ my $cfg_file = $ENV{'HOME'}.'/.kuprc';
+ my $cfg = new Config::Simple($cfg_file);
+ 
+ if (defined($cfg)) {
+-	# Update %opt with cfgfile settings (only rsh and host vars)
++	# Update %opt with cfgfile settings (only rsh, subcmd, and host vars)
+ 	my %cfg_opt = $cfg->vars();
+ 
+ 	if (defined($cfg_opt{'default.host'})) {
+ 		$opt{'host'} = $cfg_opt{'default.host'};
+ 	}
+ 
++	if (defined($cfg_opt{'default.subcmd'})) {
++		$opt{'subcmd'} = $cfg_opt{'default.subcmd'};
++	}
++
+ 	if (defined($cfg_opt{'default.rsh'})) {
+ 		$opt{'rsh'} = $cfg_opt{'default.rsh'};
+ 	}
+@@ -66,6 +71,9 @@ if (defined $ENV{'KUP_RSH'}) {
+ if (defined $ENV{'KUP_HOST'}) {
+ 	$opt{'host'} = $ENV{'KUP_HOST'};
+ }
++if (defined $ENV{'KUP_SUBCMD'}) {
++	$opt{'subcmd'} = $ENV{'KUP_SUBCMD'};
++}
+ delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};   # Make %ENV safer
+ 
+ # We process the command set twice, once as a dry run and one for real,
+@@ -80,10 +88,11 @@ sub usage($) {
+ 	print STDERR "Usage: $0 [global options] command [-- command...]\n";
+ 	print STDERR "\n";
+ 	print STDERR "Global options:\n";
+-	print STDERR "   -b  --batch			 Output command stream to stdout\n";
+-	print STDERR "   -e  --rsh=command	   Send output to command, override KUP_RSH\n";
+-	print STDERR "   -o  --host=[user@]host  Connect to [user@]host, override KUP_HOST\n";
+-	print STDERR "   -v  --verbose		   Print each command to stderr as it is sent\n";
++	print STDERR "   -b  --batch            Output command stream to stdout\n";
++	print STDERR "   -e  --rsh=command      Send output to command, override KUP_RSH\n";
++	print STDERR "   -o  --host=[user@]host Connect to [user@]host, override KUP_HOST\n";
++	print STDERR "   -c  --subcmd=cmd       After connecting via ssh, issue this subcommand\n";
++	print STDERR "   -v  --verbose          Print each command to stderr as it is sent\n";
+ 	print STDERR "\n";
+ 	print STDERR "Commands:\n";
+ 	print STDERR "   put local_file signature remote_path\n";
+@@ -224,6 +233,10 @@ sub parse_global_options()
+ 			$opt{'host'} = shift(@ARGV);
+ 		} elsif ($arg =~ /^--host=(.+)$/) {
+ 			$opt{'host'} = $1;
++		} elsif ($arg eq '-c' || $arg eq '--subcmd') {
++			$opt{'subcmd'} = shift(@ARGV);
++		} elsif ($arg =~ /^--subcmd=(.+)$/) {
++			$opt{'subcmd'} = $1;
+ 		} elsif ($arg eq '-v' || $arg eq '--verbose') {
+ 			$opt{'verbose'}++;
+ 		} elsif ($arg eq '-h' || $arg eq '--help') {
+@@ -271,6 +284,13 @@ sub setup_output()
+ 			die "$0: suspicious KUP_HOST\n";
+ 		}
+ 		$rsh .= " \Q$1";
++		if ($opt{'subcmd'}) {
++			if ($opt{'subcmd'} !~ /^([-a-zA-Z0-9_]+)$/) {
++				die "$0: suspicious KUP_SUBCMD\n";
++			}
++			# Add the subcommand for the receiving server
++			$rsh .= " " . $opt{'subcmd'}
++		}
+ 		open(STDOUT, '|-', $rsh)
+ 			or die "$0: cannot execute rsh command ", $rsh, "\n";
+ 	}
+--- a/kup.1
++++ b/kup.1
+@@ -49,6 +49,13 @@ is set by the environment variable
+ .B KUP_HOST
+ or if that is not set,
+ \fIkup.kernel.org\fP.
++.TP
++\fB\-c\fP, \fB\-\-subcmd\fP \fIsubcommand\fP
++After establishing the ssh connection, issue a subcommand in case the remote
++server is used in conjunction with an AuthZ tool like gitolite. Can also be set
++using the env variable
++.B KUP_SUBCMD
++or if not set, no subcommand will be used (default kup-server behavior).
+ .SH COMMANDS
+ A series of commands can be specified on a single command line,
+ separated by a double dash argument (\fB\-\-\fP).
diff --git a/debian/patches/make-sure-we-use-sanitized-kup_subcmd.patch b/debian/patches/make-sure-we-use-sanitized-kup_subcmd.patch
new file mode 100644
index 0000000..7c107fc
--- /dev/null
+++ b/debian/patches/make-sure-we-use-sanitized-kup_subcmd.patch
@@ -0,0 +1,24 @@
+From: Konstantin Ryabitsev <konstantin at linuxfoundation.org>
+Date: Tue, 28 Mar 2017 14:01:18 -0400
+Subject: Make sure we use sanitized KUP_SUBCMD
+Origin: https://git.kernel.org/pub/scm/utils/kup/kup.git/commit?id=0ff2c2a5d25046a8f0bb8da431449206c8d702bc
+Bug-Debian: https://bugs.debian.org/859143
+
+Otherwise we break the -T mode
+
+Signed-off-by: Konstantin Ryabitsev <konstantin at linuxfoundation.org>
+---
+ kup | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/kup
++++ b/kup
+@@ -289,7 +289,7 @@ sub setup_output()
+ 				die "$0: suspicious KUP_SUBCMD\n";
+ 			}
+ 			# Add the subcommand for the receiving server
+-			$rsh .= " " . $opt{'subcmd'}
++			$rsh .= " \Q$1";
+ 		}
+ 		open(STDOUT, '|-', $rsh)
+ 			or die "$0: cannot execute rsh command ", $rsh, "\n";
diff --git a/debian/patches/series b/debian/patches/series
index 58fe5a7..9a5c4b8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
+add-support-for-subcmd-config-option.patch
+make-sure-we-use-sanitized-kup_subcmd.patch
 debian-paths.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/kup.git



More information about the Kernel-svn-changes mailing list