projects
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add control=submission to relay_from_hosts and authenticated checks in
[exim.git]
/
src
/
src
/
mime.c
diff --git
a/src/src/mime.c
b/src/src/mime.c
index f97d25abb3748885f700a579a4a16bba0c305df1..486fd3d1f9822b7edc78bd300929dab195ebf32e 100644
(file)
--- a/
src/src/mime.c
+++ b/
src/src/mime.c
@@
-1,4
+1,4
@@
-/* $Cambridge: exim/src/src/mime.c,v 1.
6 2005/03/08 16:57:28 ph10
Exp $ */
+/* $Cambridge: exim/src/src/mime.c,v 1.
12 2005/08/16 12:32:32 tom
Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
/*************************************************
* Exim - an Internet mail transport agent *
@@
-159,7
+159,6
@@
uschar *mime_parse_line(uschar *buffer, uschar *data, uschar *encoding, int *num
/* byte 0 ---------------------- */
if (*(p+1) == 255) {
/* byte 0 ---------------------- */
if (*(p+1) == 255) {
- mime_set_anomaly(MIME_ANOMALY_BROKEN_BASE64);
break;
}
data[(*num_decoded)] = *p;
break;
}
data[(*num_decoded)] = *p;
@@
-171,7
+170,6
@@
uschar *mime_parse_line(uschar *buffer, uschar *data, uschar *encoding, int *num
p++;
/* byte 1 ---------------------- */
if (*(p+1) == 255) {
p++;
/* byte 1 ---------------------- */
if (*(p+1) == 255) {
- mime_set_anomaly(MIME_ANOMALY_BROKEN_BASE64);
break;
}
data[(*num_decoded)] = *p;
break;
}
data[(*num_decoded)] = *p;
@@
-183,7
+181,6
@@
uschar *mime_parse_line(uschar *buffer, uschar *data, uschar *encoding, int *num
p++;
/* byte 2 ---------------------- */
if (*(p+1) == 255) {
p++;
/* byte 2 ---------------------- */
if (*(p+1) == 255) {
- mime_set_anomaly(MIME_ANOMALY_BROKEN_BASE64);
break;
}
data[(*num_decoded)] = *p;
break;
}
data[(*num_decoded)] = *p;
@@
-243,11
+240,11
@@
FILE *mime_get_decode_file(uschar *pname, uschar *fname) {
filename = (uschar *)malloc(2048);
if ((pname != NULL) && (fname != NULL)) {
filename = (uschar *)malloc(2048);
if ((pname != NULL) && (fname != NULL)) {
-
snprintf(CS
filename, 2048, "%s/%s", pname, fname);
- f = fopen(CS filename,"w+");
+
(void)string_format(
filename, 2048, "%s/%s", pname, fname);
+ f = fopen(CS filename,"w
b
+");
}
else if (pname == NULL) {
}
else if (pname == NULL) {
- f = fopen(CS fname,"w+");
+ f = fopen(CS fname,"w
b
+");
}
else if (fname == NULL) {
int file_nr = 0;
}
else if (fname == NULL) {
int file_nr = 0;
@@
-256,7
+253,7
@@
FILE *mime_get_decode_file(uschar *pname, uschar *fname) {
/* must find first free sequential filename */
do {
struct stat mystat;
/* must find first free sequential filename */
do {
struct stat mystat;
-
snprintf(CS
filename,2048,"%s/%s-%05u", pname, message_id, file_nr);
+
(void)string_format(
filename,2048,"%s/%s-%05u", pname, message_id, file_nr);
file_nr++;
/* security break */
if (file_nr >= 1024)
file_nr++;
/* security break */
if (file_nr >= 1024)
@@
-264,7
+261,7
@@
FILE *mime_get_decode_file(uschar *pname, uschar *fname) {
result = stat(CS filename,&mystat);
}
while(result != -1);
result = stat(CS filename,&mystat);
}
while(result != -1);
- f = fopen(CS filename,"w+");
+ f = fopen(CS filename,"w
b
+");
};
/* set expansion variable */
};
/* set expansion variable */
@@
-292,7
+289,7
@@
int mime_decode(uschar **listptr) {
f_pos = ftell(mime_stream);
/* build default decode path (will exist since MBOX must be spooled up) */
f_pos = ftell(mime_stream);
/* build default decode path (will exist since MBOX must be spooled up) */
-
snprintf(CS
decode_path,1024,"%s/scan/%s",spool_directory,message_id);
+
(void)string_format(
decode_path,1024,"%s/scan/%s",spool_directory,message_id);
/* reserve a line and decoder buffer to work in */
buffer = (uschar *)malloc(MIME_MAX_LINE_LENGTH+1);
/* reserve a line and decoder buffer to work in */
buffer = (uschar *)malloc(MIME_MAX_LINE_LENGTH+1);
@@
-384,7
+381,7
@@
int mime_decode(uschar **listptr) {
}
}
- fclose(decode_file);
+
(void)
fclose(decode_file);
clearerr(mime_stream);
fseek(mime_stream,f_pos,SEEK_SET);
clearerr(mime_stream);
fseek(mime_stream,f_pos,SEEK_SET);
@@
-418,7
+415,7
@@
int mime_get_header(FILE *f, uschar *header) {
c = fgetc(f);
if (c == EOF) break;
if ( (c == '\t') || (c == ' ') ) continue;
c = fgetc(f);
if (c == EOF) break;
if ( (c == '\t') || (c == ' ') ) continue;
- ungetc(c,f);
+
(void)
ungetc(c,f);
};
/* end of the header, terminate with ';' */
c = ';';
};
/* end of the header, terminate with ';' */
c = ';';
@@
-487,7
+484,7
@@
int mime_get_header(FILE *f, uschar *header) {
};
};
};
};
- if (
header[num_copied-1] != ';'
) {
+ if (
(num_copied > 0) && (header[num_copied-1] != ';')
) {
header[num_copied-1] = ';';
};
header[num_copied-1] = ';';
};
@@
-502,8
+499,8
@@
int mime_get_header(FILE *f, uschar *header) {
}
}
-int mime_acl_check(
FILE *f, struct mime_boundary_context *context, uschar
- **user_msgptr, uschar **log_msgptr) {
+int mime_acl_check(
uschar *acl, FILE *f, struct mime_boundary_context *context,
+
uschar
**user_msgptr, uschar **log_msgptr) {
int rc = OK;
uschar *header = NULL;
struct mime_boundary_context nested_context;
int rc = OK;
uschar *header = NULL;
struct mime_boundary_context nested_context;
@@
-512,7
+509,7
@@
int mime_acl_check(FILE *f, struct mime_boundary_context *context, uschar
header = (uschar *)malloc(MIME_MAX_HEADER_SIZE+1);
if (header == NULL) {
log_write(0, LOG_PANIC,
header = (uschar *)malloc(MIME_MAX_HEADER_SIZE+1);
if (header == NULL) {
log_write(0, LOG_PANIC,
- "
acl_smtp_mime
: can't allocate %d bytes of memory.", MIME_MAX_HEADER_SIZE+1);
+ "
MIME ACL
: can't allocate %d bytes of memory.", MIME_MAX_HEADER_SIZE+1);
return DEFER;
};
return DEFER;
};
@@
-659,7
+656,7
@@
int mime_acl_check(FILE *f, struct mime_boundary_context *context, uschar
mime_is_coverletter = !(context && context->context == MBC_ATTACHMENT);
/* call ACL handling function */
mime_is_coverletter = !(context && context->context == MBC_ATTACHMENT);
/* call ACL handling function */
- rc = acl_check(ACL_WHERE_MIME, NULL, acl
_smtp_mime
, user_msgptr, log_msgptr);
+ rc = acl_check(ACL_WHERE_MIME, NULL, acl, user_msgptr, log_msgptr);
mime_stream = NULL;
mime_current_boundary = NULL;
mime_stream = NULL;
mime_current_boundary = NULL;
@@
-680,7
+677,7
@@
int mime_acl_check(FILE *f, struct mime_boundary_context *context, uschar
else
nested_context.context = MBC_COVERLETTER_ONESHOT;
else
nested_context.context = MBC_COVERLETTER_ONESHOT;
- rc = mime_acl_check(f, &nested_context, user_msgptr, log_msgptr);
+ rc = mime_acl_check(
acl,
f, &nested_context, user_msgptr, log_msgptr);
if (rc != OK) break;
}
else if ( (mime_content_type != NULL) &&
if (rc != OK) break;
}
else if ( (mime_content_type != NULL) &&
@@
-693,7
+690,7
@@
int mime_acl_check(FILE *f, struct mime_boundary_context *context, uschar
/* must find first free sequential filename */
do {
struct stat mystat;
/* must find first free sequential filename */
do {
struct stat mystat;
-
snprintf(CS
filename,2048,"%s/scan/%s/__rfc822_%05u", spool_directory, message_id, file_nr);
+
(void)string_format(
filename,2048,"%s/scan/%s/__rfc822_%05u", spool_directory, message_id, file_nr);
file_nr++;
/* security break */
if (file_nr >= 128)
file_nr++;
/* security break */
if (file_nr >= 128)