[libnet-sftp-sftpserver-perl] 07/10: Switch to CDBS, drop unneeded (B-)D on libsys-syslog-perl, fix running tests build-chroots happening due to hard-coded look-up of /home/<user> in SftpServer.pm.

Mike Gabriel sunweaver at debian.org
Sun Sep 21 19:03:16 UTC 2014


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

sunweaver pushed a commit to branch master
in repository libnet-sftp-sftpserver-perl.

commit ef85fc6785b77b4c82303598e9aab235975956f9
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Sat Sep 20 13:45:16 2014 +0200

    Switch to CDBS, drop unneeded (B-)D on libsys-syslog-perl, fix running tests build-chroots happening due to hard-coded look-up of /home/<user> in SftpServer.pm.
---
 debian/control                                       |  4 +---
 debian/libnet-sftp-sftpserver-perl.examples          |  1 +
 .../0001_set-default-values-for-ssh-connection.patch | 19 +++++++++++++++++++
 .../0002_allow-chrooting-to-subfolders-of-home.patch | 19 +++++++++++++++++++
 debian/patches/2001_example-wrong-interpreter.patch  | 10 ++++++++++
 debian/patches/2002_use-fake-homedir-in-tests.patch  | 20 ++++++++++++++++++++
 debian/patches/README                                |  3 +++
 debian/patches/series                                |  4 ++++
 debian/rules                                         | 14 ++++++++++++--
 9 files changed, 89 insertions(+), 5 deletions(-)

diff --git a/debian/control b/debian/control
index 720d2ea..61c6298 100644
--- a/debian/control
+++ b/debian/control
@@ -7,9 +7,8 @@ Uploaders:
  Mike Gabriel <sunweaver at debian.org>,
 Build-Depends:
  debhelper (>= 8),
-Build-Depends-Indep:
+ cdbs,
  libstat-lsmode-perl,
- libsys-syslog-perl,
  perl,
 Standards-Version: 3.9.5
 Homepage: http://search.cpan.org/dist/Net-SFTP-SftpServer/
@@ -22,7 +21,6 @@ Depends:
  ${misc:Depends},
  ${perl:Depends},
  libstat-lsmode-perl,
- libsys-syslog-perl,
  perl,
 Suggests:
  libbsd-resource-perl,
diff --git a/debian/libnet-sftp-sftpserver-perl.examples b/debian/libnet-sftp-sftpserver-perl.examples
new file mode 100644
index 0000000..2d9186c
--- /dev/null
+++ b/debian/libnet-sftp-sftpserver-perl.examples
@@ -0,0 +1 @@
+bin/sftp-server.pl
\ No newline at end of file
diff --git a/debian/patches/0001_set-default-values-for-ssh-connection.patch b/debian/patches/0001_set-default-values-for-ssh-connection.patch
new file mode 100644
index 0000000..48548b4
--- /dev/null
+++ b/debian/patches/0001_set-default-values-for-ssh-connection.patch
@@ -0,0 +1,19 @@
+Description: Let log initialization succeed during unit tests
+Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+--- a/lib/Net/SFTP/SftpServer.pm
++++ b/lib/Net/SFTP/SftpServer.pm
+@@ -298,7 +298,13 @@
+ sub initLog {
+   my $syslog = shift;
+   openlog( 'sftp', 'pid', $syslog);
+-  my ($remote_ip, $remote_port, $local_ip, $local_port) = split(' ', $ENV{SSH_CONNECTION});
++  my $remote_ip = 'REMOTE_IP_NOT_SET';
++  my $remote_port = "0";
++  my $local_ip = 'LOCAL_IP_NOT_SET';
++  my $local_port = "0";
++  if ( $ENV{SSH_CONNECTION} ) {
++    ($remote_ip, $remote_port, $local_ip, $local_port) = split(' ', $ENV{SSH_CONNECTION});
++  }
+   logGeneral "Client connected from $remote_ip:$remote_port";
+   logDetail "Client connected to   $local_ip:$local_port";
+ }
diff --git a/debian/patches/0002_allow-chrooting-to-subfolders-of-home.patch b/debian/patches/0002_allow-chrooting-to-subfolders-of-home.patch
new file mode 100644
index 0000000..bbdf5aa
--- /dev/null
+++ b/debian/patches/0002_allow-chrooting-to-subfolders-of-home.patch
@@ -0,0 +1,19 @@
+Description: Allow chrooting into subfolders of the user's $HOME
+Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+--- a/lib/Net/SFTP/SftpServer.pm
++++ b/lib/Net/SFTP/SftpServer.pm
+@@ -401,7 +401,13 @@
+   if (defined $arg{file_perms}){ $self->{file_perms} = $arg{file_perms} };
+   if (defined $arg{dir_perms} ){ $self->{dir_perms}  = $arg{dir_perms}  };
+ 
+-  $self->{home_dir} = "$self->{home}/$USER";
++  # if the given home already includes the user's home directory path, allow chroot'ing to a subfolder
++  # of the user's home directory
++  if ( $self->{home} =~ m/^$ENV{HOME}\/.*/ ) {
++    $self->{home_dir} = $self->{home};
++  } else {
++    $self->{home_dir} = "$self->{home}/$USER";
++  }
+   $self->{FS} = Net::SFTP::SftpServer::FS->new();
+   $self->{FS}->setChrootDir( $self->{home_dir} );
+   unless ( -d $self->{home_dir} ){
diff --git a/debian/patches/2001_example-wrong-interpreter.patch b/debian/patches/2001_example-wrong-interpreter.patch
new file mode 100644
index 0000000..be6bb81
--- /dev/null
+++ b/debian/patches/2001_example-wrong-interpreter.patch
@@ -0,0 +1,10 @@
+Description: Perl interpreter is in /usr/bin, not /usr/local/bin
+Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+--- a/bin/sftp-server.pl
++++ b/bin/sftp-server.pl
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/perl
++#!/usr/bin/perl
+ 
+ use strict;
+ use warnings;
diff --git a/debian/patches/2002_use-fake-homedir-in-tests.patch b/debian/patches/2002_use-fake-homedir-in-tests.patch
new file mode 100644
index 0000000..e45dbbf
--- /dev/null
+++ b/debian/patches/2002_use-fake-homedir-in-tests.patch
@@ -0,0 +1,20 @@
+Description: Tests fail if /home/${USER} is not present in build chroot
+Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+Abstract:
+ For the chroot builds in Debian, we instantiate the SftpServer
+ class with a given "home" parameter.
+ .
+ The $ENV{HOME} variable has to be set to a fake-home/${USER} in
+ debian/rules to make this patch fully functional.
+
+--- a/t/00-use.t
++++ b/t/00-use.t
+@@ -4,7 +4,7 @@
+ 
+ ok(1);
+ 
+-my $sftp = Net::SFTP::SftpServer->new();
++my $sftp = Net::SFTP::SftpServer->new(home => $ENV{HOME});
+ 
+ is( ref $sftp, 'Net::SFTP::SftpServer', 'Sftp class created: ' . ref $sftp);
+ 
diff --git a/debian/patches/README b/debian/patches/README
new file mode 100644
index 0000000..80c1584
--- /dev/null
+++ b/debian/patches/README
@@ -0,0 +1,3 @@
+0xxx: Grabbed from upstream development.
+1xxx: Possibly relevant for upstream adoption.
+2xxx: Only relevant for official Debian release.
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..100a14c
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,4 @@
+0001_set-default-values-for-ssh-connection.patch
+0002_allow-chrooting-to-subfolders-of-home.patch
+2001_example-wrong-interpreter.patch
+2002_use-fake-homedir-in-tests.patch
diff --git a/debian/rules b/debian/rules
index 2d33f6a..5becc31 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,4 +1,14 @@
 #!/usr/bin/make -f
 
-%:
-	dh $@
+export HOME=$(DEB_SRCDIR)/debian/fake-home/
+export USER=$(shell id -un)
+
+include /usr/share/cdbs/1/class/perl-makemaker.mk
+include /usr/share/cdbs/1/rules/debhelper.mk
+
+makebuilddir::
+	mkdir -p $(DEB_SRCDIR)/debian/fake-home/$(USER)
+
+clean::
+	rm -f $(CURDIR)/Makefile.old
+	-rm -rf $(DEB_SRCDIR)/debian/fake-home/

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libnet-sftp-sftpserver-perl.git



More information about the Pkg-perl-cvs-commits mailing list