Update to 5.21n. No user-visible changes.

The new upstream version now opens temporary files in a safe manner,
so our local patches for this are no longer needed.

Approved by:	ache
This commit is contained in:
Christian Weisgerber 2005-10-14 12:25:57 +00:00
parent dd3d3c91a5
commit 2a4fabbee2
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=145370
6 changed files with 18 additions and 139 deletions

View File

@ -6,10 +6,11 @@
#
PORTNAME= arc
PORTVERSION= 5.21j
PORTVERSION= 5.21n
CATEGORIES= archivers
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
EXTRACT_SUFX= .tgz
MAINTAINER= ache@FreeBSD.org
COMMENT= Create & extract files from DOS .ARC files

View File

@ -1,2 +1,2 @@
MD5 (arc-5.21j.tar.gz) = b3c12bbc71c440df19d3a8a653d4baf5
SIZE (arc-5.21j.tar.gz) = 81164
MD5 (arc-5.21n.tgz) = 160eb7b7db1fa0c4b39296b6366a7b66
SIZE (arc-5.21n.tgz) = 82213

View File

@ -1,70 +0,0 @@
--- ./marc.c.orig Tue Apr 14 18:59:21 1992
+++ ./marc.c Wed Aug 11 10:22:31 1999
@@ -28,12 +28,17 @@
#if UNIX
#include <sys/types.h>
#include <sys/stat.h>
+#include <errno.h>
+#include <unistd.h>
+#include <string.h>
+#include <err.h>
#endif
#ifndef __STDC__
char *calloc(), *malloc(), *realloc(); /* memory managers */
#endif
VOID arcdie();
+int move(),setstamp();
static VOID expandlst(), merge();
FILE *src; /* source archive */
@@ -50,7 +55,7 @@
char *makefnam(); /* filename fixup routine */
char *envfind();
#if !_MTS
- char *arctemp2, *mktemp(); /* temp file stuff */
+ char *arctemp2; /* temp file stuff */
#endif
#if GEMDOS
VOID exitpause();
@@ -114,8 +119,18 @@
#endif
#if !MSDOS
{
- static char tempname[] = "AXXXXXX";
- strcat(arctemp, mktemp(tempname));
+ static char tempname[] = "AXXXXXX.arc";
+ int fd=-1;
+ strcat(arctemp, tempname);
+ if((fd = mkstemps(arctemp,4)) == -1 ||
+ (new = fdopen(fd, "w+")) == NULL) {
+ if (fd != -1) {
+ unlink(arctemp);
+ close(fd);
+ }
+ err(1, "can't create temp file %s", arctemp);
+ }
+
}
#else
strcat(arctemp, "$ARCTEMP");
@@ -148,8 +163,10 @@
arc = fopen(arcname,OPEN_R); /* open the archives */
if(!(src=fopen(srcname,OPEN_R)))
arcdie("Cannot read source archive %s",srcname);
+#if !defined(__OpenBSD__) && !defined(__FreeBSD__) /* this is insecure, see mkstemp(3) */
if(!(new=fopen(newname,OPEN_W)))
arcdie("Cannot create new archive %s",newname);
+#endif
if(!arc)
printf("Creating new archive %s\n",arcname);
@@ -283,7 +300,7 @@
else return 0; /* or fake end of archive */
}
-copyfile(f,hdr,ver) /* copy a file from an archive */
+int copyfile(f,hdr,ver) /* copy a file from an archive */
FILE *f; /* archive to copy from */
struct heads *hdr; /* header data for file */
int ver; /* header version */

View File

@ -1,58 +1,6 @@
--- ./arc.c.orig Tue Apr 14 18:58:59 1992
+++ ./arc.c Wed Aug 11 10:21:06 1999
@@ -76,11 +76,14 @@
#if UNIX
#include <sys/types.h>
#include <sys/stat.h>
+#include <unistd.h>
#endif
#include <string.h>
#if BSD
#include <strings.h>
+#include <err.h>
+#include <errno.h>
#endif
#if !__STDC__
@@ -101,6 +104,7 @@
static char **lst; /* files list */
static int lnum; /* length of files list */
+int
main(num, arg) /* system entry point */
int num; /* number of arguments */
char *arg[]; /* pointers to arguments */
@@ -110,7 +114,7 @@
VOID upper();/* case conversion routine */
char *envfind(); /* environment searcher */
int n; /* index */
- char *arctemp2, *mktemp();
+ char *arctemp2;
#if GEMDOS
VOID exitpause();
int append;
@@ -219,8 +223,17 @@
#endif
#if !MSDOS
{
- static char tempname[] = "AXXXXXX";
- strcat(arctemp, mktemp(tempname));
+ static char tempname[] = "AXXXXXX.arc";
+ int fd=-1;
+ strcat(arctemp, tempname);
+ if((fd = mkstemps(arctemp,4)) == -1 ||
+ (new = fdopen(fd, "w+")) == NULL) {
+ if (fd != -1) {
+ unlink(arctemp);
+ close(fd);
+ }
+ err(1, "can't create temp file %s", arctemp);
+ }
}
#else
strcat(arctemp, "$ARCTEMP");
@@ -276,7 +289,7 @@
--- arc.c.orig Sun Oct 9 03:38:22 2005
+++ arc.c Fri Oct 14 14:22:38 2005
@@ -290,7 +290,7 @@
keepbak = 1;
else if (*a == 'W') /* suppress warnings */
@ -61,7 +9,7 @@
#if !DOS
else if (*a == 'I') /* image mode, no ASCII/EBCDIC x-late */
image = !image;
@@ -401,7 +414,7 @@
@@ -426,7 +426,7 @@
expandlst(n) /* expand an indirect reference */
int n; /* number of entry to expand */
{

View File

@ -1,12 +1,12 @@
--- ./arcext.c.orig Tue Aug 10 23:03:25 1999
+++ ./arcext.c Tue Aug 10 23:01:56 1999
--- arcext.c.orig Sat Oct 8 22:24:37 2005
+++ arcext.c Fri Oct 14 00:52:14 2005
@@ -143,7 +143,7 @@
if (note)
printf("Extracting file: %s\n", fix);
- if (warn && !overlay) {
+ if (arcwarn && !overlay) {
if (f = fopen(fix, "r")) { /* see if it exists */
if ((f = fopen(fix, "r"))) { /* see if it exists */
fclose(f);
printf("WARNING: File %s already exists!", fix);
@@ -190,7 +190,7 @@

View File

@ -1,6 +1,6 @@
--- ./arcrun.c.orig Tue Aug 10 23:03:25 1999
+++ ./arcrun.c Tue Aug 10 23:01:57 1999
@@ -94,7 +94,7 @@
--- arcrun.c.orig Sun Oct 9 03:38:22 2005
+++ arcrun.c Fri Oct 14 00:53:57 2005
@@ -98,7 +98,7 @@
strcpy(sys, buf);
else {
@ -9,7 +9,7 @@
printf("File %s is not a .BAS, .BAT, .COM, or .EXE\n",
hdr->name);
nerrs++;
@@ -108,7 +108,7 @@
@@ -112,7 +112,7 @@
&& strcmp(i, ".TTP")
&& strcmp(i, ".TOS"))
{
@ -18,16 +18,16 @@
printf("File %s is not a .PRG, .TOS, or .TTP\n",
hdr->name);
nerrs++;
@@ -118,7 +118,7 @@
@@ -122,7 +122,7 @@
}
#endif
- if (warn)
+ if (arcwarn)
if (tmp = fopen(buf, "r"))
if ((tmp = fopen(buf, "r")))
arcdie("Temporary file %s already exists", buf);
if (!(tmp = fopen(buf, OPEN_W)))
@@ -142,7 +142,7 @@
@@ -148,7 +148,7 @@
#endif
chdir(dir);
free(dir); /* return to whence we started */