Commit Graph

30314 Commits

Author SHA1 Message Date
Jenkins2 8ae31f7126 Merge "vectors: Add new macro and a string vector definition." 2017-11-13 17:26:23 -06:00
Joshua Colp 52c1d05296 Merge "menuselect: Delete and ignore aclocal.m4." 2017-11-13 17:01:35 -06:00
Corey Farrell edd1016dd8 core: Use ast_alertpipe for Asterisk signal monitoring thread.
Reduce the signal monitoring thread file descriptor use from two to one
on systems that support eventfd.

Change-Id: Id4041a237d481ff699639e153ea6982fee14a462
2017-11-13 17:41:07 -05:00
Corey Farrell cdaaa14a5f core: Fix configuration of remote console socket path.
The remote console socket path is the combination of asterisk.conf
settings astrundir from [directories] and astctl from [files].
Unconditionally combine the two strings after processing all values
to ensure we end up with the correct socket path.

ASTERISK-27415

Change-Id: Ib1e2805d55d6b0955c6430a1a2a93acbf9b091e8
2017-11-13 17:20:27 -05:00
George Joseph f6ebd16bb8 bundled_pjproject: sip_parser: Fix return code in pjsip_find_msg
The default return code for pjsip_find_msg was PJ_SUCCESS so if
a Content-Length header wasn't found at all, pjsip_find_msg was
returning PJ_SUCCESS instead of PJSIP_EMISSINGHDR.

Also added the volatile keyword to a few variables that are used
both inside and outside the PJ_TRY/PJ_CATCH block.

Partial fix for ASTERISK_27408

Change-Id: If82ba9de921e3d57df9c68cf96ee45ccc1491f7a
2017-11-13 16:50:07 -05:00
Ben Ford 2e7f6cd31b bundled_pjproject: Update to 2.7.1
Update from 2.7 to 2.7.1 for bundled pjproject. Changed version
and removed patch files included in the update.

Change-Id: I55cea8e734b318c2df9daf86aa0802c559ec8357
2017-11-13 16:43:38 -05:00
Sean Bright ffccce76d9 sorcery: Add ast_sorcery_retrieve_by_prefix()
Some consumers of the sorcery API use ast_sorcery_retrieve_by_regex
only so that they can anchor the potential match as a prefix and not
because they truly need regular expressions.

Rather than using regular expressions for simple prefix lookups, add
a new operation - ast_sorcery_retrieve_by_prefix - that does them.

Change-Id: I56f4e20ba1154bd52281f995c27a429a854f6a79
2017-11-13 15:15:33 -05:00
Corey Farrell 14d60cee0c CLI: Create ast_cli_completion_vector.
This is a rewrite of ast_cli_completion_matches using a vector to build
the list.  The original function calls the vector version, NULL
terminates the vector and extracts the elements array.

One change in behavior the results are now sorted and deduplicated. This
will solve bugs where some duplicate checking was done before the list
was sorted.

Change-Id: Iede20c5b4d965fa5ec71fda136ce9425eeb69519
2017-11-13 13:37:59 -05:00
Corey Farrell 4930404715 vectors: Add new macro and a string vector definition.
* AST_VECTOR_STEAL_ELEMENTS - steal the array of elements for use
  with non-vector code.
* struct ast_vector_string - a vector of 'char *'.

Change-Id: I104d1b204be03fccf67e02a195596adcb5ab1e42
2017-11-13 13:37:50 -05:00
Joshua Colp 9eacd55c71 Merge "Build System: Disable parallel make in the root Makefile." 2017-11-13 07:47:38 -06:00
Jenkins2 939b484553 Merge "res_pjsip_pubsub: Ensure remote URI contains URI only." 2017-11-13 07:11:57 -06:00
Richard Mudgett 90bb0a3e10 core: Add cache_media_frames debugging option.
The media frame cache gets in the way of finding use after free errors of
media frames.  Tools like valgrind and MALLOC_DEBUG don't know when a
frame is released because it gets put into the cache instead of being
freed.

* Added the "cache_media_frames" option to asterisk.conf.  Disabling the
option helps track down media frame mismanagement when using valgrind or
MALLOC_DEBUG.  The cache gets in the way of determining if the frame is
used after free and who freed it.  NOTE: This option has no effect when
Asterisk is compiled with the LOW_MEMORY compile time option enabled
because the cache code does not exist.

To disable the media frame cache simply disable the cache_media_frames
option in asterisk.conf and restart Asterisk.

Sample asterisk.conf setting:
[options]
cache_media_frames=no

ASTERISK-27413

Change-Id: I0ab2ce0f4547cccf2eb214901835c2d951b78c00
2017-11-11 14:46:15 -05:00
Richard Mudgett b865d29f1c frame.c: Make ast_frame_free()/ast_frfree() NULL tolerant
Change-Id: Ic49d821ef88ada38a31bdd835b9531443c55d793
2017-11-11 14:04:55 -05:00
Corey Farrell 96987737b9 menuselect: Delete and ignore aclocal.m4.
This file is temporary output from the bootstrap.sh command, it does not
need to be committed.

Change-Id: Ie0fd113aff6eac44924c0bd0c900833c6c86a6d9
2017-11-10 23:04:53 -05:00
Corey Farrell e9f8b317c3 Build: Make function constructor/destructor attributes mandatory.
This change causes the configure script to fail if the C compiler does
not support both function attributes constructor and destructor.  These
were already required as modules cannot function without these attributes
and Asterisk requires modules.

This also has AST_GCC_ATTRIBUTE set a variable
ax_cv_have_func_attribute_$1.  This is the same variable name used by
autoconf-archive's AX_GCC_FUNC_ATTRIBUTE, used for the same purpose.

Change-Id: Id68e8a1447f2a6d707c54b56350e7bfdb33fb663
2017-11-10 13:32:06 -05:00
Joshua Colp 6f1910d6ec Merge "core: Remove disabled code." 2017-11-10 08:00:32 -06:00
Joshua Colp 0bcb3a0201 Merge "chan_pjsip.c: Fix uninitialized cause value on failure." 2017-11-10 08:00:12 -06:00
Joshua Colp 96f2ee865e pjsip: Add patch to allow all transports to be destroyed.
If a transport is created with the same transport type, source
IP address, and source port as one that already exists the old
transport is moved into a linked list called "tp_list".

If this old transport is later shutdown it will not be destroyed
as the process checks whether the transport is valid or not. This
check does not look at the "tp_list" when making the determination
causing the transport to not be destroyed.

This change updates the logic to query not just the main storage
method for transports but also the "tp_list".

Upstream issue https://trac.pjsip.org/repos/ticket/2061

ASTERISK-27411

Change-Id: Ic5c2bb60226df0ef1c8851359ed8d4cd64469429
2017-11-10 08:14:51 -05:00
Corey Farrell bb77666620 core: Remove disabled code.
handle_quit has been disabled since 2003, remove it.

Change-Id: Idc3aaa6c81676160547078f9b71e8aa43de2db18
2017-11-09 21:34:32 -05:00
Joshua Colp 15d3c5f316 Merge "stasis_bridges.c: Fix off-nominal json memory leaks." 2017-11-09 18:05:09 -06:00
Corey Farrell 23b0ef3e9b Build System: Disable parallel make in the root Makefile.
This ensures that the root Makefile runs only a single target at a time.
SUBMAKE will still honor requested parallelism, so 'make -j8' will build
one directory at a time but allow 8 jobs at once when building a sub
directory.

This will fix some display glitches related to rebuild of XML
documentation.  It will also prevent some edge case errors where
bundled pjproject needs to be rebuild before other parts of Asterisk.

Change-Id: I4f2ec6fbbec1ada0ccb1109a28ea303524239b1e
2017-11-09 14:30:06 -05:00
Kevin Harwell 5f5c3cfa6f Merge "res_pjsip_registrar.c: Fix AOR and pjproject group deadlock." 2017-11-09 11:48:34 -06:00
Richard Mudgett 12010fc5c0 chan_pjsip.c: Fix uninitialized cause value on failure.
Change-Id: I3f9dd3c31bd582e54a30381500077de2319d8cc3
2017-11-09 08:42:34 -05:00
Joshua Colp f4d37e0d03 Merge "res_pjsip_pubsub: Fix multiple leaks on failure to append vectors." 2017-11-09 03:44:56 -06:00
Joshua Colp fa684ffb22 Merge "res_pjsip_history: Fix multiple leaks on vector append failure." 2017-11-09 03:44:37 -06:00
Joshua Colp d83d96dba6 Merge "res_pjsip_session: Fix multiple leaks." 2017-11-09 03:43:58 -06:00
Joshua Colp c32710386e Merge "main/sdp_state: Check for errors from ast_stream_topology_set_stream." 2017-11-09 03:43:35 -06:00
Joshua Colp 47d4848358 Merge "bridge_softmix: Note why ast_stream_topology_set_stream cannot fail." 2017-11-09 03:42:51 -06:00
Joshua Colp fe23c48081 Merge "res_pjsip_session: Check for errors from ast_stream_topology_set_stream." 2017-11-09 03:42:34 -06:00
Joshua Colp 65ced11206 Merge "res_pjsip_t38: Better error checking for t38_create_media_state." 2017-11-08 13:11:27 -06:00
Corey Farrell 0bda39c668 DEBUG_FD_LEAKS: Add missing FD creators.
This adds FD tracking for the following functions:
* eventfd
* timerfd_create
* socketpair
* accept

ASTERISK-27404

Change-Id: Id6848fe904ade2d34eb39d2a20bd6b223e1111fc
2017-11-08 13:57:45 -05:00
Corey Farrell 05f557820b bridge_softmix: Note why ast_stream_topology_set_stream cannot fail.
This appeared in my audit of ast_stream_topology_set_stream callers
not checking for errors but in this situation the call cannot fail.
Add comment so this can be ignored in the future.

Change-Id: I91d25704859efbe50b8b82cfe1cd3c40ba177c9f
2017-11-08 11:14:13 -05:00
George Joseph 38669ac57a Merge "AST-2017-009: pjproject: Add validation of numeric header values" 2017-11-08 09:52:47 -06:00
George Joseph 9c024497e9 Merge "AST-2017-011 - res_pjsip_session: session leak when a call is rejected" 2017-11-08 09:45:24 -06:00
George Joseph 9e69c78d6f Merge "AST-2017-010: Fix cdr_object_update_party_b_userfield_cb() buf overrun" 2017-11-08 08:25:54 -06:00
Joshua Colp 698ff5b4cb Merge "res_pjproject.c: Fix ast_strdup() alloc failure." 2017-11-08 07:38:45 -06:00
Kevin Harwell dd1a914495 AST-2017-011 - res_pjsip_session: session leak when a call is rejected
A previous commit made it so when an invite session transitioned into a
disconnected state destruction of the Asterisk pjsip session object was
postponed until either a transport error occurred or the event timer
expired. However, if a call was rejected (for instance a 488) before the
session was fully established the event timer may not have been initiated,
or it was canceled without triggering either of the session finalizing states
mentioned above.

Really the only time destruction of the session should be delayed is when a
BYE is being transacted. This is because it's possible in some cases for the
session to be disconnected, but the BYE is still transacting.

This patch makes it so the session object always gets released (no more
memory leak) when the pjsip session is in a disconnected state. Except when
the method is a BYE. Then it waits until a transport error occurs or an event
timeout.

ASTERISK-27345 #close

Reported by: Corey Farrell

Change-Id: I1e724737b758c20ac76d19d3611e3d2876ae10ed
2017-11-08 05:49:59 -07:00
Richard Mudgett b358e441cd AST-2017-010: Fix cdr_object_update_party_b_userfield_cb() buf overrun
cdr_object_update_party_b_userfield_cb() could overrun the fixed buffer if
the supplied string is too long.  The long string could be supplied by
external means using the CDR(userfield) function.

This may seem reminiscent to AST-2017-001 (ASTERISK_26897) and it is.  The
earlier patch fixed the buffer overrun for Party A's userfield while this
patch fixes the same thing for Party B's userfield.

ASTERISK-27337

Change-Id: I0fa767f65ecec7e676ca465306ff9e0edbf3b652
2017-11-08 05:41:12 -07:00
George Joseph 74432f51f9 AST-2017-009: pjproject: Add validation of numeric header values
Parsing the numeric header fields like cseq, ttl, port, etc. all
had the potential to overflow, either causing unintended values to
be captured or, if the values were subsequently converted back to
strings, a buffer overrun.  To address this, new "strto" functions
have been created that do range checking and those functions are
used wherever possible in the parser.

 * Created pjlib/include/limits.h and pjlib/include/compat/limits.h
   to either include the system limits.h or define common numeric
   limits if there is no system limits.h.

 * Created strto*_validate functions in sip_parser that take bounds
   and on failure call the on_str_parse_error function which prints
   an error message and calls PJ_THROW.

 * Updated sip_parser to validate the numeric fields.

 * Fixed an issue in sip_transport that prevented error messages
   from being properly displayed.

 * Added "volatile" to some variables referenced in PJ_CATCH blocks
   as the optimizer was sometimes optimizing them away.

 * Fixed length calculation in sip_transaction/create_tsx_key_2543
   to account for signed ints being 11 characters, not 9.

ASTERISK-27319
Reported by: Youngsung Kim at LINE Corporation

Change-Id: I48de2e4ccf196990906304e8d7061f4ffdd772ff
2017-11-08 05:26:54 -07:00
Jenkins2 b7f64c30e2 Merge "stream: Return error from ast_stream_topology_set_stream." 2017-11-08 06:06:51 -06:00
Joshua Colp d91d0e992d Merge "res_stasis: Fix multiple leaks." 2017-11-08 04:58:12 -06:00
Corey Farrell 2c4db2a3d5 res_pjsip_pubsub: Fix multiple leaks on failure to append vectors.
Change-Id: I68ece0073ea79667ca41eb10405f516f1d30d482
2017-11-07 22:38:16 -05:00
Corey Farrell 48e96aba6a res_pjsip_history: Fix multiple leaks on vector append failure.
Change-Id: I41e8d5183ace284095cc721f3b1fb32ade3f940f
2017-11-07 22:31:12 -05:00
Corey Farrell ecb81ae4de res_pjsip_session: Fix multiple leaks.
* Pre-initialize cloned media state vectors to final size to ensure
  vector errors cannot happen later in the clone initialization.
* Release session_media on vector replace failure in
  ast_sip_session_media_state_add.
* Release clone and media_state in ast_sip_session_refresh if we fail to
  append to the stream topology, return an error.

Change-Id: Ib5ffc9b198683fa7e9bf166d74d30c1334c23acb
2017-11-07 22:23:59 -05:00
Jenkins2 0129e396b2 Merge "res_pjsip_outbound_registration: Fix leak on vector add failure." 2017-11-07 20:39:31 -06:00
Jenkins2 ca5bffb305 Merge "res_pjsip_exten_state: Check for vector append failure." 2017-11-07 20:06:27 -06:00
Jenkins2 ebd9e5c8c3 Merge "res_pjsip_config_wizard: Fix leaks and add check for malloc failure." 2017-11-07 19:41:46 -06:00
Jenkins2 13ffdfd96a Merge "res_stasis_playback: Check for failure to append vector." 2017-11-07 19:02:20 -06:00
Jenkins2 d6213397f0 Merge "res_pjsip: Fix leak on error in ast_sip_auth_vector_init." 2017-11-07 18:14:28 -06:00
Jenkins2 250d905fc3 Merge "test_sorcery_memory_cache_thrash: Handle error from vector append." 2017-11-07 17:32:48 -06:00