summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-12-30 23:28:38 +0100
committerAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-12-30 23:28:38 +0100
commit63bb32c8eaf92ca816ed91e638acb714fb155d6a (patch)
tree4f313e863441fdec8e43b65ddd85ce4142a48ddc
parenta1e912235a55232327dd1b708aca25195a73a1f7 (diff)
account: password in SIP uri is now deprecated
<sip:user:password@domain.com> ^^^^^^^^ deprecated please use the "auth_pass" parameter instead: <sip:user@domain.com>;auth_pass=xxx
-rw-r--r--src/account.c3
-rw-r--r--test/account.c6
-rw-r--r--test/sip/sipsrv.c2
-rw-r--r--test/ua.c18
4 files changed, 19 insertions, 10 deletions
diff --git a/src/account.c b/src/account.c
index 2a99e58..d7ab9c0 100644
--- a/src/account.c
+++ b/src/account.c
@@ -388,6 +388,9 @@ int account_alloc(struct account **accp, const char *sipaddr)
/* optional password prompt */
if (pl_isset(&acc->laddr.uri.password)) {
+ warning("account: username:password is now deprecated"
+ " please use ;auth_pass=xxx instead\n");
+
err = re_sdprintf(&acc->auth_pass, "%H",
uri_password_unescape,
&acc->laddr.uri.password);
diff --git a/test/account.c b/test/account.c
index bf03b03..cb62acd 100644
--- a/test/account.c
+++ b/test/account.c
@@ -15,9 +15,10 @@
static const char str[] =
- "\"Mr User\" <sip:user:pass@domain.com>"
+ "\"Mr User\" <sip:user@domain.com>"
";answermode=auto"
";auth_user=xuser"
+ ";auth_pass=pass"
";outbound=\"sip:edge.domain.com\""
";ptime=10"
";regint=600"
@@ -45,7 +46,7 @@ int test_account(void)
TEST_STRCMP("Mr User", 7, addr->dname.p, addr->dname.l);
TEST_STRCMP("sip", 3, addr->uri.scheme.p, addr->uri.scheme.l);
TEST_STRCMP("user", 4, addr->uri.user.p, addr->uri.user.l);
- TEST_STRCMP("pass", 4, addr->uri.password.p, addr->uri.password.l);
+ TEST_STRCMP("", 0, addr->uri.password.p, addr->uri.password.l);
TEST_STRCMP("domain.com", 10, addr->uri.host.p, addr->uri.host.l);
ASSERT_EQ(0, addr->uri.params.l);
ASSERT_TRUE(addr->params.l > 0);
@@ -53,6 +54,7 @@ int test_account(void)
/* verify all decoded parameters */
ASSERT_TRUE(ANSWERMODE_AUTO == account_answermode(acc));
ASSERT_STREQ("xuser", account_auth_user(acc));
+ ASSERT_STREQ("pass", account_auth_pass(acc));
ASSERT_STREQ("sip:edge.domain.com", account_outbound(acc, 0));
ASSERT_TRUE(NULL == account_outbound(acc, 1));
ASSERT_TRUE(NULL == account_outbound(acc, 333));
diff --git a/test/sip/sipsrv.c b/test/sip/sipsrv.c
index 374ea3b..1174893 100644
--- a/test/sip/sipsrv.c
+++ b/test/sip/sipsrv.c
@@ -322,7 +322,7 @@ int sip_server_uri(struct sip_server *srv, char *uri, size_t sz,
return err;
/* NOTE: angel brackets needed to parse ;transport parameter */
- if (re_snprintf(uri, sz, "<sip:x:x@%J%s>",
+ if (re_snprintf(uri, sz, "<sip:x@%J%s>",
&laddr, sip_transp_param(tp)) < 0)
return ENOMEM;
diff --git a/test/ua.c b/test/ua.c
index 4f04e4f..0621e92 100644
--- a/test/ua.c
+++ b/test/ua.c
@@ -293,7 +293,7 @@ static int reg_dns(enum sip_transp tp)
t.srvc = server_count;
/* NOTE: angel brackets needed to parse ;transport parameter */
- if (re_snprintf(aor, sizeof(aor), "<sip:x:x@%s;transport=%s>",
+ if (re_snprintf(aor, sizeof(aor), "<sip:x@%s;transport=%s>",
domain, sip_transp_name(tp)) < 0)
return ENOMEM;
@@ -362,7 +362,7 @@ int test_ua_register_dns(void)
#define USER "alfredh"
-#define PASS "pass%40word" /* NOTE: url-encoded */
+#define PASS "pass@word"
#define DOMAIN "localhost"
static int reg_auth(enum sip_transp tp)
@@ -384,7 +384,7 @@ static int reg_auth(enum sip_transp tp)
TEST_ERR(err);
err = user_add(domain_lookup(t.srvv[0], DOMAIN)->ht_usr,
- "alfredh", "pass@word", DOMAIN);
+ USER, PASS, DOMAIN);
TEST_ERR(err);
t.srvv[0]->auth_enabled = true;
@@ -395,10 +395,12 @@ static int reg_auth(enum sip_transp tp)
/* NOTE: angel brackets needed to parse ;transport parameter */
if (re_snprintf(aor, sizeof(aor),
- "<sip:%s:%s@%s>;outbound=\"sip:%J;transport=%s\"",
+ "<sip:%s@%s>"
+ ";auth_pass=%s"
+ ";outbound=\"sip:%J;transport=%s\"",
USER,
- PASS,
DOMAIN,
+ PASS,
&laddr,
sip_transp_name(tp)) < 0)
return ENOMEM;
@@ -540,8 +542,10 @@ static int reg_auth_dns(enum sip_transp tp)
t.srvc = server_count;
/* NOTE: angel brackets needed to parse ;transport parameter */
- if (re_snprintf(aor, sizeof(aor), "<sip:%s:%s@%s;transport=%s>",
- username, password, domain, sip_transp_name(tp)) < 0)
+ if (re_snprintf(aor, sizeof(aor),
+ "<sip:%s@%s;transport=%s>;auth_pass=%s",
+ username, domain, sip_transp_name(tp),
+ password) < 0)
return ENOMEM;
/*