]> git.ipfire.org Git - thirdparty/squid.git/blame - src/auth/basic/POP3/basic_pop3_auth.pl.in
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / auth / basic / POP3 / basic_pop3_auth.pl.in
CommitLineData
c2cf387f 1#!@PERL@
90cf12ec
AJ
2
3use strict;
4use Pod::Usage;
5use Getopt::Long;
6
7=pod
8
9=head1 NAME
10
11 basic_pop3_auth - POP3 authenticator for Squid
12
13=head1 SYNOPSIS
14
15 basic_pop3_auth server
16
17=head1 DESCRIPTION
18
19B<basic_pop3_auth> authenticates user credentials against a POP3 server.
20
21=head1 OPTIONS
22
23The only option this helper takes is the name of the POP3 server to validate against.
24
25=head1 AUTHOR
26
27This program was written by I<Henrik Nordstrom <henrik@henriknordstrom.net>>
28
29This manual was written by I<Amos Jeffries <squid3@treenet.co.nz>>
30
31=head1 COPYRIGHT
32
77b1029d 33 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
90cf12ec
AJ
34 *
35 * Squid software is distributed under GPLv2+ license and includes
36 * contributions from numerous individuals and organizations.
37 * Please see the COPYING and CONTRIBUTORS files for details.
38
39 # Copyright (C) 2006 Henrik Nordstrom <henrik@henriknordstrom.net>
40 #
41 # This program is free software; you can redistribute it and/or modify
42 # it under the terms of the GNU General Public License as published by
43 # the Free Software Foundation; either version 2 of the License, or
44 # (at your option) any later version.
45 #
46 # This program is distributed in the hope that it will be useful,
47 # but WITHOUT ANY WARRANTY; without even the implied warranty of
48 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49 # GNU General Public License for more details.
50 #
51 # You should have received a copy of the GNU General Public License
52 # along with this program; if not, write to the Free Software
53 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
54 #
55 # Change log:
56 # 2006-12-10 henrik Initial revision
57 #
58
59=head1 QUESTIONS
60
8311b837 61Questions on the usage of this program can be sent to the I<Squid Users mailing list <squid-users@lists.squid-cache.org>>
90cf12ec
AJ
62
63=head1 REPORTING BUGS
64
65Bug reports need to be made in English.
66See http://wiki.squid-cache.org/SquidFaq/BugReporting for details of what you need to include with your bug report.
67
68Report bugs or bug fixes using http://bugs.squid-cache.org/
69
8311b837 70Report serious security bugs to I<Squid Bugs <squid-bugs@lists.squid-cache.org>>
90cf12ec 71
8311b837 72Report ideas for new improvements to the I<Squid Developers mailing list <squid-dev@lists.squid-cache.org>>
90cf12ec
AJ
73
74=head1 SEE ALSO
75
76squid (8), GPL (7),
77
78The Squid FAQ wiki http://wiki.squid-cache.org/SquidFaq
79
80The Squid Configuration Manual http://www.squid-cache.org/Doc/config/
81
82=cut
e0301d3c 83
e0301d3c 84use Net::POP3;
85$|=1;
86
87if ( @ARGV != 1 ) {
88 print STDERR "Usage: $0 popserver\n";
89 exit 1
90}
91
d429cbd0 92my $server = shift @ARGV;
e0301d3c 93
94while(<>) {
95 my ($username, $password) = split(/\s+/);
96 $username =~ s/%([0-9a-f][0-9a-f])/pack("H2",$1)/gie;
97 $password =~ s/%([0-9a-f][0-9a-f])/pack("H2",$1)/gie;
98
d429cbd0 99 my $pop = Net::POP3->new($server);
e0301d3c 100 if (!$pop) {
101 print "ERR Server not responding\n";
102 next;
103 }
104
105 # Here apop could be used instead for MD5 support
106 if ($pop->login($username, $password)) {
107 print "OK\n";
108 } else {
109 print "ERR\n";
110 }
111 $pop->quit;
112 undef $pop;
113}