Current oav website
This commit is contained in:
121
tmp/openldap/mailboxes.pm
Normal file
121
tmp/openldap/mailboxes.pm
Normal file
@ -0,0 +1,121 @@
|
||||
# $Id: mailboxes.pm,v 1.1 2007/02/19 22:33:18 kiwi Exp $
|
||||
#
|
||||
package mailboxes;
|
||||
|
||||
use Mail::RFC822::Address qw(valid);
|
||||
use POSIX;
|
||||
use strict;
|
||||
|
||||
sub new
|
||||
{
|
||||
my $class = shift;
|
||||
|
||||
my $this = {};
|
||||
bless $this, $class;
|
||||
print STDERR "Starting mailboxes\n";
|
||||
return $this;
|
||||
}
|
||||
|
||||
sub init
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub search
|
||||
{
|
||||
my $this = shift;
|
||||
my @match_entries = ();
|
||||
my $todo;
|
||||
my($row, $mailaddr, $quotedmail, $res, $sth, $path, $searchmail);
|
||||
my($base, $scope, $deref, $sizeLim, $timeLim, $filter, $attrOnly, @attrs ) = @_;
|
||||
|
||||
# Checking about what looking for
|
||||
# mail= foo -> postfix / pll VDA delivery
|
||||
# uid= foo -> pop3/imap that supports @ -> %
|
||||
$todo = $filter;
|
||||
$todo =~ s/^\((.*)=.*\)$/\1/g;
|
||||
|
||||
#print STDERR "==> Want : $todo \n";
|
||||
|
||||
$mailaddr = $filter;
|
||||
|
||||
if ($todo =~ "uid") {
|
||||
# replacing % -> @
|
||||
print STDERR "We get a request for UID\n";
|
||||
$mailaddr =~ s/\%/\@/g;
|
||||
}
|
||||
|
||||
print STDERR "Looking for : $mailaddr \n";
|
||||
|
||||
if (not ($mailaddr =~ s/^\(uid=(.*)\)$/\1/g)) {
|
||||
if(not ($mailaddr =~ s/^\(mail=(.*)\)$/\1/g)) {
|
||||
return(0, ()); # Filtre non authorise.
|
||||
}
|
||||
}
|
||||
|
||||
if (not valid("<".$mailaddr.">")) {
|
||||
return(0, ()); # Mail non valide RFC822
|
||||
}
|
||||
|
||||
# We get data, then format output... :)
|
||||
print STDERR "We get some results...\n";
|
||||
my $entry =
|
||||
"dn : uid=$mailaddr,ou=mailboxes,dc=kazar,dc=net\n\t".
|
||||
"objectClass : top\n\t".
|
||||
"objectClass : kazarPerson\n\t";
|
||||
|
||||
$entry .= "uid : $mailaddr\n\t";
|
||||
$entry .= "cn : Nom Prenom\n\t";
|
||||
$entry .= "description : Sample description\n\t";
|
||||
$entry .= "uidNumber : 10\n\t";
|
||||
$entry .= "gidNumber : 10\n\t";
|
||||
$entry .= "userPassword : Password\n\t";
|
||||
$entry .= "homeDirectory : /home/test\n\t";
|
||||
$entry .= "mailQuota : 50\n\t";
|
||||
$entry .= "CouriermailQuota : 50S\n\t";
|
||||
|
||||
print STDERR "Sending -> $entry\n";
|
||||
|
||||
push @match_entries, $entry;
|
||||
|
||||
return(0, @match_entries);
|
||||
|
||||
}
|
||||
|
||||
sub compare
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub modify
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub add
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub modrdn
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub delete
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub config
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub bind
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
Reference in New Issue
Block a user