[Asterisk-code-review] res config ldap: Fix erroneous LDAP MOD REPLACE in LDAP modify (asterisk[13])

Sean Bright asteriskteam at digium.com
Fri Feb 17 14:01:01 CST 2017


Hello Anonymous Coward #1000019,

I'd like you to reexamine a change.  Please visit

    https://gerrit.asterisk.org/4994

to look at the new patch set (#4).

Change subject: res_config_ldap: Fix erroneous LDAP_MOD_REPLACE in LDAP modify
......................................................................

res_config_ldap: Fix erroneous LDAP_MOD_REPLACE in LDAP modify

There are a few issues resolved here, the primary one being the issue
described in the associated JIRA issue. We always treat the first
change of our modification batch as a replacement when it sometimes is
actually a delete. So we have to pass the correct arguments to the
OpenLDAP library.

In setting this up in my development environment, I discovered a few
additional things that I resolved as well:

* OpenLDAP will raise an error when we try to delete an LDAP attribute
  that doesn't exist. We need to filter out LDAP_MOD_DELETE requests
  based on which attributes the current LDAP entry actually has. There
  is of course a small window of opportunity for this to still fail,
  but it is much less likely now.

* The code in update_ldap() and update2_ldap() was using both Asterisk's
  memory allocation routines as well as OpenLDAP's. I've changed it so
  that everything that is passed to OpenLDAP's functions are allocated
  with their routines.

* The "_general" configuration section allows administrators to provide
  both general configuration options (host, port, url, etc.) as well as
  a global realtime-to-LDAP-attribute mapping that is a fallback if one
  of the later sections do not override it. This neglected to exclude
  the general configuration options from the mapping. As an example,
  during my testing, chan_sip requested 'port' from realtime, and
  because I did not have it defined, it pulled in the 'port'
  configuration option from "_general." We now filter those out
  explicitly.

* Extraneous line numbers were being output in many log messages. These
  have been removed.

ASTERISK-26580 #close
Reported by: Nicholas John Koch
Patches:
	res_config_ldap.c-11.24.1.patch (license #6833) patch uploaded
	by Nicholas John Koch

Change-Id: I0a534a60c7a5d79876bc75eff6588ce7db0d8c2e
---
M res/res_config_ldap.c
1 file changed, 178 insertions(+), 67 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/94/4994/4
-- 
To view, visit https://gerrit.asterisk.org/4994
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I0a534a60c7a5d79876bc75eff6588ce7db0d8c2e
Gerrit-PatchSet: 4
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019



More information about the asterisk-code-review mailing list