update to latest freerdist-0.94:

* use intmax_t instead of long long
    * Don't limit the size of the environment
    * Don't leak a directory file descriptor
    * ansify
    * dynamically allocate EARGS
    * use getaddrinfo
This commit is contained in:
christos 2012-09-26 16:52:38 +00:00
parent de52e314c4
commit 42454cbb9b
14 changed files with 7 additions and 557 deletions

View file

@ -1,8 +1,8 @@
# $NetBSD: Makefile,v 1.22 2010/06/12 19:36:00 dholland Exp $
# $NetBSD: Makefile,v 1.23 2012/09/26 16:52:38 christos Exp $
#
DISTNAME= freerdist-0.92
PKGREVISION= 4
DISTNAME= freerdist-0.94
#PKGREVISION= 4
CATEGORIES= net
MASTER_SITES= ftp://ftp.astron.com/pub/freerdist/
@ -21,8 +21,4 @@ CONFLICTS= rdist6-[0-9]*
PKG_DESTDIR_SUPPORT= user-destdir
post-extract:
${CP} ${FILESDIR}/os-dragonfly.h ${WRKSRC}/config
${ECHO} LIB_SYS=-lcompat > ${WRKSRC}/config/mf.dragonfly
.include "../../mk/bsd.pkg.mk"

View file

@ -1,8 +1,8 @@
$NetBSD: distinfo,v 1.14 2010/06/12 19:36:00 dholland Exp $
$NetBSD: distinfo,v 1.15 2012/09/26 16:52:38 christos Exp $
SHA1 (freerdist-0.92.tar.gz) = 84db4efd8d223a7e10d62e386349aa9236f71ae3
RMD160 (freerdist-0.92.tar.gz) = 2106cbf21fbe6fda2738d2e9e2d750625eb8c2da
Size (freerdist-0.92.tar.gz) = 135824 bytes
SHA1 (freerdist-0.94.tar.gz) = 12141ceb7932727362c560b2589a06a8fa2dbb20
RMD160 (freerdist-0.94.tar.gz) = d253d6e9fd930b9fc6ee49496bee2f55086da5cf
Size (freerdist-0.94.tar.gz) = 138512 bytes
SHA1 (patch-aa) = 9a63f74b3507d35d54a2590a5178896ffb193a54
SHA1 (patch-ab) = 3cd2de9d584e8aaa0cf4258c66ba027ff767a367
SHA1 (patch-ac) = 78df932333c8742139368abb5d12b910d34e222c

View file

@ -1,157 +0,0 @@
/*
* Copyright (c) 1993 Michael A. Cooper
* Copyright (c) 1993 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* $Id: os-dragonfly.h,v 1.1 2006/03/23 13:41:41 joerg Exp $
* @(#)os-netbsd.h
*/
/*
* DragonFly os-*.h file
*/
#define NEED_RE_COMP_H
/*
* Set process args to messages that show up when running ps(1)
*
* NetBSD has setproctitle() in libc so we don't want to use rdist's.
*/
#define HAVE_SETPROCTITLE
/*
* Define the type of directory routines your system has.
*/
#define DIR_TYPE DIR_DIRENT
/*
* Determine what routines we have to get filesystem info.
*/
#define FSI_TYPE FSI_GETFSSTAT
/*
* Type of non-blocking I/O.
*/
#define NBIO_TYPE NBIO_FCNTL
/*
* Type of wait() function to use.
*/
#define WAIT_TYPE WAIT_WAIT3
/*
* Type of argument passed to wait() (above).
*/
#define WAIT_ARG_TYPE int
/*
* Select the type of executable file format.
*/
#define EXE_TYPE EXE_ELF
/*
* Select the type of statfs() system call (if any).
*/
#define STATFS_TYPE STATFS_44BSD
/*
* Use f_fstypename in struct statfs.
*/
#define HAVE_FSTYPENAME 1
/*
* Type of arg functions we have.
*/
#define ARG_TYPE ARG_STDARG
/*
* Do we have select()?
*/
#define HAVE_SELECT
/*
* Name of <paths.h> include file
*/
#define PATHS_H <paths.h>
/*
* UID argument type for chown()
*/
typedef uid_t CHOWN_UID_T;
/*
* GID argument type for chown()
*/
typedef gid_t CHOWN_GID_T;
/*
* Our types, usually these are uid_t and gid_t.
*/
typedef uid_t UID_T; /* Must be signed */
typedef gid_t GID_T; /* Must be signed */
/*
* Generic pointer, used by memcpy, malloc, etc. Usually char or void.
*/
typedef void POINTER;
/*
* Type of set file time function available
*/
#define SETFTIME_TYPE SETFTIME_UTIMES
/*
* We have fchown()
*/
#define HAVE_FCHOWN
/*
* We have fchmod()
*/
#define HAVE_FCHMOD
/*
* We have vis()
*/
#define HAVE_VIS
/*
* We have vsnprintf()
*/
#define HAVE_VSNPRINTF
/*
* Path to remote shell command
*/
#define _PATH_REMSH "/usr/bin/rsh"

View file

@ -1,24 +0,0 @@
$NetBSD: patch-ae,v 1.5 2005/09/03 21:21:57 abs Exp $
--- config/os-netbsd.h.orig 2001-03-12 13:16:18.000000000 -0500
+++ config/os-netbsd.h 2004-05-30 22:01:15.000000000 -0400
@@ -45,6 +45,7 @@
* Things we need
*/
#define NEED_RE_COMP_H
+#define NEED_SETPROGNAME
/*
* Set process args to messages that show up when running ps(1)
@@ -86,7 +87,11 @@
/*
* Select the type of statfs() system call (if any).
*/
+#if __NetBSD_Version__ < 299000900
#define STATFS_TYPE STATFS_44BSD
+#else
+#define STATFS_TYPE STATFS_SVR4
+#endif
/*
* Use f_fstypename in struct statfs.

View file

@ -1,20 +0,0 @@
$NetBSD: patch-af,v 1.3 2005/08/26 08:42:09 abs Exp $
--- src/filesys.c.orig 2005-08-26 09:30:21.000000000 +0100
+++ src/filesys.c
@@ -452,12 +452,10 @@ int getfilesysinfo(file, freespace, free
*/
#if STATFS_TYPE == STATFS_SYSV
r = statfs(mntpt, &statfsbuf, sizeof(statfs_t), 0);
-#endif
-#if STATFS_TYPE == STATFS_BSD || STATFS_TYPE == STATFS_44BSD
- r = statfs(mntpt, &statfsbuf);
-#endif
-#if STATFS_TYPE == STATFS_OSF1
+#elif STATFS_TYPE == STATFS_OSF1
r = statfs(mntpt, &statfsbuf, sizeof(statfs_t));
+#else
+ r = statfs(mntpt, &statfsbuf);
#endif
if (r < 0) {

View file

@ -1,34 +0,0 @@
$NetBSD: patch-ag,v 1.4 2006/08/19 23:34:54 abs Exp $
--- config/os-type.orig 1999-08-04 16:57:30.000000000 +0100
+++ config/os-type
@@ -75,7 +75,6 @@ fi
if [ -z "${OS}" -a ! -z "${uname}" ]; then
case "`$uname -a | tr '[A-Z]' '[a-z]'`" in
"osf1"*) OS="osf1";;
- *"4.0"*) OS=svr4;; # There has to be a better way
*" dcosx "*) OS=dcosx;;
*"cx/ux"*) OS=cxux;;
*"hp-ux"*) OS=hpux;; # HP-UX 9.x
@@ -102,6 +101,7 @@ if [ -z "${OS}" -a ! -z "${uname}" ]; th
"linux"*) OS=linux;;
"netbsd"*) OS="${osname}";;
"freebsd"*) OS="${osname}${osmajver}";;
+ "dragonfly"*) OS="${osname}";;
"openbsd"*) OS="${osname}";;
"dgux"*) OS=dgux;;
"unicos"*) OS=unicos;;
@@ -109,6 +109,13 @@ if [ -z "${OS}" -a ! -z "${uname}" ]; th
esac
fi
+# At least do this _after_ the above to avoid some false matches
+if [ -z "${OS}" -a ! -z "${uname}" ]; then
+ case "`$uname -a | tr '[A-Z]' '[a-z]'`" in
+ *"4.0"*) OS=svr4;; # There has to be a better way
+ esac
+fi
+
#
# NeXTStep specific.
#

View file

@ -1,90 +0,0 @@
$NetBSD: patch-ai,v 1.3 2010/06/12 19:36:01 dholland Exp $
Print and parse time_t as intmax_t, not as long (which might not fit).
Likewise for (perhaps only some uses of) off_t.
The last hunk is unrelated to the rest and fixes a tilde expansion bug.
--- src/server.c.orig 1999-08-04 15:57:33.000000000 +0000
+++ src/server.c
@@ -683,8 +683,8 @@ static void query(xname)
case S_IFIFO:
#endif
#endif
- (void) sendcmd(QC_YES, "%ld %ld %o %s %s",
- (long) stb.st_size, stb.st_mtime,
+ (void) sendcmd(QC_YES, "%jd %jd %o %s %s",
+ (intmax_t)stb.st_size, (intmax_t)stb.st_mtime,
stb.st_mode & 07777,
getusername(stb.st_uid, target, options),
getgroupname(stb.st_gid, target, options));
@@ -1449,6 +1449,7 @@ static void recvit(cmd, type)
opt_t opts;
off_t size;
time_t mtime, atime;
+ intmax_t size_big, mtime_big, atime_big;
char *owner, *group, *file;
char new[MAXPATHLEN];
char fileb[MAXPATHLEN];
@@ -1476,7 +1477,12 @@ static void recvit(cmd, type)
/*
* Get file size
*/
- size = strtol(cp, &cp, 10);
+ size_big = strtoimax(cp, &cp, 10);
+ if ((intmax_t)(off_t)size_big != size_big) {
+ error("recvit: size out of range");
+ return;
+ }
+ size = (off_t)size_big;
if (*cp++ != ' ') {
error("recvit: size not delimited");
return;
@@ -1485,7 +1491,12 @@ static void recvit(cmd, type)
/*
* Get modification time
*/
- mtime = strtol(cp, &cp, 10);
+ mtime_big = strtoimax(cp, &cp, 10);
+ if ((intmax_t)(off_t)mtime_big != mtime_big) {
+ error("recvit: mtime out of range");
+ return;
+ }
+ mtime = (time_t)mtime_big;
if (*cp++ != ' ') {
error("recvit: mtime not delimited");
return;
@@ -1494,7 +1505,12 @@ static void recvit(cmd, type)
/*
* Get access time
*/
- atime = strtol(cp, &cp, 10);
+ atime_big = strtoimax(cp, &cp, 10);
+ if ((intmax_t)(off_t)atime_big != atime_big) {
+ error("recvit: atime out of range");
+ return;
+ }
+ atime = (time_t)atime_big;
if (*cp++ != ' ') {
error("recvit: atime not delimited");
return;
@@ -1534,8 +1550,8 @@ static void recvit(cmd, type)
file = fileb;
debugmsg(DM_MISC,
- "recvit: opts = %04o mode = %04o size = %d mtime = %d",
- opts, mode, size, mtime);
+ "recvit: opts = %04o mode = %04o size = %jd mtime = %jd",
+ opts, mode, (intmax_t)size, (intmax_t)mtime);
debugmsg(DM_MISC,
"recvit: owner = '%s' group = '%s' file = '%s' catname = %d isdir = %d",
owner, group, file, catname, (type == S_IFDIR) ? 1 : 0);
@@ -1737,7 +1753,7 @@ static void settarget(cmd, isdir)
/*
* Handle target
*/
- if (exptilde(target, cp) == NULL)
+ if (exptilde(target, file) == NULL)
return;
ptarget = target;
while (*ptarget)

View file

@ -1,12 +0,0 @@
$NetBSD: patch-aj,v 1.1 2004/05/31 02:18:44 kim Exp $
--- config/config-def.h.orig 1995-05-20 19:35:17.000000000 -0400
+++ config/config-def.h 2004-05-30 21:54:24.000000000 -0400
@@ -92,6 +92,7 @@
#define STATFS_BSD 1
#define STATFS_SYSV 2
#define STATFS_OSF1 3
+#define STATFS_SVR4 4
/*
* Arg types

View file

@ -1,18 +0,0 @@
$NetBSD: patch-ak,v 1.1 2004/05/31 02:18:44 kim Exp $
--- include/filesys.h.orig 1999-08-04 11:57:31.000000000 -0400
+++ include/filesys.h 2004-05-30 22:13:44.000000000 -0400
@@ -104,10 +104,12 @@
# include <sys/statfs.h>
typedef struct statfs statfs_t;
# define f_bavail f_bfree
-# elif defined(SVR4)
+# elif defined(SVR4) || STATFS_TYPE == STATFS_SVR4
# include <sys/statvfs.h>
typedef struct statvfs statfs_t;
# define statfs(mp,sb) statvfs(mp,sb)
+# define getfsstat(buf,sz,fl) getvfsstat(buf,sz,fl)
+# define f_flags f_flag
# elif STATFS_TYPE == STATFS_44BSD || STATFS_TYPE == STATFS_OSF1
typedef struct statfs statfs_t;
# else

View file

@ -1,44 +0,0 @@
$NetBSD: patch-al,v 1.2 2006/03/23 13:41:41 joerg Exp $
--- src/filesys-os.c.orig 1999-08-04 11:57:33.000000000 -0400
+++ src/filesys-os.c 2004-05-30 22:10:03.000000000 -0400
@@ -49,7 +49,7 @@
*/
#if FSI_TYPE == FSI_GETFSSTAT
-static struct statfs *mnt = NULL;
+static statfs_t *mnt = NULL;
#endif /* FSI_GETFSSTAT */
#if FSI_TYPE == FSI_MNTCTL
@@ -101,17 +101,17 @@
if (mntbuf)
(void) free(mntbuf);
- size = getfsstat((struct statfs *) NULL, 0, MNT_WAIT);
+ size = getfsstat((statfs_t *) NULL, 0, MNT_WAIT);
if (size == -1)
return (NULL);
- size *= sizeof(struct statfs);
+ size *= sizeof(statfs_t);
mntbuf = (char *) xmalloc(size);
- entries_left = getfsstat((struct statfs *)mntbuf, size, MNT_WAIT);
+ entries_left = getfsstat((statfs_t *)mntbuf, size, MNT_WAIT);
if (entries_left == -1)
return((FILE *) NULL);
- mnt = (struct statfs *) mntbuf;
+ mnt = (statfs_t *) mntbuf;
return((FILE *) 1);
}
@@ -195,7 +195,7 @@
mntstruct.me_type = METYPE_OTHER;
}
- mnt = (struct statfs*)(sizeof(struct statfs)+(ulong)mnt);
+ mnt = (statfs_t *)(sizeof(statfs_t)+(unsigned long)mnt);
entries_left--;
return(&mntstruct);

View file

@ -1,102 +0,0 @@
$NetBSD: patch-an,v 1.2 2010/06/12 19:36:01 dholland Exp $
Print and parse time_t as intmax_t, not as long (which might not fit).
Likewise for (perhaps only some uses of) off_t.
--- src/client.c.orig 1999-11-01 00:22:14.000000000 +0000
+++ src/client.c
@@ -433,9 +433,9 @@ static int sendfile(rname, opts, stb, us
debugmsg(DM_MISC, "Turning off compression");
}
- (void) sendcmd(C_RECVREG, "%o %04o %ld %ld %ld %s %s %s",
- opts, stb->st_mode & 07777, (long) stb->st_size,
- stb->st_mtime, stb->st_atime,
+ (void) sendcmd(C_RECVREG, "%o %04o %jd %jd %jd %s %s %s",
+ opts, stb->st_mode & 07777, (intmax_t) stb->st_size,
+ (intmax_t)stb->st_mtime, (intmax_t)stb->st_atime,
user, group, ername);
if (response() < 0) {
(void) close(f);
@@ -450,8 +450,8 @@ static int sendfile(rname, opts, stb, us
}
}
- debugmsg(DM_MISC, "Send file '%s' %ld bytes%s\n", rname,
- (long) stb->st_size, rem_wz ? " (compressing)" : "");
+ debugmsg(DM_MISC, "Send file '%s' %jd bytes%s\n", rname,
+ (intmax_t) stb->st_size, rem_wz ? " (compressing)" : "");
/*
* Set remote time out alarm handler.
@@ -732,9 +732,9 @@ static int sendlink(rname, opts, stb, us
* Gather and send basic link info
*/
ENCODE(ername, rname);
- (void) sendcmd(C_RECVSYMLINK, "%o %04o %ld %ld %ld %s %s %s",
- opts, stb->st_mode & 07777, (long) stb->st_size,
- stb->st_mtime, stb->st_atime,
+ (void) sendcmd(C_RECVSYMLINK, "%o %04o %jd %jd %jd %s %s %s",
+ opts, stb->st_mode & 07777, (intmax_t) stb->st_size,
+ (intmax_t)stb->st_mtime, (intmax_t)stb->st_atime,
user, group, ername);
if (response() < 0)
return(-1);
@@ -833,6 +833,7 @@ static int update(rname, opts, statp)
{
off_t size;
time_t mtime;
+ intmax_t size_big, mtime_big;
unsigned short lmode;
unsigned short rmode;
char *owner = NULL, *group = NULL;
@@ -921,7 +922,12 @@ static int update(rname, opts, statp)
/*
* Parse size
*/
- size = (off_t) strtol(cp, (char **)&cp, 10);
+ size_big = strtoimax(cp, (char **)&cp, 10);
+ if ((intmax_t)(off_t)size_big != size_big) {
+ error("update: size out of range");
+ return(US_NOTHING);
+ }
+ size = (off_t)size_big;
if (*cp++ != ' ') {
error("update: size not delimited");
return(US_NOTHING);
@@ -930,7 +936,12 @@ static int update(rname, opts, statp)
/*
* Parse mtime
*/
- mtime = strtol(cp, (char **)&cp, 10);
+ mtime_big = strtoimax(cp, (char **)&cp, 10);
+ if ((intmax_t)(off_t)mtime_big != mtime_big) {
+ error("update: mtime out of range");
+ return(US_NOTHING);
+ }
+ mtime = (time_t)mtime_big;
if (*cp++ != ' ') {
error("update: mtime not delimited");
return(US_NOTHING);
@@ -973,8 +984,8 @@ static int update(rname, opts, statp)
debugmsg(DM_MISC, "update(%s,) local mode %04o remote mode %04o\n",
rname, lmode, rmode);
- debugmsg(DM_MISC, "update(%s,) size %ld mtime %d owner '%s' grp '%s'\n",
- rname, (long) size, mtime, owner, group);
+ debugmsg(DM_MISC, "update(%s,) size %jd mtime %jd owner '%s' grp '%s'\n",
+ rname, (intmax_t)size, (intmax_t)mtime, owner, group);
if (statp->st_mtime != mtime) {
if (statp->st_mtime < mtime && IS_ON(opts, DO_YOUNGER)) {
@@ -987,8 +998,8 @@ static int update(rname, opts, statp)
}
if (statp->st_size != size) {
- debugmsg(DM_MISC, "size does not match (%ld != %ld).\n",
- (long) statp->st_size, (long) size);
+ debugmsg(DM_MISC, "size does not match (%jd != %jd).\n",
+ (intmax_t)statp->st_size, (intmax_t)size);
return(US_OUTDATE);
}

View file

@ -1,15 +0,0 @@
$NetBSD: patch-ao,v 1.2 2010/06/12 19:36:01 dholland Exp $
Print and parse time_t as intmax_t, not as long (which might not fit).
--- src/docmd.c.orig 2001-03-12 18:42:23.000000000 +0000
+++ src/docmd.c
@@ -786,7 +786,7 @@ static void dodcolon(cmd, filev)
return;
}
- debugmsg(DM_MISC, "%s: mtime %d\n", stamp, stb.st_mtime);
+ debugmsg(DM_MISC, "%s: mtime %jd\n", stamp, (intmax_t)stb.st_mtime);
env = NULL;
for (sc = sbcmds; sc != NULL; sc = sc->sc_next) {

View file

@ -1,14 +0,0 @@
$NetBSD: patch-ap,v 1.1 2010/06/12 19:36:01 dholland Exp $
Need inttypes.h for strtoimax for handling time_t safely.
--- include/defs.h.orig 2001-03-12 18:16:30.000000000 +0000
+++ include/defs.h
@@ -42,6 +42,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <inttypes.h>
#include <ctype.h>
#include <errno.h>
#include <pwd.h>

View file

@ -1,16 +0,0 @@
$NetBSD: patch-aq,v 1.1 2010/06/12 19:36:01 dholland Exp $
Use NULL, not 0, to terminate execl() args. Otherwise (e.g. on LP64)
you might not get a pointer-sized zero value.
--- src/common.c.orig 2001-03-12 18:16:36.000000000 +0000
+++ src/common.c
@@ -859,7 +859,7 @@ void runcommand(cmd)
(void) dup(fd[PIPE_WRITE]);
(void) close(fd[PIPE_READ]);
(void) close(fd[PIPE_WRITE]);
- (void) execl(_PATH_BSHELL, "sh", "-c", cmd, 0);
+ (void) execl(_PATH_BSHELL, "sh", "-c", cmd, NULL);
_exit(127);
}
(void) close(fd[PIPE_WRITE]);