30 #define USE_NEW_GET_BOUNDARY 1 39 static VALUES mime_types[] = {
51 static VALUES mime_encode[] = {
66 static bool J_MIME_DEBUG =
FALSE;
81 #define MAX(a,b) ((a) > (b) ? (a) : (b)) 84 #define MIN(a,b) ((a) < (b) ? (a) : (b)) 88 #define MAXLONG (1 << 30) 98 #define MAX_RECURSIVE_LEVEL 5 101 #define REGCOMP_FLAGS (REG_ICASE | REG_NEWLINE | REG_EXTENDED) 103 #define REGCOMP_FLAGS (REG_ICASE | REG_EXTENDED) 106 #define REGEXEC_FLAGS (0) 112 #define FREE_ALLOC() \ 123 #define LOG_SOB(h, txt) \ 127 strlcpy(titi, txt, sizeof(titi)); \ 128 ZE_MessageInfo(LOG_LEVEL, "*************** %s **************", h); \ 129 ZE_MessageInfo(LOG_LEVEL, "%s",titi); \ 130 ZE_MessageInfo(LOG_LEVEL, "*************"); \ 133 #define BADFILENAMECHARS " \t\n\r\"\'\\/$&|;,:()[]<>*{}@?" 135 #define CLEANUP_FILENAME(fname) \ 139 while ((s = strpbrk(fname, BADFILENAMECHARS)) != NULL) \ 143 #define GOTO_FIN(r) \ 169 char *boundary = NULL;
171 char *filename = NULL;
172 char *mimetype = NULL;
173 char *charset = NULL;
178 char *bodybuf = NULL;
180 bool is_mime =
FALSE;
185 memset(&mpart, 0,
sizeof (mpart));
188 ZE_MessageInfo(10,
"MIME recursion level seems high : %d", level);
199 if ((buf == NULL) || (strlen(buf) == 0))
207 buf += strspn(buf,
" \t\n\r");
308 if (boundary != NULL)
370 if ((p == NULL) || (*p ==
'\0'))
373 if ((bodybuf = strdup(p)) == NULL)
380 bodyl = strlen(bodybuf);
385 if ((bodybuf = (
char *) malloc(sz + 1)) == NULL)
390 memset(bodybuf, 0, sz + 1);
397 if ((p == NULL) || (*p ==
'\0'))
402 if ((bodybuf = strdup(p)) == NULL)
409 bodyl = strlen(bodybuf);
427 bodyl = strlen(bodyp);
454 size_t l = strlen(p);
479 func(p, l,
id, level, type, arg, &mpart);
492 if ((gotcha = strstr(p, bstrp)) != NULL)
494 size_t pi = 0, pf = 0;
499 pf = pi + strlen(bstrp);
516 if (strncmp(p,
"--", 2) == 0)
521 if ((t = strdup(p)) == NULL)
530 STRBOOL(gotcha != NULL,
"YES",
"NO"));
544 ZE_MessageInfo(10,
"%s SPAM CHECK : multipart/... without boundaries",
567 func(bodyp, bodyl,
id, level, type, arg, &mpart);
666 int n = strcspn(s,
"/");
673 if (strncasecmp(s, p->
str_value, n) == 0)
715 if ((s == NULL) || ((n = strlen(s)) == 0))
718 for (n--; n >= 0; n--)
#define str_clear_right_spaces(s)
#define MAX_RECURSIVE_LEVEL
char * zeStrnDup(const char *s, size_t n)
#define ZE_LogMsgInfo(level,...)
#define CLEANUP_FILENAME(fname)
#define ZE_LogMsgError(level,...)
#define ZE_LogMsgDebug(level,...)
char * zeStrSet(char *, int, int)
#define ZE_MessageInfo(level,...)
#define ZE_LogSysError(...)
char * read_text_file(char *, size_t *)
char * zeStrCatDup(char *, char *)