Trim down gateway names with []'s in them

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@850 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2003-04-14 20:48:30 +00:00
parent 3fddf10c3e
commit 41129c57bd
2 changed files with 38 additions and 4 deletions

View File

@@ -448,7 +448,7 @@ static int mgcp_audit_endpoint(int fd, int argc, char *argv[])
struct mgcp_gateway *g;
struct mgcp_endpoint *e;
int found = 0;
char *ename,*gname;
char *ename,*gname, *c;
if (!mgcpdebug) {
return RESULT_SHOWUSAGE;
}
@@ -465,7 +465,10 @@ static int mgcp_audit_endpoint(int fd, int argc, char *argv[])
}
gname++;
}
if (gname[0] == '[')
gname++;
if ((c = strrchr(gname, ']')))
*c = '\0';
ast_pthread_mutex_lock(&gatelock);
g = gateways;
while(g) {
@@ -778,7 +781,7 @@ static struct mgcp_endpoint *find_endpoint(char *name, int msgid, struct sockadd
struct mgcp_endpoint *p = NULL;
struct mgcp_gateway *g;
char tmp[256] = "";
char *at = NULL;
char *at = NULL, *c;
if (name) {
strncpy(tmp, name, sizeof(tmp) - 1);
at = strchr(tmp, '@');
@@ -790,6 +793,12 @@ static struct mgcp_endpoint *find_endpoint(char *name, int msgid, struct sockadd
at++;
}
ast_pthread_mutex_lock(&gatelock);
if (at && (at[0] == '[')) {
at++;
c = strrchr(at, ']');
if (c)
*c = '\0';
}
g = gateways;
while(g) {
if ((!name || !strcasecmp(g->name, at)) &&