pkgsrc/net/mirror/patches/patch-ae
taca 69539c01e7 * Avoid to use timelocal.pl since it cause warning with perl 5.14 now.
* Allow deleting remote directories.  (It is needed to put local file tree
  to remote with  mirror.

Bump PKGREVISION.
2011-09-12 16:35:43 +00:00

99 lines
2.1 KiB
Text

$NetBSD: patch-ae,v 1.7 2011/09/12 16:35:43 taca Exp $
* Enable deleting remote directories.
* Proper signal handling.
* Miscellaneous bug fixes.
--- ftp.pl.orig 1998-06-05 09:10:27.000000000 +0000
+++ ftp.pl
@@ -233,7 +233,7 @@ sub timed_open
}
else {
print $showfd "proxy connection failed " if $proxy;
- print $showfd "Cannot open ftp to $connect_site\n" if $ftp_show;
+ print $showfd "Cannot open ftp to $newhost:$newport\n" if $ftp_show;
return 0;
}
}
@@ -270,6 +270,14 @@ sub ftp'set_signals
$SIG{ 'PIPE' } = "ftp'ftp__sighandler";
}
+# Setup a signal handler for user interrupts.
+sub ftp'set_user_signals
+{
+ $ftp_logger = @_;
+ $SIG{ 'INT' } = "ftp'ftp__sighandler";
+}
+
+
# &ftp'set_namemap( function to map outgoing name, function to map incoming )
sub ftp'set_namemap
{
@@ -486,7 +494,7 @@ sub pasv
return 0;
}
if( $ret == 1 ) {
- if( $response =~ m/^227 Entering Passive Mode \((\d+),(\d+),(\d+),(\d+),(\d+),(\d+)\)/ ){
+ if($response =~ m/^227 .*\((\d+),(\d+),(\d+),(\d+),(\d+),(\d+)\)/){
$newhost = sprintf( "%d.%d.%d.%d", $1, $2, $3, $4 );
$newport = $5 * 256 + $6;
}
@@ -581,6 +589,9 @@ sub ftp'dir_close
return 0;
}
+ # shut down our end of the socket
+ &close_data_socket;
+
# read the close
#
$ret = &expect($timeout,
@@ -590,8 +601,6 @@ sub ftp'dir_close
$ret = 0;
}
- # shut down our end of the socket
- &close_data_socket;
if( ! $ret ){
return 0;
@@ -708,6 +717,7 @@ sub ftp'get
if( ! $service_open ){
return 0;
}
+ chmod 0600, $loc_fname;
if( $loc_fname eq "" ){
$loc_fname = $rem_fname;
@@ -917,10 +927,27 @@ sub delete
sub deldir
{
- local( $fname ) = @_;
+ local( $rem_fname ) = @_;
+ local( $ret );
+
+ if( ! $service_open ){
+ return 0;
+ }
- # not yet implemented
- # RMD
+ if( $mapunixout ){
+ $rem_fname = eval "&$mapunixout( \$rem_fname, 'f' )";
+ }
+
+ &send( "RMD $rem_fname" );
+
+ $ret = &expect( $timeout,
+ 2, 1 ); # Deleted $rem_fname
+ if( $ret == 99 ){
+ &service_closed();
+ $ret = 0;
+ }
+
+ return $ret == 1;
}
# &ftp'put( local filename, remote filename, restart where left off )