Net::LDAP::Gateway - Infrastructure to build LDAP gateways
use Net::LDAP::Gateway;
This module provides a set of low level functions to encode and decode LDAP packets
The following functions can be imported from this module:
returns a normalized version of the given dn.
If enough data is available in buffer, this function returns the size of the incomming packet. Otherwise it returns undef.
When called in list context, besides the packet len, if enough data is available from the buffer, this function also returns the message ID, the LDAP operation code and depending on the packet type, the dn or the error code.
Extracts and parses the next LDAP message available from $buffer.
$msgid is the message id.
$msgid
$op is the number associated to the requested operation as defined by the LDAP specification (symbolic names for those constants can be imported from Net::LDAP::Gateway::Constant).
$op
$data is a hash representing all the data available on the packet as follows:
$data
$data = { version => $protocol_version, dn => $bind_dn, method => $auth_method, %method_data }
%method_data =(password => $password)
other authentication methods are currently not supported
The unbind request does not carry any extra data:
$data = {}
$data = { base_dn => $base_dn, scope => $scope, deref_aliases => $deref, size_limit => $sl, # optional time_limit => $tl, # optional types_only => 1, # optional filter => \@filter attributes => \@attr, # optional }
$scope can take the values LDAP_SCOPE_BASE_OBJECT [0], LDAP_SCOPE_SINGLE_LEVEL [1] or LDAP_SCOPE_WHOLE_SUBTREE [2].
$scope
LDAP_SCOPE_BASE_OBJECT
LDAP_SCOPE_SINGLE_LEVEL
LDAP_SCOPE_WHOLE_SUBTREE
$deref can take the values LDAP_DEREF_ALIASES_NEVER [0], LDAP_DEREF_ALIASES_IN_SEARCHING [1], LDAP_DEREF_ALIASES_FINDING_BASE_OBJ [2] or LDAP_DEREF_ALIASES_ALWAYS [3]
$deref
LDAP_DEREF_ALIASES_NEVER
LDAP_DEREF_ALIASES_IN_SEARCHING
LDAP_DEREF_ALIASES_FINDING_BASE_OBJ
LDAP_DEREF_ALIASES_ALWAYS
$data = { dn => $dn, add => $add, changes => \@changes } @changes = ( { operation => $op, attribute => $attribute, values => \@values }, ... )
$op can take the values LDAP_MODOP_REPLACE, LDAP_MODOP_ADD or LDAP_MODOP_DELETE.
LDAP_MODOP_REPLACE
LDAP_MODOP_ADD
LDAP_MODOP_DELETE
$data = { dn => $dn, $attr1 => \@values1, $attr2 => \@values2, ... }
$data = { dn => $dn }
$data = { dn => $dn, new_rdn => $new_rdn, delete_old_rdn => 1, # optional new_superior => $superior, # optional
$data = { dn => $dn, attribute => $attr, value => $value }
$data = { message_id => $message_id }
$data = { oid => $oid, value => $value }
$data = { result => $result_code, matched_dn => $dn, message => $message, referrals => \@referrals, # optional sasl_credentials => $credentials # optional }
$data = { dn => $entry_dn, $attr1 => \@values1, $attr2 => \@values2, ... }
$data = { result => $result_code, matched_dn => $dn, message => $message, referrals => \@referrals # optional }
$result_code contains the status of the operation (see "Error codes" in Net::LDAP::Gateway::Constant).
$result_code
These functions take a $msgid and a reference to a hash containing the message data and return the LDAP message.
The data structured passed must be as documented on ldap_shift_message.
ldap_shift_message
These functions take a $msgid and a list of arguments and return the corresponding LDAP message.
Other Perl LDAP related modules: Net::LDAP, Net::LDAPapi, Net::LDAP::Server.
LDAP RFCs 4511, 4513, 4515, 4517, 4519, 4510, 4512, 4514, 4516 and 4518.
Salvador Fandiño, <sfandino@yahoo.com>
Copyright (C) 2009, 2010, 2011 by Qindel Formacion y Servicios S.L.
This Perl module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This Perl module is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this package. If not, see http://www.gnu.org/licenses/.
To install Net::LDAP::Gateway, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::LDAP::Gateway
CPAN shell
perl -MCPAN -e shell install Net::LDAP::Gateway
For more information on module installation, please visit the detailed CPAN module installation guide.