Module: kamailio
Branch: master
Commit: c02e165cc7a44e525dd55714c4471f1236e96b43
URL:
https://github.com/kamailio/kamailio/commit/c02e165cc7a44e525dd55714c4471f1…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-05-22T12:43:55+02:00
lib/srdb1: use last @ as delimiter for start of host in db url
- allow @ to be part of password
- reported by GH#169, Debojit Kakoti
---
Modified: lib/srdb1/db_id.c
---
Diff:
https://github.com/kamailio/kamailio/commit/c02e165cc7a44e525dd55714c4471f1…
Patch:
https://github.com/kamailio/kamailio/commit/c02e165cc7a44e525dd55714c4471f1…
---
diff --git a/lib/srdb1/db_id.c b/lib/srdb1/db_id.c
index aab3054..f1969c1 100644
--- a/lib/srdb1/db_id.c
+++ b/lib/srdb1/db_id.c
@@ -81,7 +81,7 @@ static int parse_db_url(struct db_id* id, const str* url)
};
enum state st;
- unsigned int len, i;
+ unsigned int len, i, j, a;
const char* begin;
char* prev_token;
@@ -162,6 +162,14 @@ static int parse_db_url(struct db_id* id, const str* url)
st = ST_HOST;
id->username = prev_token;
prev_token = 0;
+ a = 0;
+ /* go to last '@' to support when it is part of password */
+ for(j = i+1; j < len; j++) {
+ if(url->s[j]=='@') {
+ a = j;
+ }
+ }
+ if(a!=0) i = a;
if (dupl_string(&id->password, begin, url->s + i) < 0) goto err;
begin = url->s + i + 1;
break;