r44688 - in /branches/upstream/libnet-sftp-foreign-perl/current: Changes META.yml debug.txt lib/Net/SFTP/Foreign.pm t/1_run.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Wed Sep 23 22:59:42 UTC 2009


Author: jawnsy-guest
Date: Wed Sep 23 22:59:36 2009
New Revision: 44688

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=44688
Log:
[svn-upgrade] Integrating new upstream version, libnet-sftp-foreign-perl (1.55+dfsg)

Modified:
    branches/upstream/libnet-sftp-foreign-perl/current/Changes
    branches/upstream/libnet-sftp-foreign-perl/current/META.yml
    branches/upstream/libnet-sftp-foreign-perl/current/debug.txt
    branches/upstream/libnet-sftp-foreign-perl/current/lib/Net/SFTP/Foreign.pm
    branches/upstream/libnet-sftp-foreign-perl/current/t/1_run.t

Modified: branches/upstream/libnet-sftp-foreign-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-sftp-foreign-perl/current/Changes?rev=44688&op=diff
==============================================================================
--- branches/upstream/libnet-sftp-foreign-perl/current/Changes (original)
+++ branches/upstream/libnet-sftp-foreign-perl/current/Changes Wed Sep 23 22:59:36 2009
@@ -1,4 +1,23 @@
 Revision history for Net::SFTP::Foreign
+
+1.55  Sep 9, 2009
+        - re-release as stable
+
+1.54_03  Sep 4, 2009
+	- add debugging to _rel2abs
+
+1.54_02  Aug 19, 2009
+	- add extra sanity check to setcwd method. It seems that some
+          servers do not report an error when realpath is called on an
+          inexistent file (bug report by Ben Szulc)
+	- password authentication broken in AIX
+        - some documentation corrections
+        - more tests added
+
+1.54_01  Jul 22, 2009
+        - yet another "Password not requested as expected" bug solved,
+          $pty->close_slave was being called too soon (bug report by
+          Tim Rayner)
 
 1.53  Jul 6, 2009
         - re-released as stable

Modified: branches/upstream/libnet-sftp-foreign-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-sftp-foreign-perl/current/META.yml?rev=44688&op=diff
==============================================================================
--- branches/upstream/libnet-sftp-foreign-perl/current/META.yml (original)
+++ branches/upstream/libnet-sftp-foreign-perl/current/META.yml Wed Sep 23 22:59:36 2009
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                Net-SFTP-Foreign
-version:             1.53
+version:             1.55
 abstract:            Secure File Transfer Protocol client
 license:             ~
 author:              

Modified: branches/upstream/libnet-sftp-foreign-perl/current/debug.txt
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-sftp-foreign-perl/current/debug.txt?rev=44688&op=diff
==============================================================================
--- branches/upstream/libnet-sftp-foreign-perl/current/debug.txt (original)
+++ branches/upstream/libnet-sftp-foreign-perl/current/debug.txt Wed Sep 23 22:59:36 2009
@@ -10,4 +10,4 @@
  512 -
 1024 - hexdump of sysreads
 2048 - hexdump of syswrites
-
+4096 - _rel2abs

Modified: branches/upstream/libnet-sftp-foreign-perl/current/lib/Net/SFTP/Foreign.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-sftp-foreign-perl/current/lib/Net/SFTP/Foreign.pm?rev=44688&op=diff
==============================================================================
--- branches/upstream/libnet-sftp-foreign-perl/current/lib/Net/SFTP/Foreign.pm (original)
+++ branches/upstream/libnet-sftp-foreign-perl/current/lib/Net/SFTP/Foreign.pm Wed Sep 23 22:59:36 2009
@@ -1,6 +1,6 @@
 package Net::SFTP::Foreign;
 
-our $VERSION = '1.53';
+our $VERSION = '1.55';
 
 use strict;
 use warnings;
@@ -441,7 +441,7 @@
 		    exit -1;
 		}
 		_ipc_open2_bug_workaround $this_pid;
-		$pty->close_slave();
+		# $pty->close_slave();
 	    }
 	    else {
 		$expect = Expect->new;
@@ -476,6 +476,7 @@
                 $sftp->_conn_failed("$name interchange did not complete", $expect->error);
                 return $sftp;
             }
+	    $expect->close_slave();
         }
         else {
             _debug "ssh cmd: @open2_cmd\n" if ($debug and $debug & 1);
@@ -636,12 +637,14 @@
 
 sub _rel2abs {
     my ($sftp, $path) = @_;
+    my $old = $path;
     my $cwd = $sftp->{cwd};
     if (defined $cwd and $path !~ m|^/|) {
         # carp "sftp->rel2abs($path) => $sftp->{cwd}/$path\n";
 	$path =~ s|^(?:\./+)+||;
-	return ($cwd =~ m|/$| ? "$cwd$path" : "$cwd/$path");
-    }
+	$path = ($cwd =~ m|/$| ? "$cwd$path" : "$cwd/$path");
+    }
+    $debug and $debug & 4096 and _debug("_rel2abs: '$old' --> '$path'");
     return $path
 }
 
@@ -740,7 +743,6 @@
     my ($sftp, $eid, $error, $errstr) = @_;
     if (my $msg = $sftp->_get_msg_and_check(SSH2_FXP_STATUS, $eid,
 					    $error, $errstr)) {
-	
 	my $status = $sftp->_set_status($msg->get_int32, $msg->get_str);
 	return 1 if $status == SSH2_FX_OK;
 
@@ -750,19 +752,27 @@
 }
 
 sub setcwd {
-
-    @_ == 2 or croak 'Usage: $sftp->setcwd($path)';
+    @_ <= 2 or croak 'Usage: $sftp->setcwd($path)';
     ${^TAINT} and &_catch_tainted_args;
 
     my ($sftp, $cwd) = @_;
     if (defined $cwd) {
         $cwd = $sftp->realpath($cwd);
         return undef unless defined $cwd;
-        $sftp->{cwd} = $cwd;
+	my $a = $sftp->stat($cwd)
+	    or return undef;
+	if (S_ISDIR($a->perm)) {
+	    return $sftp->{cwd} = $cwd;
+	}
+	else {
+	    $sftp->_set_error(SFTP_ERR_REMOTE_BAD_OBJECT,
+			      "Remote object '$cwd' is not a directory");
+	    return undef;
+	}
     }
     else {
         delete $sftp->{cwd};
-        return $sftp->cwd;
+        return $sftp->cwd if defined wantarray;
     }
 }
 
@@ -1496,8 +1506,8 @@
         $sftp->status != SSH2_FX_OP_UNSUPPORTED and return undef;
     }
 
-    # we are optimistic and try to rename it whitout testing if a file
-    # of the same name already exists
+    # we are optimistic here and try to rename it without testing if a
+    # file of the same name already exists first
     $sftp->_rename($old, $new) and return 1;
 
     if ($overwrite and $sftp->status == SSH2_FX_FAILURE) {
@@ -4615,7 +4625,7 @@
 
 B<A>: Use the C<S_IS*> functions from L<Fcntl>. For instance:
 
-  use Fcntl qw(IS_DIR);
+  use Fcntl qw(S_ISDIR);
   my $ls = $sftp->ls or die $sftp->error;
   for my $entry (@$ls) {
     if (S_ISDIR($entry->{a}->perm)) {

Modified: branches/upstream/libnet-sftp-foreign-perl/current/t/1_run.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-sftp-foreign-perl/current/t/1_run.t?rev=44688&op=diff
==============================================================================
--- branches/upstream/libnet-sftp-foreign-perl/current/t/1_run.t (original)
+++ branches/upstream/libnet-sftp-foreign-perl/current/t/1_run.t Wed Sep 23 22:59:36 2009
@@ -21,7 +21,7 @@
 plan skip_all => "sftp-server not found"
     unless defined $sscmd;
 
-plan tests => 717;
+plan tests => 722;
 
 use_ok('Net::SFTP::Foreign');
 use Net::SFTP::Foreign::Constants qw(:flags);
@@ -49,6 +49,12 @@
 ok (defined $rcwd, "realpath");
 
 my @data = <DATA>;
+
+ok ($sftp->setcwd("."), "setcwd");
+ok (!$sftp->setcwd("miauu"), "setcwd to non existant dir");
+ok ($sftp->stat("t/1_run.t"), "check that the file exists");
+ok (!$sftp->setcwd("t/1_run.t"), "setcwd to file");
+ok ($sftp->setcwd(), "setcwd reset");
 
 for my $setcwd (0, 1) {
     my $orcwd = $rcwd;




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