summaryrefslogtreecommitdiff
path: root/res/res_config_ldap.c
AgeCommit message (Collapse)Author
2018-03-14loader: Convert reload_classes to built-in modules.Corey Farrell
* acl (named_acl.c) * cdr * cel * ccss * dnsmgr * dsp * enum * extconfig (config.c) * features * http * indications * logger * manager * plc * sounds * udptl These modules are now loaded at appropriate time by the module loader. Unlike loadable modules these use AST_MODULE_LOAD_FAILURE on error so the module loader will abort startup on failure of these modules. Some of these modules are still initialized or shutdown from outside the module loader. logger.c is initialized very early and shutdown very late, manager.c is initialized by the module loader but is shutdown by the Asterisk core (too much uses it without holding references). Change-Id: I371a9a45064f20026c492623ea8062d02a1ab97f
2018-03-07Replace direct checks of option_debug with DEBUG_ATLEAST macro.Corey Farrell
Checking option_debug directly is incorrect as it ignores file/module specific debug settings. This system-wide change replaces nearly all direct checks for option_debug with the DEBUG_ATLEAST macro. Change-Id: Ic342d4799a945dbc40ac085ac142681094a4ebf0
2017-12-22Remove as much trailing whitespace as possible.Sean Bright
Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0
2017-12-19Remove constant conditionals (dead-code).Corey Farrell
Some variables are set and never changed, making them constant. This means that code in the 'false' block of the conditional is unreachable. In chan_skinny and res_config_ldap I used preprocessor directive `#if 0` as I'm unsure if the unreachable code could be enabled in the future. Change-Id: I62e2aac353d739fb3c983cf768933120f5fba059
2017-02-22res_config_ldap: Various code improvementsSean Bright
The initial motivation for this patch was to properly handle memory allocation failures - we weren't checking the return values from the various LDAP library allocation functions. In the process, because update_ldap() and update2_ldap() were substantially the same code, they've been consolidated. Change-Id: Iebcfe404177cc6860ee5087976fe97812221b822
2017-02-22Merge "realtime: Centralize some common realtime backend code"Joshua Colp
2017-02-21realtime: Centralize some common realtime backend codeSean Bright
All of the realtime backends create artificial ast_categorys to pass back into the core as query results. These categories have no filename or line number information associated with them and the backends differ slightly on how they create them. So create a couple helper macros to help make things more consistent. Also updated the call sites to remove redundant error messages about memory allocation failure. Note that res_config_ldap sets the category filename to the 'table name' but that is not read by anything in the core, so I've dropped it. Change-Id: I3a1fd91e0c807dea1ce3b643b0a6fe5be9002897
2017-02-20res_config_ldap: Don't try to delete non-existent attributesSean Bright
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. Change-Id: I3fe1b04472733e43151563aaf9f8b49980273e6b
2017-02-20res_config_ldap: Remove extraneous line numbers from log messagesSean Bright
Extraneous line numbers were being output in many log messages. These have been removed. Change-Id: Ice9efa3d252ee87f37fa8f5ea852fda482675431
2017-02-20res_config_ldap: Make memory allocation more consistentSean Bright
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. Change-Id: Iafec9c1fd8ea49ccc496d6316769a6a426daa804
2017-02-20res_config_ldap: Fix configuration inheritance from _generalSean Bright
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. Change-Id: I1fc61560bf96b8ba623063cfb7e0a49c4690d778
2017-02-20res_config_ldap: Fix erroneous LDAP_MOD_REPLACE in LDAP modifySean Bright
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. 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: I0741d25de07c9539f1edc6eff3696165dfb64fbe
2016-10-27Remove ASTERISK_REGISTER_FILE.Corey Farrell
ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes all traces of it. Previously exported symbols removed: * __ast_register_file * __ast_unregister_file * ast_complete_source_filename This also removes the mtx_prof static variable that was declared when MTX_PROFILE was enabled. This variable was only used in lock.c so it is now initialized in that file only. ASTERISK-26480 #close Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
2016-03-07main/cli.c: Refactor function to print seconds formattedRodrigo Ramírez Norambuena
Refactor and created function ast_cli_print_timestr_fromseconds to print seconds formatted: year(s) week(s) day(s) hour(s) second(s) This function now is used in addons/cdr_mysql.c,cdr_pgsql.c, main/cli.c, res_config_ldap.c, res_config_pgsql.c. Change-Id: Ibeb8634102cd11d3f8623398b279cb731bcde36c
2015-04-13git migration: Refactor the ASTERISK_FILE_VERSION macroMatt Jordan
Git does not support the ability to replace a token with a version string during check-in. While it does have support for replacing a token on clone, this is somewhat sub-optimal: the token is replaced with the object hash, which is not particularly easy for human consumption. What's more, in practice, the source file version was often not terribly useful. Generally, when triaging bugs, the overall version of Asterisk is far more useful than an individual SVN version of a file. As a result, this patch removes Asterisk's support for showing source file versions. Specifically, it does the following: * Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and remove passing the version in with the macro. Other facilities than 'core show file version' make use of the file names, such as setting a debug level only on a specific file. As such, the act of registering source files with the Asterisk core still has use. The macro rename now reflects the new macro purpose. * main/asterisk: - Refactor the file_version structure to reflect that it no longer tracks a version field. - Remove the "core show file version" CLI command. Without the file version, it is no longer useful. - Remove the ast_file_version_find function. The file version is no longer tracked. - Rename ast_register_file_version/ast_unregister_file_version to ast_register_file/ast_unregister_file, respectively. * main/manager: Remove value from the Version key of the ModuleCheck Action. The actual key itself has not been removed, as doing so would absolutely constitute a backwards incompatible change. However, since the file version is no longer tracked, there is no need to attempt to include it in the Version key. * UPGRADE: Add notes for: - Modification to the ModuleCheck AMI Action - Removal of the "core show file version" CLI command Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2014-09-26core: Don't allow free to mean ast_free (and malloc, etc..).Walter Doekes
This gets rid of most old libc free/malloc/realloc and replaces them with ast_free and friends. When compiling with MALLOC_DEBUG you'll notice it when you're mistakenly using one of the libc variants. For the legacy cases you can define WRAP_LIBC_MALLOC before including asterisk.h. Even better would be if the errors were also enabled when compiling without MALLOC_DEBUG, but that's a slightly more invasive header file change. Those compiling addons/format_mp3 will need to rerun ./contrib/scripts/get_mp3_source.sh. ASTERISK-24348 #related Review: https://reviewboard.asterisk.org/r/4015/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423978 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-25Add module support level to ast_module_info structure. Print it in CLI ↵Mark Michelson
"module show" . ASTERISK-23919 #close Reported by Malcolm Davenport Review: https://reviewboard.asterisk.org/r/3802 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419592 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-27Add support for a realtime sorcery module.Joshua Colp
This change does the following: 1. Adds the sorcery realtime module 2. Adds unit tests for the sorcery realtime module 3. Changes the realtime core to use an ast_variable list instead of variadic arguments 4. Changes all realtime drivers to accept an ast_variable list Review: https://reviewboard.asterisk.org/r/2424/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@386731 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-10Use LDAP memory management functions instead of Asterisk'sMatthew Jordan
When MALLOC_DEBUG is enabled with res_config_ldap, issues (munmap_chunk: invalid pointer errors) can occur as the memory is being allocated with Asterisk's wrappers around malloc/calloc/free/strdup, as opposed to the LDAP library's wrappers. This patch uses the LDAP library's wrappers where appropriate, so that compiling with MALLOC_DEBUG doesn't cause more problems than it solves. Note that the patch listed below was modified slightly for this commit to account for some additional memory allocation/deallocations. (closes issue ASTERISK-17386) Reported by: John Covert Tested by: Andrew Latham patches: issue18789-1.8-r316873.patch uploaded by seanbright (License 5060) ........ Merged revisions 385190 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 385199 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@385202 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-12Update DoxygenAndrew Latham
Push some cleanups upstream before testing another ticket. (issue ASTERISK-20259) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382989 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-04Doxygen CleanupsAndrew Latham
Baseline clean up of formating to make room for extended documentation (issue ASTERISK-20259) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@378543 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-14Doxygen Updates - Title updateAndrew Latham
Update and extend the configuration_file group and enable linking to the resource. Update title that was left behind many years ago. (issue ASTERISK-20259) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375003 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-01Doxygen CleanupAndrew Latham
Start adding configuration file linking and pages. Add module loading doxygen block. Breaking up commits to keep it easy to track (issue ASTERISK-20259) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374165 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-21Doxygen Updates - janitor workAndrew Latham
Doxygen updates including mistakes, misspellings, missing parameters, updates for Doxygen style. Some missing txt file links are removed but their content or essense will be included in some later updates. A majority of the txt files were removed in the 1.6 era but never noted. The HR and EXTREF are simple changes that make the documentation more compatable with more versions of Doxygen. Further updates coming. (issue ASTERISK-20259) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373330 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-17Avoid cppcheck warnings; removing unused vars and a bit of cleanup.Walter Doekes
Patch by: junky Review: https://reviewboard.asterisk.org/r/1743/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362307 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-08-19Fix infinite loop releasing the same memory in ldap_loadentry().Richard Mudgett
* Fixed memory leak of vars in ldap_loadentry(). * Fixed potential NULL ptr dereference of vars in ldap_loadentry(). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@332615 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-14Merged revisions 328247 via svnmerge from Leif Madsen
https://origsvn.digium.com/svn/asterisk/branches/1.10 ................ r328247 | lmadsen | 2011-07-14 16:25:31 -0400 (Thu, 14 Jul 2011) | 14 lines Merged revisions 328209 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r328209 | lmadsen | 2011-07-14 16:13:06 -0400 (Thu, 14 Jul 2011) | 6 lines Introduce <support_level> tags in MODULEINFO. This change introduces MODULEINFO into many modules in Asterisk in order to show the community support level for those modules. This is used by changes committed to menuselect by Russell Bryant recently (r917 in menuselect). More information about the support level types and what they mean is available on the wiki at https://wiki.asterisk.org/wiki/display/AST/Asterisk+Module+Support+States ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@328259 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-02-04Replace ast_log(LOG_DEBUG, ...) with ast_debug()Paul Belanger
(closes issue #18556) Reported by: kkm Review: https://reviewboard.asterisk.org/r/1071/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@306258 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-01-29Merged revisions 304866 via svnmerge from Sean Bright
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r304866 | seanbright | 2011-01-29 18:07:18 -0500 (Sat, 29 Jan 2011) | 14 lines Merged revisions 304865 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r304865 | seanbright | 2011-01-29 18:05:25 -0500 (Sat, 29 Jan 2011) | 7 lines Plug some memory leaks in the LDAP realtime driver. (closes issue #18435) Reported by: zaltar Patches: res_config_ldap.patch uploaded by zaltar (license 1148) ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@304867 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-10-21Merged revisions 292523 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r292523 | russell | 2010-10-21 06:36:47 -0500 (Thu, 21 Oct 2010) | 4 lines Add var=value to log message on update failure, and add newline. ... just for you, Leif. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@292524 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-09-29Merged revisions 289333 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r289333 | russell | 2010-09-29 15:20:23 -0500 (Wed, 29 Sep 2010) | 11 lines Merged revisions 289332 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r289332 | russell | 2010-09-29 15:15:57 -0500 (Wed, 29 Sep 2010) | 4 lines Don't completely ignore md5secret from LDAP if the value does not begin with {md5}. This fixes a problem that lmadsen ran in to where md5secret was not working for him. ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@289335 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-26Merged revisions 279601 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r279601 | tilghman | 2010-07-26 16:07:45 -0500 (Mon, 26 Jul 2010) | 19 lines Merged revisions 279597 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r279597 | ghenry | 2010-07-26 15:25:54 -0500 (Mon, 26 Jul 2010) | 13 lines Apply all patches in: https://issues.asterisk.org/view.php?id=13573 (closes issue #13573) Reported by: navkumar Patches: res_config_ldap-category.diff uploaded by navkumar (license 580) res_config_ldap.patch uploaded by bencer (license 961) res_config_ldap uploaded by bencer (license 961) Tested by: suretec ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@279602 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-23Minor corrections to the LDAP realtime driverOlle Johansson
Review: https://reviewboard.asterisk.org/r/798/ Thanks Mark for a quick review! git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@278875 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-20Add load priority order, such that preload becomes unnecessary in most casesTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@278132 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-14Plug a memory leak in res_config_ldap.Sean Bright
(closes issue #16257) Reported by: nito Patches: issue16257_20100111.diff uploaded by seanbright (license 71) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@240271 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-12Fix crash in res_config_ldap.Sean Bright
We need to allocate enough room for 2 pointers, not 2 characters. (closes issue #16397) Reported by: bklang Patches: res_config_ldap.patch uploaded by applsplatz (license 949) Tested by: applsplatz git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239473 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-10-07Formatting, moving error messages to ERROR, removing references to ↵Olle Johansson
unexisting debug output. No functionality changes. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@222615 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-12Added three new attributes and applied a patch to res_config_ldap.cGavin Henry
attributetype ( AstAccountSubscribeContext NAME 'AstAccountSubscribeContext' DESC 'Asterisk subscribe context' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15) attributetype ( AstAccountIpAddr NAME 'AstAccountIpAddr' DESC 'Asterisk aaccount IP address' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15) attributetype ( AstAccountUserAgent NAME 'AstAccountUserAgent' DESC 'Asterisk account user context' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15) and patch fix_empty_attributes_1.6.1.4_v2.patch (closes issue #13725) Reported by: macogeek Patches: fix_empty_attributes_1.6.1.4_v2.patch uploaded by xvisor (license 863) Tested by: suretec git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@211767 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-10AST-2009-005Tilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@211539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-18fixes some memory leaks and redundant conditionsDavid Vossel
(closes issue #15269) Reported by: contactmayankjain Patches: patch.txt uploaded by contactmayankjain (license 740) memory_leak_stuff.trunk.diff uploaded by dvossel (license 671) Tested by: contactmayankjain, dvossel git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201678 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-18a few more namespace updates... res_ael_share still needs some work before ↵Kevin P. Fleming
this can be merged to other release branches git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@182848 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-13Merge ast_str_opaque branch (discontinue usage of ast_str internals)Tilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163991 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-05Janitor, use ARRAY_LEN() when possible.Eliel C. Sardanons
(closes issue #13990) Reported by: eliel Patches: array_len.diff uploaded by eliel (license 64) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@161218 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-14Merge realtime_update2 branch, which adds a new realtime API call namedTilghman Lesher
'update2', which permits updates which match across multiple columns, instead of requiring all tables to have a single unique identifier. All of the other API calls with the exception of 'update' already had the ability to match on multiple fields, so it was a missing and very desireable feature that an API call implementing an update should have this, too. This does not change any outward performance of Asterisk, but it should make life easier for application developers who use the RealTime framework. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@148570 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-28Merge the cli_cleanup branch.Michiel van Baak
This work is done by lmadsen, junky and mvanbaak during AstriDevCon. This is the second audit the CLI got, and this time lmadsen made sure he had _ALL_ modules loaded that have CLI commands in them. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@145121 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-12Create a new config file status, CONFIG_STATUS_FILEINVALID for differentiatingTilghman Lesher
when a file is invalid from when a file is missing. This is most important when we have two configuration files. Consider the following example: Old system: sip.conf users.conf Old result New result ======== ========== ========== ========== Missing Missing SIP doesn't load SIP doesn't load Missing OK SIP doesn't load SIP doesn't load Missing Invalid SIP doesn't load SIP doesn't load OK Missing SIP loads SIP loads OK OK SIP loads SIP loads OK Invalid SIP loads incompletely SIP doesn't load Invalid Missing SIP doesn't load SIP doesn't load Invalid OK SIP doesn't load SIP doesn't load Invalid Invalid SIP doesn't load SIP doesn't load So in the case when users.conf doesn't load because there's a typo that disrupts the syntax, we may only partially load users, instead of failing with an error, which may cause some calls not to get processed. Worse yet, the old system would do this with no indication that anything was even wrong. (closes issue #10690) Reported by: dtyoo Patches: 20080716__bug10690.diff.txt uploaded by Corydon76 (license 14) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@142992 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-10All of the res/ stuff (other than res_jabber) from the RSW branch.Sean Bright
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@137028 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-11Fix some usages of snprintf, and clarify a couple variable names.Sean Bright
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@129864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-21Reduce warning to debug, otherwise we flood the log when we (legitimately)Tilghman Lesher
can't find a record. (Closes issue #12908) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@124505 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-19Don't change pointers that need to be later passed back for deallocation.Tilghman Lesher
(closes issue #12572) Reported by: flyn Patches: 20080613__bug12572.diff.txt uploaded by Corydon76 (license 14) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@123952 65c4cc65-6c06-0410-ace0-fbb531ad65f3