# ---------------------------------------------------------------
# Ldap
# ---------------------------------------------------------------
# release: 0.1 
# date: 19-04-2001
#
# Description
# 
# This module is used to query a ldap server and attempt to 
# retriew a register.  It use Mozilla::LDAP
# module which is available at Mozilla.org
# 
# Parameters
#
# host  IP for Ldap Server
# dn    DN to check
# pass  UserPassword 
# port  ldap tcp port (default: 389)
# item	The item to report (default: ldap)
# time	The number of seconds to wait for a response before
# 		timing out.  (default: 5)
# 
# Manuel de Vega Barreiro
# Madrid,Spain
# mbarreiro@red.madritel.es
# 
# Based in Kevin O'Donnell (kevin_odonnell@telus.net)  Radius Monitor
#
# ---------------------------------------------------------------

# Load the monitor
my $ldap;
unless( $ldap = $memory{"ldap_mozilla"} ) {
    &uxmon::load_module( "ldap_mozilla" );
    &uxmon::checker(
        $memory{"ldap_mozilla"} = $ldap = Monitor::ldap->new()
    );
}

my $host = $args{host} ? $args{host} : $args{alias};
my $port = $args{port} ? $args{port} : '389';
my $dn = $args{dn};
my $pass = $args{pass};
my $item = $args{item} ? $args{item} : 'ldap';
my $time = $args{time} ? $args{time} : 5;
$item = "$args{alias}.$item";

$ldap->add($host,$port,$dn,$pass,$item,$time);

1;
