diff options
author | Alfred E. Heggestad <alfred.heggestad@gmail.com> | 2017-07-07 15:40:29 +0200 |
---|---|---|
committer | Alfred E. Heggestad <alfred.heggestad@gmail.com> | 2017-07-07 15:40:29 +0200 |
commit | 5b1f3237c1cc181d216a02ce604614adb792aa17 (patch) | |
tree | 649665eda3bfc6c9c3a1949a9b9a2fa4a3472969 | |
parent | d2a391c693c0b1bcd9c5eda132f51be7991db189 (diff) |
account: handle URL-encoded passwords (fixes #273)
-rw-r--r-- | src/account.c | 4 | ||||
-rw-r--r-- | test/ua.c | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/account.c b/src/account.c index e23d5c8..c3f26eb 100644 --- a/src/account.c +++ b/src/account.c @@ -396,7 +396,9 @@ int account_alloc(struct account **accp, const char *sipaddr) goto out; } else { - err = pl_strdup(&acc->auth_pass, &acc->laddr.uri.password); + err = re_sdprintf(&acc->auth_pass, "%H", + uri_password_unescape, + &acc->laddr.uri.password); if (err) goto out; } @@ -363,7 +363,7 @@ int test_ua_register_dns(void) #define USER "alfredh" -#define PASS "password" +#define PASS "pass%40word" /* NOTE: url-encoded */ #define DOMAIN "localhost" static int reg_auth(enum sip_transp tp) @@ -385,7 +385,7 @@ static int reg_auth(enum sip_transp tp) TEST_ERR(err); err = user_add(domain_lookup(t.srvv[0], DOMAIN)->ht_usr, - "alfredh", "password", DOMAIN); + "alfredh", "pass@word", DOMAIN); TEST_ERR(err); t.srvv[0]->auth_enabled = true; |