1
0
Fork 0

fix: reduce length of trans-id and msgid

This commit is contained in:
bagyenda 2006-05-29 06:30:39 +00:00
parent 9e59d79de5
commit f8c0ef9a7b
3 changed files with 24 additions and 15 deletions

View File

@ -549,8 +549,8 @@ static int mkqf(char qf[QFNAMEMAX], char subdir[64], char *mms_queuedir)
Octstr *tmp;
xqf = octstr_format("%cf%ld.%d.x%d.%ld",
MQF,
time(NULL),
(++ect % 10000), getpid()%1000, random() % 1000);
(long)time(NULL) % 10000,
(++ect % 10000), getpid()%1000, random() % 100);
tmp = octstr_format("%.64s/%s%S", mms_queuedir, subdir, xqf);
ctmp = octstr_get_cstr(tmp);

View File

@ -133,7 +133,7 @@ Octstr *mms_maketransid(char *qf, Octstr *mmscname)
if (!qf)
x = octstr_format("msg.%ld.x%d.%d.%d",
time(NULL), (++ct % 10000), getpid()%1000, random()%1000);
(long)time(NULL) % 10000, (++ct % 1000), getpid()%100, random()%100);
else
x = octstr_create(qf);

View File

@ -323,22 +323,31 @@ static int fetch_serviceurl(MmsEnvelope *e,
octstr_destroy(body);
break;
case TRANS_TYPE_FILE:
case TRANS_TYPE_EXEC:
fp = (ms->type == TRANS_TYPE_EXEC) ?
popen(octstr_get_cstr(ms->url), "r") :
fopen(octstr_get_cstr(ms->url), "r");
rb = octstr_read_pipe(fp);
if (ms->type == TRANS_TYPE_EXEC) {
ctype = octstr_imm("application/smil");
pclose(fp);
} else {
if ((fp = fopen(octstr_get_cstr(ms->url), "r")) != NULL) {
rb = octstr_read_pipe(fp);
fclose(fp);
ctype = filename2content_type(octstr_get_cstr(ms->url));
}
}
if (!rb)
*err = octstr_format("MMSBox: Failed to fetch content for Service %S, file/path = %S!",
*err = octstr_format("MMSBox: Failed to open file %S for service %S!",
ms->url, ms->name);
typ = FILE_TYPE;
break;
case TRANS_TYPE_EXEC:
if ((fp = popen(octstr_get_cstr(ms->url), "r+")) != NULL) {
Octstr *s = mime_entity_to_octstr(msg);
if (s) { /* Send the MMS to the exec program */
octstr_print(fp, s);
fflush(fp);
octstr_destroy(s);
}
rb = octstr_read_pipe(fp);
ctype = octstr_imm("application/smil");
pclose(fp);
}
if (!rb)
*err = octstr_format("MMSBox: Failed to fetch content for Service %S, exec path = %S!",
ms->name, ms->url);
typ = FILE_TYPE;
break;