quanah / net-ldapapi

The Net::LDAPapi Perl Module uses the OpenLDAP and Mozilla C api's to directly access and manipulate an LDAP v2 or LDAP v3 server.
8 stars 6 forks source link

Asynchronous bind from the Perl OO API calls ldap_sasl_bind with invalid arguments #6

Closed phillipod closed 9 years ago

phillipod commented 9 years ago

This code:

#!/usr/bin/perl
use Net::LDAPapi;
my $ld = Net::LDAPapi->new("localhost");
my $msg = $ld->bind(-dn => "cn=admin,dc=example,dc=com", -password => "password");

Results in:

# perl bind-test.pl
Usage: Net::LDAPapi::ldap_sasl_bind(ld, dn, passwd, sctrls, serverctrls, clientctrls, msgidp) at /usr/local/lib/perl/5.14.2/Net/LDAPapi.pm line 469.

Looks like the prototype for ldap_sasl_bind() in LDAPapi.xs is wrong - notice the 'sctrls' and 'serverctrls':

int
ldap_sasl_bind(ld, dn, passwd, sctrls, serverctrls, clientctrls, msgidp)
    LDAP *          ld
    LDAP_CHAR *     dn
    LDAP_CHAR *     passwd
    LDAPControl **  serverctrls
    LDAPControl **  clientctrls
    int             msgidp = NO_INIT
    CODE:
    { ... }
quanah commented 9 years ago

Nice catch. Looking back, I'm not sure why we hard code this function to doing simple binds (used by the bind function in LDAPapi.pm), rather than letting people pick their mechanism like we do with bind_s. Oh well. :)