releasing/cbrtools/perl/Net/Config.pm
author jjkang
Fri, 25 Jun 2010 18:37:20 +0800
changeset 602 3145852acc89
permissions -rw-r--r--
add releasing to new structure
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
602
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     1
# Net::Config.pm
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     2
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     3
# Copyright (c) 2000 Graham Barr <gbarr@pobox.com>. All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     4
# This program is free software; you can redistribute it and/or
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     5
# modify it under the same terms as Perl itself.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     6
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     7
package Net::Config;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     8
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     9
require Exporter;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    10
use vars qw(@ISA @EXPORT %NetConfig $VERSION $CONFIGURE $LIBNET_CFG);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    11
use Socket qw(inet_aton inet_ntoa);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    12
use strict;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    13
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    14
@EXPORT  = qw(%NetConfig);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    15
@ISA     = qw(Net::LocalCfg Exporter);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    16
$VERSION = "1.10"; # $Id: //depot/libnet/Net/Config.pm#17 $
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    17
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    18
eval { local $SIG{__DIE__}; require Net::LocalCfg };
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    19
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    20
%NetConfig = (
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    21
    nntp_hosts => [],
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    22
    snpp_hosts => [],
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    23
    pop3_hosts => [],
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    24
    smtp_hosts => [],
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    25
    ph_hosts => [],
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    26
    daytime_hosts => [],
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    27
    time_hosts => [],
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    28
    inet_domain => undef,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    29
    ftp_firewall => undef,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    30
    ftp_ext_passive => 0,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    31
    ftp_int_passive => 0,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    32
    test_hosts => 1,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    33
    test_exist => 1,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    34
);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    35
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    36
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
# Try to get as much configuration info as possible from InternetConfig
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
$^O eq 'MacOS' and eval <<TRY_INTERNET_CONFIG;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
use Mac::InternetConfig;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    41
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    42
{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    43
my %nc = (
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
    nntp_hosts      => [ \$InternetConfig{ kICNNTPHost() } ],
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
    pop3_hosts      => [ \$InternetConfig{ kICMailAccount() } =~ /\@(.*)/ ],
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
    smtp_hosts      => [ \$InternetConfig{ kICSMTPHost() } ],
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    47
    ftp_testhost    => \$InternetConfig{ kICFTPHost() } ? \$InternetConfig{ kICFTPHost()} : undef,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    48
    ph_hosts        => [ \$InternetConfig{ kICPhHost() }   ],
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    49
    ftp_ext_passive => \$InternetConfig{"646F676F\xA5UsePassiveMode"} || 0,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
    ftp_int_passive => \$InternetConfig{"646F676F\xA5UsePassiveMode"} || 0,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
    socks_hosts     => 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
    	\$InternetConfig{ kICUseSocks() }    ? [ \$InternetConfig{ kICSocksHost() }    ] : [],
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    53
    ftp_firewall    => 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    54
    	\$InternetConfig{ kICUseFTPProxy() } ? [ \$InternetConfig{ kICFTPProxyHost() } ] : [],
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    55
);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    56
\@NetConfig{keys %nc} = values %nc;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    57
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    58
TRY_INTERNET_CONFIG
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    59
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    60
my $file = __FILE__;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    61
my $ref;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    62
$file =~ s/Config.pm/libnet.cfg/;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    63
if ( -f $file ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    64
    $ref = eval { local $SIG{__DIE__}; do $file };
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    65
    if (ref($ref) eq 'HASH') {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    66
	%NetConfig = (%NetConfig, %{ $ref });
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    67
	$LIBNET_CFG = $file;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    68
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    69
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    70
if ($< == $> and !$CONFIGURE)  {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
    my $home = eval { local $SIG{__DIE__}; (getpwuid($>))[7] } || $ENV{HOME};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
    $home ||= $ENV{HOMEDRIVE} . ($ENV{HOMEPATH}||'') if defined $ENV{HOMEDRIVE};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
    if (defined $home) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
	$file = $home . "/.libnetrc";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
	$ref = eval { local $SIG{__DIE__}; do $file } if -f $file;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
	%NetConfig = (%NetConfig, %{ $ref })
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
	    if ref($ref) eq 'HASH';	
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    78
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    79
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    80
my ($k,$v);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
while(($k,$v) = each %NetConfig) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
	$NetConfig{$k} = [ $v ]
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    83
		if($k =~ /_hosts$/ and $k ne "test_hosts" and defined($v) and !ref($v));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    84
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    85
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    86
# Take a hostname and determine if it is inside the firewall
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    87
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    88
sub requires_firewall {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
    shift; # ignore package
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    90
    my $host = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    91
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    92
    return 0 unless defined $NetConfig{'ftp_firewall'};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    93
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    94
    $host = inet_aton($host) or return -1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    95
    $host = inet_ntoa($host);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    96
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
    if(exists $NetConfig{'local_netmask'}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    98
	my $quad = unpack("N",pack("C*",split(/\./,$host)));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    99
	my $list = $NetConfig{'local_netmask'};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   100
	$list = [$list] unless ref($list);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   101
	foreach (@$list) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   102
	    my($net,$bits) = (m#^(\d+\.\d+\.\d+\.\d+)/(\d+)$#) or next;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   103
	    my $mask = ~0 << (32 - $bits);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   104
	    my $addr = unpack("N",pack("C*",split(/\./,$net)));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   105
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   106
	    return 0 if (($addr & $mask) == ($quad & $mask));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   107
	}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   108
	return 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   109
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   110
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   111
    return 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   112
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   113
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   114
use vars qw(*is_external);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   115
*is_external = \&requires_firewall;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   116
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   117
1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   118
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   119
__END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   120
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   121
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   122
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   123
Net::Config - Local configuration data for libnet
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   124
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   125
=head1 SYNOPSYS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   126
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   127
    use Net::Config qw(%NetConfig);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   128
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   129
=head1 DESCRIPTION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   130
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   131
C<Net::Config> holds configuration data for the modules in the libnet
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   132
distribuion. During installation you will be asked for these values.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   133
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   134
The configuration data is held globally in a file in the perl installation
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   135
tree, but a user may override any of these values by providing their own. This
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   136
can be done by having a C<.libnetrc> file in their home directory. This file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   137
should return a reference to a HASH containing the keys described below.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   138
For example
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   139
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   140
    # .libnetrc
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   141
    {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   142
        nntp_hosts => [ "my_prefered_host" ],
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   143
	ph_hosts   => [ "my_ph_server" ],
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   144
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   145
    __END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   146
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   147
=head1 METHODS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   148
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   149
C<Net::Config> defines the following methods. They are methods as they are
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   150
invoked as class methods. This is because C<Net::Config> inherits from
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   151
C<Net::LocalCfg> so you can override these methods if you want.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   152
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   153
=over 4
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   154
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   155
=item requires_firewall HOST
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   156
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   157
Attempts to determine if a given host is outside your firewall. Possible
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   158
return values are.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   159
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   160
  -1  Cannot lookup hostname
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   161
   0  Host is inside firewall (or there is no ftp_firewall entry)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   162
   1  Host is outside the firewall
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   163
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   164
This is done by using hostname lookup and the C<local_netmask> entry in
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   165
the configuration data.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   166
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   167
=back
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   168
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   169
=head1 NetConfig VALUES
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   170
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   171
=over 4
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   172
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   173
=item nntp_hosts
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   174
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   175
=item snpp_hosts
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   176
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   177
=item pop3_hosts
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   178
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   179
=item smtp_hosts
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   180
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   181
=item ph_hosts
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   182
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   183
=item daytime_hosts
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   184
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   185
=item time_hosts
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   186
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   187
Each is a reference to an array of hostnames (in order of preference),
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   188
which should be used for the given protocol
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   189
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   190
=item inet_domain
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   191
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   192
Your internet domain name
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   193
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   194
=item ftp_firewall
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   195
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   196
If you have an FTP proxy firewall (B<NOT> an HTTP or SOCKS firewall)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   197
then this value should be set to the firewall hostname. If your firewall
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   198
does not listen to port 21, then this value should be set to
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   199
C<"hostname:port"> (eg C<"hostname:99">)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   200
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   201
=item ftp_firewall_type
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   202
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   203
There are many different ftp firewall products available. But unfortunately
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   204
there is no standard for how to traverse a firewall.  The list below shows the
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   205
sequence of commands that Net::FTP will use
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   206
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   207
  user        Username for remote host
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   208
  pass        Password for remote host
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   209
  fwuser      Username for firewall
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   210
  fwpass      Password for firewall
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   211
  remote.host The hostname of the remote ftp server
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   212
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   213
=over 4
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   214
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   215
=item 0
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   216
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   217
There is no firewall
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   218
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   219
=item 1
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   220
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   221
     USER user@remote.host
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   222
     PASS pass
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   223
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   224
=item 2
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   225
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   226
     USER fwuser
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   227
     PASS fwpass
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   228
     USER user@remote.host
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   229
     PASS pass
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   230
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   231
=item 3
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   232
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   233
     USER fwuser
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   234
     PASS fwpass
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   235
     SITE remote.site
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   236
     USER user
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   237
     PASS pass
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   238
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   239
=item 4
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   240
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   241
     USER fwuser
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   242
     PASS fwpass
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   243
     OPEN remote.site
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   244
     USER user
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   245
     PASS pass
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   246
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   247
=item 5
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   248
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   249
     USER user@fwuser@remote.site
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   250
     PASS pass@fwpass
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   251
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   252
=item 6
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   253
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   254
     USER fwuser@remote.site
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   255
     PASS fwpass
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   256
     USER user
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   257
     PASS pass
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   258
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   259
=item 7
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   260
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   261
     USER user@remote.host
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   262
     PASS pass
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   263
     AUTH fwuser
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   264
     RESP fwpass
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   265
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   266
=back
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   267
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   268
=item ftp_ext_passive
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   269
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   270
=item ftp_int_pasive
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   271
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   272
FTP servers normally work on a non-passive mode. That is when you want to
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   273
transfer data you have to tell the server the address and port to
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   274
connect to.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   275
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   276
With some firewalls this does not work as the server cannot
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   277
connect to your machine (because you are behind a firewall) and the firewall
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   278
does not re-write the command. In this case you should set C<ftp_ext_passive>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   279
to a I<true> value.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   280
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   281
Some servers are configured to only work in passive mode. If you have
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   282
one of these you can force C<Net::FTP> to always transfer in passive
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   283
mode; when not going via a firewall, by setting C<ftp_int_passive> to
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   284
a I<true> value.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   285
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   286
=item local_netmask
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   287
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   288
A reference to a list of netmask strings in the form C<"134.99.4.0/24">.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   289
These are used by the C<requires_firewall> function to determine if a given
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   290
host is inside or outside your firewall.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   291
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   292
=back
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   293
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   294
The following entries are used during installation & testing on the
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   295
libnet package
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   296
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   297
=over 4
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   298
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   299
=item test_hosts
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   300
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   301
If true then C<make test> may attempt to connect to hosts given in the
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   302
configuration.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   303
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   304
=item test_exists
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   305
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   306
If true then C<Configure> will check each hostname given that it exists
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   307
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   308
=back
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   309
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   310
=for html <hr>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   311
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   312
I<$Id: //depot/libnet/Net/Config.pm#17 $>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   313
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   314
=head1 COPYRIGHT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   315
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   316
Copyright (c) 2000 Graham Barr <gbarr@pobox.com>. All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   317
This program is free software; you can redistribute it and/or 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   318
modify it under the same terms as Perl itself.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   319
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   320
=cut