X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fmhbuildsbr.c;h=041a14296df4e5481ca82203ae014979b8cf3d31;hb=55b8f7b6a738adb4dc9833233fc6111f3cd56969;hp=c6f50981bf99ddf5d419ab8dc1e93e8216180586;hpb=5ff96d61ee5af34956ae958a0bc72ee78734a4d7;p=mmh diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index c6f5098..041a142 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -152,8 +152,8 @@ int pidcheck (int); */ static CT get_content (FILE *, char *, int); static int add_header (CT, char *, char *); -static int get_ctinfo (char *, CT, int); -static int get_comment (CT, char **, int); +static int get_ctinfo (unsigned char *, CT, int); +static int get_comment (CT, unsigned char **, int); static int InitGeneric (CT); static int InitText (CT); static int InitMultiPart (CT); @@ -186,7 +186,7 @@ static int scan_content (CT); static int build_headers (CT); static char *calculate_digest (CT, int); static int readDigest (CT, char *); -static char *incl_name_value (char *, char *, char *); +static char *incl_name_value (unsigned char *, char *, char *); static char *extract_name_value (char *, char *); /* @@ -244,7 +244,8 @@ pidcheck (int status) fflush (stdout); fflush (stderr); - return done (1); + done (1); + return 1; } @@ -300,15 +301,15 @@ build_mime (char *infile) compnum++; /* abort if draft has Mime-Version header field */ - if (!strcasecmp (name, VRSN_FIELD)) + if (!mh_strcasecmp (name, VRSN_FIELD)) adios (NULL, "draft shouldn't contain %s: field", VRSN_FIELD); /* abort if draft has Content-Transfer-Encoding header field */ - if (!strcasecmp (name, ENCODING_FIELD)) + if (!mh_strcasecmp (name, ENCODING_FIELD)) adios (NULL, "draft shouldn't contain %s: field", ENCODING_FIELD); /* ignore any Content-Type fields in the header */ - if (!strcasecmp (name, TYPE_FIELD)) { + if (!mh_strcasecmp (name, TYPE_FIELD)) { while (state == FLDPLUS) state = m_getfld (state, name, buf, sizeof(buf), in); goto finish_field; @@ -497,9 +498,10 @@ get_content (FILE *in, char *file, int toplevel) compnum++; /* Get MIME-Version field */ - if (!strcasecmp (name, VRSN_FIELD)) { + if (!mh_strcasecmp (name, VRSN_FIELD)) { int ucmp; - char c, *cp, *dp; + char c; + unsigned char *cp, *dp; cp = add (buf, NULL); while (state == FLDPLUS) { @@ -533,7 +535,7 @@ get_content (FILE *in, char *file, int toplevel) for (dp = cp; istoken (*dp); dp++) continue; c = *dp, *dp = '\0'; - ucmp = !strcasecmp (cp, VRSN_VALUE); + ucmp = !mh_strcasecmp (cp, VRSN_VALUE); *dp = c; if (!ucmp) admonish (NULL, @@ -543,7 +545,7 @@ get_content (FILE *in, char *file, int toplevel) } /* Get Content-Type field */ - if (!strcasecmp (name, TYPE_FIELD)) { + if (!mh_strcasecmp (name, TYPE_FIELD)) { char *cp; struct str2init *s2i; CI ci = &ct->c_ctinfo; @@ -574,7 +576,7 @@ get_content (FILE *in, char *file, int toplevel) * flag for this content type. */ for (s2i = str2cts; s2i->si_key; s2i++) - if (!strcasecmp (ci->ci_type, s2i->si_key)) + if (!mh_strcasecmp (ci->ci_type, s2i->si_key)) break; if (!s2i->si_key && !uprf (ci->ci_type, "X-")) s2i++; @@ -584,8 +586,8 @@ get_content (FILE *in, char *file, int toplevel) } /* Get Content-Transfer-Encoding field */ - if (!strcasecmp (name, ENCODING_FIELD)) { - char *cp, *dp; + if (!mh_strcasecmp (name, ENCODING_FIELD)) { + unsigned char *cp, *dp; char c; struct str2init *s2i; @@ -620,7 +622,7 @@ get_content (FILE *in, char *file, int toplevel) * for this transfer encoding. */ for (s2i = str2ces; s2i->si_key; s2i++) - if (!strcasecmp (cp, s2i->si_key)) + if (!mh_strcasecmp (cp, s2i->si_key)) break; if (!s2i->si_key && !uprf (cp, "X-")) s2i++; @@ -634,7 +636,7 @@ get_content (FILE *in, char *file, int toplevel) } /* Get Content-ID field */ - if (!strcasecmp (name, ID_FIELD)) { + if (!mh_strcasecmp (name, ID_FIELD)) { ct->c_id = add (buf, ct->c_id); while (state == FLDPLUS) { state = m_getfld (state, name, buf, sizeof(buf), in); @@ -644,7 +646,7 @@ get_content (FILE *in, char *file, int toplevel) } /* Get Content-Description field */ - if (!strcasecmp (name, DESCR_FIELD)) { + if (!mh_strcasecmp (name, DESCR_FIELD)) { ct->c_descr = add (buf, ct->c_descr); while (state == FLDPLUS) { state = m_getfld (state, name, buf, sizeof(buf), in); @@ -654,7 +656,7 @@ get_content (FILE *in, char *file, int toplevel) } /* Get Content-Disposition field */ - if (!strcasecmp (name, DISPO_FIELD)) { + if (!mh_strcasecmp (name, DISPO_FIELD)) { ct->c_dispo = add (buf, ct->c_dispo); while (state == FLDPLUS) { state = m_getfld (state, name, buf, sizeof(buf), in); @@ -664,8 +666,9 @@ get_content (FILE *in, char *file, int toplevel) } /* Get Content-MD5 field */ - if (!strcasecmp (name, MD5_FIELD)) { - char *cp, *dp, *ep; + if (!mh_strcasecmp (name, MD5_FIELD)) { + unsigned char *cp, *dp; + char *ep; cp = add (buf, NULL); while (state == FLDPLUS) { @@ -828,10 +831,11 @@ add_header (CT ct, char *name, char *value) */ static int -get_ctinfo (char *cp, CT ct, int magic) +get_ctinfo (unsigned char *cp, CT ct, int magic) { int i; - char *dp, **ap, **ep; + unsigned char *dp; + char **ap, **ep; char c; CI ci; @@ -926,7 +930,8 @@ magic_skip: */ ep = (ap = ci->ci_attrs) + NPARMS; while (*cp == ';') { - char *vp, *up; + char *vp; + unsigned char *up; if (ap >= ep) { advise (NULL, @@ -1127,10 +1132,11 @@ bad_quote: static int -get_comment (CT ct, char **ap, int istype) +get_comment (CT ct, unsigned char **ap, int istype) { int i; - char *bp, *cp; + char *bp; + unsigned char *cp; char c, buffer[BUFSIZ], *dp; CI ci; @@ -1220,7 +1226,7 @@ InitText (CT ct) /* match subtype */ for (kv = SubText; kv->kv_key; kv++) - if (!strcasecmp (ci->ci_subtype, kv->kv_key)) + if (!mh_strcasecmp (ci->ci_subtype, kv->kv_key)) break; ct->c_subtype = kv->kv_value; @@ -1234,14 +1240,14 @@ InitText (CT ct) /* scan for charset parameter */ for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) - if (!strcasecmp (*ap, "charset")) + if (!mh_strcasecmp (*ap, "charset")) break; /* check if content specified a character set */ if (*ap) { /* match character set or set to CHARSET_UNKNOWN */ for (kv = Charset; kv->kv_key; kv++) - if (!strcasecmp (*ep, kv->kv_key)) + if (!mh_strcasecmp (*ep, kv->kv_key)) break; t->tx_charset = kv->kv_value; } @@ -1259,7 +1265,8 @@ InitMultiPart (CT ct) { int inout; long last, pos; - char *cp, *dp, **ap, **ep; + unsigned char *cp, *dp; + char **ap, **ep; char *bp, buffer[BUFSIZ]; struct multipart *m; struct k2v *kv; @@ -1282,7 +1289,7 @@ InitMultiPart (CT ct) /* match subtype */ for (kv = SubMultiPart; kv->kv_key; kv++) - if (!strcasecmp (ci->ci_subtype, kv->kv_key)) + if (!mh_strcasecmp (ci->ci_subtype, kv->kv_key)) break; ct->c_subtype = kv->kv_value; @@ -1291,7 +1298,7 @@ InitMultiPart (CT ct) * required for multipart messages. */ for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) { - if (!strcasecmp (*ap, "boundary")) { + if (!mh_strcasecmp (*ap, "boundary")) { bp = *ep; break; } @@ -1512,7 +1519,7 @@ InitMessage (CT ct) /* match subtype */ for (kv = SubMessage; kv->kv_key; kv++) - if (!strcasecmp (ci->ci_subtype, kv->kv_key)) + if (!mh_strcasecmp (ci->ci_subtype, kv->kv_key)) break; ct->c_subtype = kv->kv_value; @@ -1531,11 +1538,11 @@ InitMessage (CT ct) /* scan for parameters "id", "number", and "total" */ for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) { - if (!strcasecmp (*ap, "id")) { + if (!mh_strcasecmp (*ap, "id")) { p->pm_partid = add (*ep, NULL); continue; } - if (!strcasecmp (*ap, "number")) { + if (!mh_strcasecmp (*ap, "number")) { if (sscanf (*ep, "%d", &p->pm_partno) != 1 || p->pm_partno < 1) { invalid_param: @@ -1547,7 +1554,7 @@ invalid_param: } continue; } - if (!strcasecmp (*ap, "total")) { + if (!mh_strcasecmp (*ap, "total")) { if (sscanf (*ep, "%d", &p->pm_maxno) != 1 || p->pm_maxno < 1) goto invalid_param; @@ -1668,12 +1675,12 @@ params_external (CT ct, int composing) CI ci = &ct->c_ctinfo; for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) { - if (!strcasecmp (*ap, "access-type")) { + if (!mh_strcasecmp (*ap, "access-type")) { struct str2init *s2i; CT p = e->eb_content; for (s2i = str2methods; s2i->si_key; s2i++) - if (!strcasecmp (*ep, s2i->si_key)) + if (!mh_strcasecmp (*ep, s2i->si_key)) break; if (!s2i->si_key) { @@ -1691,39 +1698,39 @@ params_external (CT ct, int composing) return NOTOK; continue; } - if (!strcasecmp (*ap, "name")) { + if (!mh_strcasecmp (*ap, "name")) { e->eb_name = *ep; continue; } - if (!strcasecmp (*ap, "permission")) { + if (!mh_strcasecmp (*ap, "permission")) { e->eb_permission = *ep; continue; } - if (!strcasecmp (*ap, "site")) { + if (!mh_strcasecmp (*ap, "site")) { e->eb_site = *ep; continue; } - if (!strcasecmp (*ap, "directory")) { + if (!mh_strcasecmp (*ap, "directory")) { e->eb_dir = *ep; continue; } - if (!strcasecmp (*ap, "mode")) { + if (!mh_strcasecmp (*ap, "mode")) { e->eb_mode = *ep; continue; } - if (!strcasecmp (*ap, "size")) { + if (!mh_strcasecmp (*ap, "size")) { sscanf (*ep, "%lu", &e->eb_size); continue; } - if (!strcasecmp (*ap, "server")) { + if (!mh_strcasecmp (*ap, "server")) { e->eb_server = *ep; continue; } - if (!strcasecmp (*ap, "subject")) { + if (!mh_strcasecmp (*ap, "subject")) { e->eb_subject = *ep; continue; } - if (composing && !strcasecmp (*ap, "body")) { + if (composing && !mh_strcasecmp (*ap, "body")) { e->eb_body = getcpy (*ep); continue; } @@ -1752,7 +1759,7 @@ InitApplication (CT ct) /* match subtype */ for (kv = SubApplication; kv->kv_key; kv++) - if (!strcasecmp (ci->ci_subtype, kv->kv_key)) + if (!mh_strcasecmp (ci->ci_subtype, kv->kv_key)) break; ct->c_subtype = kv->kv_value; @@ -1895,7 +1902,8 @@ openBase64 (CT ct, char **file) int fd, len, skip; unsigned long bits; unsigned char value, *b, *b1, *b2, *b3; - char *cp, *ep, buffer[BUFSIZ]; + unsigned char *cp, *ep; + char buffer[BUFSIZ]; CE ce; MD5_CTX mdContext; @@ -2091,7 +2099,7 @@ static int openQuoted (CT ct, char **file) { int cc, digested, len, quoted; - char *cp, *ep; + unsigned char *cp, *ep; char buffer[BUFSIZ]; unsigned char mask; CE ce; @@ -2503,7 +2511,7 @@ openFile (CT ct, char **file) return NOTOK; } - if ((!e->eb_permission || strcasecmp (e->eb_permission, "read-write")) + if ((!e->eb_permission || mh_strcasecmp (e->eb_permission, "read-write")) && find_cache (NULL, wcachesw, &cachetype, e->eb_content->c_id, cachefile, sizeof(cachefile)) != NOTOK) { int mask; @@ -2651,7 +2659,7 @@ openFTP (CT ct, char **file) ce->ce_unlink = (*file == NULL); caching = 0; cachefile[0] = '\0'; - if ((!e->eb_permission || strcasecmp (e->eb_permission, "read-write")) + if ((!e->eb_permission || mh_strcasecmp (e->eb_permission, "read-write")) && find_cache (NULL, wcachesw, &cachetype, e->eb_content->c_id, cachefile, sizeof(cachefile)) != NOTOK) { if (*file == NULL) { @@ -2687,7 +2695,7 @@ openFTP (CT ct, char **file) vec[vecp++] = e->eb_dir; vec[vecp++] = e->eb_name; vec[vecp++] = ce->ce_file, - vec[vecp++] = e->eb_mode && !strcasecmp (e->eb_mode, "ascii") + vec[vecp++] = e->eb_mode && !mh_strcasecmp (e->eb_mode, "ascii") ? "ascii" : "binary"; vec[vecp] = NULL; @@ -2724,7 +2732,7 @@ losing_ftp: else if (ftp_get (e->eb_site, user, pass, e->eb_dir, e->eb_name, ce->ce_file, - e->eb_mode && !strcasecmp (e->eb_mode, "ascii"), 0) + e->eb_mode && !mh_strcasecmp (e->eb_mode, "ascii"), 0) == NOTOK) goto losing_ftp; #endif @@ -2918,7 +2926,8 @@ static int user_content (FILE *in, char *file, char *buf, CT *ctp) { int extrnal, vrsn; - char *cp, **ap; + unsigned char *cp; + char **ap; char buffer[BUFSIZ]; struct multipart *m; struct part **pp; @@ -3056,7 +3065,7 @@ rock_and_roll: done (1); for (s2i = str2cts; s2i->si_key; s2i++) - if (!strcasecmp (ci->ci_type, s2i->si_key)) + if (!mh_strcasecmp (ci->ci_type, s2i->si_key)) break; if (!s2i->si_key && !uprf (ci->ci_type, "X-")) s2i++; @@ -3066,7 +3075,7 @@ rock_and_roll: */ switch (ct->c_type = s2i->si_val) { case CT_MESSAGE: - if (!strcasecmp (ci->ci_subtype, "rfc822")) { + if (!mh_strcasecmp (ci->ci_subtype, "rfc822")) { ct->c_encoding = CE_7BIT; goto call_init; } @@ -3102,7 +3111,7 @@ call_init: /* check directive against the list of MIME types */ for (s2i = str2cts; s2i->si_key; s2i++) - if (!strcasecmp (ci->ci_type, s2i->si_key)) + if (!mh_strcasecmp (ci->ci_type, s2i->si_key)) break; /* @@ -3123,10 +3132,10 @@ call_init: /* NOTREACHED */ case CT_MESSAGE: - if (!strcasecmp (ci->ci_subtype, "partial")) + if (!mh_strcasecmp (ci->ci_subtype, "partial")) adios (NULL, "sorry, \"#%s/%s\" isn't supported", ci->ci_type, ci->ci_subtype); - if (!strcasecmp (ci->ci_subtype, "external-body")) + if (!mh_strcasecmp (ci->ci_subtype, "external-body")) adios (NULL, "use \"#@type/subtype ... [] ...\" instead of \"#%s/%s\"", ci->ci_type, ci->ci_subtype); use_forw: @@ -3233,7 +3242,7 @@ use_forw: * Message directive * #forw [+folder] [msgs] */ - if (!strcasecmp (ci->ci_type, "forw")) { + if (!mh_strcasecmp (ci->ci_type, "forw")) { int msgnum; char *folder, *arguments[MAXARGS]; struct msgs *mp; @@ -3254,7 +3263,7 @@ use_forw: if (folder) adios (NULL, "only one folder per #forw directive"); else - folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF); + folder = pluspath (cp); } } @@ -3339,7 +3348,7 @@ use_forw: /* * #end */ - if (!strcasecmp (ci->ci_type, "end")) { + if (!mh_strcasecmp (ci->ci_type, "end")) { free_content (ct); *ctp = NULL; return DONE; @@ -3348,14 +3357,14 @@ use_forw: /* * #begin [ alternative | parallel ] */ - if (!strcasecmp (ci->ci_type, "begin")) { + if (!mh_strcasecmp (ci->ci_type, "begin")) { if (!ci->ci_magic) { vrsn = MULTI_MIXED; cp = SubMultiPart[vrsn - 1].kv_key; - } else if (!strcasecmp (ci->ci_magic, "alternative")) { + } else if (!mh_strcasecmp (ci->ci_magic, "alternative")) { vrsn = MULTI_ALTERNATE; cp = SubMultiPart[vrsn - 1].kv_key; - } else if (!strcasecmp (ci->ci_magic, "parallel")) { + } else if (!mh_strcasecmp (ci->ci_magic, "parallel")) { vrsn = MULTI_PARALLEL; cp = SubMultiPart[vrsn - 1].kv_key; } else if (uprf (ci->ci_magic, "digest")) { @@ -3702,7 +3711,7 @@ scan_content (CT ct) int checkboundary, boundaryclash = 0; /* check if clashes with multipart boundary */ int checklinespace, linespace = 0; /* check if any line ends with space */ int checkebcdic, ebcdicunsafe = 0; /* check if contains ebcdic unsafe characters */ - char *cp, buffer[BUFSIZ]; + unsigned char *cp, buffer[BUFSIZ]; struct text *t; FILE *in; CE ce = ct->c_cefile; @@ -3973,7 +3982,7 @@ build_headers (CT ct) * the end of the Content-Type line. */ for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) { - if (mailbody && !strcasecmp (*ap, "body")) + if (mailbody && !mh_strcasecmp (*ap, "body")) continue; vp = add (";", vp); @@ -4325,7 +4334,7 @@ invalid_digest: filename="foo". If it doesn't and value does, use value from that. */ static char * -incl_name_value (char *buf, char *name, char *value) { +incl_name_value (unsigned char *buf, char *name, char *value) { char *newbuf = buf; /* Assume that name is non-null. */ @@ -4334,7 +4343,7 @@ incl_name_value (char *buf, char *name, char *value) { if (! strstr (buf, name_plus_equal)) { char *insertion; - char *cp; + unsigned char *cp; char *prefix, *suffix; /* Trim trailing space, esp. newline. */