--- ftpmirror/ftputil.pl-ooo Sun Feb 8 20:30:47 1998 +++ ftpmirror/ftputil.pl Wed May 19 10:49:34 1999 @@ -524,6 +524,58 @@ log::putl("NOTICE", "success to login $xhost/$xuser."); 1; } +;# +;# yy_login try to log on a single server. +;# +sub yy_login { + my($xhost, $xuser, $xpass, $xnetid, $xnetpass) = @_; + + if (defined($dumpfile)) { + undef $dumpfile if !open(DUMP, ">$dumpfile"); + } + + if (!xx_init($xhost, 'ftp')) { + log::putl("WARNING", "xx_init failed"); + return undef; + } + + if (!(xx_recv(1) == 220 + && xx_send("USER $xnetid") + && xx_recv(1) == 331 + && xx_send("PASS $xnetpass") + && xx_recv(1) == 230 + && xx_send("USER $xuser") + && xx_recv(1) == 331 + && xx_send("PASS $xpass") + && xx_recv(1) == 230)) { + log::putl("WARNING", "fail to login $xhost/$xuser."); + quit; + return undef; + } + + ;# send group/gpass + if ($group ne '' && $gpass ne '') { + if (!sitegroup($group, $gpass)) { + log::putl("WARNING", "site group/gpass failed."); + quit; + return undef; + } + } + + ;# get/set idle timer + if ($idle > 0 || $max_idle) { + my($i, $max) = siteidle(); + log::putl("DEBUG", "IDLE ($i, $max)"); + if (defined($max)) { + $idle = $max if $max_idle; + siteidle($idle); # ignore result + } + } + + ;# success to login + log::putl("NOTICE", "success to login $xhost/$xuser."); + 1; +} ;# ;# login - call xx_login for each FTP server, until connection @@ -546,6 +598,7 @@ my @servers = split(/\s+/, $server); ;# is $gateway defined? + if ($netid eq '') { if ($gateway eq '') { for $s (@servers) { log::putl("DEBUG", "login: try $s."); @@ -557,7 +610,14 @@ return 1 if xx_login($gateway, $user.'@'.$s, $pass); } } - + } else { + for $s (@servers) { + log::putl("DEBUG", "login: try $s."); + return 1 + if yy_login($gateway, $user.'@'.$s, $pass, $netid, $netpass); + } + + } ;# all tries failed. undef; } --- ftpmirror/param.pl-ooo Mon Jun 2 10:43:45 1997 +++ ftpmirror/param.pl Wed May 19 11:11:17 1999 @@ -66,6 +66,8 @@ 'ftp-gateway' => '', 'ftp-user' => 'anonymous', 'ftp-pass' => $name.'@'.$hostname, + 'ftp-netid' => '', + 'ftp-netpass' => '', 'ftp-group' => '', 'ftp-gpass' => '', 'ftp-idle' => undef, @@ -384,7 +386,7 @@ $p->{'offset'} = $offset; ;# parameters in ftputil.pl - for $x (qw(debug timeout bindaddress server gateway + for $x (qw(debug timeout bindaddress server gateway netid netpass user pass group gpass passive idle max-idle)) { my $y = "ftp-$x"; $x =~ s/-/_/g;