aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-03-11 22:55:16 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-03-11 22:55:16 +0000
commitdbcca86ee13fa87cea506b68ee7834bd242ea960 (patch)
tree044b5e038aebbcadb348b2b79dc47b6fea73339e /res
parentd2d92188c2395ba71f173cd9fcb00eaf57489778 (diff)
An offhand comment from Russell made me realize that the configuration file
caching would not work properly for users.conf and any other file read from more than one place. I needed to add the filename which requested the config file to get it to work properly. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@107791 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/res_config_curl.c4
-rw-r--r--res/res_config_ldap.c4
-rw-r--r--res/res_config_odbc.c4
-rw-r--r--res/res_config_pgsql.c4
-rw-r--r--res/res_config_sqlite.c8
5 files changed, 13 insertions, 11 deletions
diff --git a/res/res_config_curl.c b/res/res_config_curl.c
index 7556a7066..f36a5f6a9 100644
--- a/res/res_config_curl.c
+++ b/res/res_config_curl.c
@@ -407,7 +407,7 @@ static int destroy_curl(const char *url, const char *unused, const char *keyfiel
}
-static struct ast_config *config_curl(const char *url, const char *unused, const char *file, struct ast_config *cfg, struct ast_flags flags, const char *sugg_incl)
+static struct ast_config *config_curl(const char *url, const char *unused, const char *file, struct ast_config *cfg, struct ast_flags flags, const char *sugg_incl, const char *who_asked)
{
struct ast_str *query;
char buf1[200];
@@ -463,7 +463,7 @@ static struct ast_config *config_curl(const char *url, const char *unused, const
}
if (!strcmp(var_name, "#include")) {
- if (!ast_config_internal_load(var_val, cfg, loader_flags, ""))
+ if (!ast_config_internal_load(var_val, cfg, loader_flags, "", who_asked))
return NULL;
}
diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c
index 56f95ac01..b76ad8ae7 100644
--- a/res/res_config_ldap.c
+++ b/res/res_config_ldap.c
@@ -1006,7 +1006,7 @@ static int compare_categories(const void *a, const void *b)
* called on a reload
*/
static struct ast_config *config_ldap(const char *basedn, const char *table_name,
- const char *file, struct ast_config *cfg, struct ast_flags config_flags, const char *sugg_incl)
+ const char *file, struct ast_config *cfg, struct ast_flags config_flags, const char *sugg_incl, const char *who_asked)
{
unsigned int vars_count = 0;
struct ast_variable **vars;
@@ -1088,7 +1088,7 @@ static struct ast_config *config_ldap(const char *basedn, const char *table_name
for (i = 0; i < vars_count; i++) {
if (!strcmp(categories[i].variable_name, "#include")) {
struct ast_flags config_flags = { 0 };
- if (!ast_config_internal_load(categories[i].variable_value, cfg, config_flags, ""))
+ if (!ast_config_internal_load(categories[i].variable_value, cfg, config_flags, "", who_asked))
break;
continue;
}
diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c
index 57b1ba528..8a28ddec8 100644
--- a/res/res_config_odbc.c
+++ b/res/res_config_odbc.c
@@ -625,7 +625,7 @@ static SQLHSTMT config_odbc_prepare(struct odbc_obj *obj, void *data)
return sth;
}
-static struct ast_config *config_odbc(const char *database, const char *table, const char *file, struct ast_config *cfg, struct ast_flags flags, const char *sugg_incl)
+static struct ast_config *config_odbc(const char *database, const char *table, const char *file, struct ast_config *cfg, struct ast_flags flags, const char *sugg_incl, const char *who_asked)
{
struct ast_variable *new_v;
struct ast_category *cur_cat;
@@ -682,7 +682,7 @@ static struct ast_config *config_odbc(const char *database, const char *table, c
while ((res = SQLFetch(stmt)) != SQL_NO_DATA) {
if (!strcmp (q.var_name, "#include")) {
- if (!ast_config_internal_load(q.var_val, cfg, loader_flags, "")) {
+ if (!ast_config_internal_load(q.var_val, cfg, loader_flags, "", who_asked)) {
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
ast_odbc_release_obj(obj);
return NULL;
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index e0511bbc6..04e4f1409 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -658,7 +658,7 @@ static int destroy_pgsql(const char *database, const char *table, const char *ke
static struct ast_config *config_pgsql(const char *database, const char *table,
const char *file, struct ast_config *cfg,
- struct ast_flags flags, const char *suggested_incl)
+ struct ast_flags flags, const char *suggested_incl, const char *who_asked)
{
PGresult *result = NULL;
long num_rows;
@@ -723,7 +723,7 @@ static struct ast_config *config_pgsql(const char *database, const char *table,
char *field_var_val = PQgetvalue(result, rowIndex, 2);
char *field_cat_metric = PQgetvalue(result, rowIndex, 3);
if (!strcmp(field_var_name, "#include")) {
- if (!ast_config_internal_load(field_var_val, cfg, flags, "")) {
+ if (!ast_config_internal_load(field_var_val, cfg, flags, "", who_asked)) {
PQclear(result);
ast_mutex_unlock(&pgsql_lock);
return NULL;
diff --git a/res/res_config_sqlite.c b/res/res_config_sqlite.c
index fb22009b2..7eea32af8 100644
--- a/res/res_config_sqlite.c
+++ b/res/res_config_sqlite.c
@@ -178,6 +178,7 @@ struct cfg_entry_args {
struct ast_category *cat;
char *cat_name;
struct ast_flags flags;
+ const char *who_asked;
};
/*!
@@ -277,7 +278,7 @@ static int add_cfg_entry(void *arg, int argc, char **argv, char **columnNames);
* \see add_cfg_entry()
*/
static struct ast_config * config_handler(const char *database, const char *table, const char *file,
- struct ast_config *cfg, struct ast_flags flags, const char *suggested_incl);
+ struct ast_config *cfg, struct ast_flags flags, const char *suggested_incl, const char *who_asked);
/*!
* \brief Helper function to parse a va_list object into 2 dynamic arrays of
@@ -710,7 +711,7 @@ static int add_cfg_entry(void *arg, int argc, char **argv, char **columnNames)
char *val;
val = argv[RES_CONFIG_SQLITE_CONFIG_VAR_VAL];
- cfg = ast_config_internal_load(val, args->cfg, args->flags, "");
+ cfg = ast_config_internal_load(val, args->cfg, args->flags, "", args->who_asked);
if (!cfg) {
ast_log(LOG_WARNING, "Unable to include %s\n", val);
@@ -753,7 +754,7 @@ static int add_cfg_entry(void *arg, int argc, char **argv, char **columnNames)
}
static struct ast_config *config_handler(const char *database, const char *table, const char *file,
- struct ast_config *cfg, struct ast_flags flags, const char *suggested_incl)
+ struct ast_config *cfg, struct ast_flags flags, const char *suggested_incl, const char *who_asked)
{
struct cfg_entry_args args;
char *query, *errormsg;
@@ -779,6 +780,7 @@ static struct ast_config *config_handler(const char *database, const char *table
args.cat = NULL;
args.cat_name = NULL;
args.flags = flags;
+ args.who_asked = who_asked;
ast_mutex_lock(&mutex);