1
0
Fork 0

minor bug fix in mmsbox message routing

This commit is contained in:
bagyenda 2007-12-26 07:36:54 +00:00
parent a49d02b4e8
commit 5d01704548
2 changed files with 15 additions and 20 deletions

View File

@ -919,9 +919,10 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
if (!subject && e && e->subject)
subject = octstr_duplicate(e->subject);
#if 0 /* don't route via sender, instead use allow/deny settings. */
if (!mmc && e)
mmc = e->fromproxy;
#endif
/* Get the from address. */
if (faked_sender)
from = octstr_duplicate(faked_sender);
@ -1119,10 +1120,8 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
break;
}
loop:
if (h)
octstr_destroy(h);
if (v)
octstr_destroy(v);
octstr_destroy(h);
octstr_destroy(v);
}
}

View File

@ -457,12 +457,18 @@ MmscGrp *get_handler_mmc(Octstr *id, Octstr *to, Octstr *from)
MmscGrp *mmc = NULL, *res = NULL;
int i, n;
Octstr *phonenum = NULL, *xfrom = NULL;
int has_criteria = 0;
if (id) /* If ID is set, use it. */
for (i = 0, n = gwlist_len(mmscs); i < n; i++)
if ((mmc = gwlist_get(mmscs, i)) != NULL &&
mmc->id && octstr_compare(mmc->id, id) == 0)
return mmc;
if (octstr_search_char(to, '@', 0) > 0 ||
octstr_case_search(to, octstr_imm("/TYPE=IPv"), 0) > 0) /* For emails, or ip take first mmsc. */
return gwlist_get(mmscs, 0);
/* now try allow/deny stuff. */
phonenum = extract_phonenum(to, unified_prefix);
xfrom = extract_phonenum(from, NULL);
@ -486,24 +492,14 @@ MmscGrp *get_handler_mmc(Octstr *id, Octstr *to, Octstr *from)
does_prefix_match(mmc->denied_sender_prefix, xfrom) != 0)
continue; /* matches. */
has_criteria = has_criteria || mmc->denied_prefix ||
mmc->allowed_prefix || mmc->denied_sender_prefix || mmc->allowed_sender_prefix;
res = mmc; /* otherwise it matches, so go away. */
break;
}
octstr_destroy(phonenum);
octstr_destroy(xfrom);
if (res && has_criteria) /* choice driven by allowed/denied settings */
return res;
else if (res == NULL && id) /* try sending it back the way it came. */
for (i = 0, n = gwlist_len(mmscs); i < n; i++)
if ((mmc = gwlist_get(mmscs, i)) != NULL &&
mmc->id && octstr_compare(mmc->id, id) == 0)
return mmc;
return res;
octstr_destroy(phonenum);
octstr_destroy(xfrom);
return res;
}
/* handle message routing. */