Commit Graph

123 Commits

Author SHA1 Message Date
Sean Bright 3b806a3303 extconfig: Allow explicit DB result set ordering to be disabled.
Added a new boolean configuration flag -
`order_multi_row_results_by_initial_column` - to both res_pgsql.conf
and res_config_odbc.conf that allows the administrator to disable the
explicit `ORDER BY` that was previously being added to all generated
SQL statements that returned multiple rows.

Fixes: #179
2023-08-14 17:20:09 +00:00
George Joseph 4aa541683b GCC12: Fixes for 16+
Most issues were in stringfields and had to do with comparing
a pointer to an constant/interned string with NULL.  Since the
string was a constant, a pointer to it could never be NULL so
the comparison was always "true".  gcc now complains about that.

There were also a few issues where determining if there was
enough space for a memcpy or s(n)printf which were fixed
by defining some of the involved variables as "volatile".

There were also a few other miscellaneous fixes.

ASTERISK-30044

Change-Id: Ia081ca1bcfb329df6487c4660aaf1944309eb570
2022-05-09 08:21:45 -05:00
Boris P. Korzun 636d43caa3 res_config_pgsql: Add text-type column check in require_pgsql()
Omit "unsupported column type 'text'" warning in logs while
using text-type column in the PgSQL backend.

ASTERISK-29924 #close

Change-Id: I48061a7d469426859670db07f1ed8af1eb814712
2022-03-14 09:06:08 -05:00
Josh Soref 9ae9893c63 res: Spelling fixes
Correct typos of the following word families:

identifying
structures
actcount
initializer
attributes
statement
enough
locking
declaration
userevent
provides
unregister
session
execute
searches
verification
suppressed
prepared
passwords
recipients
event
because
brief
unidentified
redundancy
character
the
module
reload
operation
backslashes
accurate
incorrect
collision
initializing
instance
interpreted
buddies
omitted
manually
requires
queries
generator
scheduler
configuration has
owner
resource
performed
masquerade
apparently
routable

ASTERISK-29714

Change-Id: I88485116d2c59b776aa2e1f8b4ce8239a21decda
2021-11-15 16:37:34 -06:00
Boris P. Korzun b046e960af res_config_pgsql: Limit realtime_pgsql() to return one (no more) record.
Added a SELECT 'LIMIT' clause to realtime_pgsql() and refactored the function.

ASTERISK-29293 #close

Change-Id: If5a6d4b1072ea2e6e89059b21139d554a74b34f5
2021-02-25 07:59:02 -06:00
Christoph Moench-Tegeder 52ade18420 cdr_pgsql cel_pgsql res_config_pgsql: compatibility with PostgreSQL 12
PostgreSQL 12 finally removed column adsrc from table pg_catalog.pg_attrdef
(column default values), which has been deprecated since version 8.0.
Since then, the official/correct/supported way to retrieve the column
default value from the catalog is function pg_catalog.pg_get_expr().

This change breaks compatibility with pre-8.0 PostgreSQL servers,
but has reached end-of-support more than a decade ago.
cdr_pgsql and res_config_pgsql still have support for pre-7.3
servers, but cleaning that up is perhaps a topic for a major release,
not this bugfix.

ASTERISK-28571

Change-Id: I834cb3addf1937e19e87ede140bdd16cea531ebe
2019-10-14 05:08:02 -05:00
Corey Farrell 572a508ef2 loader: Convert reload_classes to built-in modules.
* acl (named_acl.c)
* cdr
* cel
* ccss
* dnsmgr
* dsp
* enum
* extconfig (config.c)
* features
* http
* indications
* logger
* manager
* plc
* sounds
* udptl

These modules are now loaded at appropriate time by the module loader.
Unlike loadable modules these use AST_MODULE_LOAD_FAILURE on error so
the module loader will abort startup on failure of these modules.

Some of these modules are still initialized or shutdown from outside the
module loader.  logger.c is initialized very early and shutdown very
late, manager.c is initialized by the module loader but is shutdown by
the Asterisk core (too much uses it without holding references).

Change-Id: I371a9a45064f20026c492623ea8062d02a1ab97f
2018-03-14 05:20:12 -04:00
Corey Farrell c8a521b6c8 Replace direct checks of option_debug with DEBUG_ATLEAST macro.
Checking option_debug directly is incorrect as it ignores file/module
specific debug settings.  This system-wide change replaces nearly all
direct checks for option_debug with the DEBUG_ATLEAST macro.

Change-Id: Ic342d4799a945dbc40ac085ac142681094a4ebf0
2018-03-07 16:03:01 -06:00
Alexander Traud eb9b85baec res_config_pgsql: Avoid typecasting an int to unsigned char.
clang 5.0 warned about this.

ASTERISK-27576

Change-Id: If41f400a51973c06cdb9b75462e535b616bfe385
2018-01-12 16:24:17 +01:00
Joshua Colp 8b7aed0025 Merge "res_config_pgsql: Fix removed support to previous for versions PostgreSQL 9.1" 2017-09-22 05:42:43 -05:00
Jenkins2 f01cd0b409 Merge "res_config_pgsql: Add missing \n in debug log and update copyright year" 2017-09-21 13:06:18 -05:00
Rodrigo Ramírez Norambuena cad68137a7 res_config_pgsql: Fix removed support to previous for versions PostgreSQL 9.1
In PostgreSQL 9.1 the backslash are string literals and not the escape
of characters.

In previous issue ASTERISK_26057 was fixed the use of escape LIKE but the
support for old version of Postgresql than 9.1 was dropped. The sentence
before make was "ESCAPE '\'" but in version before than 9.1  need it to be
as follow "ESCAPE '\\'".

ASTERISK-27283

Change-Id: I96d9ee1ed7693ab17503cb36a9cd72847165f949
2017-09-21 06:52:41 -05:00
Rodrigo Ramírez Norambuena 56f0d5fc0f res_config_pgsql: Add missing \n in debug log and update copyright year
Change-Id: I4ba338ecbdecc6a814a902eddc4121c8ef3cda58
2017-09-19 08:34:28 -03:00
Corey Farrell 58d032112b Fix compiler warnings on Fedora 26 / GCC 7.
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-08-01 15:42:38 -06:00
Sean Bright 1dacf317f3 res_config_pgsql: Make 'require' return consistent with other backends
res_config_pgsql should match the behavior of other realtime backend
drivers so that queue_log can disable adaptive logging.

ASTERISK-25628 #close
Reported by: Dmitry Wagin

Change-Id: Ic1fb1600c7ce10fdfb1bcdc43c5576b7e0014372
2017-03-01 07:27:50 -06:00
Sean Bright e5b44c26b4 res_config_pgsql: Release table locks where appropriate
The find_table() functions NULL or a locked table pointer. We are
not consistently calling release_table() in failure paths.

Change-Id: I6f665b455799c84b036e5b34904b82b05eab9544
2017-02-28 09:44:09 -06:00
Sean Bright 0f4b349d37 res_config_pgsql: Fix thread safety problems
* A missing AST_LIST_UNLOCK() in find_table()

* The ESCAPE_STRING() macro uses pgsqlConn under the hood and we were
  not consistently locking before calling it.

* There were a handful of other places where pgsqlConn was accessed
  directly without appropriate locking.

Change-Id: Iea63f0728f76985a01e95b9912c3c5c6065836ed
2017-02-23 14:56:53 -06:00
Sean Bright 6e6c96d713 realtime: Centralize some common realtime backend code
All of the realtime backends create artificial ast_categorys to pass
back into the core as query results. These categories have no filename
or line number information associated with them and the backends differ
slightly on how they create them. So create a couple helper macros to
help make things more consistent.

Also updated the call sites to remove redundant error messages about
memory allocation failure.

Note that res_config_ldap sets the category filename to the 'table name'
but that is not read by anything in the core, so I've dropped it.

Change-Id: I3a1fd91e0c807dea1ce3b643b0a6fe5be9002897
2017-02-21 10:53:17 -06:00
Sean Bright e93f2a5142 realtime: Fix LIKE escaping in SQL backends
The realtime framework allows for components to look up values using a
LIKE clause with similar syntax to SQL's. pbx_realtime uses this
functionality to search for pattern matching extensions that start with
an underscore (_).

When passing an underscore to SQL's LIKE clause, it will be interpreted
as a wildcard matching a single character and therefore needs to be
escaped. It is (for better or for worse) the responsibility of the
component that is querying realtime to escape it with a backslash before
passing it in. Some RDBMs support escape characters by default, but the
SQL92 standard explicitly says that there are no escape characters
unless they are specified with an ESCAPE clause, e.g.

	SELECT * FROM table WHERE column LIKE '\_%' ESCAPE '\'

This patch instructs 3 backends - res_config_mysql, res_config_pgsql,
and res_config_sqlite3 - to use the ESCAPE clause where appropriate.

Looking through documentation and source tarballs, I was able to
determine that the ESCAPE clause is supported in:

MySQL 5.0.15   (released 2005-10-22 - earliest version available from
                archives)
PostgreSQL 7.1 (released 2001-04-13)
SQLite 3.1.0   (released 2005-01-21)

The versions of the relevant libraries that we depend on to access MySQL
and PostgreSQL will not work on versions that old, and I've added an
explicit check in res_config_sqlite3 to only use the ESCAPE clause when
we have a sufficiently new version of SQLite3.

res_config_odbc already handles the escape characters appropriately, so
no changes were required there.

ASTERISK-15858 #close
Reported by: Humberto Figuera

ASTERISK-26057 #close
Reported by: Stepan

Change-Id: I93117fbb874189ae819f4a31222df7c82cd20efa
2017-02-16 12:59:50 -06:00
Corey Farrell a6e5bae3ef Remove ASTERISK_REGISTER_FILE.
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-27 09:53:55 -04:00
Rodrigo Ramírez Norambuena 0ec9fe5421 main/cli.c: Refactor function to print seconds formatted
Refactor and created function ast_cli_print_timestr_fromseconds to print
seconds formatted:  year(s) week(s) day(s) hour(s) second(s)

This function now is used in addons/cdr_mysql.c,cdr_pgsql.c, main/cli.c,
res_config_ldap.c, res_config_pgsql.c.

Change-Id: Ibeb8634102cd11d3f8623398b279cb731bcde36c
2016-03-07 03:42:18 -03:00
Rodrigo Ramírez Norambuena fd668670b5 res_config_pgsql: Show error message in reload if not connected.
Change-Id: I9290115a1aaadb589eb1d02eaeb502eec01b31fa
2016-02-10 14:41:09 -03:00
Rodrigo Ramírez Norambuena 72bf53eea5 res_config_pgsql: Add message on cli failed command status
In case failed of command "realtime show pgsql status" show a message the data
of connection to more clear information in error.

Change-Id: Ia8e9e2400466606e7118f52a46e05df0719b6a29
2016-02-07 17:08:43 -03:00
Richard Mudgett d799bcf361 res_config_pgsql.c: Fix deadlock loading realtime configuration.
On v13, loading several thousand PJSIP endpoints on Asterisk start causes
a deadlock most of the time.

Thanks to mdu113 for discovering that there was a call to pgsql_exec() not
protected by the pgsql_lock reentrancy lock.

{quote}
I believe a code path exists that attempts to use pgsql connection without
locking pgsql_lock.  I believe what happens during that deadlock that I
see is two concurrent threads are both attempting to send query to pgsql,
one of the thread is using a code path without locking pgsql_lock.  If
they managed to send queries at the same time, it seems postgres ignores
one of the queries and replies only to the one of them.  If it happens so
that the thread holding the lock didn't receive the reply it will wait for
it (and hold the lock) forever (or at least for very long time), thus
completely blocking all access to db.
{quote}

* Added missing reentrancy locking around pgsql_exec() in find_table().

* Moved unlock of pgsql_lock in unload_module() to avoid locking inversion
between the psql_tables list lock and the pgsql_lock.

ASTERISK-25455 #close
Reported by:  mdu113
Patches:
      res_config_pgsql.c-connlock2.diff (license #5543) patch uploaded by mdu113

Change-Id: Id9e7cdf8a3b65ff19964b0cf942ace567938c4e2
2015-10-14 14:18:56 -05:00
Rodrigo Ramírez Norambuena 95b186a174 res/res_config_pgsql.c: Use PQescapeStringConn for escaping names.
Use function PQescapeStringConn for escaping the name of the table and
schema instead of doing it manually.

ASTERISK-25132 #close
Reported By: Rodrigo Ramírez Norambuena <decipher.hk@gmail.com>

Change-Id: I302a263f7210d20925f14716b508b081998b7608
2015-05-26 16:48:27 -04:00
Rodrigo Ramírez Norambuena eec010829a AST_MODULE_INFO: Format corrections to the usages of AST_MODULE_INFO macro.
Change-Id: Icf88f9f861c6b2a16e5f626ff25795218a6f2723
2015-05-13 16:34:23 -05:00
Matt Jordan 4a58261694 git migration: Refactor the ASTERISK_FILE_VERSION macro
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-04-13 03:48:57 -04:00
Mark Michelson dcf1ad14da Add module support level to ast_module_info structure. Print it in CLI "module show" .
ASTERISK-23919 #close
Reported by Malcolm Davenport

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419592 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-25 16:47:17 +00:00
Matthew Jordan 03e9c598e5 cel_pgsql, cdr_pgsql, res_config_pgsql: Add PostgreSQL application_name support
This patch adds support for the PostgreSQL application_name connection setting.
When the appropriate PostgreSQL module's configuration is set with an
application name, the name will be passed to PostgreSQL on connection and
displayed in the database's pg_stat_activity view, as well as in CSV logs. This
aids in managing which applications/servers are connected to a PostgreSQL
database, as well as tracing the activity of those connections.

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

ASTERISK-23737 #close
Reported by: Gergely Domodi
patches:
  pgsql_application_name.patch uploaded by Gergely Domodi (License 6610)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418755 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-16 13:55:36 +00:00
Matthew Jordan fb5690ce4b Logger/CLI/etc.: Fix some aesthetic issues; reduce chatty verbose messages
This patch addresses some aesthetic issues in Asterisk. These are all just
minor tweaks to improve the look of the CLI when used in a variety of
settings. Specifically:
 * A number of chatty verbose messages were removed or demoted to DEBUG
   messages. Verbose messages with a verbosity level of 5 or higher were -
   if kept as verbose messages - demoted to level 4. Several messages
   that were emitted at verbose level 3 were demoted to 4, as announcement
   of dialplan applications being executed occur at level 3 (and so the
   effects of those applications should generally be less).
 * Some verbose messages that only appear when their respective 'debug'
   options are enabled were bumped up to always be displayed.
 * Prefix/timestamping of verbose messages were moved to the verboser
   handlers. This was done to prevent duplication of prefixes when the
   timestamp option (-T) is used with the CLI.
 * Verbose magic is removed from messages before being emitted to
   non-verboser handlers. This prevents the magic in multi-line verbose
   messages (such as SIP debug traces or the output of DumpChan) from
   being written to files.
 * _Slightly_ better support for the "light background" option (-W) was
   added. This includes using ast_term_quit in the output of XML
   documentation help, as well as changing the "Asterisk Ready" prompt to
   bright green on the default background (which stands a better chance of
   being displayed properly than bright white).

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414798 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-28 22:54:12 +00:00
Mark Michelson ff1658ed3b Return the number of rows affected by a SQL insert, rather than an object ID.
The realtime API specifies that the store callback is supposed to return the number
of rows affected. res_config_pgsql was instead returning an Oid cast as an int, which
during any nominal execution would be cast to 0. Returning 0 when more than 0 rows were
inserted causes problems to the function's callers.

To give an idea of how strange code can be, this is the necessary code change to fix
a device state issue reported against chan_pjsip in Asterisk 12+. The issue was that
the registrar would attempt to insert contacts into the database. Because of the 0
return from res_config_pgsql, the registrar would think that the contact was not successfully
inserted, even though it actually was. As such, even though the contact was query-able
and it was possible to call the endpoint, Asterisk would "think" the endpoint was unregistered,
meaning it would report the device state as UNAVAILABLE instead of NOT_INUSE.

The necessary fix applies to all versions of Asterisk, so even though the bug reported
only applies to Asterisk 12+, the code correction is being inserted into 1.8+.

Closes issue ASTERISK-23707
Reported by Mark Michelson
........

Merged revisions 413224 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 413225 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 413226 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413227 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-02 20:07:08 +00:00
Walter Doekes 72bf9b1315 res_config_pgsql: Fix ast_update2_realtime calls.
Fix so multiple updates from a single call works (add missing ',').
Remove bogus ast_free's that weren't supposed to be there.
Moved a few spaces for readability.

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

Merged revisions 407873 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 407874 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 407875 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407876 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-10 16:49:40 +00:00
Jonathan Rose b78d0c0187 res_config_pgsql: Fix a memory leak and use RAII_VAR for cleanup when practical
Review: https://reviewboard.asterisk.org/r/3141/
........

Merged revisions 406360 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 406361 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 406389 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406399 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-24 21:46:54 +00:00
David M. Lee dd87bea808 Minor fixups to Doxygen comments.
The \example tags marks an entire file as an example, not a code snippet.
........

Merged revisions 387823 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@387824 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-07 18:30:55 +00:00
Joshua Colp 02be50b1ac Add support for a realtime sorcery module.
This change does the following:

1. Adds the sorcery realtime module
2. Adds unit tests for the sorcery realtime module
3. Changes the realtime core to use an ast_variable list instead of variadic arguments
4. Changes all realtime drivers to accept an ast_variable list

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@386731 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-27 12:01:29 +00:00
Andrew Latham c7857504df Doxygen Updates - Title update
Update and extend the configuration_file group and enable linking to the resource.  Update title that was left behind many years ago.

(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375003 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-14 21:44:27 +00:00
Andrew Latham fd98835f1f Doxygen Updates Janitor Work
* Whitespace, doc-blocks, spelling, case, missing and incorrect tags.
* Add cleanup to Makefile for the Doxygen configuration update
* Start updating Doxygen configuration for cleaner output
* Enable inclusion of configuration files into documentation
* remove mantisworkflow...
* update documentation README
* Add markup to Tilghman's email and talk with him about updating his email, he knows...
* no code changes on this commit other than the mentioned Makefile change

(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373384 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-22 20:43:30 +00:00
Andrew Latham 6f61cb50c5 Doxygen Updates - janitor work
Doxygen updates including mistakes, misspellings, missing parameters, updates for Doxygen style.  Some missing txt file links are removed but their content or essense will be included in some later updates.  A majority of the txt files were removed in the 1.6 era but never noted. The HR and EXTREF are simple changes that make the documentation more compatable with more versions of Doxygen.

Further updates coming.

(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373330 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-21 17:14:59 +00:00
Kinsey Moore 9b16c8b0f6 Clean up and ensure proper usage of alloca()
This replaces all calls to alloca() with ast_alloca() which calls gcc's
__builtin_alloca() to avoid BSD semantics and removes all NULL checks
on memory allocated via ast_alloca() and ast_strdupa().

(closes issue ASTERISK-20125)
Review: https://reviewboard.asterisk.org/r/2032/
Patch-by: Walter Doekes (wdoekes)
........

Merged revisions 370642 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 370643 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370655 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-31 20:21:43 +00:00
Jonathan Rose f88a632d96 Make use of va_args more appropriate to form in various res_config modules plus utils.
A number of va_copy operations weren't matched with a corresponding va_end in res_config_odbc. Also, there was a potential for va_end to be invoked twice on the same va_arg in utils, which would mean invoking va_end on an undefined variable... which is bad.
va_end is removed from various functions in config_pgsql and config_curl since they aren't making their own copy.  The invokers of those functions are responsible for calling va_end on them.

(issue ASTERISK-19451)
Reported by: Walter Doekes
Review: https://reviewboard.asterisk.org/r/1848/
........

Merged revisions 362354 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 362357 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362363 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-17 21:10:50 +00:00
Richard Mudgett a955a4770f Fix reconnecting to pgsql database after connection loss.
There can only be one database connection in res_config_pgsql just like
res_config_sqlite.  If the connection is lost, the connection may not get
reestablished to the same database if the res_pgsql.conf and
extconfig.conf files are inconsistent.

* Made only use the configured database from res_pgsql.conf.

* Fixed potential buffer overwrite of last[] in config_pgsql().

(closes issue ASTERISK-16982)
Reported by: german aracil boned

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

Merged revisions 354953 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 354959 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354964 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-13 17:25:41 +00:00
Richard Mudgett bac5a51e21 Merged revisions 332830 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r332830 | rmudgett | 2011-08-22 13:32:09 -0500 (Mon, 22 Aug 2011) | 15 lines
  
  Merged revisions 332816 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r332816 | rmudgett | 2011-08-22 13:14:59 -0500 (Mon, 22 Aug 2011) | 8 lines
    
    Memory leaks in realtime_multi_xxx() when database access returns error.
    
    * Fix realtime_multi_pgsql() configuration memory leak when the database 
    access returns an error.  
    
    * Fix realtime_multi_odbc() configuration category use after free when the
    database access returns an error.
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@332831 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-08-22 18:33:27 +00:00
Leif Madsen a525edea59 Merged revisions 328247 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.10

................
  r328247 | lmadsen | 2011-07-14 16:25:31 -0400 (Thu, 14 Jul 2011) | 14 lines
  
  Merged revisions 328209 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r328209 | lmadsen | 2011-07-14 16:13:06 -0400 (Thu, 14 Jul 2011) | 6 lines
    
    Introduce <support_level> tags in MODULEINFO.
    This change introduces MODULEINFO into many modules in Asterisk in order to show
    the community support level for those modules. This is used by changes committed
    to menuselect by Russell Bryant recently (r917 in menuselect). More information about
    the support level types and what they mean is available on the wiki at
    https://wiki.asterisk.org/wiki/display/AST/Asterisk+Module+Support+States
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@328259 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-14 20:28:54 +00:00
Jonathan Rose 337515d25b Merged revisions 323610 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r323610 | jrose | 2011-06-15 11:09:24 -0500 (Wed, 15 Jun 2011) | 7 lines
  
  Adds PQclear calls on result to various parts of res_conf_pgsql
  
  (closes issue ASTERISK-17812)
  Reported by: byronclark
  Patches: 
        pgsql_pqclear.patch uploaded by byronclark (license 1200)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@323621 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-06-15 16:19:38 +00:00
Brett Bryant 475f4be06f Patch that fixes the "realtime show pgsql cache" command crash when giving a
table name, because of the use of an uninitialized variable. Fixes an error
introduced in r300882.

(closes issue #18605)
Reported by: romain_proformatique
Patches:
      res_config_pgsql_fix.patch uploaded by romain proformatique (license 975)
Tested by: romain_proformatique



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@304600 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-01-27 20:09:33 +00:00
Mark Murawki a7f9ce2e77 Added support for postgres database retry query on disconnection to res_config_pgsql
If your postgres connection died suddenly in between res_config_pgsql
queries, the next query will fail because the query is executed on a
disconnected/disconnecting handle.  The query is abandoned and is
returned from in error.

Now we will reconnect and try again if a query was run on a
disconnected connection.

(closes issue #18071)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@300882 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-01-07 07:47:36 +00:00
Tilghman Lesher af67f7621a Merged revisions 284473 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r284473 | tilghman | 2010-09-01 13:16:37 -0500 (Wed, 01 Sep 2010) | 12 lines
  
  Merged revisions 284472 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ........
    r284472 | tilghman | 2010-09-01 13:13:35 -0500 (Wed, 01 Sep 2010) | 5 lines
    
    Don't warn on floats and timestamps
    
    (closes issue #17082)
    Reported by: coolmig
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@284474 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-09-01 18:19:12 +00:00
Tilghman Lesher 82448ad7d2 Separate queue_log arguments into separate fields, and allow the text file to be used, even when realtime is used.
(closes issue #17082)
 Reported by: coolmig
 Patches: 
       20100720__issue17082.diff.txt uploaded by tilghman (license 14)
 Tested by: coolmig


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@278307 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-20 23:23:25 +00:00
Tilghman Lesher b4e18d5660 Add load priority order, such that preload becomes unnecessary in most cases
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@278132 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-20 19:35:02 +00:00
Tilghman Lesher a7c92fad28 Merged revisions 277568 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r277568 | tilghman | 2010-07-16 16:54:29 -0500 (Fri, 16 Jul 2010) | 8 lines
  
  Since we split values at the semicolon, we should store values with a semicolon as an encoded value.
  
  (closes issue #17369)
   Reported by: gkservice
   Patches: 
         20100625__issue17369.diff.txt uploaded by tilghman (license 14)
   Tested by: tilghman
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@277773 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-17 17:39:28 +00:00