summaryrefslogtreecommitdiff
path: root/main/utils.c
AgeCommit message (Collapse)Author
2017-12-08utils: Add convenience function for setting fd flagsSean Bright
There are many places in the code base where we ignore the return value of fcntl() when getting/setting file descriptior flags. This patch introduces a convenience function that allows setting or clearing file descriptor flags and will also log an error on failure for later analysis. Change-Id: I8b81901e1b1bd537ca632567cdb408931c6eded7
2017-11-06Fix ast_(v)asprintf() malloc failure usage conditions.Richard Mudgett
When (v)asprintf() fails, the state of the allocated buffer is undefined. The library had better not leave an allocated buffer as a result or no one will know to free it. The most likely way it can return failure is for an allocation failure. If the printf conversion fails then you actually have a threading problem which is much worse because another thread modified the parameter values. * Made __ast_asprintf()/__ast_vasprintf() set the returned buffer to NULL on failure. That is much more useful than either an uninitialized pointer or a pointer that has already been freed. Many uses won't have to check for failure to ensure that the buffer won't be double freed or prevent an attempt to free an uninitialized pointer. * stasis.c: Fixed memory leak in multi_object_blob_to_ami() allocated by ast_asprintf(). * ari/resource_bridges.c:ari_bridges_play_helper(): Remove assignment to the wrong thing which is now not needed even if assigning to the right thing. Change-Id: Ib5252fb8850ecf0f78ed0ee2ca0796bda7e91c23
2017-08-01Fix compiler warnings on Fedora 26 / GCC 7.Corey Farrell
GCC 7 has added capability to produce warnings, this fixes most of those warnings. The specific warnings are disabled in a few places: * app_voicemail.c: truncation of paths more than 4096 chars in many places. * chan_mgcp.c: callid truncated to 80 chars. * cdr.c: two userfields are combined to cdr copy, fix would break ABI. * tcptls.c: ignore use of deprecated method SSLv3_client_method(). ASTERISK-27156 #close Change-Id: I65f280e7d3cfad279d16f41823a4d6fddcbc4c88
2017-04-24core: Use eventfd for alert pipes on Linux when possibleSean Bright
The primary win of switching to eventfd when possible is that it only uses a single file descriptor while pipe() will use two. This means for each bridge channel we're reducing the number of required file descriptors by 1, and - if you're using timerfd - we also now have 1 less file descriptor per Asterisk channel. The API is not ideal (passing int arrays), but this is the cleanest approach I could come up with to maintain API/ABI. I've also removed what I believe to be an erroneous code block that checked the non-blocking flag on the pipe ends for each read. If the file descriptor is 'losing' its non-blocking mode, it is because of a bug somewhere else in our code. In my testing I haven't seen any measurable difference in performance. Change-Id: Iff0fb1573e7f7a187d5211ddc60aa8f3da3edb1d
2016-11-30res_rtp: Fix regression when IPv6 is not available.Guido Falsi
The latest Release candidate fails to create RTP streams when IPv6 is not available. Due to the changes made in September the ast_sockaddr structure passed around to create these streams is always of AF_INET6 type, causing failure when used for IPv4. This patch adds a utility function to check for availability of IPv6 and applies such check at startup to determine how to create the ast_sockaddr structures. ASTERISK-26617 #close Change-Id: I627a4e91795e821111e1cda523f083a40d0e0c3e
2016-11-15Implement internal abstraction for iostreamsTimo Teräs
fopencookie/funclose is a non-standard API and should not be used in portable software. Additionally, the way FILE's fd is used in non-blocking mode is undefined behaviour and cannot be relied on. This introduces internal abstraction for io streams, that allows implementing the desired virtualization of read/write operations with necessary timeout handling. ASTERISK-24515 #close ASTERISK-24517 #close Change-Id: Id916aef418b665ced6a7489aef74908b6e376e85
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-10-16utils.c: Fix ast_set_default_eid for multiple platformsGeorge Joseph
ast_set_default_eid was searching for ethX, emX, enoX, ensX and even pciD#U interface names. While this was a good attempt, it wasn't inclusive enough to capture interfaces like enp6s0 or ens6d1, etc. Rather than relying on interface names, we now simply find the first interface returned by the OS that has a hardware address and that address isn't all 0x00 or all 0xff. The code IS different for BSD, Solaris and Linux based on what method is available for enumerating interfaces. Tested on: FreeBSD9 CentOS6 Ubuntu14 Fedora24 I was unable to test on Solaris at this time but the code for Solaris is used elsewhere at Digium. Change-Id: Iaa6db87ca78a9a375e47d70e043ae08c1448cb72
2016-09-30astobj2: Add backtrace to log_bad_ao2.Corey Farrell
* Compile __ast_assert_failed unconditionally. * Use __ast_assert_failed to log messages from log_bad_ao2 * Remove calls to ast_assert(0) that happen after log_bad_ao2 was run. Change-Id: I48f1af44b2718ad74a421ff75cb6397b924a9751
2016-09-29core: Remove ABI effects of LOW_MEMORY.Corey Farrell
This allows asterisk to compiled with LOW_MEMORY to load modules built without LOW_MEMORY. ASTERISK-26398 #close Change-Id: I24b78ac9493ab933b11087a8b6794f3c96d4872d
2016-08-19Fix naming mismatch of allocator functions.Corey Farrell
Allocator functions that take file/line/func parameters are prefixed with single-underscore when MALLOC_DEBUG is not defined, double-underscore when it is defined. This change updates all allocators that accept file/line/func to have the same prototype in either ABI mode. The parameter order of __ast_vasprintf and __ast_asprintf in utils.h have been changed to match that of astmm.h. End-use allocator macro's have been removed from astmm.h and moved to an unconditional part of utils.h. Change-Id: I823bb6ce2b5675b3a4735948f10a3b420e9a023a
2016-08-15core: Entity ID is not set or invalidAlexei Gradinari
The Exchanging Device and Mailbox States could not working if the Entity ID (EID) is not set manually and can't be obtained from ethernet interface. This patch replaces debug message to warning and addes missing description about option 'entityid' to asterisk.conf.sample. With this patch the asterisk also: (1) decline loading the modules which won't work without EID: res_corosync and res_pjsip_publish_asterisk. (2) warn if EID is empty on loading next modules: pbx_dundi, res_xmpp Starting with v197 systemd/udev will automatically assign "predictable" names for all local Ethernet interfaces. This patch also addes some new ethernet prefixes "eno" and "ens". ASTERISK-26164 #close Change-Id: I72d712f1ad5b6f64571bb179c5cb12461e7c58c6
2016-07-19Add conditional support for noreturn functions.Corey Farrell
This adds support for tagging functions with the noreturn attribute. If DO_CRASH is enabled then ast_do_crash never returns. If AST_DEVMODE and DO_CRASH are enabled then failed assertions never return. This can resolve a large number of false positives with static analyzers. ASTERISK-26220 #close Change-Id: Icfb61e5fe54574eced4c3e88b317244f467ec753
2016-04-04stringfields: Refactor to allow fields to be added to the end of structuresGeorge Joseph
String fields are great, except that you can't add new ones without breaking ABI compatibility because it shifts down everything else in the structure. The only alternative is to add your own char * field to the end of the structure and manage the memory yourself which isn't ideal, especially since you then can't use the OPT_STRINGFIELD_T type. Background: The reason string fields had to be declared inside the AST_DECLARE_STRING_FIELDS block was to facilitate iteration over all declared fields for initialization, compare and copy. Since AST_DECLARE_STRING_FIELDS declared the pool, then the fields, then the manager, you could use the offsets of the pool and manager and iterate over the sequential addresses in between to access the fields. The actual pool, field allocation and field set operations don't actually care where the field is. It's just iteration over the fields that was the problem. Solution: Extended String Fields An extended string field is one that is declared outside the AST_DECLARE_STRING_FIELDS block but still (anywhere) inside the parent structure. Other than using AST_STRING_FIELD_EXTENDED instead of AST_STRING_FIELD, it looks the same as other string fields. It's storage comes from the pool and it participates in string field compare and copy operations peformed on the parent structure. It's also a valid target for the OPT_STRINGFIELD_T aco option type. Implementation: To keep track of the extended fields and make sure that ABI isn't broken, the existing embedded_pool pointer in the manager structure was repurposed to be a pointer to a separate header structure that contains the embedded_pool pointer plus a vector of fields. The length of the manager structure didn't change and the embedded_pool pointer isn't used in the macros, only the stringfields C code. A side benefit of this is that changing the header structure in the future won't break ABI. ast_string_fields_init initializes the normal string fields and appends them to the vector, and subsequent calls to ast_string_field_init_extended initialize and append the extended fields. Cleanup, ast_string_fields_cmp, and ast_string_fields_copy can now work on the vector instead of sequentially traversing the addresses between the pool and manager. The total size of a structure using string fields didn't change, whether using extended fields or not, nor have the offsets of any structure members, either inside the original block or outside. Adding an extended field to the end of a structure is the same as adding a char *. Details: The stringfield C code was pulled out from utils.c and into stringfields.c. It just made sense. Additional work was done in ast_string_field_init and ast_calloc_with_stringfields to handle the allocation of the new header structure and the vector, and the associated cleanup. In the process some additional NULL pointer checking was added. A lot of work was done in stringfields.h since the logic for compare and copy is there. Documentation was added as well as somne additional NULL checking. The ability to call ast_calloc_with_stringfields with a number of structures greater than 1 never really worked. Well, the calloc worked but there was no way to access the additional structures or clean them up. It was agreed that there was no use case for requesting more than 1 structure so an ast_assert was added to prevent it and the iteration code removed. Testing: The stringfield unit tests were updated to test both normal and extended fields. Tests for ast_string_field_ptr_set_by_fields and ast_calloc_with_stringfields were also added. As an ABI test, 13 was compiled from git and the res_pjsip_* modules, except res_pjsip itself, saved off. The patch was then added and a full compile and install was performed. Then the older res_pjsip_* moduled were copied over the installed versions so res_pjsip was new and the rest were old. No issues. contact->aor, which is a char * at the end of contact, was then changed to an extended string field and a recompile and reinstall was performed, again leaving stock versions of the the res_pjsip_* modules. Again, no issues with the res_pjsip_* modules using the old stringfield implementation and with contact->aor as a char *, and res_pjsip itself using the new stringfield implementation and contact->aor being an extended string field. Finally, several existing string fields were converted to extended string fields to test OPT_STRINGFIELD_T. Again, no issues. Change-Id: I235db338c5b178f5a13b7946afbaa5d4a0f91d61
2016-04-01utils.c: Fix typo in handle_show_locksGeorge Joseph
ast_cli_allow_on_shutdown(e) should have been ast_cli_allow_at_shutdown(e). Change-Id: I4f092495c0b2bfd85c2651e0b5877bf4d05d9faf
2016-03-24Restrict CLI/AMI commands on shutdown.Mark Michelson
During stress testing, we have frequently seen crashes occur because a CLI or AMI command attempts to access information that is in the process of being destroyed. When addressing how to fix this issue, we initially considered fixing individual crashes we observed. However, the changes required to fix those problems would introduce considerable overhead to the nominal case. This is not reasonable in order to prevent a crash from occurring while Asterisk is already shutting down. Instead, this change makes it so AMI and CLI commands cannot be executed if Asterisk is being shut down. For AMI, this is absolute. For CLI, though, certain commands can be registered so that they may be run during Asterisk shutdown. ASTERISK-25825 #close Change-Id: I8887e215ac352fadf7f4c1e082da9089b1421990
2016-01-07main: Use ast_strdup instead of strdupDiederik de Groot
Fix compile error in main/utils.c because strdup was used in dummy_start Change-Id: Id61a6cf4f3cbf235450441e10e7da101a6335793
2015-12-14Fix sscanf() format string type mismatch.Richard Mudgett
ASTERISK-25615 Reported by: George Joseph Change-Id: Ieff35307254ca193f3d473cff2e396ca57c7ce0b
2015-12-14Merge "main/utils: Don't emit an ERROR message if the read end of a pipe closes"Matt Jordan
2015-12-13main/utils: Don't emit an ERROR message if the read end of a pipe closesMatt Jordan
An ERROR or WARNING message should generally indicate that something has gone wrong in Asterisk. In the case of writing to a file descriptor, Asterisk is not in control of when the far end closes its reading on a file descriptor. If the far end does close the file descriptor in an unclean fashion, this isn't a bug or error in Asterisk, particularly when the situation can be gracefully handled in Asterisk. Currently, when this happens, a user would see the following somewhat cryptic ERROR message: "utils.c: write() returned error: Broken pipe" There's a few problems with this: (1) It doesn't provide any context, other than 'something broke a pipe' (2) As noted, it isn't actually an error in Asterisk (3) It can get rather spammy if the thing breaking the pipe occurs often, such as a FastAGI server (4) Spammy ERROR messages make Asterisk appear to be having issues, or can even mask legitimate issues This patch changes ast_carefulwrite to only log an ERROR if we actually had one that was reasonably under our control. For debugging purposes, we still emit a debug message if we detect that the far side has stopped reading. Change-Id: Ia503bb1efcec685fa6f3017bedf98061f8e1b566
2015-12-12pjsip/config_transport: Check pjproject version at runtime for async opsGeorge Joseph
pjproject < 2.5.0 will segfault on a tls transport if async_operations is greater than 1. A runtime version check has been added to throw an error if the version is < 2.5.0 and async_operations > 1. To assist in the check, a new api "ast_compare_versions" was added to utils which compares 2 major.minor.patch.extra version strings. ASTERISK-25615 #close Change-Id: I8e88bb49cbcfbca88d9de705496d6f6a8c938a98 Reported-by: George Joseph Tested-by: George Joseph
2015-12-08res_pjsip: Add existence and readablity checks for tls related filesGeorge Joseph
Both transport and endpoint now check for the existence and readability of tls certificate and key files before passing them on to pjproject. This will cause the object to not load rather than waiting for pjproject to discover that there's a problem when a session is attempted. NOTE: chan_sip also uses ast_rtp_dtls_cfg_parse but it's located in build_peer which is gigantic and I didn't want to disturb it. Error messages will emit but it won't interrupt chan_sip loading. ASTERISK-25618 #close Change-Id: Ie43f2c1d653ac1fda6a6f6faecb7c2ebadaf47c9 Reported-by: George Joseph Tested-by: George Joseph
2015-09-03Core/General: Add #ifdef needed on FreeBSD.Guido Falsi
pthread_attr_init() defaults to PTHREAD_EXPLICIT_SCHED on FreeBSD too. ASTERISK-25310 #close Reported by: Guido Falsi Change-Id: Iae6befac9028b5b9795f86986a4a08a1ae6ab7c4
2015-07-16strings.h: Fix issues with escape string functions.Richard Mudgett
Fixes for issues with the ASTERISK-24934 patch. * Fixed ast_escape_alloc() and ast_escape_c_alloc() if the s parameter is an empty string. If it were an empty string the functions returned NULL as if there were a memory allocation failure. This failure caused the AMI VarSet event to not get posted if the new value was an empty string. * Fixed dest buffer overwrite potential in ast_escape() and ast_escape_c(). If the dest buffer size is smaller than the space needed by the escaped s parameter string then the dest buffer would be written beyond the end by the nul string terminator. The num parameter was really the dest buffer size parameter so I renamed it to size. * Made nul terminate the dest buffer if the source string parameter s was an empty string in ast_escape() and ast_escape_c(). * Updated ast_escape() and ast_escape_c() doxygen function description comments to reflect reality. * Added some more unit test cases to /main/strings/escape to cover the empty source string issues. ASTERISK-25255 #close Reported by: Richard Mudgett Change-Id: Id77fc704600ebcce81615c1200296f74de254104
2015-06-08AMI: Escape string values.Kevin Harwell
So this issue is a bit complicated. Since it is possible to pass values to AMI that contain a '\r\n' (or other similar sequences) these values need to be escaped. One way to solve this is to escape the values and then pass the escaped values to the AMI variable parameter string building function. However, this puts the onus on the pre-build function to escape all string values. This potentially requires a fair amount of changes along with a lot of string allocations/freeing for all values. Surely there is a way to push this complexity down a level into the string building function itself? This of course is possible, but ends up requiring a way to distinguish between strings that need to be escaped and those that don't. The best way to handle this is by introducing a new format specifier in the format string. For instance a %s (no escape) and %S (escape). However, that is a bit weird and unexpected. So faced with those possibilities this patch implements a limited version of the first option. Instead of attempting to escape all string values this patch only escapes those values that make sense. This approach limits the number of changes and doesn't suffer from the odd format specifier problem. ASTERISK-24934 #close Reported by: warren smith Change-Id: Ib55a5b84fe0481b0f2caaaab68c566f392c0aac0
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
2015-03-26Replace most uses of ast_register_atexit with ast_register_cleanup.Corey Farrell
Since 'core stop now' and 'core restart now' do not stop modules, it is unsafe for most of the core to run cleanups. Originally all cleanups used ast_register_atexit, and were only changed when it was shown to be unsafe. ast_register_atexit is now used only when absolutely required to prevent corruption and close child processes. Exceptions that need to use ast_register_atexit: * CDR: Flush records. * res_musiconhold: Kill external applications. * AstDB: Close the DB. * canary_exit: Kill canary process. ASTERISK-24142 #close Reported by: David Brillert ASTERISK-24683 #close Reported by: Peter Katzmann ASTERISK-24805 #close Reported by: Badalian Vyacheslav ASTERISK-24881 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4500/ Review: https://reviewboard.asterisk.org/r/4501/ ........ Merged revisions 433495 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433497 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433498 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17Various: bugfixes found via chaosScott Griepentrog
Using DEBUG_CHAOS several instances of a null pointer crash, and one uninitialized variable were uncovered and fixed. Also added details on why Asterisk failed to initialize. Review: https://reviewboard.asterisk.org/r/4468/ ........ Merged revisions 433064 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433065 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-06various: cleanup issues found during leak huntScott Griepentrog
In this collection of small patches to prevent Valgrind errors are: fixes for reference leaks in config hooks, evaluating a parameter beyond bounds, and accessing a structure after a lock where it could have been already free'd. Review: https://reviewboard.asterisk.org/r/4407/ ........ Merged revisions 431583 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431584 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-17Fix printf problems with high ascii characters after r413586 (1.8).Walter Doekes
In r413586 (1.8) various casts were added to silence gcc 4.10 warnings. Those fixes included things like: -out += sprintf(out, "%%%02X", (unsigned char) *ptr); +out += sprintf(out, "%%%02X", (unsigned) *ptr); That works for low ascii characters, but for the high range that yields e.g. FFFFFFC3 when C3 is expected. This changeset: - fixes those casts to use the 'hh' unsigned char modifier instead - consistently uses %02x instead of %2.2x (or other non-standard usage) - adds a few 'h' modifiers in various places - fixes a 'replcaes' typo - dev/urandon typo (in 13+ patch) Review: https://reviewboard.asterisk.org/r/4263/ ASTERISK-24619 #close Reported by: Stefan27 (on IRC) ........ Merged revisions 429673 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 429674 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 429675 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429683 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-06Fix unintential memory retention in stringfields.Corey Farrell
* Fix missing / unreachable calls to __ast_string_field_release_active. * Reset pool->used to zero when the current pool->active reaches zero. ASTERISK-24307 #close Reported by: Etienne Lessard Tested by: ibercom, Etienne Lessard Review: https://reviewboard.asterisk.org/r/4114/ ........ Merged revisions 427380 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 427381 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 427382 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 427384 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@427388 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-05config: Make text_file_save and 'dialplan save' escape semicolons in values.George Joseph
When a config file is read, an unescaped semicolon signals comments which are stripped from the value before it's stored. Escaped semicolons are then unescaped and become part of the value. Both of these behaviors are normal and expected. When the config is serialized either by 'dialplan save' or AMI/UpdateConfig however, the now unescaped semicolons are written as-is. If you actually reload the file just saved, the unescaped semicolons are now treated as start of comments. Since true comments are stripped on read, any semicolons in ast_variable.value must have been escaped originally. This patch re-escapes semicolons in ast_variable.values before they're written to file either by 'dialplan save' or config/ast_config_text_file_save which is called by AMI/UpdateConfig. I also fixed a few pre-existing formatting issues nearby in pbx_config.c Tested-by: George Joseph ASTERISK-20127 #close Review: https://reviewboard.asterisk.org/r/4132/ ........ Merged revisions 427275 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 427276 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@427277 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-18utils: Create ast_strsep function that ignores separators inside quotesGeorge Joseph
This function acts like strsep with three exceptions... * The separator is a single character instead of a string. * Separators inside quotes are treated literally instead of like separators. * You can elect to have leading and trailing whitespace and quotes stripped from the result and have '\' sequences unescaped. Like strsep, ast_strsep maintains no internal state and you can call it recursively using different separators on the same storage. Also like strsep, for consistent results, consecutive separators are not collapsed so you may get an empty string as a valid result. Tested by: George Joseph Review: https://reviewboard.asterisk.org/r/3989/ ........ Merged revisions 423476 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 423478 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423480 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-27CallerID: Fix parsing of malformed calleridKinsey Moore
This allows the callerid parsing function to handle malformed input strings and strings containing escaped and unescaped double quotes. This also adds a unittest to cover many of the cases where the parsing algorithm previously failed. Review: https://reviewboard.asterisk.org/r/3923/ Review: https://reviewboard.asterisk.org/r/3933/ ........ Merged revisions 422112 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 422113 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 422114 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 422154 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-11general: Fix memory Corruption in __ast_string_field_ptr_build_va.Walter Doekes
If the space left in a stringfield is between 0 and (alignof(ast_string_field_allocation)-1) adding new data would cause memory corruption, because we would assume enough space (unsigned underrun). Thanks Arnd Schmitter for reporting and finding out the cause! ASTERISK-23508 #close Reported by: Arnd Schmitter Tested by: Arnd Schmitter, JoshE Review: https://reviewboard.asterisk.org/r/3898/ ........ Merged revisions 420680 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 420715 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 420716 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 420717 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420718 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-20media formats: re-architect handling of media for performance improvementsMatthew Jordan
In the old times media formats were represented using a bit field. This was fast but had a few limitations. 1. Asterisk was limited in how many formats it could handle. 2. Formats, being a bit field, could not include any attribute information. A format was strictly its type, e.g., "this is ulaw". This was changed in Asterisk 10 (see https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal for notes on that work) which led to the creation of the ast_format structure. This structure allowed Asterisk to handle attributes and bundle information with a format. Additionally, ast_format_cap was created to act as a container for multiple formats that, together, formed the capability of some entity. Another mechanism was added to allow logic to be registered which performed format attribute negotiation. Everywhere throughout the codebase Asterisk was changed to use this strategy. Unfortunately, in software, there is no free lunch. These new capabilities came at a cost. Performance analysis and profiling showed that we spend an inordinate amount of time comparing, copying, and generally manipulating formats and their related structures. Basic prototyping has shown that a reasonably large performance improvement could be made in this area. This patch is the result of that project, which overhauled the media format architecture and its usage in Asterisk to improve performance. Generally, the new philosophy for handling formats is as follows: * The ast_format structure is reference counted. This removed a large amount of the memory allocations and copying that was done in prior versions. * In order to prevent race conditions while keeping things performant, the ast_format structure is immutable by convention and lock-free. Violate this tenet at your peril! * Because formats are reference counted, codecs are also reference counted. The Asterisk core generally provides built-in codecs and caches the ast_format structures created to represent them. Generally, to prevent inordinate amounts of module reference bumping, codecs and formats can be added at run-time but cannot be removed. * All compatibility with the bit field representation of codecs/formats has been moved to a compatibility API. The primary user of this representation is chan_iax2, which must continue to maintain its bit-field usage of formats for interoperability concerns. * When a format is negotiated with attributes, or when a format cannot be represented by one of the cached formats, a new format object is created or cloned from an existing format. That format may have the same codec underlying it, but is a different format than a version of the format with different attributes or without attributes. * While formats are reference counted objects, the reference count maintained on the format should be manipulated with care. Formats are generally cached and will persist for the lifetime of Asterisk and do not explicitly need to have their lifetime modified. An exception to this is when the user of a format does not know where the format came from *and* the user may outlive the provider of the format. This occurs, for example, when a format is read from a channel: the channel may have a format with attributes (hence, non-cached) and the user of the format may last longer than the channel (if the reference to the channel is released prior to the format's reference). For more information on this work, see the API design notes: https://wiki.asterisk.org/wiki/display/AST/Media+Format+Rewrite Finally, this work was the culmination of a large number of developer's efforts. Extra thanks goes to Corey Farrell, who took on a large amount of the work in the Asterisk core, chan_sip, and was an invaluable resource in peer reviews throughout this project. There were a substantial number of patches contributed during this work; the following issues/patch names simply reflect some of the work (and will cause the release scripts to give attribution to the individuals who work on them). Reviews: https://reviewboard.asterisk.org/r/3814 https://reviewboard.asterisk.org/r/3808 https://reviewboard.asterisk.org/r/3805 https://reviewboard.asterisk.org/r/3803 https://reviewboard.asterisk.org/r/3801 https://reviewboard.asterisk.org/r/3798 https://reviewboard.asterisk.org/r/3800 https://reviewboard.asterisk.org/r/3794 https://reviewboard.asterisk.org/r/3793 https://reviewboard.asterisk.org/r/3792 https://reviewboard.asterisk.org/r/3791 https://reviewboard.asterisk.org/r/3790 https://reviewboard.asterisk.org/r/3789 https://reviewboard.asterisk.org/r/3788 https://reviewboard.asterisk.org/r/3787 https://reviewboard.asterisk.org/r/3786 https://reviewboard.asterisk.org/r/3784 https://reviewboard.asterisk.org/r/3783 https://reviewboard.asterisk.org/r/3778 https://reviewboard.asterisk.org/r/3774 https://reviewboard.asterisk.org/r/3775 https://reviewboard.asterisk.org/r/3772 https://reviewboard.asterisk.org/r/3761 https://reviewboard.asterisk.org/r/3754 https://reviewboard.asterisk.org/r/3753 https://reviewboard.asterisk.org/r/3751 https://reviewboard.asterisk.org/r/3750 https://reviewboard.asterisk.org/r/3748 https://reviewboard.asterisk.org/r/3747 https://reviewboard.asterisk.org/r/3746 https://reviewboard.asterisk.org/r/3742 https://reviewboard.asterisk.org/r/3740 https://reviewboard.asterisk.org/r/3739 https://reviewboard.asterisk.org/r/3738 https://reviewboard.asterisk.org/r/3737 https://reviewboard.asterisk.org/r/3736 https://reviewboard.asterisk.org/r/3734 https://reviewboard.asterisk.org/r/3722 https://reviewboard.asterisk.org/r/3713 https://reviewboard.asterisk.org/r/3703 https://reviewboard.asterisk.org/r/3689 https://reviewboard.asterisk.org/r/3687 https://reviewboard.asterisk.org/r/3674 https://reviewboard.asterisk.org/r/3671 https://reviewboard.asterisk.org/r/3667 https://reviewboard.asterisk.org/r/3665 https://reviewboard.asterisk.org/r/3625 https://reviewboard.asterisk.org/r/3602 https://reviewboard.asterisk.org/r/3519 https://reviewboard.asterisk.org/r/3518 https://reviewboard.asterisk.org/r/3516 https://reviewboard.asterisk.org/r/3515 https://reviewboard.asterisk.org/r/3512 https://reviewboard.asterisk.org/r/3506 https://reviewboard.asterisk.org/r/3413 https://reviewboard.asterisk.org/r/3410 https://reviewboard.asterisk.org/r/3387 https://reviewboard.asterisk.org/r/3388 https://reviewboard.asterisk.org/r/3389 https://reviewboard.asterisk.org/r/3390 https://reviewboard.asterisk.org/r/3321 https://reviewboard.asterisk.org/r/3320 https://reviewboard.asterisk.org/r/3319 https://reviewboard.asterisk.org/r/3318 https://reviewboard.asterisk.org/r/3266 https://reviewboard.asterisk.org/r/3265 https://reviewboard.asterisk.org/r/3234 https://reviewboard.asterisk.org/r/3178 ASTERISK-23114 #close Reported by: mjordan media_formats_translation_core.diff uploaded by kharwell (License 6464) rb3506.diff uploaded by mjordan (License 6283) media_format_app_file.diff uploaded by kharwell (License 6464) misc-2.diff uploaded by file (License 5000) chan_mild-3.diff uploaded by file (License 5000) chan_obscure.diff uploaded by file (License 5000) jingle.diff uploaded by file (License 5000) funcs.diff uploaded by file (License 5000) formats.diff uploaded by file (License 5000) core.diff uploaded by file (License 5000) bridges.diff uploaded by file (License 5000) mf-codecs-2.diff uploaded by file (License 5000) mf-app_fax.diff uploaded by file (License 5000) mf-apps-3.diff uploaded by file (License 5000) media-formats-3.diff uploaded by file (License 5000) ASTERISK-23715 rb3713.patch uploaded by coreyfarrell (License 5909) rb3689.patch uploaded by mjordan (License 6283) ASTERISK-23957 rb3722.patch uploaded by mjordan (License 6283) mf-attributes-3.diff uploaded by file (License 5000) ASTERISK-23958 Tested by: jrose rb3822.patch uploaded by coreyfarrell (License 5909) rb3800.patch uploaded by jrose (License 6182) chan_sip.diff uploaded by mjordan (License 6283) rb3747.patch uploaded by jrose (License 6182) ASTERISK-23959 #close Tested by: sgriepentrog, mjordan, coreyfarrell sip_cleanup.diff uploaded by opticron (License 6273) chan_sip_caps.diff uploaded by mjordan (License 6283) rb3751.patch uploaded by coreyfarrell (License 5909) chan_sip-3.diff uploaded by file (License 5000) ASTERISK-23960 #close Tested by: opticron direct_media.diff uploaded by opticron (License 6273) pjsip-direct-media.diff uploaded by file (License 5000) format_cap_remove.diff uploaded by opticron (License 6273) media_format_fixes.diff uploaded by opticron (License 6273) chan_pjsip-2.diff uploaded by file (License 5000) ASTERISK-23966 #close Tested by: rmudgett rb3803.patch uploaded by rmudgetti (License 5621) chan_dahdi.diff uploaded by file (License 5000) ASTERISK-24064 #close Tested by: coreyfarrell, mjordan, opticron, file, rmudgett, sgriepentrog, jrose rb3814.patch uploaded by rmudgett (License 5621) moh_cleanup.diff uploaded by opticron (License 6273) bridge_leak.diff uploaded by opticron (License 6273) translate.diff uploaded by file (License 5000) rb3795.patch uploaded by rmudgett (License 5621) tls_fix.diff uploaded by mjordan (License 6283) fax-mf-fix-2.diff uploaded by file (License 5000) rtp_transfer_stuff uploaded by mjordan (License 6283) rb3787.patch uploaded by rmudgett (License 5621) media-formats-explicit-translate-format-3.diff uploaded by file (License 5000) format_cache_case_fix.diff uploaded by opticron (License 6273) rb3774.patch uploaded by rmudgett (License 5621) rb3775.patch uploaded by rmudgett (License 5621) rtp_engine_fix.diff uploaded by opticron (License 6273) rtp_crash_fix.diff uploaded by opticron (License 6273) rb3753.patch uploaded by mjordan (License 6283) rb3750.patch uploaded by mjordan (License 6283) rb3748.patch uploaded by rmudgett (License 5621) media_format_fixes.diff uploaded by opticron (License 6273) rb3740.patch uploaded by mjordan (License 6283) rb3739.patch uploaded by mjordan (License 6283) rb3734.patch uploaded by mjordan (License 6283) rb3689.patch uploaded by mjordan (License 6283) rb3674.patch uploaded by coreyfarrell (License 5909) rb3671.patch uploaded by coreyfarrell (License 5909) rb3667.patch uploaded by coreyfarrell (License 5909) rb3665.patch uploaded by mjordan (License 6283) rb3625.patch uploaded by coreyfarrell (License 5909) rb3602.patch uploaded by coreyfarrell (License 5909) format_compatibility-2.diff uploaded by file (License 5000) core.diff uploaded by file (License 5000) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419044 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-18astobj2: assert on invalid ref and backtrace cleanupScott Griepentrog
If a reference count goes negative, instead of just logging that fact, be more helpful with a backtrace and an assert that will DO_CRASH. This patch also removes the duplicate ao2_bt() function and cleans up extraneous usage of the ast_log_backtrace() call. Review: https://reviewboard.asterisk.org/r/3765/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418963 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-03main/untils: Prevent potential infinite loop in ast_careful_fwriteMatthew Jordan
A loop in ast_careful_fwrite exists that will continually attempt to write to a file stream, even in the presence of EAGAIN/EINTR errors. However, if a connection that uses ast_careful_fwrite closes suddenly, ast_careful_fwrite's call to fflush may return EAGAIN/EINTER along with EOF. A subsequent call to fflush will return EOF but not clear errno, resulting in an infinite loop. This patch clears errno after it is detected and handled the loop, such that any subsequent call to fflush will not get erroneously stuck. Review: https://reviewboard.asterisk.org/r/3704 #ASTERISK-23984 #close Reported by: Steve Davies patches: fflush_loop_fix uploaded by one47 (License 5012) ........ Merged revisions 417797 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 417798 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 417799 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417800 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-24Move eid functions to utils.c, mark netsock.h deprecatedCorey Farrell
Move eid functions from netsock.c to utils.c. These functions were already published by utils.h. Flag netsock.h as deprecated and switch res_pjsip_session.h to use netsock2.h. The only code that still uses netsock.h is chan_iax2. ASTERISK-23920 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/3661/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417167 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-12AST-2014-007: Fix DOS by consuming the number of allowed HTTP connections.Richard Mudgett
Simply establishing a TCP connection and never sending anything to the configured HTTP port in http.conf will tie up a HTTP connection. Since there is a maximum number of open HTTP sessions allowed at a time you can block legitimate connections. A similar problem exists if a HTTP request is started but never finished. * Added http.conf session_inactivity timer option to close HTTP connections that aren't doing anything. Defaults to 30000 ms. * Removed the undocumented manager.conf block-sockets option. It interferes with TCP/TLS inactivity timeouts. * AMI and SIP TLS connections now have better authentication timeout protection. Though I didn't remove the bizzare TLS timeout polling code from chan_sip. * chan_sip can now handle SSL certificate renegotiations in the middle of a session. It couldn't do that before because the socket was non-blocking and the SSL calls were not restarted as documented by the OpenSSL documentation. * Fixed an off nominal leak of the ssl struct in handle_tcptls_connection() if the FILE stream failed to open and the SSL certificate negotiations failed. The patch creates a custom FILE stream handler to give the created FILE streams inactivity timeout and timeout after a specific moment in time capability. This approach eliminates the need for code using the FILE stream to be redesigned to deal with the timeouts. This patch indirectly fixes most of ASTERISK-18345 by fixing the usage of the SSL_read/SSL_write operations. ASTERISK-23673 #close Reported by: Richard Mudgett ........ Merged revisions 415841 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 415854 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 415896 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415907 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-09Allow Asterisk to compile under GCC 4.10Kinsey Moore
This resolves a large number of compiler warnings from GCC 4.10 which cause the build to fail under dev mode. The vast majority are signed/unsigned mismatches in printf-style format strings. ........ Merged revisions 413586 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 413587 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 413588 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-04Add some asserts that were handy when looking for a stasis cache problem.Richard Mudgett
* Assert if a channel is destroyed but has the snapshot staging flag set. In this case the final channel destruction snapshot would never get taken. * Assert if what we just got out of the stasis cache is not what we were looking for. This assert would have saved several days searching for a bug and a lot of my hair. * Assert if the music on hold message posts could not find the associated channel. A crash will happen later when manager tries to send the MOH AMI message. This assert catches the problem when the stasis message is posted instead of by the thread processing the defective message. * Always generate a backtrace when an ast_assert() fails. Review: https://reviewboard.asterisk.org/r/3411/ ........ Merged revisions 411701 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411702 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-24Thread Debugging: Add LWP to core show locks outputJonathan Rose
This patch adds the LWP to core show locks output if it is available. Review: https://reviewboard.asterisk.org/r/3142/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406416 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-23res_pjsip: AMI commands and events.Kevin Harwell
Created the following AMI commands and corresponding events for res_pjsip: PJSIPShowEndpoints - Provides a listing of all pjsip endpoints and a few select attributes on each. Events: EndpointList - for each endpoint a few attributes. EndpointlistComplete - after all endpoints have been listed. PJSIPShowEndpoint - Provides a detail list of attributes for a specified endpoint. Events: EndpointDetail - attributes on an endpoint. AorDetail - raised for each AOR on an endpoint. AuthDetail - raised for each associated inbound and outbound auth TransportDetail - transport attributes. IdentifyDetail - attributes for the identify object associated with the endpoint. EndpointDetailComplete - last event raised after all detail events. PJSIPShowRegistrationsInbound - Provides a detail listing of all inbound registrations. Events: InboundRegistrationDetail - inbound registration attributes for each registration. InboundRegistrationDetailComplete - raised after all detail records have been listed. PJSIPShowRegistrationsOutbound - Provides a detail listing of all outbound registrations. Events: OutboundRegistrationDetail - outbound registration attributes for each registration. OutboundRegistrationDetailComplete - raised after all detail records have been listed. PJSIPShowSubscriptionsInbound - A detail listing of all inbound subscriptions and their attributes. Events: SubscriptionDetail - on each subscription detailed attributes SubscriptionDetailComplete - raised after all detail records have been listed. PJSIPShowSubscriptionsOutbound - A detail listing of all outboundbound subscriptions and their attributes. Events: SubscriptionDetail - on each subscription detailed attributes SubscriptionDetailComplete - raised after all detail records have been listed. (issue ASTERISK-22609) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/2959/ ........ Merged revisions 403131 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403133 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-24utils: Fix memory leaks and missed unregistration of CLI commands on shutdownJonathan Rose
Final set of patches in a series of memory leak/cleanup patches by Corey Farrell (closes issue ASTERISK-22467) Reported by: Corey Farrell Patches: main-utils-1.8.patch uploaded by coreyfarrell (license 5909) main-utils-11.patch uploaded by coreyfarrell (license 5909) main-utils-12up.patch uploaded by coreyfarrell (license 5909) ........ Merged revisions 401829 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 401830 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 401831 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401832 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-02MALLOC_DEBUG: Fix some misuses of free() when MALLOC_DEBUG is enabled.Richard Mudgett
* There were several places in ARI where an external library was mallocing memory that must always be released with free(). When MALLOC_DEBUG is enabled, free() is redirected to the MALLOC_DEBUG version. Since the external library call still uses the normal malloc(), MALLOC_DEBUG complains that the freed memory block is not registered and will not free it. These cases must use ast_std_free(). * Changed calls to asprintf() and vasprintf() to the equivalent ast_asprintf() and ast_vasprintf() versions respectively. ........ Merged revisions 400270 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400271 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-09Fix DEBUG_THREADS when lock is acquired in __constructor__David M. Lee
This patch fixes some long-standing bugs in debug threads that were exacerbated with recent Optional API work in Asterisk 12. With debug threads enabled, on some systems, there's a lock ordering problem between our mutex and glibc's mutex protecting its module list (Ubuntu Lucid, glibc 2.11.1 in this instance). In one thread, the module list will be locked before acquiring our mutex. In another thread, our mutex will be locked before locking the module list (which happens in the depths of calling backtrace()). This patch fixes this issue by moving backtrace() calls outside of critical sections that have the mutex acquired. The bigger change was to reentrancy tracking for ast_cond_{timed,}wait, which wrongly assumed that waiting on the mutex was equivalent to a single unlock (it actually suspends all recursive locks on the mutex). (closes issue ASTERISK-22455) Review: https://reviewboard.asterisk.org/r/2824/ ........ Merged revisions 398648 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 398649 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 398651 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398652 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-23Fix memory corruption when trying to get "core show locks".Richard Mudgett
Review https://reviewboard.asterisk.org/r/2580/ tried to fix the mismatch in memory pools but had a math error determining the buffer size and didn't address other similar memory pool mismatches. * Effectively reverted the previous patch to go in the same direction as trunk for the returned memory pool of ast_bt_get_symbols(). * Fixed memory leak in ast_bt_get_symbols() when BETTER_BACKTRACES is defined. * Fixed some formatting in ast_bt_get_symbols(). * Fixed sig_pri.c freeing memory allocated by libpri when MALLOC_DEBUG is enabled. * Fixed __dump_backtrace() freeing memory from ast_bt_get_symbols() when MALLOC_DEBUG is enabled. * Moved __dump_backtrace() because of compile issues with the utils directory. (closes issue ASTERISK-22221) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/2778/ ........ Merged revisions 397525 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 397528 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397570 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-16Fix utilities compilation/linking.Richard Mudgett
The horrid structure of the source in the utils directory strikes again. Moved the _ast_mem_backtrace_buffer[] definition from the logical location in utils.c to hashtab.c so the aelparse and conf2ael utilities can link. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396850 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-16Improve sounds indexer CLI commandsKinsey Moore
This reworks the CLI commands used to access sounds information from "sounds show[ soundid]" to "core show sounds" and "core show sound <soundid>". This also reworks the "sounds reload" CLI command to fall under normal module reloading ("module reload sounds"). Also, make trunk build when DEBUG_MALLOC is not enabled. Review: https://reviewboard.asterisk.org/r/2745/ (closes issue ASTERISK-22141) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396829 65c4cc65-6c06-0410-ace0-fbb531ad65f3