Commit Graph

167 Commits

Author SHA1 Message Date
Mark Michelson fe72baf06b Make sure to set owner_line, ownder_func, and owner_file in ast_calloc_with_stringfields.
Asterisk would crash on startup if MALLOC_DEBUG were set in menuselect. This is because
the manager action UpdateConfig had to resize its string field allocation to set the
description. When the resize occurred, ast_copy_string would crash because we were
attempting to copy a string from a NULL pointer. Setting the strings initially makes
the code much less crashy.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@240420 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-15 20:58:24 +00:00
Russell Bryant 3a6d247def Fix build of utility apps that include utils.c.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@237749 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-05 17:26:50 +00:00
Russell Bryant 630152f848 Merged revisions 237697 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r237697 | russell | 2010-01-05 11:13:28 -0600 (Tue, 05 Jan 2010) | 7 lines
  
  Change a NOTICE log message to DEBUG where it belongs.
  
  (closes issue #16479)
  Reported by: alexrecarey
  
  (closes SWP-577)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@237699 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-05 17:16:01 +00:00
David Vossel e44e6b33b3 fixes incorrect logic in ast_uri_encode
issue #16299


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@233611 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-12-07 23:28:51 +00:00
Matthew Nicholson f44f8650cb Merged revisions 228378 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r228378 | mnicholson | 2009-11-06 10:26:59 -0600 (Fri, 06 Nov 2009) | 8 lines
  
  Properly handle '=' while decoding base64 messages and null terminate strings returned from BASE64_DECODE.
  
  (closes issue #15271)
  Reported by: chappell
  Patches:
        base64_fix.patch uploaded by chappell (license 8)
  Tested by: kobaz
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@228620 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-11-06 19:47:11 +00:00
Michiel van Baak 7348bacf05 Merged revisions 216435 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r216435 | mvanbaak | 2009-09-04 15:56:10 +0200 (Fri, 04 Sep 2009) | 2 lines
  
  make asterisk compile under devmode with DEBUG_THREADS enabled on OpenBSD
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@216506 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-04 15:05:05 +00:00
Tilghman Lesher 642bec4d6f AST-2009-005
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@211539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-10 19:20:57 +00:00
Kevin P. Fleming e4dafd3d0b Ensure that accidental calls to ast_string_field_free_memory() on embedded stringfield pools are safe.
It is possible for a stringfield manager structure (and pool) structure to be allocated
as part of a larger structure allocation (using ast_calloc_with_strinfields()); when
this is done, the stringfield pool cannot be separately freed, but users of the tructure
may not be aware (and shouldn't have to be aware) of whether the pool was embedded.
This patch modifies the behavior so that they can always call ast_string_field_free_memory()
and the function will do the right thing for both embedded and non-embedded situations.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@197775 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-28 20:36:49 +00:00
Joshua Colp e960f0da90 Fix a bug in stringfields where it did not actually free the pools of memory.
(closes issue #15074)
Reported by: pj


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@197538 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-28 14:51:43 +00:00
Kevin P. Fleming e6b2e9a750 Const-ify the world (or at least a good part of it)
This patch adds 'const' tags to a number of Asterisk APIs where they are appropriate (where the API already demanded that the function argument not be modified, but the compiler was not informed of that fact). The list includes:

- CLI command handlers
- CLI command handler arguments
- AGI command handlers
- AGI command handler arguments
- Dialplan application handler arguments
- Speech engine API function arguments

In addition, various file-scope and function-scope constant arrays got 'const' and/or 'static' qualifiers where they were missing.

Review: https://reviewboard.asterisk.org/r/251/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196072 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-21 21:13:09 +00:00
Kevin P. Fleming 2746f589b7 Add a more efficient way of allocating structures that use stringfields
This commit adds an API call that can be used to allocate a structure along with this stringfield storage in a single allocation.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@192362 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-05 14:17:18 +00:00
Kevin P. Fleming 1f49e675bb Correct some flaws in the memory accounting code for stringfields and ao2 objects
Under some conditions, the memory allocation for stringfields and ao2 objects would not have supplied valid file/function names for MALLOC_DEBUG tracking, so this commit corrects that.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@192357 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-05 13:18:21 +00:00
Kevin P. Fleming d8182202ef Ensure that string pools allocated to hold stringfields are properly accounted in MALLOC_DEBUG mode
This commit modifies the stringfield pool allocator to remember the 'owner' of the stringfield manager the pool is being allocated for, and ensures that pools allocated in the future when fields are populated are owned by that file/function.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@192279 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-05 08:51:06 +00:00
Tilghman Lesher ce6ebaef97 Support HTTP digest authentication for the http manager interface.
(closes issue #10961)
 Reported by: ys
 Patches: 
       digest_auth_r148468_v5.diff uploaded by ys (license 281)
       SVN branch http://svn.digium.com/svn/asterisk/team/group/manager_http_auth
 Tested by: ys, twilson, tilghman
 Review: http://reviewboard.digium.com/r/223/
 Reviewed by: tilghman,russellb,mmichelson


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190349 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-23 20:36:35 +00:00
Kevin P. Fleming a009068110 Optimizations to the stringfields API
This patch provides a number of optimizations to the stringfields API, focused around saving (not wasting) memory whenever possible. Thanks to Mark Michelson for inspiring this work and coming up with the first two optimizations that are represented here:

Changes:

- Cleanup of some code, fix incorrect doxygen comments

- When a field is emptied or replaced with a new allocation, decrease the amount of 'active' space in the pool it was held in; if that pool reaches zero active space, and is not the current pool, then free it as it is no longer in use

- When allocating a pool, try to allocate a size that will fit in a 'standard' malloc() allocation without wasting space

- When allocating space for a field, store the amount of space in the two bytes immediately preceding the field; this eliminates the need to call strlen() on the field when overwriting it, and more importantly it 'remembers' the amount of space the field has available, even if a shorter string has been stored in it since it was allocated

- Don't automatically double the size of each successive pool allocated; it's wasteful

http://reviewboard.digium.com/r/165/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@185581 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-31 21:29:50 +00:00
Russell Bryant 0bdd99ad64 Merged revisions 182810 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r182810 | russell | 2009-03-17 21:09:13 -0500 (Tue, 17 Mar 2009) | 44 lines

Fix cases where the internal poll() was not being used when it needed to be.

We have seen a number of problems caused by poll() not working properly on 
Mac OSX.  If you search around, you'll find a number of references to using 
select() instead of poll() to work around these issues.  In Asterisk, we've 
had poll.c which implements poll() using select() internally.  However, we 
were still getting reports of problems.

vadim investigated a bit and realized that at least on his system, even 
though we were compiling in poll.o, the system poll() was still being used.  
So, the primary purpose of this patch is to ensure that we're using the 
internal poll() when we want it to be used.

The changes are:

1) Remove logic for when internal poll should be used from the Makefile.  
   Instead, put it in the configure script.  The logic in the configure 
   script is the same as it was in the Makefile.  Ideally, we would have 
   a functionality test for the problem, but that's not actually possible, 
   since we would have to be able to run an application on the _target_ 
   system to test poll() behavior.

2) Always include poll.o in the build, but it will be empty if AST_POLL_COMPAT
   is not defined.

3) Change uses of poll() throughout the source tree to ast_poll().  I feel 
   that it is good practice to give the API call a new name when we are 
   changing its behavior and not using the system version directly in all cases.
   So, normally, ast_poll() is just redefined to poll().  On systems where 
   AST_POLL_COMPAT is defined, ast_poll() is redefined to ast_internal_poll().

4) Change poll() in main/poll.c to be ast_internal_poll().

It's worth noting that any code that still uses poll() directly will work fine 
(if they worked fine before).  So, for example, out of tree modules that are 
using poll() will not stop working or anything.  However, for modules to work 
properly on Mac OSX, ast_poll() needs to be used.

(closes issue #13404)
Reported by: agalbraith
Tested by: russell, vadim

http://reviewboard.digium.com/r/198/

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@182847 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-18 02:28:55 +00:00
Doug Bailey 7949345352 Fixed error where a check for an zero length, terminated string was needed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@177035 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-18 17:24:07 +00:00
Doug Bailey fa3dec169b Need to take into account the \0 terminator of the old string to determine the amount available.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176948 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-18 16:09:12 +00:00
Kevin P. Fleming 0381d94d14 Merged revisions 176216 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r176216 | kpfleming | 2009-02-16 15:10:38 -0600 (Mon, 16 Feb 2009) | 3 lines
  
  fix a flaw in the ast_string_field_build() family of API calls; these functions made no attempt to reuse the space already allocated to a field, so every time the field was written it would allocate new space, leading to what appeared to be a memory leak.
........
  r176254 | kpfleming | 2009-02-16 15:41:46 -0600 (Mon, 16 Feb 2009) | 3 lines

  correct a logic error in the last stringfields commit... don't mark additional space as allocated if the string was built using already-allocated space
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176255 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-16 21:45:54 +00:00
Russell Bryant 50387142b7 Merged revisions 166297 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r166297 | russell | 2008-12-22 11:22:56 -0600 (Mon, 22 Dec 2008) | 2 lines

Fix up timeout handling in ast_carefulwrite().

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@166317 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-22 17:29:10 +00:00
Russell Bryant c2999a8366 Introduce ast_careful_fwrite() and use in AMI to prevent partial writes.
This patch introduces a function to do careful writes on a file stream which
will handle timeouts and partial writes.  It is currently used in AMI to
address the issue that has been reported.  However, there are probably a few
other places where this could be used.

(closes issue #13546)
Reported by: srt
Tested by: russell
http://reviewboard.digium.com/r/104/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@166282 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-22 17:09:36 +00:00
Russell Bryant 1cb4baade2 Merged revisions 165796 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r165796 | russell | 2008-12-18 15:39:25 -0600 (Thu, 18 Dec 2008) | 11 lines

Make ast_carefulwrite() be more careful.

This patch handles some additional cases that could result in partial writes
to the file description.  This was done to address complaints about partial
writes on AMI.

(issue #13546) (more changes needed to address potential problems in 1.6)
Reported by: srt
Tested by: russell
Review: http://reviewboard.digium.com/r/99/

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@165801 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-18 21:44:47 +00:00
Russell Bryant c8da171dd1 Merged revisions 164881 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r164881 | russell | 2008-12-16 15:38:29 -0600 (Tue, 16 Dec 2008) | 9 lines

Fix an issue where DEBUG_THREADS may erroneously report that a thread 
is exiting while holding a lock.

If the last lock attempt was a trylock, and it failed, it will still be in the
list of locks so that it can be reported.

(closes issue #13219)
Reported by: pj

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@164882 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-16 21:39:15 +00:00
Joshua Colp 6df30fb8cc Update to work with new ast_str changes.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@164208 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-15 15:21:23 +00:00
Tilghman Lesher c8223fc957 Merge ast_str_opaque branch (discontinue usage of ast_str internals)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163991 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-13 08:36:35 +00:00
Russell Bryant 179667088b Merged revisions 162413 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r162413 | russell | 2008-12-09 16:17:39 -0600 (Tue, 09 Dec 2008) | 8 lines

Remove the test_for_thread_safety() function completely.

The test is not valid.  Besides, if we actually suspected that recursive
mutexes were not working, we would get a ton of LOG_ERROR messages when
DEBUG_THREADS is turned on.

(inspired by a discussion on the asterisk-dev list)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@162414 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-09 22:25:06 +00:00
Kevin P. Fleming 887e28d7aa incorporates r159808 from branches/1.4:
------------------------------------------------------------------------
r159808 | kpfleming | 2008-11-29 10:58:29 -0600 (Sat, 29 Nov 2008) | 7 lines

update dev-mode compiler flags to match the ones used by default on Ubuntu Intrepid, so all developers will see the same warnings and errors

since this branch already had some printf format attributes, enable checking for them and tag functions that didn't have them

format attributes in a consistent way


------------------------------------------------------------------------

in addition:

move some format attributes from main/utils.c to the header files they belong in, and fix up references to the relevant functions based on new compiler warnings



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@159818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-29 17:57:39 +00:00
Tilghman Lesher afb571ba8f Starting with a change to ensure that ast_verbose() preserves ABI compatibility
in 1.6.1 (as compared to 1.6.0 and versions of 1.4), this change also
deprecates the use of Asterisk with FreeBSD 4, given the central use of va_copy
in core functions.  va_copy() is C99, anyway, and we already require C99 for
other purposes, so this isn't really a big change anyway.  This change also
simplifies some of the core ast_str_* functions.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157639 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-19 01:02:45 +00:00
Kevin P. Fleming bd4eb070f3 bring over all the fixes for the warnings found by gcc 4.3.x from the 1.4 branch, and add the ones needed for all the new code here too
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153616 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-02 18:52:13 +00:00
Kevin P. Fleming f910cfc444 Merged revisions 132872 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r132872 | kpfleming | 2008-07-23 06:52:18 -0500 (Wed, 23 Jul 2008) | 2 lines

minor optimization for stringfields: when a field is being set to a larger value than it currently contains and it happens to be the most recent field allocated from the currentl pool, it is possible to 'grow' it without having to waste the space it is currently using (or potentially even allocate a new pool)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@132964 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-23 16:30:18 +00:00
Brett Bryant 5b7933fe5e Janitor patch to change uses of sizeof to ARRAY_LEN
(closes issue #13054)
Reported by: pabelanger
Patches:
      ARRAY_LEN.patch2 uploaded by pabelanger (license 224)
Tested by: seanbright


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@130129 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-11 18:09:35 +00:00
Tilghman Lesher 09c15a0b71 Merged revisions 125793 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r125793 | tilghman | 2008-06-27 08:45:03 -0500 (Fri, 27 Jun 2008) | 2 lines

In this debugging function, copy to a buffer instead of using potentially unsafe pointers.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@125794 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-27 13:54:13 +00:00
Jason Parker c1e4f50f54 Merged revisions 125587 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r125587 | qwell | 2008-06-26 18:03:15 -0500 (Thu, 26 Jun 2008) | 1 line

Make sure to unlock the lock_info lock (huh?).  Possible deadlock?
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@125589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-26 23:04:18 +00:00
Brett Bryant b4574d2a79 Add errors that report any locks held by threads when they are being closed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@124064 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-19 19:48:26 +00:00
Tilghman Lesher 53459f86b2 Expand RQ_INTEGER type out to multiple types, one for each precision
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121367 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-09 22:51:59 +00:00
Russell Bryant 51051ce949 Add lock tracking for rwlocks. Previously, lock.h only had the ability to
hold tracking information for mutexes.  Now, the "core show locks" output
will output information about who is holding a rwlock when a thread is
waiting on it.

(closes issue #11279)
Reported by: ys
Patches:
      trunk_lock_utils.v8.diff uploaded by ys (license 281)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@120064 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-03 18:26:51 +00:00
Russell Bryant da85b710ef Fix a minor merge issue that caused a function to not get compiled in with
DEBUG_THREADS like it was supposed to


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@119423 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-30 21:51:17 +00:00
Tilghman Lesher 6e5d843a71 Merged revisions 118953 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r118953 | tilghman | 2008-05-29 12:20:16 -0500 (Thu, 29 May 2008) | 3 lines

Add some debugging code that ensures that when we do deadlock avoidance, we
don't lose the information about how a lock was originally acquired.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@118955 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-29 17:35:19 +00:00
Mark Michelson 975a848b67 A new feature thanks to the fine folks at Switchvox!
If a deadlock is detected, then the typical lock information will be
printed along with a backtrace of the stack for the offending threads.
Use of this requires compiling with DETECT_DEADLOCKS and having glibc
installed.

Furthermore, issuing the "core show locks" CLI command will print the
normal lock information as well as a backtraces for each lock. This
requires that DEBUG_THREADS is enabled and that glibc is installed.

All the backtrace features may be disabled by running the configure
script with --without-execinfo as an argument



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@118173 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-23 22:35:50 +00:00
Russell Bryant 61e6ae545b Merged revisions 118048 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r118048 | russell | 2008-05-23 07:30:53 -0500 (Fri, 23 May 2008) | 9 lines

Don't declare a function that takes variable arguments as inline, because it's
not valid, and on some compilers, will emit a warning.

http://gcc.gnu.org/onlinedocs/gcc/Inline.html#Inline

(closes issue #12289)
Reported by: francesco_r
Patches by Tilghman, final patch by me

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@118049 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-23 12:37:31 +00:00
Luigi Rizzo 18065a175d Use casts or intermediate variables to remove a number
of platform/compiler-dependent warnings when handing
struct timeval fields, both reading and printing them.

It is a lost battle to handle the different ways struct timeval
is handled on the various platforms and compilers, so try
to be pragmatic and go through int/long which are universally
supported.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@116557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-15 10:56:29 +00:00
Mark Michelson 2e054642d5 Merged revisions 115735 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115735 | mmichelson | 2008-05-12 12:51:14 -0500 (Mon, 12 May 2008) | 7 lines

If a thread holds no locks, do not print any information on the thread when issuing
a core show locks command. This will help to de-clutter output somewhat.

Russell said it would be fine to place this improvement in the 1.4 branch, so that's
why it's going here too.


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115737 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-12 17:55:08 +00:00
Tilghman Lesher 95490ee5c2 Merged revisions 115017 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115017 | tilghman | 2008-05-01 13:59:08 -0500 (Thu, 01 May 2008) | 6 lines

'#' is another reserved character for URIs that also needs to be escaped.
(closes issue #10543)
 Reported by: blitzrage
 Patches: 
       20080418__bug10543.diff.txt uploaded by Corydon76 (license 14)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115018 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-01 19:00:18 +00:00
Steve Murphy 161b4abd79 Hopefully, this will resolve the issues that russellb had with this log_show_lock().
I gathered the code that filled the string, and put it in a different func which
I cryptically call "append_lock_information()".
Now, both log_show_lock(), and handle_show_locks() both call this code to do
the work. Tested, seems to work fine. 
Also, log_show_lock was modified to use the ast_str stuff, along with checking
for successful ast_str creation, and freeing the ast_str obj when finished.
A break was inserted to terminate the search for the lock; we should never
see it twice.

An example usage in chan_sip.c was created as a comment, for instructional
purposes.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114520 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-22 14:38:46 +00:00
Russell Bryant 0270b3d6c9 Make this file compile. The variable str is never set anywhere. Furthermore,
it duplicates a lot of code.  I will leave it to murf to clean up.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114231 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-17 22:21:32 +00:00
Steve Murphy 752f6681b1 A small enhancement-- I added the routine log_show_lock to utils.c, which if the mentioned lock has been acquired, this routine will log to the console the normal info about that lock you'd see from the CLI when you do a 'core show locks'. It's solely for debug-- if the lock is NOT acquired, there is no output. I use it to show 'unexpected' locks, to see where/why a lock is pre-locked. This command is to be called from points of interest, like just before a trylock, and helps to spot fleeting, highly temporal locks that normally are not locked...
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114187 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-16 20:54:41 +00:00
Mark Michelson 115d5024a1 Merged revisions 114051 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114051 | mmichelson | 2008-04-10 15:59:49 -0500 (Thu, 10 Apr 2008) | 3 lines

Fix 1.4 build when LOW_MEMORY is enabled.


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114052 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-10 22:02:32 +00:00
Russell Bryant c1cf92d304 Merged revisions 109838 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r109838 | russell | 2008-03-18 23:06:05 -0500 (Tue, 18 Mar 2008) | 2 lines

Tweak spacing in a recent change because I'm very picky.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109839 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-19 04:06:31 +00:00
Terry Wilson b02bc230af Go through and fix a bunch of places where character strings were being interpreted as format strings. Most of these changes are solely to make compiling with -Wsecurity and -Wformat=2 happy, and were not
actual problems, per se.  I also added format attributes to any printf wrapper functions I found that didn't have them.  -Wsecurity and -Wmissing-format-attribute added to --enable-dev-mode.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109447 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-18 15:43:34 +00:00
Mark Michelson b246e010d5 Merged revisions 109226 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r109226 | mmichelson | 2008-03-17 17:05:49 -0500 (Mon, 17 Mar 2008) | 12 lines

Fix a logic flaw in the code that stores lock info which is displayed
via the "core show locks" command. The idea behind this section of code was
to remove the previous lock from the list if it was a trylock that had failed.
Unfortunately, instead of checking the status of the previous lock, we were referencing
the index immediately following the previous lock in the lock_info->locks array. 
The result of this problem, under the right circumstances, was that the lock which 
we currently in the process of attempting to acquire could "overwrite" the previous lock 
which was acquired. While this does not in any way affect typical operation, it *could*
lead to misleading "core show locks" output.



........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109227 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-17 22:06:44 +00:00
Tilghman Lesher cfc1df4c1a Whitespace changes only
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105840 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-04 23:04:29 +00:00
Russell Bryant 7da06e6cb8 Merged revisions 105116 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105116 | russell | 2008-02-28 16:23:05 -0600 (Thu, 28 Feb 2008) | 8 lines

Fix a bug in the lock tracking code that was discovered by mmichelson.  The issue
is that if the lock history array was full, then the functions to mark a lock as
acquired or not would adjust the stats for whatever lock is at the end of the array,
which may not be itself.  So, do a sanity check to make sure that we're updating
lock info for the proper lock.

(This explains the bizarre stats on lock #63 in BE-396, thanks Mark!)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105144 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-28 22:39:26 +00:00
Russell Bryant 16b84e260c Merged revisions 104102 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r104102 | russell | 2008-02-25 17:19:05 -0600 (Mon, 25 Feb 2008) | 7 lines

Improve the lock tracking code a bit so that a bunch of old locks that threads
failed to lock don't sit around in the history.  When a lock is first locked,
this checks to see if the last lock in the list was one that was failed to be
locked.  If it is, then that was a lock that we're no longer sitting in a trylock
loop trying to lock, so just remove it.
(inspired by issue #11712)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@104103 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-25 23:19:31 +00:00
Joshua Colp c81350d6f6 Just some minor coding style cleanup...
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103318 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-11 18:27:47 +00:00
Tilghman Lesher 81e421284d New module res_config_curl (closes issue #11747)
Reported by: Corydon76
 Patches: 
       res_config_curl.c uploaded by Corydon76 (license 14)
       20080116__bug11747.diff.txt uploaded by Corydon76 (license 14)
 Tested by: jmls


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@98981 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-16 22:20:45 +00:00
Tilghman Lesher f48ed5a943 Merged revisions 97194 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r97194 | tilghman | 2008-01-08 14:47:07 -0600 (Tue, 08 Jan 2008) | 3 lines

Increase constants to where we're less likely to hit them while debugging.
(Closes issue #11694)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@97198 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-08 20:56:38 +00:00
Luigi Rizzo 8e4360b072 Add a new API function, written at least twice in app_voicemail.c
and likely in other places too.

This is quite useful when placing mail/html stuff in config files.

 /*!
   \brief Convert some C escape sequences (\b\f\n\r\t) into the
        equivalent characters.
   \brief s The string to be converted (will be modified).
   \return The converted string.
  */
 char *ast_unescape_c(char *s);
 




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93950 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-19 17:09:01 +00:00
Joshua Colp 3bc9c162f1 Merged revisions 93377 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r93377 | file | 2007-12-17 18:28:09 -0400 (Mon, 17 Dec 2007) | 7 lines

Do not try to access information about a lock when printing out a trylock attempt. It is possible for the lock that it references to no longer be valid. This would have caused segfaults or deadlocks.
(issue #BE-263)
(closes issue #11080)
Reported by: callguy
(closes issue #11100)
Reported by: callguy

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93378 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-17 22:29:56 +00:00
Tilghman Lesher 99308dfb4e Conversions of free to ast_free, where applicable, and several other formatting fixes.
Reported by: eliel
Patch by: eliel,tilghman
(Closes issue #11209)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@92594 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-12 20:05:13 +00:00
Russell Bryant 8093fa188b Merged revisions 91830 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r91830 | russell | 2007-12-07 15:24:33 -0600 (Fri, 07 Dec 2007) | 5 lines

Make the lock protecting each thread's list of locks it currently holds
recursive.  I think that this will fix the situation where some people have
said that "core show locks" locks up the CLI.
(related to issue #11080)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@91831 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-07 21:25:03 +00:00
Russell Bryant ec846d6cf2 Merged revisions 91074 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r91074 | russell | 2007-12-04 18:48:47 -0600 (Tue, 04 Dec 2007) | 4 lines

When DEBUG_THREADS is enabled, we only have the details about who is holding
a lock that we are waiting on for a mutex, not rwlocks.  This should fix the
problem where people have reported "core show locks" crashing sometimes.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@91077 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-05 00:49:19 +00:00
Joshua Colp 98fbe822f5 Ensure the value returned from ast_random is between 0 and RAND_MAX on 64-bit platforms.
(closes issue #11348)
Reported by: sperreault


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89637 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-27 17:01:19 +00:00
Joshua Colp 72a8e08bf5 Revert change for 11348 until it can be looked at even more.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89582 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-26 16:20:04 +00:00
Joshua Colp a1b79aa278 Make the behavior of using /dev/urandom for random numbers the same as random().
(closes issue #11348)
Reported by: sperreault
Patches:
      ast_random2.diff uploaded by sperreault (license 252)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89576 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-26 15:28:13 +00:00
Luigi Rizzo e0ff5fef5c remove a bunch of useless #include "options.h"
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89511 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-21 23:09:02 +00:00
Mark Michelson 3851bc9789 There existed about a 1 in 4 billion chance that reading from /dev/urandom
would return LONG_MIN (1 in 9 quintillion if using 64-bit longs). Since there
is no positive equivalent of LONG_MIN, the result of labs() in this case is
unpredictable. This fixes that situation.

(closes issue #11336, reported and patched by sperreault)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89487 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-21 18:19:22 +00:00
Luigi Rizzo 9335ace850 another bunch of include removals (errno.h and asterisk/logger.h)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89425 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-19 19:09:03 +00:00
Luigi Rizzo a0f06d0dd5 start using asterisk/network.h for network related headers.
Also remove some unnecessary includes.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89380 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-17 14:11:53 +00:00
Luigi Rizzo 130b6291cb netdb.h is used for gethostbyname, and it was not included in some
platforms.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89365 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-17 09:44:14 +00:00
Luigi Rizzo fdb7f7ba3d Start untangling header inclusion in a way that does not affect
build times - tested, there is no measureable difference before and
after this commit.

In this change:

use asterisk/compat.h to include a small set of system headers:
inttypes.h, unistd.h, stddef.h, stddint.h, sys/types.h, stdarg.h,
stdlib.h, alloca.h, stdio.h

Where available, the inclusion is conditional on HAVE_FOO_H as determined
by autoconf.

Normally, source files should not include any of the above system headers,
and instead use either "asterisk.h" or "asterisk/compat.h" which does it
better. 

For the time being I have left alone second-level directories
(main/db1-ast, etc.).



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89333 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-16 20:04:58 +00:00
Tilghman Lesher 8309f54e39 If we're going to be passing a negative value for the size of a stringfield,
in order to indicate something, then using an UNSIGNED parameter is bad,
mmmmmkay?


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89312 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-15 23:50:15 +00:00
Tilghman Lesher 9cd09c5214 Merged revisions 89239 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r89239 | tilghman | 2007-11-13 07:51:53 -0600 (Tue, 13 Nov 2007) | 4 lines

Debugging is running into the 16-lock limit.  Increase to avoid.
(This define is only effective when debugging is turned on, so there's
no effect for most installations.)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89240 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-13 14:03:34 +00:00
Luigi Rizzo 08b10da53b Simplify the implementation and the API for stringfields;
details and examples are in include/asterisk/stringfields.h.

Not applicable to older branches except for 1.4 which will
receive a fix for the routines that free memory pools.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@88454 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-04 19:44:31 +00:00
Tilghman Lesher c2aee728e9 Conditionally free lock_info->thread_name to avoid a useless warning
Reported by: snuffy
Patch by: snuffy
Closes issue #11125


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@88010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-01 06:12:08 +00:00
Russell Bryant f7782d60d1 Merged revisions 87396 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r87396 | russell | 2007-10-29 15:22:07 -0500 (Mon, 29 Oct 2007) | 5 lines

Add some more details to the output of "core show locks".  When a thread
is waiting for a lock, this will now show the details about who currently
has it locked.
(inspired by issue #11100)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@87397 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-29 20:24:47 +00:00
Joshua Colp 0769dd6e1e Merged revisions 87294 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r87294 | file | 2007-10-29 11:23:49 -0300 (Mon, 29 Oct 2007) | 6 lines

Fix issue with ast_unescape_semicolon going into an endless loop.
(closes issue #10550)
Reported by: ramonpeek
Patches:
      unescape-85177-1.patch uploaded by IgorG (license 20)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@87295 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-29 14:29:18 +00:00
Jason Parker ebe4050128 Switch from AST_CLI (formerly NEW_CLI) to AST_CLI_DEFINE, since the former didn't make much sense
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86820 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-22 20:05:18 +00:00
Jason Parker b0f3e6097e Convert NEW_CLI to AST_CLI.
Closes issue #11039, as suggested by seanbright.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86536 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-19 18:29:40 +00:00
Russell Bryant ac4d66cc73 Merged revisions 86237 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r86237 | russell | 2007-10-17 23:40:52 -0500 (Wed, 17 Oct 2007) | 9 lines

Revert a change that I made for issue #10979 which, as has been pointed out to
me in issue #11018, doesn't really make sense.  There is no reason to have
the base64 decode function force a '\0' terminated buffer, when the result is
almost always binary, anyway.  In fact, this caused some breakage, as some code
in res_crypto passed in a buffer exactly the right size to get its binary
result, which got stomped on by this patch.

(closes issue #11018, reported by dimas)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86238 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-18 04:41:33 +00:00
Russell Bryant 4c1b8cb9fa Merged revisions 85649 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r85649 | russell | 2007-10-15 14:22:45 -0500 (Mon, 15 Oct 2007) | 2 lines

Be pedantic about handling memory allocation failure.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@85650 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-15 19:25:56 +00:00
Russell Bryant ac9a6dce25 Merged revisions 85647 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r85647 | russell | 2007-10-15 14:11:38 -0500 (Mon, 15 Oct 2007) | 5 lines

The loop in the handler for the "core show locks" could potentially block for
some amount of time.  Be a little bit more careful and prepare all of the
output in an intermediary buffer while holding a global resource.  Then, after
releasing it, send the output to ast_cli().

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@85648 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-15 19:19:01 +00:00
Russell Bryant 42b2f932d2 Merged revisions 85543 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r85543 | russell | 2007-10-15 07:48:10 -0500 (Mon, 15 Oct 2007) | 8 lines

Make sure that the base64 decoder returns a terminated string.

(closes issue #10979)
Reported by: ys
Patches: 
      util.c.diff uploaded by ys (license 281)
	    - small mods by me

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@85544 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-15 12:49:31 +00:00
Tilghman Lesher e9221b062e Merged revisions 85158 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r85158 | tilghman | 2007-10-09 16:55:06 -0500 (Tue, 09 Oct 2007) | 5 lines

This commit fixes the following issues:
- Deadlock in ast_write (issue #10406)
- Deadlock in ast_read (issue #10406)
- Possible mutex initialization error in lock.h (issue #10571)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@85176 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-09 22:21:49 +00:00
Russell Bryant 9334e72e76 Merged revisions 84271 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r84271 | russell | 2007-10-01 16:07:06 -0500 (Mon, 01 Oct 2007) | 4 lines

Fulfull a feature request from Qwell on the "core show locks" output.  It will
now note the lock type for each lock that a thread holds.
(mutex, rdlock, or wrlock)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@84272 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-01 21:15:57 +00:00
Jason Parker 100e2387db Merged revisions 79904 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

(closes issue #10430)
........
r79904 | qwell | 2007-08-17 14:12:19 -0500 (Fri, 17 Aug 2007) | 11 lines

Don't send a semicolon over the wire in sip notify messages.
Caused by fix for issue 9938.

I basically took the code that existed before 9938 was fixed, and
 copied it into a new function - ast_unescape_semicolon

There should be very few places this will be needed (pbx_config
 does NOT need this (see issue 9938 for details))

Issue 10430, patch by me, with help/ideas from murf (thanks murf).

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79905 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-17 19:13:25 +00:00
Russell Bryant befb383d16 Merged revisions 78095 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r78095 | russell | 2007-08-03 14:39:49 -0500 (Fri, 03 Aug 2007) | 28 lines

Add some improvements to lock debugging.  These changes take effect
with DEBUG_THREADS enabled and provide the following:

 * This will keep track of which locks are held by which thread as well as
   which lock a thread is waiting for in a thread-local data structure.  A
   reference to this structure is available on the stack in the dummy_start()
   function, which is the common entry point for all threads.  This information
   can be easily retrieved using gdb if you switch to the dummy_start() stack
   frame of any thread and print the contents of the lock_info variable.

 * All of the thread-local structures for keeping track of this lock information
   are also stored in a list so that the information can be dumped to the CLI
   using the "core show locks" CLI command.  This introduces a little bit of a
   performance hit as it requires additional underlying locking operations
   inside of every lock/unlock on an ast_mutex.  However, the benefits of
   having this information available at the CLI is huge, especially considering
   this is only done in DEBUG_THREADS mode.  It means that in most cases where
   we debug deadlocks, we no longer have to request access to the machine to
   analyze the contents of ast_mutex_t structures.  We can now just ask them
   to get the output of "core show locks", which gives us all of the information
   we needed in most cases.

I also had to make some additional changes to astmm.c to make this work when
both MALLOC_DEBUG and DEBUG_THREADS are enabled.  I disabled tracking of one
of the locks in astmm.c because it gets used inside the replacement memory
allocation routines, and the lock tracking code allocates memory.  This caused
infinite recursion.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@78096 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-03 19:41:42 +00:00
Joshua Colp 28fec17d59 Merged revisions 77867 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r77867 | file | 2007-08-01 14:52:11 -0300 (Wed, 01 Aug 2007) | 2 lines

Whoops, I meant R_5 not R5.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77868 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-01 17:53:09 +00:00
Joshua Colp d51079b70a Merged revisions 77863 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r77863 | file | 2007-08-01 14:22:35 -0300 (Wed, 01 Aug 2007) | 2 lines

Extend autoconf logic to determine which version of gethostbyname_r is on the system.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-01 17:27:09 +00:00
Russell Bryant 3ed2deb7df Ensure that the read from /dev/urandom returns a positive result
(closes issue #10308, reported by yehavi, patched by me)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77268 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-26 13:20:36 +00:00
Joshua Colp 93b72115d1 Add support for using /dev/urandom to get random numbers on systems that support it.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@76296 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-21 14:39:52 +00:00
Tilghman Lesher 81bc1d7af5 Merge in ast_strftime branch, which changes timestamps to be accurate to the microsecond, instead of only to the second
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75706 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-18 19:47:20 +00:00
Tilghman Lesher a1bc823136 Issue 9990 - New API ast_mkdir, which creates parent directories as necessary (and is faster than an outcall to mkdir -p)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@71040 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-22 04:35:12 +00:00
Tilghman Lesher 9d05ff8ed5 Issue 9869 - replace malloc and memset with ast_calloc, and other coding guidelines changes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-06 21:20:11 +00:00
Russell Bryant 4b3a3fb14c Add a new API call for creating detached threads. Then, go replace all of the
places in the code where the same block of code for creating detached threads
was replicated.  (patch from bbryant)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@65968 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-05-24 18:30:19 +00:00
Joshua Colp 21b53af31d Cosmetic changes. Make main source files better conform to coding guidelines and standards. (issue #8679 reported by johann8384)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@51486 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-23 00:11:32 +00:00
Tilghman Lesher a48fdb83a5 Merged revisions 51195 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r51195 | tilghman | 2007-01-17 14:56:15 -0600 (Wed, 17 Jan 2007) | 12 lines

Merged revisions 51194 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r51194 | tilghman | 2007-01-17 14:52:21 -0600 (Wed, 17 Jan 2007) | 4 lines

When ast_strip_quoted was called with a zero-length string, it would treat a
NULL as if it were the quoting character (and would thus return the string
in memory immediately following the passed-in string).

........

................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@51196 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-17 20:57:51 +00:00
Luigi Rizzo 2703a1a9df forgot this part...
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48520 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-16 11:23:07 +00:00
Luigi Rizzo 055abfe9d9 simplify the ast_dynamic_str_*.... routines by
renaming them to ast_str ... and putting the
struct ast_threadstorage pointer into the struct ast_str.

This makes the code a lot more readable.

At this point we can use these routines also to
replace ast_build_string().



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48510 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-15 23:10:42 +00:00
Luigi Rizzo 961754d4b1 move the dynamic string support in a better place i.e. string.h
While doing this, add a bit of documentation, and slightly
extend the functionality as follows:
 + a max_len of -1 means that we take whatever the current size
   is, and never try to extend the buffer;
 + add support for alloca()-ted dynamic strings, which is very
   useful for all cases where we do an ast_build_string() now.

Next step is to simplify the interface by using shorter names
(e.g. ast_str as a prefix) and removing the _thread variant
of the functions by saving the threadstorage reference into
the struct ast_str. This can be done by overloading the
'type' field.

Finally, I will do my best to remove the convoluted interface
that results from trying to support platforms without va_copy().



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48509 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-15 22:08:46 +00:00
Russell Bryant eaf98f31e8 Go ahead and make this write unconditional. Making it conditional is more work
in both the append and non-append modes.  Also, always truncating the partial
write makes the behavior of the function more consistent, where in any type of
write, no partial result is left in the buffer.

Thanks for the feedback, luigi


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48109 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-29 17:37:31 +00:00