1
0
Fork 0

Improved sender/recipient address format checking

This commit is contained in:
bagyenda 2005-11-04 16:43:16 +00:00
parent 788ba4c2fe
commit 26b1c37a1d
2 changed files with 16 additions and 6 deletions

View File

@ -207,14 +207,20 @@ MmsEnvelope *mms_queue_readenvelope(char *qf, char *mms_queuedir, int shouldbloc
break; break;
case 'F': case 'F':
e->from = octstr_create(res); e->from = octstr_create(res);
if (mms_validate_address(e->from) != 0) if (mms_validate_address(e->from) != 0) {
error(0, "mms_queueread: Mal-formed address %s in file %s!", res, xqf); warning(0, "mms_queueread: Mal-formed address [%s] in file %s! "
"Attempting fixup.", res, xqf);
_mms_fixup_address(e->from);
}
break; break;
case 'R': case 'R':
t = octstr_create(res); t = octstr_create(res);
if (mms_validate_address(t) != 0) if (mms_validate_address(t) != 0) {
error(0, "mms_queueread: Mal-formed address %s in file %s!", res, xqf); warning(0, "mms_queueread: Mal-formed address [%s] in file %s! "
"Attempting fixup.", res, xqf);
_mms_fixup_address(t);
}
to = gw_malloc(sizeof *to); to = gw_malloc(sizeof *to);
to->rcpt = t; to->rcpt = t;
to->process = 1; to->process = 1;

View File

@ -34,6 +34,7 @@ static int find_own(int i, int argc, char *argv[])
if (argv[i][1] == 'f') if (argv[i][1] == 'f')
if (i + 1 < argc) { if (i + 1 < argc) {
from = octstr_create(argv[i+1]); from = octstr_create(argv[i+1]);
_mms_fixup_address(from);
return 1; return 1;
} else } else
return -1; return -1;
@ -45,8 +46,11 @@ static int find_own(int i, int argc, char *argv[])
int j, m; int j, m;
List *l = octstr_split(octstr_create(argv[i+1]), List *l = octstr_split(octstr_create(argv[i+1]),
octstr_imm(":")); octstr_imm(":"));
for (j = 0, m = list_len(l); j < m; j++) for (j = 0, m = list_len(l); j < m; j++) {
list_append(to, list_get(l, j)); Octstr *x = list_get(l, j);
_mms_fixup_address(x);
list_append(to, x);
}
list_destroy(l, NULL); list_destroy(l, NULL);
return 1; return 1;
} else } else