This file is indexed.

/usr/lib/dpkg/methods/ftp/setup is in dselect 1.18.25.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/usr/bin/perl
#
# Copyright © 1996 Andy Guy <awpguy@acs.ucalgary.ca>
# Copyright © 1998 Martin Schulze <joey@infodrom.north.de>
# Copyright © 1999, 2009 Raphaël Hertzog <hertzog@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

use strict;
use warnings;

eval q{
    pop @INC if $INC[-1] eq '.';
    use Net::FTP;
};
if ($@) {
    warn "Please install the 'perl' package if you want to use the\n" .
         "FTP access method of dselect.\n\n";
    exit 1;
}
use Dselect::Ftp;

# deal with arguments
my $vardir = $ARGV[0];
my $method = $ARGV[1];
my $option = $ARGV[2];

if ($option eq 'manual') {
    print "Manual package installation.\n";
    exit 0;
}
#print "vardir: $vardir, method: $method, option: $option\n";

#Defaults
my $arch = qx(dpkg --print-architecture);
$arch='i386' if $?;
chomp $arch;

my $logname = qx(whoami);
chomp $logname;
my $host = qx(cat /etc/mailname || dnsdomainname);
chomp $host;

$CONFIG{dldir} = 'debian';
$CONFIG{use_auth_proxy} = 0;
$CONFIG{proxyhost} = '';
$CONFIG{proxylogname} = $logname;
$CONFIG{proxypassword} = '';

my $methdir = "$vardir/methods/ftp";
my $exit = 0;
my $problem = 0;

if (-f "$methdir/vars") {
  read_config("$methdir/vars");
}

chdir "$methdir";
if (! -d 'debian') {
    mkdir 'debian', 0755;
}
# get info from user

$| = 1;

print <<"EOM";

You must supply an ftp site, use of passive mode, username, password,
path to the debian directory,list of distributions you are interested
in and place to download the binary package files to (relative to
/var/lib/dpkg/methods/ftp). You can add as much sites as you like. Later
entries will always override older ones.

Supply "?" as a password to be asked each time you connect.

Eg:      ftp site: ftp.debian.org
          passive: y
         username: anonymous
         password: $logname\@$host
          ftp dir: /debian
    distributions: dists/stable/main dists/stable/contrib
     download dir: debian

If you want to install package from non-US consider adding a second ftp site
with "debian-non-US" as debian directory and "dists/stable/non-US" as
distribution.

You may have to use an authenticated FTP proxy in order to reach the
FTP site:

Eg:  use auth proxy: y
              proxy: proxy.isp.com
      proxy account: $CONFIG{proxylogname}
     proxy password: ?
EOM

if (! $CONFIG{done}) {
  view_mirrors() if (yesno('y', 'Would you like to see a list of ftp mirrors'));
  add_site();
}
edit_config($methdir);

my $ftp;
sub download() {
 foreach (@{$CONFIG{site}}) {

    $ftp = do_connect ($_->[0], # Ftp server
                       $_->[4], # username
		       $_->[5], # password
		       $_->[1], # ftp dir
		       $_->[3], # passive
		       $CONFIG{use_auth_proxy},
		       $CONFIG{proxyhost},
		       $CONFIG{proxylogname},
		       $CONFIG{proxypassword});

    my @dists = @{$_->[2]};

    foreach my $dist (@dists) {
	my $dir = "$dist/binary-$arch";
	print "Checking $dir...\n";
#	if (!$ftp->pasv()) { print $ftp->message . "\n"; die 'error'; }
	my @dirlst = $ftp->ls("$dir/");
	my $got_pkgfile = 0;

	foreach my $line (@dirlst) {
	    if($line =~ /Packages/) {
		$got_pkgfile=1;
	    }
	}
	if( !$got_pkgfile) {
	    print "Warning: Could not find a Packages file in $dir\n",
	    "This may not be a problem if the directory is a symbolic link\n";
	    $problem=1;
	}
    }
    print "Closing ftp connection...\n";
    $ftp->quit();
  }
}

# download stuff (protect from ^C)
print "\nUsing FTP to check directories...(stop with ^C)\n\n";
eval {
    local $SIG{INT} = sub {
	die "interrupted!\n";
    };
    download();
};
if($@) {
    $ftp->quit();
    print 'FTP ERROR - ';
    if ($@ eq 'connect') {
	print "config was untested\n";
    } else {
	print "$@\n";
    }
    $exit = 1;
};

# output new vars file
$CONFIG{done} = 1;
store_config("$methdir/vars");
chmod  0600, "$methdir/vars";

if($exit || $problem) {
    print "Press <enter> to continue\n";
    <STDIN>;
}

exit $exit;