|
@@ -1,7 +1,7 @@
|
|
#
|
|
#
|
|
# $Id$
|
|
# $Id$
|
|
#
|
|
#
|
|
-# Perl module for OpenSER
|
|
|
|
|
|
+# Perl module for Kamailio
|
|
#
|
|
#
|
|
# Copyright (C) 2006 Collax GmbH
|
|
# Copyright (C) 2006 Collax GmbH
|
|
# (Bastian Friedrich <[email protected]>)
|
|
# (Bastian Friedrich <[email protected]>)
|
|
@@ -25,21 +25,21 @@
|
|
|
|
|
|
# This file was kindly donated by Collax GmbH
|
|
# This file was kindly donated by Collax GmbH
|
|
|
|
|
|
-=head1 OpenSER::LDAPUtils::LDAPConnection
|
|
|
|
|
|
+=head1 Kamailio::LDAPUtils::LDAPConnection
|
|
|
|
|
|
-OpenSER::LDAPUtils::LDAPConnection - Perl module to perform simple LDAP queries.
|
|
|
|
|
|
+Kamailio::LDAPUtils::LDAPConnection - Perl module to perform simple LDAP queries.
|
|
|
|
|
|
OO-Style interface:
|
|
OO-Style interface:
|
|
|
|
|
|
- use OpenSER::LDAPUtils::LDAPConnection;
|
|
|
|
- my $ldap = new OpenSER::LDAPUtils::LDAPConnection;
|
|
|
|
|
|
+ use Kamailio::LDAPUtils::LDAPConnection;
|
|
|
|
+ my $ldap = new Kamailio::LDAPUtils::LDAPConnection;
|
|
my @rows = $ldap-search("uid=andi","ou=people,ou=coreworks,ou=de");
|
|
my @rows = $ldap-search("uid=andi","ou=people,ou=coreworks,ou=de");
|
|
|
|
|
|
Procedural interface:
|
|
Procedural interface:
|
|
|
|
|
|
- use OpenSER::LDAPUtils::LDAPConnection;
|
|
|
|
|
|
+ use Kamailio::LDAPUtils::LDAPConnection;
|
|
my @rows = $ldap->search(
|
|
my @rows = $ldap->search(
|
|
- new OpenSER::LDAPUtils::LDAPConfig(), "uid=andi","ou=people,ou=coreworks,ou=de");
|
|
|
|
|
|
+ new Kamailio::LDAPUtils::LDAPConfig(), "uid=andi","ou=people,ou=coreworks,ou=de");
|
|
|
|
|
|
This perl module offers a somewhat simplified interface to the C<Net::LDAP>
|
|
This perl module offers a somewhat simplified interface to the C<Net::LDAP>
|
|
functionality. It is intended for cases where just a few attributes should
|
|
functionality. It is intended for cases where just a few attributes should
|
|
@@ -47,9 +47,9 @@ be retrieved without the overhead of the full featured C<Net::LDAP>.
|
|
|
|
|
|
=cut
|
|
=cut
|
|
|
|
|
|
-package OpenSER::LDAPUtils::LDAPConnection;
|
|
|
|
|
|
+package Kamailio::LDAPUtils::LDAPConnection;
|
|
|
|
|
|
-use OpenSER::LDAPUtils::LDAPConf;
|
|
|
|
|
|
+use Kamailio::LDAPUtils::LDAPConf;
|
|
use Net::LDAP;
|
|
use Net::LDAP;
|
|
use Authen::SASL;
|
|
use Authen::SASL;
|
|
use UNIVERSAL qw( isa );
|
|
use UNIVERSAL qw( isa );
|
|
@@ -62,9 +62,9 @@ my $ldap_singleton = undef;
|
|
Set up a new LDAP connection.
|
|
Set up a new LDAP connection.
|
|
|
|
|
|
The first argument, when given, should be a hash reference pointing
|
|
The first argument, when given, should be a hash reference pointing
|
|
-to to the connection parameters, possibly an C<OpenSER::LDAPUtils::LDAPConfig>
|
|
|
|
|
|
+to to the connection parameters, possibly an C<Kamailio::LDAPUtils::LDAPConfig>
|
|
object. This argument may be C<undef> in which case a new (default)
|
|
object. This argument may be C<undef> in which case a new (default)
|
|
-C<OpenSER::LDAPUtils::LDAPConfig> object is used.
|
|
|
|
|
|
+C<Kamailio::LDAPUtils::LDAPConfig> object is used.
|
|
|
|
|
|
When the optional second argument is a true value, the connection
|
|
When the optional second argument is a true value, the connection
|
|
will be authenticated. Otherwise an anonymous bind is done.
|
|
will be authenticated. Otherwise an anonymous bind is done.
|
|
@@ -79,7 +79,7 @@ sub new {
|
|
my $doauth = shift;
|
|
my $doauth = shift;
|
|
|
|
|
|
if( ! defined( $conf ) ) {
|
|
if( ! defined( $conf ) ) {
|
|
- $conf = new OpenSER::LDAPUtils::LDAPConf();
|
|
|
|
|
|
+ $conf = new Kamailio::LDAPUtils::LDAPConf();
|
|
}
|
|
}
|
|
|
|
|
|
#print STDERR "new ldap checks\n";
|
|
#print STDERR "new ldap checks\n";
|
|
@@ -137,14 +137,14 @@ perform an ldap search, return the dn of the first matching
|
|
directory entry, unless a specific attribute has been requested,
|
|
directory entry, unless a specific attribute has been requested,
|
|
in wich case the values(s) fot this attribute are returned.
|
|
in wich case the values(s) fot this attribute are returned.
|
|
|
|
|
|
-When the first argument (conf) is a C<OpenSER::LDAPUtils::LDAPConnection>, it
|
|
|
|
|
|
+When the first argument (conf) is a C<Kamailio::LDAPUtils::LDAPConnection>, it
|
|
will be used to perform the queries. You can pass the first argument
|
|
will be used to perform the queries. You can pass the first argument
|
|
implicitly by using the "method" syntax.
|
|
implicitly by using the "method" syntax.
|
|
|
|
|
|
Otherwise the C<conf> argument should be a reference to a hash
|
|
Otherwise the C<conf> argument should be a reference to a hash
|
|
containing the connection setup parameters as contained in a
|
|
containing the connection setup parameters as contained in a
|
|
-C<OpenSER::LDAPUtils::LDAPConf> object. In this mode, the
|
|
|
|
-C<OpenSER::LDAPUtils::LDAPConnection> from previous queries will be reused.
|
|
|
|
|
|
+C<Kamailio::LDAPUtils::LDAPConf> object. In this mode, the
|
|
|
|
+C<Kamailio::LDAPUtils::LDAPConnection> from previous queries will be reused.
|
|
|
|
|
|
=head3 Arguments:
|
|
=head3 Arguments:
|
|
|
|
|
|
@@ -185,11 +185,11 @@ sub search {
|
|
|
|
|
|
my $ldap = undef;
|
|
my $ldap = undef;
|
|
|
|
|
|
- if( isa($conf ,"OpenSER::LDAPUtils::LDAPConnection") ) {
|
|
|
|
|
|
+ if( isa($conf ,"Kamailio::LDAPUtils::LDAPConnection") ) {
|
|
$ldap = $conf;
|
|
$ldap = $conf;
|
|
} else {
|
|
} else {
|
|
if( ! $ldap_singleton ) {
|
|
if( ! $ldap_singleton ) {
|
|
- $ldap_singleton = new OpenSER::LDAPUtils::LDAPConnection($conf);
|
|
|
|
|
|
+ $ldap_singleton = new Kamailio::LDAPUtils::LDAPConnection($conf);
|
|
}
|
|
}
|
|
return undef unless $ldap_singleton;
|
|
return undef unless $ldap_singleton;
|
|
$ldap = $ldap_singleton;
|
|
$ldap = $ldap_singleton;
|