Module: sip-router
Branch: master
Commit: e56ff0e6a5745321c6a4a5f362cc728177acef0d
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e56ff0e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri Jan 24 15:43:59 2014 +0100
core/parser: handle the case when username field in auth header has proto scheme
- some phones put there "sip:username@domain", so far it was handling
"username" and "username@domain"
---
parser/digest/digest_parser.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/parser/digest/digest_parser.c b/parser/digest/digest_parser.c
index 6e4adce..08683d7 100644
--- a/parser/digest/digest_parser.c
+++ b/parser/digest/digest_parser.c
@@ -275,6 +275,7 @@ static inline void parse_username(struct username* _u)
_u->user = _u->whole;
if (_u->whole.len <= 2) return;
+ /* get domain - it can be: username@domain */
d = q_memchr(_u->whole.s, '@', _u->whole.len);
if (d) {
@@ -282,6 +283,13 @@ static inline void parse_username(struct username* _u)
_u->domain.len = _u->whole.len - (d - _u->whole.s) - 1;
_u->user.len = d - _u->user.s;
}
+
+ /* get user - it can be: sip:username@domain */
+ d = q_memchr(_u->user.s, ':', _u->user.len);
+ if (d) {
+ _u->user.len = _u->user.s + _u->user.len - d - 1;
+ _u->user.s = d + 1;
+ }
}