Package: release.debian.org
Severity: normal
Tags: jessie
User: release.debian....@packages.debian.org
Usertags: pu

The upload service at kernel.org will soon be changed in a way that is
incompatible with the current kup client.  The changes below add
support for this new configuration, and have been tested against a
test server.

diff -Nru kup-0.3.2/debian/changelog kup-0.3.2/debian/changelog
--- kup-0.3.2/debian/changelog  2011-12-04 02:27:52.000000000 +0000
+++ kup-0.3.2/debian/changelog  2017-04-09 03:57:47.000000000 +0100
@@ -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 <b...@decadent.org.uk>  Sun, 09 Apr 2017 03:57:47 +0100
+
 kup (0.3.2-1) unstable; urgency=low
 
   * Initial release (Closes: #648896)
diff -Nru kup-0.3.2/debian/patches/add-support-for-subcmd-config-option.patch 
kup-0.3.2/debian/patches/add-support-for-subcmd-config-option.patch
--- kup-0.3.2/debian/patches/add-support-for-subcmd-config-option.patch 
1970-01-01 01:00:00.000000000 +0100
+++ kup-0.3.2/debian/patches/add-support-for-subcmd-config-option.patch 
2017-04-09 03:57:47.000000000 +0100
@@ -0,0 +1,116 @@
+From: Konstantin Ryabitsev <konstan...@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 <konstan...@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 -Nru kup-0.3.2/debian/patches/make-sure-we-use-sanitized-kup_subcmd.patch 
kup-0.3.2/debian/patches/make-sure-we-use-sanitized-kup_subcmd.patch
--- kup-0.3.2/debian/patches/make-sure-we-use-sanitized-kup_subcmd.patch        
1970-01-01 01:00:00.000000000 +0100
+++ kup-0.3.2/debian/patches/make-sure-we-use-sanitized-kup_subcmd.patch        
2017-04-09 03:57:47.000000000 +0100
@@ -0,0 +1,24 @@
+From: Konstantin Ryabitsev <konstan...@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 <konstan...@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 -Nru kup-0.3.2/debian/patches/series kup-0.3.2/debian/patches/series
--- kup-0.3.2/debian/patches/series     2011-12-04 00:52:01.000000000 +0000
+++ kup-0.3.2/debian/patches/series     2017-04-09 03:57:27.000000000 +0100
@@ -1 +1,3 @@
+add-support-for-subcmd-config-option.patch
+make-sure-we-use-sanitized-kup_subcmd.patch
 debian-paths.patch
--- END ---

-- System Information:
Debian Release: 9.0
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 
'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Reply via email to