Package: mpack
Severity: normal
Tags: patch
I've uploaded an NMU for mpack which fixes several issues.
Patch attached.
Gruesse,
Frank Lichtenheld
-- System Information:
Debian Release: testing/unstable
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.8-2-k7
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
diff -Naur mpack-1.6.bak/codes.c mpack-1.6/codes.c
--- mpack-1.6.bak/codes.c 2003-07-21 22:51:08.000000000 +0200
+++ mpack-1.6/codes.c 2005-08-06 23:12:52.442290032 +0200
@@ -128,7 +128,7 @@
int nbytes;
MD5Init(&context);
- while (nbytes = fread(buf, 1, sizeof(buf), infile)) {
+ while ((nbytes = fread(buf, 1, sizeof(buf), infile))) {
length += nbytes;
MD5Update(&context, buf, nbytes);
}
diff -Naur mpack-1.6.bak/debian/changelog mpack-1.6/debian/changelog
--- mpack-1.6.bak/debian/changelog 2005-08-06 22:54:52.816418112 +0200
+++ mpack-1.6/debian/changelog 2005-08-06 23:25:57.507941912 +0200
@@ -1,3 +1,19 @@
+mpack (1.6-1.1) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Include patch by Daniel Schepler (based on earlier patches
+ by Roger Leigh and Andreas Jochens) to fix FTBFS with
+ gcc 4.0 (Closes: #260652) and other code problems
+ (Closes: #153187)
+ * Change priority to optional, I see no reason why this should be
+ standard.
+ * Remove inewsinn from suggests as it isn't in the archive anymore
+ (Closes: #243737)
+ * Fix typo in munpack man page (Closes: #311460)
+ * Bump Standards-Version to 3.6.2 (no changes)
+
+ -- Frank Lichtenheld <[EMAIL PROTECTED]> Sat, 6 Aug 2005 23:12:56 +0200
+
mpack (1.6-1) unstable; urgency=low
* New upstream version, incorporating a number of Debian patches.
diff -Naur mpack-1.6.bak/debian/control mpack-1.6/debian/control
--- mpack-1.6.bak/debian/control 2005-08-06 22:54:52.817417960 +0200
+++ mpack-1.6/debian/control 2005-08-06 23:25:39.758640216 +0200
@@ -1,13 +1,13 @@
Source: mpack
Section: mail
-Priority: standard
+Priority: optional
Maintainer: Richard Braakman <[EMAIL PROTECTED]>
-Standards-Version: 3.6.0
+Standards-Version: 3.6.2
Package: mpack
Architecture: any
Depends: ${shlibs:Depends}
-Suggests: mail-transport-agent, inewsinn | inews
+Suggests: mail-transport-agent, inews
Description: tools for encoding/decoding MIME messages
Mpack and munpack are utilities for encoding and decoding
(respectively) binary files in MIME (Multipurpose Internet
diff -Naur mpack-1.6.bak/decode.c mpack-1.6/decode.c
--- mpack-1.6.bak/decode.c 2003-07-21 22:47:54.000000000 +0200
+++ mpack-1.6/decode.c 2005-08-06 23:12:52.443289880 +0200
@@ -26,8 +26,10 @@
* SOFTWARE. */
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <ctype.h>
+#include <unistd.h>
#include "xmalloc.h"
#include "common.h"
#include "part.h"
@@ -37,6 +39,19 @@
extern FILE *os_newtypedfile(char *fname, char *contentType, int flags, params
contentParams);
extern FILE *os_createnewfile(char *fname);
extern char *md5contextTo64(MD5_CTX *context);
+extern void warn(char *s);
+extern void os_perror(char *str);
+extern void chat(char *s);
+extern void os_donewithdir(char *dir);
+extern void os_warnMD5mismatch(void);
+extern void os_closetypedfile(FILE *outfile);
+
+extern int part_depth(struct part *part);
+extern void part_ungets(char *s, struct part *part);
+extern void part_close(struct part *part);
+extern int part_fill(struct part *part);
+extern void part_addboundary(struct part *part, char *boundary);
+extern int part_readboundary(struct part *part);
/* The possible content transfer encodings */
enum encoding { enc_none, enc_qp, enc_base64 };
@@ -49,6 +64,17 @@
void from64(struct part *inpart, FILE *outfile, char **digestp, int
suppressCR);
void fromqp(struct part *inpart, FILE *outfile, char **digestp);
void fromnone(struct part *inpart, FILE *outfile, char **digestp);
+int handlePartial(struct part *inpart, char *headers, params contentParams,
+ int extractText);
+int ignoreMessage(struct part *inpart);
+int handleMultipart(struct part *inpart, char *contentType,
+ params contentParams, int extractText);
+int handleUuencode(struct part *inpart, char *subject, int extractText);
+int handleText(struct part *inpart, enum encoding contentEncoding);
+int saveToFile(struct part *inpart, int inAppleDouble, char *contentType,
+ params contentParams, enum encoding contentEncoding,
+ char *contentDisposition, char *contentMD5);
+
/*
* Read and handle an RFC 822 message from the body-part 'inpart'.
*/
@@ -624,7 +650,7 @@
}
thispart = atoi(p);
- if (p = getParam(contentParams, "total")) {
+ if ((p = getParam(contentParams, "total"))) {
nparts = atoi(p);
if (nparts <= 0) {
warn("partial message has invalid number of parts");
@@ -643,7 +669,7 @@
else {
/* Try to retrieve number of parts from reassembly directory */
sprintf(buf, "%sCT", dir);
- if (partfile = fopen(buf, "r")) {
+ if ((partfile = fopen(buf, "r"))) {
if (fgets(buf, sizeof(buf), partfile)) {
nparts = atoi(buf);
if (nparts < 0) nparts = 0;
diff -Naur mpack-1.6.bak/encode.c mpack-1.6/encode.c
--- mpack-1.6.bak/encode.c 2003-07-21 22:35:31.000000000 +0200
+++ mpack-1.6/encode.c 2005-08-06 23:12:52.443289880 +0200
@@ -23,12 +23,15 @@
* SOFTWARE.
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
extern char *magic_look(FILE *infile);
extern char *os_genid(void);
extern FILE *os_createnewfile(char *fname);
extern char *md5digest(FILE *infile, long int *len);
+extern void os_perror(char *str);
+extern int to64(FILE *infile, FILE *outfile, long int limit);
#define NUMREFERENCES 4
@@ -43,7 +46,7 @@
char *type;
FILE *outfile;
char *cleanfname, *p;
- char *digest, *appledigest;
+ char *digest, *appledigest = NULL;
long filesize, l, written;
int thispart, numparts = 1;
int wrotefiletype = 0;
@@ -57,12 +60,12 @@
/* This filename-cleaning knowledge will probably
* be moved to the os layer in a future version.
*/
- if (p = strrchr(cleanfname, '.')) cleanfname = p+1;
+ if ((p = strrchr(cleanfname, '.'))) cleanfname = p+1;
#else
- if (p = strrchr(cleanfname, '/')) cleanfname = p+1;
- if (p = strrchr(cleanfname, '\\')) cleanfname = p+1;
+ if ((p = strrchr(cleanfname, '/'))) cleanfname = p+1;
+ if ((p = strrchr(cleanfname, '\\'))) cleanfname = p+1;
#endif
- if (p = strrchr(cleanfname, ':')) cleanfname = p+1;
+ if ((p = strrchr(cleanfname, ':'))) cleanfname = p+1;
/* Find file type */
if (typeoverride) {
diff -Naur mpack-1.6.bak/magic.c mpack-1.6/magic.c
--- mpack-1.6.bak/magic.c 2003-07-21 22:35:31.000000000 +0200
+++ mpack-1.6/magic.c 2005-08-06 23:12:52.444289728 +0200
@@ -23,6 +23,7 @@
* SOFTWARE.
*/
#include <stdio.h>
+#include <string.h>
/* Description of the various file formats and their magic numbers */
struct magic {
diff -Naur mpack-1.6.bak/md5.h mpack-1.6/md5.h
--- mpack-1.6.bak/md5.h 2003-07-21 22:35:31.000000000 +0200
+++ mpack-1.6/md5.h 2005-08-06 23:12:52.445289576 +0200
@@ -34,14 +34,16 @@
#define PROTOTYPES 0
#endif
+#include <stdint.h>
+
/* POINTER defines a generic pointer type */
typedef unsigned char *POINTER;
/* UINT2 defines a two byte word */
-typedef unsigned short int UINT2;
+typedef uint16_t UINT2;
/* UINT4 defines a four byte word */
-typedef unsigned long int UINT4;
+typedef uint32_t UINT4;
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
diff -Naur mpack-1.6.bak/part.c mpack-1.6/part.c
--- mpack-1.6.bak/part.c 2005-08-06 22:54:52.814418416 +0200
+++ mpack-1.6/part.c 2005-08-06 23:12:52.445289576 +0200
@@ -27,6 +27,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "part.h"
diff -Naur mpack-1.6.bak/unixos.c mpack-1.6/unixos.c
--- mpack-1.6.bak/unixos.c 2005-08-06 22:54:52.813418568 +0200
+++ mpack-1.6/unixos.c 2005-08-06 23:12:52.445289576 +0200
@@ -23,17 +23,23 @@
* SOFTWARE.
*/
#include <stdio.h>
+#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
+#include <sys/stat.h>
#include <sys/param.h>
+#include <time.h>
#include <netdb.h>
#include <fcntl.h>
+#include <unistd.h>
#include "xmalloc.h"
#include "common.h"
#include "part.h"
+extern void warn(char *s);
+
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 64
#endif
@@ -41,8 +47,6 @@
#ifndef errno
extern int errno;
#endif
-extern char *malloc();
-extern char *getenv();
int overwrite_files = 0;
int didchat;
@@ -78,7 +82,7 @@
}
result = malloc(25+strlen(hostname));
- sprintf(result, "[EMAIL PROTECTED]", pid, curtime++, hostname);
+ sprintf(result, "[EMAIL PROTECTED]", pid, (unsigned long) curtime++,
hostname);
return result;
}
@@ -196,7 +200,7 @@
do {
if (outfile) fclose(outfile);
sprintf(buf, "part%d", ++filesuffix);
- } while (outfile = fopen(buf, "r"));
+ } while ((outfile = fopen(buf, "r")));
fname = buf;
}
else if (!overwrite_files && (outfile = fopen(fname, "r"))) {
@@ -204,7 +208,7 @@
fclose(outfile);
sprintf(buf, "%s.%d", fname, ++filesuffix);
- } while (outfile = fopen(buf, "r"));
+ } while ((outfile = fopen(buf, "r")));
fname = buf;
}
@@ -230,7 +234,7 @@
p = strchr(descfname, '/');
if (!p) p = descfname;
- if (p = strrchr(p, '.')) *p = '\0';
+ if ((p = strrchr(p, '.'))) *p = '\0';
strcat(descfname, ".desc");
(void) rename(TEMPFILENAME, descfname);
diff -Naur mpack-1.6.bak/unixpk.c mpack-1.6/unixpk.c
--- mpack-1.6.bak/unixpk.c 2005-08-06 22:54:52.812418720 +0200
+++ mpack-1.6/unixpk.c 2005-08-06 23:12:52.445289576 +0200
@@ -23,22 +23,26 @@
* SOFTWARE.
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <getopt.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
#include "common.h"
#include "version.h"
#include "xmalloc.h"
#define MAXADDRESS 100
-extern char *getenv();
-
-extern int optind;
-extern char *optarg;
-
void usage(void);
void sendmail(FILE *infile, char **addr, int start);
void inews(FILE *infile);
+void os_perror(char *str);
+int encode(FILE *infile, FILE *applefile, char *fname, FILE *descfile,
+ char *subject, char *headers, long int maxsize,
+ char *typeoverride, char *outfname);
int main(int argc, char **argv)
{
@@ -154,7 +158,7 @@
fprintf(stderr, "A subject is required\n");
usage();
}
- if (p = strchr(sbuf, '\n')) *p = '\0';
+ if ((p = strchr(sbuf, '\n'))) *p = '\0';
subject = sbuf;
}
diff -Naur mpack-1.6.bak/unixunpk.c mpack-1.6/unixunpk.c
--- mpack-1.6.bak/unixunpk.c 2005-08-06 22:54:52.813418568 +0200
+++ mpack-1.6/unixunpk.c 2005-08-06 23:12:52.445289576 +0200
@@ -23,17 +23,19 @@
* SOFTWARE.
*/
#include <stdio.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <unistd.h>
#include "version.h"
#include "part.h"
-extern int optind;
-extern char *optarg;
-
extern int overwrite_files;
extern int didchat;
int quiet;
void usage(void);
+int handleMessage(struct part *inpart, char *defaultContentType,
+ int inAppleDouble, int extractText);
int main(int argc, char **argv)
{
diff -Naur mpack-1.6.bak/unixunpk.man mpack-1.6/unixunpk.man
--- mpack-1.6.bak/unixunpk.man 2005-08-06 22:54:52.816418112 +0200
+++ mpack-1.6/unixunpk.man 2005-08-06 23:21:57.796383608 +0200
@@ -50,7 +50,7 @@
appends ".1", ".2", etc to find a nonexistent file.
.TP
.B \-q
-Be quiet. Supresses messages about saving partial messages and about
+Be quiet. Suppresses messages about saving partial messages and about
messages with no interesting information.
.TP
.B \-t
diff -Naur mpack-1.6.bak/uudecode.c mpack-1.6/uudecode.c
--- mpack-1.6.bak/uudecode.c 2005-08-06 22:54:52.814418416 +0200
+++ mpack-1.6/uudecode.c 2005-08-06 23:12:52.446289424 +0200
@@ -23,8 +23,10 @@
* SOFTWARE.
*/
#include <stdio.h>
+#include <stdlib.h>
#include <ctype.h>
#include <string.h>
+#include <unistd.h>
#include "xmalloc.h"
#include "common.h"
#include "part.h"
@@ -32,10 +34,25 @@
extern char *os_idtodir(char *id);
extern FILE *os_newtypedfile(char *fname, char *contentType, int flags, params
contentParams);
extern FILE *os_createnewfile(char *fname);
+extern int os_binhex(struct part *inpart, int part, int nparts);
+extern void os_closetypedfile(FILE *outfile);
+extern void os_donewithdir(char *dir);
+extern void os_perror(char *str);
+extern void chat(char *s);
+
+extern void part_ungets(char *s, struct part *part);
+extern void part_close(struct part *part);
+extern int handleMessage(struct part *inpart, char *defaultContentType,
+ int inAppleDouble, int extractText);
static FILE *startDescFile(char *fname);
static void uudecodeline(char *line, FILE *outfile);
+int parseSubject(char *subject, char **fnamep, int *partp, int *npartsp);
+int saveUuFile(struct part *inpart, char *fname, int part, int nparts,
+ char *firstline);
+int descEnd(char *line);
+int uudecodefiles(char *dir, int nparts);
/* Length of a normal uuencoded line, including newline */
#define UULENGTH 62
@@ -267,7 +284,7 @@
}
else if (part == 1 && fname && !descfile &&
!strncasecmp(buf, "x-file-desc: ", 13)) {
- if (descfile = startDescFile(fname)) {
+ if ((descfile = startDescFile(fname))) {
fputs(buf+13, descfile);
fclose(descfile);
descfile = 0;
@@ -455,7 +472,7 @@
/* Retrieve any previously saved number of the last part */
if (nparts == 0) {
sprintf(buf, "%sCT", dir);
- if (partfile = fopen(buf, "r")) {
+ if ((partfile = fopen(buf, "r"))) {
if (fgets(buf, sizeof(buf), partfile)) {
nparts = atoi(buf);
if (nparts < 0) nparts = 0;
@@ -723,7 +740,7 @@
if (!*fname) return 1;
/* Guess the content-type of common filename extensions */
- if (p = strrchr(fname, '.')) {
+ if ((p = strrchr(fname, '.'))) {
if (!strcasecmp(p, ".gif")) contentType = "image/gif";
if (!strcasecmp(p, ".jpg")) contentType = "image/jpeg";
if (!strcasecmp(p, ".jpeg")) contentType = "image/jpeg";
diff -Naur mpack-1.6.bak/xmalloc.c mpack-1.6/xmalloc.c
--- mpack-1.6.bak/xmalloc.c 2003-07-21 22:35:31.000000000 +0200
+++ mpack-1.6/xmalloc.c 2005-08-06 23:12:52.446289424 +0200
@@ -23,14 +23,14 @@
* SOFTWARE.
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-extern char *malloc(), *realloc();
char *xmalloc (int size)
{
char *ret;
- if (ret = malloc((unsigned) size))
+ if ((ret = malloc((unsigned) size)))
return ret;
fprintf(stderr, "Memory exhausted\n");
@@ -43,7 +43,7 @@
char *ret;
/* xrealloc (NULL, size) behaves like xmalloc (size), as in ANSI C */
- if (ret = !ptr ? malloc ((unsigned) size) : realloc (ptr, (unsigned) size))
+ if ((ret = !ptr ? malloc ((unsigned) size) : realloc (ptr, (unsigned)
size)))
return ret;
fprintf(stderr, "Memory exhausted\n");