[Asterisk-bugs] [Asterisk 0005768]: [branch][post 1.4] LDAP Realtime driver

noreply at bugs.digium.com noreply at bugs.digium.com
Tue Jul 3 10:04:55 CDT 2007


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=5768 
====================================================================== 
Reported By:                mguesdon
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   5768
Category:                   Resources/NewFeature
Reproducibility:            N/A
Severity:                   feature
Priority:                   normal
Status:                     ready for testing
Asterisk Version:            SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 48570 
Disclaimer on File?:        Yes 
Request Review:              
====================================================================== 
Date Submitted:             11-16-2005 11:11 CST
Last Modified:              07-03-2007 10:04 CDT
====================================================================== 
Summary:                    [branch][post 1.4] LDAP Realtime driver
Description: 
Here is a ldap realtime driver.
res_config_ldap.c: code
res_ldap.conf.sample: res_ldap.conf sample
asterisk.ldap-schema: example of ldap schema
ldap-patch.diff: Makefile patch
====================================================================== 

---------------------------------------------------------------------- 
 pic0 - 07-03-07 10:04  
---------------------------------------------------------------------- 
This patch:
- fixes the wrong behaviour when specifying the LDAP port number in
res_ldap.conf
- allows anonymous binding to the LDAP if username and password are leaved
commented.
- includes the protocol statement posted earlier patch by anYc 


Index: res/res_config_ldap.c
===================================================================
--- res/res_config_ldap.c       (revision 72852)
+++ res/res_config_ldap.c       (working copy)
@@ -65,6 +65,7 @@
 static char user[512];
 static char pass[50];
 static char basedn[512];
+static int protocol_version = 3;
 static int port = 389;
 static time_t connect_time;

@@ -1447,10 +1448,16 @@
                port = 389;
                ast_copy_string(host + strlen(host), ":389",
sizeof(host));
        } else {
-               ast_copy_string(host + 1, ":", sizeof(s));
-               ast_copy_string(host + strlen(host), s, sizeof(s));
+               ast_copy_string(host + strlen(host), ":", sizeof(host));
+               ast_copy_string(host + strlen(host), s, sizeof(host));
                port = atoi(s);
        }
+
+       if (!(s = ast_variable_retrieve(config, "_general", "protocol")))
{
+               ast_log(LOG_WARNING, "No protocol version found, using v3
as default.\n");
+       } else {
+               protocol_version = atoi(s);
+       }

        table_configs_free();

@@ -1505,6 +1512,8 @@
                ast_log(LOG_ERROR, "Failed to init ldap connection to %s.
Check debug for more info.\n", host);
                return 0;
        }
+
+       ldap_set_option(ldapConn, LDAP_OPT_PROTOCOL_VERSION,
&protocol_version);

        if (!ast_strlen_zero(user)) {
                if (option_debug > 1)
@@ -1515,7 +1524,7 @@
        } else {
                if (option_debug > 1)
                        ast_log(LOG_DEBUG, "bind anonymously %s
anonymously\n", host);
-               bind_result = ldap_sasl_bind_s(ldapConn, NULL,
LDAP_SASL_SIMPLE, NULL, NULL, NULL, NULL);
+               bind_result = ldap_simple_bind_s(ldapConn, NULL, NULL);
        }
        if (bind_result == LDAP_SUCCESS) {
                if (option_debug > 1) 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
07-03-07 10:04  pic0           Note Added: 0066457                          
======================================================================




More information about the Asterisk-bugs mailing list