X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fmhparse.c;h=01170a1415018e77c029a9df0d11fdf9ff94d721;hp=483ad8473ba32e18d8c3d5e7aa7bdeed5d797b36;hb=d1fefd9f614e4dc3cda16da6c69133c1b2005269;hpb=31dc797eb5178970d68962ca8939da3fd9a8efda diff --git a/uip/mhparse.c b/uip/mhparse.c index 483ad84..01170a1 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -23,10 +23,6 @@ extern int endian; /* mhmisc.c */ extern pid_t xpid; /* mhshowsbr.c */ -/* cache policies */ -extern int rcachesw; /* mhcachesbr.c */ -extern int wcachesw; /* mhcachesbr.c */ - /* ** Directory to place temp files. This must ** be set before these routines are called. @@ -80,9 +76,6 @@ struct k2v SubApplication[] = { }; -/* mhcachesbr.c */ -int find_cache(CT, int, int *, char *, char *, int); - /* mhmisc.c */ int part_ok(CT, int); int type_ok(CT, int); @@ -1873,7 +1866,7 @@ openQuoted(CT ct, char **file) int cc, len, quoted, own_ct_fp = 0; unsigned char *cp, *ep; char buffer[BUFSIZ]; - unsigned char mask; + unsigned char mask = 0; CE ce; /* sbeck -- handle suffixes */ CI ci; @@ -1947,9 +1940,6 @@ openQuoted(CT ct, char **file) } quoted = 0; -#ifdef lint - mask = 0; -#endif fseek(ct->c_fp, ct->c_begin, SEEK_SET); while (len > 0) { @@ -2273,8 +2263,6 @@ clean_up: static int openExternal(CT ct, CT cb, CE ce, char **file, int *fd) { - char cachefile[BUFSIZ]; - if (ce->ce_fp) { fseek(ce->ce_fp, 0L, SEEK_SET); goto ready_already; @@ -2289,17 +2277,6 @@ openExternal(CT ct, CT cb, CE ce, char **file, int *fd) goto ready_already; } - if (find_cache(ct, rcachesw, (int *) 0, cb->c_id, - cachefile, sizeof(cachefile)) != NOTOK) { - if ((ce->ce_fp = fopen(cachefile, "r"))) { - ce->ce_file = getcpy(cachefile); - ce->ce_unlink = 0; - goto ready_already; - } else { - admonish(cachefile, "unable to fopen for reading"); - } - } - return OK; ready_already: @@ -2322,8 +2299,7 @@ InitFile(CT ct) static int openFile(CT ct, char **file) { - int fd, cachetype; - char cachefile[BUFSIZ]; + int fd; struct exbody *e = ct->c_ctexbody; CE ce = ct->c_cefile; @@ -2349,39 +2325,6 @@ openFile(CT ct, char **file) return NOTOK; } - 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; - FILE *fp; - - mask = umask(cachetype ? ~m_gmprot() : 0222); - if ((fp = fopen(cachefile, "w"))) { - int cc; - char buffer[BUFSIZ]; - FILE *gp = ce->ce_fp; - - fseek(gp, 0L, SEEK_SET); - - while ((cc = fread(buffer, sizeof(*buffer), - sizeof(buffer), gp)) > 0) - fwrite(buffer, sizeof(*buffer), cc, fp); - fflush(fp); - - if (ferror(gp)) { - admonish(ce->ce_file, "error reading"); - unlink(cachefile); - } else if (ferror(fp)) { - admonish(cachefile, "error writing"); - unlink(cachefile); - } - fclose(fp); - } - umask(mask); - } - fseek(ce->ce_fp, 0L, SEEK_SET); *file = ce->ce_file; return fileno(ce->ce_fp); @@ -2401,10 +2344,10 @@ InitFTP(CT ct) static int openFTP(CT ct, char **file) { - int cachetype, caching, fd; + int fd; int len, buflen; char *bp, *ftp, *user, *pass; - char buffer[BUFSIZ], cachefile[BUFSIZ]; + char buffer[BUFSIZ]; struct exbody *e; CE ce; static char *username = NULL; @@ -2494,23 +2437,9 @@ openFTP(CT ct, char **file) } ce->ce_unlink = (*file == NULL); - caching = 0; - cachefile[0] = '\0'; - 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) { - ce->ce_unlink = 0; - caching = 1; - } - } if (*file) ce->ce_file = getcpy(*file); - else if (caching) - ce->ce_file = getcpy(cachefile); else ce->ce_file = getcpy(m_mktemp(tmp, NULL, NULL)); @@ -2557,38 +2486,6 @@ openFTP(CT ct, char **file) break; } - if (cachefile[0]) { - if (caching) - chmod(cachefile, cachetype ? m_gmprot() : 0444); - else { - int mask; - FILE *fp; - - mask = umask(cachetype ? ~m_gmprot() : 0222); - if ((fp = fopen(cachefile, "w"))) { - int cc; - FILE *gp = ce->ce_fp; - - fseek(gp, 0L, SEEK_SET); - - while ((cc= fread(buffer, sizeof(*buffer), - sizeof(buffer), gp)) > 0) - fwrite(buffer, sizeof(*buffer), cc, fp); - fflush(fp); - - if (ferror(gp)) { - admonish(ce->ce_file, "error reading"); - unlink(cachefile); - } else if (ferror(fp)) { - admonish(cachefile, "error writing"); - unlink(cachefile); - } - fclose(fp); - } - umask(mask); - } - } - fseek(ce->ce_fp, 0L, SEEK_SET); *file = ce->ce_file; return fileno(ce->ce_fp);