Handle hostnames with upper-case letters
[webmin.git] / fetchmail / cgi_args.pl
1
2 do 'fetchmail-lib.pl';
3
4 sub cgi_args
5 {
6 my ($cgi) = @_;
7 if ($cgi eq 'edit_poll.cgi' || $cgi eq 'edit_global.cgi') {
8         my ($file, $user, @conf);
9         if ($config{'config_file'}) {
10                 # Just one file
11                 $file = $config{'config_file'};
12                 }
13         else {
14                 # Many users, pick first one with a config
15                 setpwent();
16                 while(@uinfo = getpwent()) {
17                         my $ufile = "$uinfo[7]/.fetchmailrc";
18                         if (-s $ufile) {
19                                 @conf = grep { $_->{'poll'} }
20                                              &parse_config_file($ufile);
21                                 if (@conf) {
22                                         $file = $ufile;
23                                         $user = $uinfo[0];
24                                         last;
25                                         }
26                                 }
27                         }
28                 }
29         return 'none' if (!$file);
30         return 'file='.&urlize($file).'&idx='.$conf[0]->{'index'}.
31                '&user='.&urlize($user);
32         }
33 return undef;
34 }