Updated to new version

This commit is contained in:
Alexander S. Aganichev 2002-06-10 06:13:37 +00:00
parent 7924145087
commit 9439573390
9 changed files with 816 additions and 231 deletions

31
goldlib/uulib/crc32.h Normal file
View File

@ -0,0 +1,31 @@
#ifndef __crc32_h
#define __crc32_h
/* crc32.h */
/* wrapper for gall library */
typedef unsigned long crc32_t;
#define Z_NULL 0
#define byte(a) ((unsigned char)(a))
extern crc32_t __crc32_table[256];
static crc32_t updCrc32(unsigned char ch, crc32_t crc)
{
return (crc32_t)(__crc32_table[byte(crc) ^ byte(ch)] ^ (crc >> 8));
}
static crc32_t crc32(crc32_t crc, const unsigned char *buf, unsigned int len)
{
if (buf == Z_NULL) return 0L;
crc = crc ^ 0xffffffffL;
while (len--)
{
crc = updCrc32(*buf++, crc);
}
return crc ^ 0xffffffffL;
}
#endif /* __crc32_h */

View File

@ -846,7 +846,7 @@ UUPreProcessPart (fileread *data, int *ret)
}
lastvalid = 0;
}
else if (lastvalid && data->uudet == lastenc && result->partno <= 0) {
else if (lastvalid && data->uudet == lastenc && result->partno == -1) {
result->subfname = _FP_strdup (uucheck_lastname);
result->partno = ++lastpart;
@ -859,7 +859,7 @@ UUPreProcessPart (fileread *data, int *ret)
else if (data->partno != -1 && result->filename) {
result->subfname = _FP_strdup (result->filename);
}
else {
else {
/*
* it's got no info, it's got no begin, and we don't know anything
* about this part. Let's forget all about it.

View File

@ -82,6 +82,7 @@
#define BH_ENCODED (4) /* Binhex encoded */
#define PT_ENCODED (5) /* Plain-Text encoded (MIME) */
#define QP_ENCODED (6) /* Quoted-Printable (MIME) */
#define YENC_ENCODED (7) /* yEnc encoded */
/*
* Option indices for GetOption / SetOption
@ -225,7 +226,8 @@ int UUEXPORT UUEncodeMulti _ANSI_ARGS_((FILE *, FILE *,
int UUEXPORT UUEncodePartial _ANSI_ARGS_((FILE *, FILE *,
char *, int,
char *, char *,
int, int, long));
int, int, long,
unsigned long*));
int UUEXPORT UUEncodeToStream _ANSI_ARGS_((FILE *, FILE *,
char *, int,
char *, int));

File diff suppressed because it is too large Load Diff

View File

@ -233,22 +233,22 @@ static allomap toallocate[] = {
{ &uuestr_itemp, 256 }, /* from uuencode.c:UUEncodeStream() */
{ &uuestr_otemp, 1024 },
{ &uulib_msgstring, 1024 }, /* from uulib.c:UUMessage() */
{ &uuncdl_fulline, 260 }, /* from uunconc.c:UUDecodeLine() */
{ &uuncdp_oline, 1024 }, /* from uunconc.c:UUDecodePart() */
{ &uuncdl_fulline, 300 }, /* from uunconc.c:UUDecodeLine() */
{ &uuncdp_oline, 1200 }, /* from uunconc.c:UUDecodePart() */
{ &uunconc_UUxlat, 256 * sizeof (int) }, /* from uunconc.c:toplevel */
{ &uunconc_UUxlen, 64 * sizeof (int) },
{ &uunconc_B64xlat, 256 * sizeof (int) },
{ &uunconc_XXxlat, 256 * sizeof (int) },
{ &uunconc_BHxlat, 256 * sizeof (int) },
{ &uunconc_save, 3*256 }, /* from uunconc.c:decoding buffer */
{ &uunconc_save, 3*300 }, /* from uunconc.c:decoding buffer */
{ &uuscan_shlline, 1024 }, /* from uuscan.c:ScanHeaderLine() */
{ &uuscan_pvvalue, 256 }, /* from uuscan.c:ParseValue() */
{ &uuscan_phtext, 256 }, /* from uuscan.c:ParseHeader() */
{ &uuscan_sdline, 256 }, /* from uuscan.c:ScanData() */
{ &uuscan_sdbhds1, 256 },
{ &uuscan_sdbhds2, 256 },
{ &uuscan_spline, 256 }, /* from uuscan.c:ScanPart() */
{ &uuutil_bhwtmp, 256 }, /* from uuutil.c:UUbhwrite() */
{ &uuscan_pvvalue, 300 }, /* from uuscan.c:ParseValue() */
{ &uuscan_phtext, 300 }, /* from uuscan.c:ParseHeader() */
{ &uuscan_sdline, 300 }, /* from uuscan.c:ScanData() */
{ &uuscan_sdbhds1, 300 },
{ &uuscan_sdbhds2, 300 },
{ &uuscan_spline, 300 }, /* from uuscan.c:ScanPart() */
{ &uuutil_bhwtmp, 300 }, /* from uuutil.c:UUbhwrite() */
{ NULL, 0 }
};
@ -1094,6 +1094,9 @@ UUInfoFile (uulist *thefile, void *opaque,
else if ((thefile->uudet == UU_ENCODED || thefile->uudet == XX_ENCODED) &&
strncmp (uugen_inbuffer, "begin ", 6) == 0)
break;
else if (thefile->uudet == YENC_ENCODED &&
strncmp (uugen_inbuffer, "=ybegin ", 8) == 0)
break;
if ((*func) (opaque, uugen_inbuffer))
break;

View File

@ -49,6 +49,7 @@
#include <errno.h>
#endif
#include <crc32.h>
#include <uudeview.h>
#include <uuint.h>
#include <fptools.h>
@ -119,6 +120,7 @@ static int uulboundary;
*/
#define ACAST(s) ((int)(unsigned char)(s))
#define isnotvalid(c) (ACAST(c) >= 0x80)
/*
* Initialize decoding tables
@ -297,10 +299,10 @@ UUValidData (char *ptr, int encoding, int *bhflag)
int i=0, j, len=0, suspicious=0, flag=0;
char *s = ptr;
if ((s == NULL) || !(iscntrl(ACAST(*s)) || isascii(ACAST(*s)))) {
return(0); /* bad string */
if ((s == NULL) || (*s == '\0')) {
return 0; /* bad string */
}
while (*s && *s!='\012' && *s!='\015') {
s++;
len++;
@ -319,6 +321,8 @@ UUValidData (char *ptr, int encoding, int *bhflag)
goto _t_B64;
case BH_ENCODED:
goto _t_Binhex;
case YENC_ENCODED:
return YENC_ENCODED;
}
_t_Binhex: /* Binhex Test */
@ -381,8 +385,7 @@ UUValidData (char *ptr, int encoding, int *bhflag)
*/
while (len--) {
if (!(iscntrl(ACAST(*s)) || isascii(ACAST(*s))) ||
(B64xlat[ACAST(*s)] == -1 && *s != '=')) {
if (/* *s < 0 */ isnotvalid(*s) || (B64xlat[ACAST(*s)] == -1 && *s != '=')) {
/* allow space characters at the end of the line if we are sure */
/* that this is Base64 encoded data or the line was long enough */
if (((i>=60 && len<=10) || encoding) && *s++==' ') {
@ -474,8 +477,7 @@ UUValidData (char *ptr, int encoding, int *bhflag)
}
while (len--) {
if (!(iscntrl(ACAST(*s)) || isascii(ACAST(*s))) ||
UUxlat[ACAST(*s++)] < 0) {
if (/* *s < 0 */ isnotvalid(*s) || UUxlat[ACAST(*s++)] < 0) {
if (encoding==UU_ENCODED) return 0;
goto _t_XX; /* bad code character */
}
@ -515,8 +517,7 @@ UUValidData (char *ptr, int encoding, int *bhflag)
return 0; /* bad length */
while(len--) {
if (!(iscntrl(ACAST(*s)) || isascii(ACAST(*s))) ||
XXxlat[ACAST(*s++)] < 0) {
if(/* *s < 0 */ isnotvalid(*s) || XXxlat[ACAST(*s++)] < 0) {
return 0; /* bad code character */
}
}
@ -709,6 +710,22 @@ UUDecodeLine (char *s, char *d, int method)
while (BHxlat[ACAST(*s)] != -1)
uuncdl_fulline[leftover++] = *s++;
}
else if (method == YENC_ENCODED) {
while (*s) {
if (*s == '=') {
if (*++s != '\0') {
d[count++] = (char) ((int) *s - 64 - 42);
s++;
}
}
else if (*s == '\n' || *s == '\r') {
s++; /* ignore */
}
else {
d[count++] = (char) ((int) *s++ - 42);
}
}
}
return count;
}
@ -886,10 +903,16 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
char *line=uugen_fnbuffer, *oline=uuncdp_oline;
int warning=0, vlc=0, lc[2], hadct=0;
int tc=0, tf=0, vflag, haddata=0, haddh=0;
long yefilesize=0, yepartends=0;
crc32_t yepartcrc=crc32(0L, Z_NULL, 0);
static crc32_t yefilecrc=0;
static int bhflag=0;
size_t count=0;
size_t yepartsize=0;
char *ptr;
if (datain == NULL || dataout == NULL) {
yefilecrc = crc32(0L, Z_NULL, 0);
bhflag = 0;
return UURET_OK;
}
@ -910,27 +933,35 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
uulboundary = -1;
if (method == YENC_ENCODED) {
*state = BEGIN;
}
while (!feof (datain) && *state != DONE &&
(ftell(datain)<maxpos || flags&FL_TOEND || maxpos==-1 ||
(!(flags&FL_PROPER) && uu_fast_scanning))) {
if (_FP_fgets (line, 255, datain) == NULL)
if (_FP_fgets (line, 299, datain) == NULL)
break;
if (ferror (datain)) {
UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
uustring (S_SOURCE_READ_ERR),
strerror (uu_errno = errno));
return UURET_IOERR;
}
if (line[0]=='\015' || line[0]=='\012') { /* Empty line? */
if (*state == DATA &&
(method == UU_ENCODED || method == XX_ENCODED))
*state = END;
/*
* if we had a whole block of valid lines before, we reset our
* 'valid data' flag, tf. Without this 'if', we'd break decoding
* files with interleaved blank lines. The value of 5 is chosen
* quite arbitrarly.
*/
if (vlc > 5)
tf = tc = 0;
vlc = 0;
@ -951,7 +982,7 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
* try to make sense of data
*/
line[255] = '\0'; /* For Safety of string functions */
line[299] = '\0'; /* For Safety of string functions */
count = 0;
if (boundary && line[0]=='-' && line[1]=='-' &&
@ -990,9 +1021,9 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
}
if (*state == BEGIN) {
if (strncmp (line, "begin ", 6) == 0 ||
strncmp (line, "section ", 8) == 0 ||
_FP_strnicmp (line, "<pre>begin ", 11) == 0) { /* for LYNX */
if ((method == UU_ENCODED || method == XX_ENCODED) &&
(strncmp (line, "begin ", 6) == 0 ||
_FP_strnicmp (line, "<pre>begin ", 11) == 0)) { /* for LYNX */
*state = DATA;
continue;
}
@ -1004,8 +1035,36 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
else
continue;
}
else
else if (method == YENC_ENCODED &&
strncmp (line, "=ybegin ", 8) == 0 &&
_FP_strstr (line, " name=") != NULL) {
*state = DATA;
if ((ptr = _FP_strstr (line, " size=")) != NULL) {
ptr += 6;
yefilesize = atoi (ptr);
}
else {
yefilesize = -1;
}
if (_FP_strstr (line, " part=") != NULL) {
if (_FP_fgets (line, 299, datain) == NULL) {
break;
}
if ((ptr = _FP_strstr (line, " end=")) == NULL) {
break;
}
yepartends = atoi (ptr + 5);
}
tf = 1;
continue;
}
else {
continue;
}
tc = tf = vlc = 0;
lc[0] = lc[1] = 0;
@ -1017,6 +1076,44 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
break;
}
}
if (*state == DATA && method == YENC_ENCODED &&
strncmp (line, "=yend ", 6) == 0) {
if ((ptr = _FP_strstr (line, " pcrc32=")) != NULL) {
crc32_t pcrc32 = strtoul (ptr + 8, NULL, 16);
if (pcrc32 != yepartcrc) {
UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
uustring (S_PCRC_MISMATCH), progress.curfile, progress.partno);
}
}
if ((ptr = _FP_strstr (line, " crc32=")) != NULL)
{
crc32_t fcrc32 = strtoul (ptr + 7, NULL, 16);
if (fcrc32 != yefilecrc) {
UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
uustring (S_CRC_MISMATCH), progress.curfile);
}
}
if ((ptr = _FP_strstr (line, " size=")) != NULL)
{
size_t size = atol(ptr + 6);
if (size != yepartsize && yefilesize != -1) {
if (size != yefilesize)
UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
uustring (S_PSIZE_MISMATCH), progress.curfile,
progress.partno, yepartsize, size);
else
UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
uustring (S_SIZE_MISMATCH), progress.curfile,
yepartsize, size);
}
}
if (yepartends == 0 || yepartends >= yefilesize) {
*state = DONE;
}
break;
}
if (*state == DATA || *state == END) {
if (method==B64ENCODED && line[0]=='-' && line[1]=='-' && tc) {
break;
@ -1036,9 +1133,14 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
}
if (vflag == method) {
if (tf || (method == UU_ENCODED || method == XX_ENCODED)) {
if (tf) {
count = UUDecodeLine (line, oline, method);
tf = 1;
if (method == YENC_ENCODED) {
if (yepartends)
yepartcrc = crc32(yepartcrc, (unsigned char *) oline, count);
yefilecrc = crc32(yefilecrc, (unsigned char *) oline, count);
yepartsize += count;
}
vlc++; lc[1]++;
}
else if (tc == 3) {
@ -1066,6 +1168,7 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
else {
_FP_strncpy (save[tc++], line, 256);
}
if (method == UU_ENCODED)
*state = (line[0] == 'M') ? DATA : END;
else if (method == XX_ENCODED)
@ -1084,6 +1187,7 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
else if (*state != DONE) {
return UURET_NOEND;
}
if (count) {
if (method == BH_ENCODED) {
if (UUbhwrite (oline, 1, count, dataout) != count) {

View File

@ -326,8 +326,8 @@ static headers *
ParseHeader (headers *theheaders, char *line)
{
char **variable=NULL;
char *value, *ptr, *thenew;
int delimit, length;
char *value = NULL, *ptr, *thenew;
int delimit = 0, length;
if (line == NULL)
return theheaders;
@ -417,16 +417,12 @@ ParseHeader (headers *theheaders, char *line)
}
}
variable = NULL;
value = NULL;
delimit = 0;
}
else {
/*
* nothing interesting
*/
variable = NULL;
value = NULL;
delimit = 0;
return theheaders;
}
/*
@ -527,6 +523,7 @@ ScanData (FILE *datei, char *fname, int *errcode,
int encoding=0, dflag=0, ctline=42;
int dontcare=0, hadnl=0;
long preheaders=0, oldposition;
long yefilesize=0, yepartends=0;
size_t dcc, bhopc;
*errcode = UURET_OK;
@ -550,12 +547,12 @@ ScanData (FILE *datei, char *fname, int *errcode,
while (!feof (datei)) {
oldposition = ftell (datei);
if (_FP_fgets (line, 255, datei) == NULL)
if (_FP_fgets (line, 299, datei) == NULL)
break;
if (ferror (datei))
break;
line[255] = '\0'; /* For Safety of string functions */
line[299] = '\0'; /* For Safety of string functions */
/*
* Make Busy Polls
@ -671,7 +668,9 @@ ScanData (FILE *datei, char *fname, int *errcode,
continue;
}
if ((strncmp (line, "end", 3) == 0) && result->uudet != BH_ENCODED) {
if ((strncmp (line, "end", 3) == 0) &&
result->uudet != BH_ENCODED &&
result->uudet != YENC_ENCODED) {
if (result->uudet == B64ENCODED && result->begin)
result->uudet = XX_ENCODED;
@ -686,20 +685,16 @@ ScanData (FILE *datei, char *fname, int *errcode,
hadnl = 0;
/*
* Detect a UUDeview/UUCODE-Style headers
* Detect a UUDeview-Style header
*/
if (_FP_strnicmp (line, "_=_ Part ", 9) == 0 ||
_FP_strnicmp (line, "section ", 8) == 0) {
if (_FP_strnicmp (line, "_=_ Part ", 9) == 0 &&
result->uudet != YENC_ENCODED) {
if (result->uudet) {
fseek (datei, oldposition, SEEK_SET);
break;
}
result->partno = atoi (line + 8);
if ((ptr = _FP_stristr (line, " of ")) != NULL) {
int maxpno = atoi (ptr + 4);
if(maxpno != 0) result->maxpno = maxpno;
}
if ((ptr = _FP_stristr (line, "of file ")) != NULL) {
ptr += 8;
while (isspace (*ptr)) ptr++;
@ -726,7 +721,8 @@ ScanData (FILE *datei, char *fname, int *errcode,
* Some reduced MIME handling. Only use if boundary == NULL. Also
* accept the "X-Orcl-Content-Type" used by some braindead program.
*/
if (boundary == NULL && !ismime && !uu_more_mime) {
if (boundary == NULL && !ismime && !uu_more_mime &&
result->uudet != YENC_ENCODED) {
if (_FP_strnicmp (line, "Content-Type", 12) == 0 ||
_FP_strnicmp (line, "X-Orcl-Content-Type", 19) == 0) {
/*
@ -853,6 +849,89 @@ ScanData (FILE *datei, char *fname, int *errcode,
}
}
/*
* Detection for yEnc encoding
*/
if (strncmp (line, "=ybegin ", 8) == 0 &&
_FP_strstr (line, " name=") != NULL) {
if ((result->begin || result->end) && !uu_more_mime) {
fseek (datei, oldposition, SEEK_SET);
break;
}
/*
* name continues to the end of the line
*/
_FP_free (result->filename);
ptr = _FP_strstr (line, " name=") + 6;
result->filename = _FP_strdup (ptr);
while (isspace (result->filename[strlen(result->filename)-1]))
result->filename[strlen(result->filename)-1] = '\0';
/*
* Determine size
*/
if ((ptr = _FP_strstr (line, " size=")) != NULL) {
ptr += 6;
yefilesize = atoi (ptr);
}
else {
yefilesize = -1;
}
/*
* check for multipart file and read =ypart line
*/
if ((ptr = _FP_strstr (line, " part=")) != NULL) {
result->partno = atoi (ptr + 6);
if (result->partno == 1) {
result->begin = 1;
}
if (_FP_fgets (line, 255, datei) == NULL) {
break;
}
line[255] = '\0';
if (strncmp (line, "=ypart ", 7) != 0) {
break;
}
if ((ptr = _FP_strstr (line, " end=")) == NULL) {
break;
}
yepartends = atoi (ptr + 5);
}
else {
result->partno = 1;
result->begin = 1;
}
/*
* Don't want auto-detection
*/
result->uudet = YENC_ENCODED;
continue;
}
if (strncmp (line, "=yend ", 6) == 0 &&
result->uudet == YENC_ENCODED) {
if (yepartends == 0 || yepartends >= yefilesize) {
result->end = 1;
}
if (!uu_more_mime)
break;
}
/*
* if we haven't yet found anything encoded, try to find something
*/
@ -1202,7 +1281,8 @@ ScanData (FILE *datei, char *fname, int *errcode,
result->begin = result->end = 0;
/* Base64 and BinHex don't have a file mode */
if (result->uudet == B64ENCODED || result->uudet == BH_ENCODED)
if (result->uudet == B64ENCODED || result->uudet == BH_ENCODED ||
result->uudet == YENC_ENCODED)
result->mode = 6*64+4*8+4;
/*
@ -1997,6 +2077,7 @@ ScanPart (FILE *datei, char *fname, int *errcode)
return NULL;
}
}
/*
* So this subpart is either plain text or something else. Check
* the Content-Type and Content-Transfer-Encoding. If the latter
@ -2009,10 +2090,17 @@ ScanPart (FILE *datei, char *fname, int *errcode)
* This is done because users might `attach' a uuencoded file, which
* would then be correctly typed as `text/plain'.
*/
if (_FP_stristr (localenv.ctenc, "base64") != NULL)
result->uudet = B64ENCODED;
else if (_FP_stristr (localenv.ctenc, "x-uue") != NULL)
else if (_FP_stristr (localenv.ctenc, "x-uue") != NULL) {
result->uudet = UU_ENCODED;
result->begin = result->end = 1;
}
else if (_FP_stristr (localenv.ctenc, "x-yenc") != NULL) {
result->uudet = YENC_ENCODED;
result->begin = result->end = 1;
}
else if (_FP_stristr (localenv.ctenc, "quoted-printable") != NULL)
result->uudet = QP_ENCODED;
else if (_FP_stristr (localenv.ctenc, "7bit") != NULL ||
@ -2450,8 +2538,14 @@ ScanPart (FILE *datei, char *fname, int *errcode)
result->uudet = QP_ENCODED;
else if (_FP_stristr (localenv.ctenc, "base64") != NULL)
result->uudet = B64ENCODED;
else if (_FP_stristr (localenv.ctenc, "x-uue") != NULL)
else if (_FP_stristr (localenv.ctenc, "x-uue") != NULL) {
result->uudet = UU_ENCODED;
result->begin = result->end = 1;
}
else if (_FP_stristr (localenv.ctenc, "x-yenc") != NULL) {
result->uudet = YENC_ENCODED;
result->begin = result->end = 1;
}
else if (_FP_stristr (localenv.ctenc, "7bit") != NULL ||
_FP_stristr (localenv.ctenc, "8bit") != NULL)
result->uudet = PT_ENCODED;
@ -2610,13 +2704,13 @@ ScanPart (FILE *datei, char *fname, int *errcode)
result->subject = _FP_strdup (sstate.envelope.subject);
}
result->partno = sstate.envelope.partno;
if (sstate.envelope.partno == 1)
result->begin = 1;
result->maxpno = sstate.envelope.numparts;
result->flags = FL_PARTIAL |
((res==1 || uu_fast_scanning) ? FL_PROPER : 0) |
((uu_fast_scanning) ? FL_TOEND : 0);
result->mimeid = _FP_strdup (sstate.envelope.mimeid);
if (result->partno == 1)
result->begin = 1;
if (uu_fast_scanning)
result->length = progress.fsize - result->startpos;
@ -2665,11 +2759,13 @@ ScanPart (FILE *datei, char *fname, int *errcode)
* that we've had a Content-Disposition field, and we should probably
* decode a plain-text segment with a filename.
*/
if (sstate.isfolder && sstate.ismime &&
sstate.mimestate == MS_BODY &&
(_FP_stristr (sstate.envelope.ctenc, "quoted-printable") != NULL ||
_FP_stristr (sstate.envelope.ctenc, "base64") != NULL ||
_FP_stristr (sstate.envelope.ctenc, "x-uue") != NULL ||
_FP_stristr (sstate.envelope.ctenc, "x-yenc") != NULL ||
_FP_stristr (sstate.envelope.ctype, "message") != NULL ||
sstate.envelope.fname != NULL)) {
@ -2687,8 +2783,13 @@ ScanPart (FILE *datei, char *fname, int *errcode)
result->uudet = QP_ENCODED;
else if (_FP_stristr (sstate.envelope.ctenc, "base64") != NULL)
result->uudet = B64ENCODED;
else if (_FP_stristr (sstate.envelope.ctenc, "x-uue") != NULL)
else if (_FP_stristr (sstate.envelope.ctenc, "x-uue") != NULL) {
result->uudet = UU_ENCODED;
result->begin = result->end = 1;
}
else if (_FP_stristr (sstate.envelope.ctenc, "x-yenc") != NULL) {
result->uudet = YENC_ENCODED;
}
else if (_FP_stristr (sstate.envelope.ctenc, "7bit") != NULL ||
_FP_stristr (sstate.envelope.ctenc, "8bit") != NULL)
result->uudet = PT_ENCODED;
@ -2916,7 +3017,8 @@ ScanPart (FILE *datei, char *fname, int *errcode)
while (*ptr1 && !isspace(*ptr1))
ptr1++;
*ptr1 = '\0';
sstate.envelope.mimevers = _FP_strdup ("1.0");
sstate.envelope.boundary = _FP_strdup (line+2);
/*
@ -2954,16 +3056,23 @@ ScanPart (FILE *datei, char *fname, int *errcode)
UUkillfread (result);
return NULL;
}
/*
* produce result
*/
if (result->uudet == 0 && uu_handletext) {
result->startpos = before; /* display headers */
result->uudet = PT_ENCODED;
result->partno = 1;
}
if (sstate.envelope.fname) {
if (result->uudet == YENC_ENCODED && result->filename != NULL) {
/*
* prevent replacing the filename found on the =ybegin line
*/
}
else if (sstate.envelope.fname) {
_FP_free (result->filename);
if ((result->filename = _FP_strdup (sstate.envelope.fname)) == NULL)
*errcode = UURET_NOMEM;
@ -2977,6 +3086,7 @@ ScanPart (FILE *datei, char *fname, int *errcode)
else {
/* assign a filename lateron */
}
if (result->subject == NULL) {
if (sstate.envelope.subject)
result->subject = _FP_strdup (sstate.envelope.subject);

View File

@ -86,6 +86,10 @@ static stringmap messages[] = {
{ S_DECODE_CANCEL, "Decode operation canceled" },
{ S_ENCODE_CANCEL, "Encode operation canceled" },
{ S_SCAN_CANCEL, "Scanning canceled" },
{ S_SIZE_MISMATCH, "%s: Decoded size (%ld) does not match expected size (%ld)" },
{ S_PSIZE_MISMATCH, "%s part %d: Decoded size (%ld) does not match expected size (%ld)" },
{ S_CRC_MISMATCH, "CRC32 mismatch in %s. Decoded file probably corrupt." },
{ S_PCRC_MISMATCH, "PCRC32 mismatch in %s part %d. Decoded file probably corrupt." },
/* informational messages */
{ S_LOADED_PART, "Loaded from %s: '%s' (%s): %s part %d %s %s %s" },
@ -128,8 +132,8 @@ char *uuretcodes[] = {
* Names of encoding types
*/
char *codenames[7] = {
"", "UUdata", "Base64", "XXdata", "Binhex", "Text", "Text"
char *codenames[8] = {
"", "UUdata", "Base64", "XXdata", "Binhex", "Text", "Text", "yEnc"
};
/*

View File

@ -1,4 +1,4 @@
/* extracted from Id: uustring.c,v 1.6 2001/06/06 18:21:47 fp Exp */
/* extracted from Id: uustring.c,v 1.8 2002/03/11 09:15:47 fp Exp */
#define S_NOT_OPEN_SOURCE 1
#define S_NOT_OPEN_TARGET 2
#define S_NOT_OPEN_FILE 3
@ -19,16 +19,20 @@
#define S_DECODE_CANCEL 18
#define S_ENCODE_CANCEL 19
#define S_SCAN_CANCEL 20
#define S_LOADED_PART 21
#define S_NO_DATA_FOUND 22
#define S_NO_BIN_FILE 23
#define S_STRIPPED_SETUID 24
#define S_DATA_SUSPICIOUS 25
#define S_NO_TEMP_NAME 26
#define S_BINHEX_SIZES 27
#define S_BINHEX_BOTH 28
#define S_SMERGE_MERGED 29
#define S_MIME_NO_BOUNDARY 30
#define S_MIME_B_NOT_FOUND 31
#define S_MIME_MULTI_DEPTH 32
#define S_MIME_PART_MULTI 33
#define S_SIZE_MISMATCH 21
#define S_PSIZE_MISMATCH 22
#define S_CRC_MISMATCH 23
#define S_PCRC_MISMATCH 24
#define S_LOADED_PART 25
#define S_NO_DATA_FOUND 26
#define S_NO_BIN_FILE 27
#define S_STRIPPED_SETUID 28
#define S_DATA_SUSPICIOUS 29
#define S_NO_TEMP_NAME 30
#define S_BINHEX_SIZES 31
#define S_BINHEX_BOTH 32
#define S_SMERGE_MERGED 33
#define S_MIME_NO_BOUNDARY 34
#define S_MIME_B_NOT_FOUND 35
#define S_MIME_MULTI_DEPTH 36
#define S_MIME_PART_MULTI 37