1#! /usr/bin/perl
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7
8# You should have received a copy of the GNU General Public License
9# along with this program; if not, write to the Free Software
10# Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307,
11# USA.
12
13# This file is a part of Binc IMAP.
14
15sub authenticated {
16  my ($user,$pass) = @_;
17  # This is the only function you need to change.
18
19  # If password is OK, change to the right home area
20  # and return 1, otherwise return 0.
21  # On error exit(111);
22  exit(111);
23}
24
25use strict;
26
27my ($in, $len, $buf);
28open (FD3, "<&=3") or exit(111);
29$len = read(FD3, $buf, 512);
30close FD3;
31
32exit(111) if $len < 4;
33
34my($user, $pass) = split /\x00/, $buf;
35$user = lc $user;
36
37if (authenticated($user, $pass)) {
38    exec @ARGV;
39} else {
40    exit 1;
41}
42