mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-05-03 06:52:05 +00:00
mod_sofia: Rewrite sofia_glue_get_user_host
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13543 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
59080b8d49
commit
2eea7447d0
@ -3961,20 +3961,30 @@ int sofia_glue_get_user_host(char *in, char **user, char **host)
|
|||||||
*user = NULL;
|
*user = NULL;
|
||||||
*host = NULL;
|
*host = NULL;
|
||||||
|
|
||||||
if (!strncasecmp(u, "sip:", 4)) {
|
/* First isolate the host part from the user part */
|
||||||
u += 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((h = strchr(u, '@'))) {
|
if ((h = strchr(u, '@'))) {
|
||||||
*h++ = '\0';
|
*h++ = '\0';
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = h + strlen(h) - 1;
|
/* Clean out the user part of its protocol prefix (if any) */
|
||||||
|
if ((p = strchr(u, ':'))) {
|
||||||
|
*p++ = '\0';
|
||||||
|
u = p;
|
||||||
|
}
|
||||||
|
|
||||||
if (p && (*p == ':' || *p == ';' || *p == ' ')) {
|
/* Clean out the host part of any suffix */
|
||||||
*p = '\0';
|
if ((p = strchr(h, ':'))) {
|
||||||
|
*p = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((p = strchr(h, ';'))) {
|
||||||
|
*p = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((p = strchr(h, ' '))) {
|
||||||
|
*p = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
*user = u;
|
*user = u;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user