summaryrefslogtreecommitdiff
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authorLuigi Rizzo <rizzo@icir.org>2007-11-14 13:18:40 +0000
committerLuigi Rizzo <rizzo@icir.org>2007-11-14 13:18:40 +0000
commit7f8ecd2cd39ac2299ec08deb4dc92839be5412d1 (patch)
tree01f0ca16e50b44357fb29bdb18793405a071da0f /channels/chan_sip.c
parentd3414c7552012dac078288cc73e813a17a99e94d (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: https://origsvn.digium.com/svn/asterisk/trunk@89268 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c15
1 files changed, 9 insertions, 6 deletions
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;