aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-14 13:18:40 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-14 13:18:40 +0000
commitea0d4674a604b98a32c5f5b42f1878d3d75af9e0 (patch)
tree01f0ca16e50b44357fb29bdb18793405a071da0f /channels
parent2e70fd87205ec4f9c775075b807c65e3703145e3 (diff)
make the 'name' and 'value' fields in ast_variable const char *
This prevents modifying the strings in the stored variables, and catched a few instances where this was actually done. Given the differences between trunk and 1.4 (and the fact that this is effectively an API change) it is better to fix 1.4 independently. These are chan_sip.c::sip_register() chan_skinny.c:: near line 2847 config.c:: near line 1774 logger.c::make_components() res_adsi.c:: near line 1049 I may have missed some instances for modules that do not build here. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89268 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_agent.c2
-rw-r--r--channels/chan_iax2.c6
-rw-r--r--channels/chan_oss.c8
-rw-r--r--channels/chan_sip.c15
-rw-r--r--channels/chan_skinny.c6
5 files changed, 21 insertions, 16 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 342f46754..99462e78d 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -267,7 +267,7 @@ static const struct ast_channel_tech agent_tech = {
* @return The just created agent.
* \sa agent_pvt, agents.
*/
-static struct agent_pvt *add_agent(char *agent, int pending)
+static struct agent_pvt *add_agent(const char *agent, int pending)
{
char *parse;
AST_DECLARE_APP_ARGS(args,
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 0e3a8f78d..729b89db5 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -6287,7 +6287,7 @@ static int iax2_append_register(const char *hostname, const char *username,
return 0;
}
-static int iax2_register(char *value, int lineno)
+static int iax2_register(const char *value, int lineno)
{
char copy[256];
char *username, *hostname, *secret;
@@ -9592,7 +9592,7 @@ static int start_network_thread(void)
return 0;
}
-static struct iax2_context *build_context(char *context)
+static struct iax2_context *build_context(const char *context)
{
struct iax2_context *con;
@@ -9602,7 +9602,7 @@ static struct iax2_context *build_context(char *context)
return con;
}
-static int get_auth_methods(char *value)
+static int get_auth_methods(const char *value)
{
int methods = 0;
if (strstr(value, "rsa"))
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index 1caf1a378..7c2d60e27 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -212,7 +212,7 @@ END_CONFIG
* Likely we will come up with a better way of doing config file parsing.
*/
#define M_START(var, val) \
- char *__s = var; char *__val = val;
+ const char *__s = var; const char *__val = val;
#define M_END(x) x;
#define M_F(tag, f) if (!strcasecmp((__s), tag)) { f; } else
#define M_BOOL(tag, dst) M_F(tag, (dst) = ast_true(__val) )
@@ -1413,7 +1413,7 @@ static char *console_active(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
/*!
* \brief store the boost factor
*/
-static void store_boost(struct chan_oss_pvt *o, char *s)
+static void store_boost(struct chan_oss_pvt *o, const char *s)
{
double boost = 0;
if (sscanf(s, "%lf", &boost) != 1) {
@@ -1472,7 +1472,7 @@ static struct ast_cli_entry cli_oss[] = {
* invalid or dangerous values (the string is used as argument for
* system("mixer %s")
*/
-static void store_mixer(struct chan_oss_pvt *o, char *s)
+static void store_mixer(struct chan_oss_pvt *o, const char *s)
{
int i;
@@ -1491,7 +1491,7 @@ static void store_mixer(struct chan_oss_pvt *o, char *s)
/*!
* store the callerid components
*/
-static void store_callerid(struct chan_oss_pvt *o, char *s)
+static void store_callerid(struct chan_oss_pvt *o, const char *s)
{
ast_callerid_split(s, o->cid_name, sizeof(o->cid_name), o->cid_num, sizeof(o->cid_num));
}
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 4953de219..291c31c3c 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1572,7 +1572,7 @@ static int add_sip_domain(const char *domain, const enum domain_mode mode, const
static void clear_sip_domains(void);
/*--- SIP realm authentication */
-static struct sip_auth *add_realm_authentication(struct sip_auth *authlist, char *configuration, int lineno);
+static struct sip_auth *add_realm_authentication(struct sip_auth *authlist, const char *configuration, int lineno);
static int clear_realm_authentication(struct sip_auth *authlist); /* Clear realm authentication list (at reload) */
static struct sip_auth *find_realm_authentication(struct sip_auth *authlist, const char *realm);
@@ -1686,7 +1686,7 @@ static char *sip_prune_realtime(struct ast_cli_entry *e, int cmd, struct ast_cli
/*--- Internal UA client handling (outbound registrations) */
static void ast_sip_ouraddrfor(struct in_addr *them, struct sockaddr_in *us);
static void sip_registry_destroy(struct sip_registry *reg);
-static int sip_register(char *value, int lineno);
+static int sip_register(const char *value, int lineno);
static const char *regstate2str(enum sipregistrystate regstate) attribute_const;
static int sip_reregister(const void *data);
static int __sip_do_register(struct sip_registry *r);
@@ -5248,7 +5248,7 @@ static struct sip_pvt *find_call(struct sip_request *req, struct sockaddr_in *si
}
/*! \brief Parse register=> line in sip.conf and add to registry */
-static int sip_register(char *value, int lineno)
+static int sip_register(const char *value, int lineno)
{
struct sip_registry *reg;
int portnum = 0;
@@ -12545,8 +12545,11 @@ static char *sip_notify(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a
initreqprep(&req, p, SIP_NOTIFY);
- for (var = varlist; var; var = var->next)
- add_header(&req, var->name, ast_unescape_semicolon(var->value));
+ for (var = varlist; var; var = var->next) {
+ char buf[512];
+ ast_copy_string(buf, var->value, sizeof(buf));
+ add_header(&req, var->name, ast_unescape_semicolon(buf));
+ }
/* Recalculate our side, and recalculate Call ID */
ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip);
@@ -17236,7 +17239,7 @@ static void clear_sip_domains(void)
/*! \brief Add realm authentication in list */
-static struct sip_auth *add_realm_authentication(struct sip_auth *authlist, char *configuration, int lineno)
+static struct sip_auth *add_realm_authentication(struct sip_auth *authlist, const char *configuration, int lineno)
{
char authcopy[256];
char *username=NULL, *realm=NULL, *secret=NULL, *md5secret=NULL;
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 6808d32a4..fd1dcb412 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -2847,8 +2847,10 @@ static struct skinny_device *build_device(const char *cat, struct ast_variable *
if (!(sd = ast_calloc(1, sizeof(*sd)))) {
return NULL;
} else {
- char *stringp, *exten, *context, *label;
- stringp = v->value;
+ char buf[256];
+ char *stringp = buf, *exten, *context, *label;
+
+ ast_copy_string(buf, v->value, sizeof(buf));
exten = strsep(&stringp, ",");
if ((context = strchr(exten, '@'))) {
*context++ = '\0';