Regen patches using makepatch.

This commit is contained in:
Cy Schubert 2020-09-01 19:24:29 +00:00
parent d2b7144e50
commit 83f7ef0a7d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=547290
25 changed files with 676 additions and 719 deletions

View File

@ -1,40 +1,26 @@
*** Makefile.local.dist Tue Feb 6 02:50:27 1996
--- Makefile.local Fri May 17 16:45:19 1996
***************
*** 8,14 ****
# BIN_DIR variable, you would uncomment the following line
# or add your own line.
#
! #BIN_DIR = /usr/bin
#
# Add any local definitions you want pass to the compiler to DEFS_LOCAL
--- 8,16 ----
# BIN_DIR variable, you would uncomment the following line
# or add your own line.
#
! BIN_DIR = ${STAGEDIR}$(PREFIX)/bin
! OPT = $(BUILD_OPT)
! CLIENT = $(BUILD_CLIENT)
#
# Add any local definitions you want pass to the compiler to DEFS_LOCAL
***************
*** 45,52 ****
#
# Site specific Man Page configuration.
#
! #MAN_1_DIR = /usr/local/man/man1
! #MAN_8_DIR = /usr/local/man/man8
! #MAN_OWNER = bin
! #MAN_GROUP = bin
#MAN_MODE = 644
--- 47,54 ----
#
# Site specific Man Page configuration.
#
! MAN_1_DIR = ${STAGEDIR}$(PREFIX)/man/man1
! MAN_8_DIR = ${STAGEDIR}$(PREFIX)/man/man8
! MAN_OWNER = bin
! MAN_GROUP = bin
#MAN_MODE = 644
--- Makefile.local.orig 1998-11-10 03:36:31 UTC
+++ Makefile.local
@@ -14,7 +14,9 @@
# BIN_DIR variable, you would uncomment the following line
# or add your own line.
#
-#BIN_DIR = /usr/bin
+BIN_DIR = ${STAGEDIR}$(PREFIX)/bin
+OPT = $(BUILD_OPT)
+CLIENT = $(BUILD_CLIENT)
#
# Add any local definitions you want pass to the compiler to DEFS_LOCAL
@@ -51,8 +53,8 @@ LIBS_LOCAL =
#
# Site specific Man Page configuration.
#
-#MAN_1_DIR = /usr/local/man/man1
-#MAN_8_DIR = /usr/local/man/man8
-#MAN_OWNER = bin
-#MAN_GROUP = bin
+MAN_1_DIR = ${STAGEDIR}$(PREFIX)/man/man1
+MAN_8_DIR = ${STAGEDIR}$(PREFIX)/man/man8
+MAN_OWNER = bin
+MAN_GROUP = bin
#MAN_MODE = 644

View File

@ -1,4 +1,4 @@
--- build/os-type.orig 1998-11-09 22:37:27.000000000 -0500
--- build/os-type.orig 1998-11-10 03:37:27 UTC
+++ build/os-type
@@ -83,7 +83,7 @@ fi
if [ -z "${OS}" -a ! -z "${uname}" ]; then
@ -9,7 +9,7 @@
*" dcosx "*) OS=dcosx;;
*"cx/ux"*) OS=cxux;;
*"hp-ux"*) # HP-UX 9.x
@@ -111,7 +111,8 @@ if [ -z "${OS}" -a ! -z "${uname}" ]; th
@@ -111,7 +111,8 @@ if [ -z "${OS}" -a ! -z "${uname}" ]; then
OS="${osname}${osmajver}"
;;
"linux"*) OS=linux;;

View File

@ -1,9 +0,0 @@
--- src/client.c Mon Nov 9 23:08:47 1998
+++ src/client.c Tue Jan 18 15:47:15 2005
@@ -762,5 +762,5 @@
char *owner = NULL, *group = NULL;
int done, n;
- u_char *cp;
+ char *cp;
debugmsg(DM_CALL, "update(%s, 0x%x, 0x%x)\n", rname, opts, statp);

View File

@ -0,0 +1,15 @@
--- config/config-data.h.orig 1998-11-10 03:59:47 UTC
+++ config/config-data.h
@@ -58,10 +58,10 @@ typedef struct dirent DIRENTRY;
* Set default write(2) return and amount types.
*/
#if !defined(WRITE_RETURN_T)
-#define WRITE_RETURN_T int /* What write() returns */
+#define WRITE_RETURN_T ssize_t /* What write() returns */
#endif /* WRITE_RETURN_T */
#if !defined(WRITE_AMT_T)
-#define WRITE_AMT_T int /* Amount to write */
+#define WRITE_AMT_T size_t /* Amount to write */
#endif /* WRITE_AMT_T */
#endif /* __configdata_h__ */

View File

@ -1,6 +1,6 @@
--- config/os-freebsd2.h Mon Nov 9 22:59:55 1998
+++ config/os-freebsd2.h Tue Jan 18 15:13:07 2005
@@ -116,18 +116,23 @@
--- config/os-freebsd2.h.orig 1998-11-10 03:59:55 UTC
+++ config/os-freebsd2.h
@@ -116,18 +116,23 @@ typedef void POINTER;
*/
#define HAVE_FCHOWN /* Have fchown() */
#define HAVE_FCHMOD /* Have fchmod() */

View File

@ -1,5 +1,5 @@
--- doc/Makefile.real.orig 1998-11-09 21:40:06.000000000 -0800
+++ doc/Makefile.real 2014-05-29 19:32:52.700090356 -0700
--- doc/Makefile.real.orig 1998-11-10 05:40:06 UTC
+++ doc/Makefile.real
@@ -10,7 +10,7 @@
CLIENT_DEST = ${MAN_1_DIR}/${CLIENT}.${MAN_1_SECT}

View File

@ -1,11 +0,0 @@
--- src/docmd.c.orig Mon Nov 9 20:08:32 1998
+++ src/docmd.c Tue Oct 23 14:32:06 2001
@@ -611,7 +624,7 @@
c = *cp;
if (c & 0200)
isbad = TRUE;
- if (!isalpha(c) && !isdigit(c) && c != '_' && c != '-')
+ if (!isalpha(c) && !isdigit(c) && c != '_' && c != '-' && c != '.' )
isbad = TRUE;
}

View File

@ -1,5 +1,5 @@
--- include/defs.h Mon Nov 9 23:23:54 1998
+++ include/defs.h Tue Jan 18 15:41:40 2005
--- include/defs.h.orig 1998-11-10 04:23:54 UTC
+++ include/defs.h
@@ -17,10 +17,9 @@
/*
* POSIX settings
@ -12,7 +12,7 @@
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
@@ -357,7 +355,6 @@
@@ -357,7 +356,6 @@ extern void cleanup();
extern void complain();
extern void docmds();
extern void finish();
@ -20,7 +20,7 @@
extern void logmsg();
extern void lostconn();
extern void markassigned();
@@ -366,7 +363,6 @@
@@ -366,7 +364,6 @@ extern void note();
extern void runcmdspecial();
extern void runcommand();
extern void server();
@ -28,7 +28,7 @@
extern void sighandler();
extern void waitup();
struct namelist *expand();
@@ -379,7 +375,9 @@
@@ -379,7 +376,9 @@ extern void debugmsg(int, char *, ...);
extern void error(char *, ...);
extern void fatalerr(char *, ...);
extern void message(int, char *, ...);

View File

@ -1,47 +0,0 @@
These patches replace mktemp with mkstemp in the client code entirely.
In the server code more intrusive changes would be needed, so the hunk
simply ensures, the file is not created between the mktemp() and the
open() calls.
-mi
--- src/message.c Mon Nov 9 23:13:30 1998
+++ src/message.c Tue Jan 18 15:23:32 2005
@@ -463,6 +463,6 @@
if (!msgfac->mf_fptr) {
- register char *cp;
- char *getenv();
+ const char *cp;
+ int fd;
/*
@@ -476,6 +476,6 @@
msgfac->mf_filename = tempfile;
- (void) mktemp(msgfac->mf_filename);
- if ((msgfac->mf_fptr = fopen(msgfac->mf_filename, "w"))==NULL)
+ fd = mkstemp(tempfile);
+ if (fd == -1 || (msgfac->mf_fptr = fdopen(fd, "w"))==NULL)
fatalerr("Cannot open notify file for writing: %s: %s.",
msgfac->mf_filename, SYSERR);
@@ -514,5 +514,5 @@
static void _message(flags, msgbuf)
int flags;
- char *msgbuf;
+ const char *msgbuf;
{
register int i, x;
--- src/server.c Mon Nov 9 23:15:31 1998
+++ src/server.c Tue Jan 18 16:34:26 2005
@@ -768,7 +768,7 @@
* Create temporary file
*/
- if ((f = creat(new, mode)) < 0) {
+ if ((f = open(new, O_CREAT|O_TRUNC|O_WRONLY|O_EXCL, mode)) < 0) {
if (errno != ENOENT || chkparent(new, opts) < 0 ||
- (f = creat(new, mode)) < 0) {
+ (f = open(new, O_CREAT|O_TRUNC|O_WRONLY|O_EXCL, mode)) < 0) {
error("%s: create failed: %s", new, SYSERR);
(void) unlink(new);

View File

@ -1,45 +0,0 @@
setprogname() is a standard library function. Instead of renaming
rdist6' (incompatible) implementation, remove it entirely replacing with
much simpler code.
-mi
--- src/rdist.c Mon Nov 9 23:13:50 1998
+++ src/rdist.c Tue Jan 18 15:36:30 2005
@@ -113,5 +113,5 @@
* things in msgparseopts() need progname set.
*/
- setprogname(argv);
+ progname = basename(argv[0]);
if (cp = msgparseopts(localmsglist, TRUE)) {
--- src/common.c Mon Nov 9 23:09:01 1998
+++ src/common.c Tue Jan 18 15:40:19 2005
@@ -109,19 +109,4 @@
/*
- * Set program name
- */
-extern void setprogname(argv)
- char **argv;
-{
- register char *cp;
-
- if (!progname) {
- progname = strdup(argv[0]);
- if (cp = strrchr(progname, '/'))
- progname = cp + 1;
- }
-}
-
-/*
* Do run-time initialization
*/
@@ -138,5 +123,6 @@
(void) signal(SIGSEGV, sighandler);
- setprogname(argv);
+ if (progname == NULL)
+ progname = basename(argv[0]);
/*

View File

@ -1,404 +0,0 @@
--- ./src/rdist.c.ORI 2012-06-12 07:35:16.000000000 +0200
+++ ./src/rdist.c 2012-06-12 07:49:18.000000000 +0200
@@ -62,8 +62,8 @@
char *distfile = NULL; /* Name of distfile to use */
int maxchildren = MAXCHILDREN; /* Max no of concurrent PIDs */
int nflag = 0; /* Say without doing */
-long min_freespace = 0; /* Min filesys free space */
-long min_freefiles = 0; /* Min filesys free # files */
+int64_t min_freespace = 0; /* Min filesys free space */
+int64_t min_freefiles = 0; /* Min filesys free # files */
FILE *fin = NULL; /* Input file pointer */
struct group *gr = NULL; /* Static area for getgrent */
char localmsglist[] = "stdout=all:notify=all:syslog=nerror,ferror";
@@ -109,6 +109,7 @@
register char *cp;
int cmdargs = 0;
int c;
+ const char *errstr;
/*
* We initialize progname here instead of init() because
@@ -178,10 +179,20 @@
error("\"%s\" is not a number.", optarg);
usage();
}
- if (c == 'a')
- min_freespace = atoi(optarg);
- else if (c == 'A')
- min_freefiles = atoi(optarg);
+ if (c == 'a') {
+ min_freespace = (int64_t)strtonum(optarg,
+ 0, LLONG_MAX, &errstr);
+ if (errstr)
+ fatalerr("Minimum free space is %s: "
+ "'%s'", errstr, optarg);
+ }
+ else if (c == 'A') {
+ min_freefiles = (int64_t)strtonum(optarg,
+ 0, LLONG_MAX, &errstr);
+ if (errstr)
+ fatalerr("Minimum free files is %s: "
+ "'%s'", errstr, optarg);
+ }
else if (c == 'M')
maxchildren = atoi(optarg);
else if (c == 't')
--- ./src/server.c.ORI 2012-06-12 07:35:16.000000000 +0200
+++ ./src/server.c 2012-06-12 08:14:41.651950502 +0200
@@ -62,8 +62,8 @@
int catname = 0; /* cat name to target name */
char *sptarget[32]; /* stack of saved ptarget's for directories */
char *fromhost = NULL; /* Client hostname */
-static long min_freespace = 0; /* Minimium free space on a filesystem */
-static long min_freefiles = 0; /* Minimium free # files on a filesystem */
+static int64_t min_freespace = 0; /* Minimium free space on a filesystem */
+static int64_t min_freefiles = 0; /* Minimium free # files on a filesystem */
int oumask; /* Old umask */
/*
@@ -645,8 +645,8 @@
case S_IFLNK:
case S_IFDIR:
case S_IFREG:
- (void) sendcmd(QC_YES, "%ld %ld %o %s %s",
- (long) stb.st_size,
+ (void) sendcmd(QC_YES, "%lld %ld %o %s %s",
+ (long long) stb.st_size,
stb.st_mtime,
stb.st_mode & 07777,
getusername(stb.st_uid, target, options),
@@ -783,13 +783,13 @@
wrerr = 0;
olderrno = 0;
for (i = 0; i < size; i += BUFSIZ) {
- int amt = BUFSIZ;
+ off_t amt = BUFSIZ;
cp = buf;
if (i + amt > size)
amt = size - i;
do {
- int j;
+ ssize_t j;
j = readrem(cp, amt);
if (j <= 0) {
@@ -1306,6 +1306,7 @@
{
register char *cp = cmd;
char *estr;
+ const char *errstr;
switch (*cp++) {
case SC_HOSTNAME: /* Set hostname */
@@ -1322,19 +1323,15 @@
break;
case SC_FREESPACE: /* Minimium free space */
- if (!isdigit(*cp)) {
- fatalerr("Expected digit, got '%s'.", cp);
- return;
- }
- min_freespace = (unsigned long) atoi(cp);
+ min_freespace = (int64_t)strtonum(cp, 0, LLONG_MAX, &errstr);
+ if (errstr)
+ fatalerr("Minimum free space is %s: '%s'", errstr, optarg);
break;
case SC_FREEFILES: /* Minimium free files */
- if (!isdigit(*cp)) {
- fatalerr("Expected digit, got '%s'.", cp);
- return;
- }
- min_freefiles = (unsigned long) atoi(cp);
+ min_freefiles = (int64_t)strtonum(cp, 0, LLONG_MAX, &errstr);
+ if (errstr)
+ fatalerr("Minimum free files is %s: '%s'", errstr, optarg);
break;
case SC_LOGGING: /* Logging options */
@@ -1364,7 +1361,7 @@
time_t mtime, atime;
char *owner, *group, *file;
char new[MAXPATHLEN];
- long freespace = -1, freefiles = -1;
+ int64_t freespace = -1, freefiles = -1;
char *cp = cmd;
/*
@@ -1388,7 +1385,7 @@
/*
* Get file size
*/
- size = strtol(cp, &cp, 10);
+ size = (off_t) strtoll(cp, &cp, 10);
if (*cp++ != ' ') {
error("recvit: size not delimited");
return;
@@ -1397,7 +1394,7 @@
/*
* Get modification time
*/
- mtime = strtol(cp, &cp, 10);
+ mtime = (time_t) strtol(cp, &cp, 10);
if (*cp++ != ' ') {
error("recvit: mtime not delimited");
return;
@@ -1441,8 +1438,8 @@
}
debugmsg(DM_MISC,
- "recvit: opts = %04o mode = %04o size = %d mtime = %d",
- opts, mode, size, mtime);
+ "recvit: opts = %04o mode = %04o size = %lld mtime = %d",
+ opts, mode, (long long) size, mtime);
debugmsg(DM_MISC,
"recvit: owner = '%s' group = '%s' file = '%s' catname = %d isdir = %d",
owner, group, file, catname, (type == S_IFDIR) ? 1 : 0);
@@ -1486,7 +1483,7 @@
*/
if (min_freespace || min_freefiles) {
/* Convert file size to kilobytes */
- long fsize = (long) (size / 1024);
+ int64_t fsize = (int64_t)size / 1024;
if (getfilesysinfo(target, &freespace, &freefiles) != 0)
return;
@@ -1498,15 +1495,15 @@
if (min_freespace && (freespace >= 0) &&
(freespace - fsize < min_freespace)) {
error(
- "%s: Not enough free space on filesystem: min %d free %d",
- target, min_freespace, freespace);
+ "%s: Not enough free space on filesystem: min %lld "
+ "free %lld", target, min_freespace, freespace);
return;
}
if (min_freefiles && (freefiles >= 0) &&
(freefiles - 1 < min_freefiles)) {
error(
- "%s: Not enough free files on filesystem: min %d free %d",
- target, min_freefiles, freefiles);
+ "%s: Not enough free files on filesystem: min %lld free "
+ "%lld", target, min_freefiles, freefiles);
return;
}
}
--- ./src/docmd.c.ORI 2012-06-12 07:35:16.000000000 +0200
+++ ./src/docmd.c 2012-06-12 08:11:29.000000000 +0200
@@ -102,7 +102,8 @@
register struct namelist *to;
time_t lmod;
{
- register int fd, len;
+ register int fd;
+ ssize_t len;
FILE *pf, *popen();
struct stat stb;
static char buf[BUFSIZ];
@@ -325,7 +326,7 @@
register char *ruser, *cp;
static char *cur_host = NULL;
extern char *locuser;
- extern long min_freefiles, min_freespace;
+ extern int64_t min_freefiles, min_freespace;
extern char *remotemsglist;
char tuser[BUFSIZ], buf[BUFSIZ];
u_char respbuff[BUFSIZ];
@@ -416,13 +417,13 @@
return(0);
}
if (min_freespace) {
- (void) sendcmd(C_SETCONFIG, "%c%d", SC_FREESPACE,
+ (void) sendcmd(C_SETCONFIG, "%c%lld", SC_FREESPACE,
min_freespace);
if (response() < 0)
return(0);
}
if (min_freefiles) {
- (void) sendcmd(C_SETCONFIG, "%c%d", SC_FREEFILES,
+ (void) sendcmd(C_SETCONFIG, "%c%lld", SC_FREEFILES,
min_freefiles);
if (response() < 0)
return(0);
--- ./src/common.c.ORI 2012-06-12 07:35:16.000000000 +0200
+++ ./src/common.c 2012-06-12 08:01:34.000000000 +0200
@@ -379,14 +379,14 @@
*/
static u_char rembuf[BUFSIZ];
static u_char *remptr;
-static int remleft;
+static ssize_t remleft;
#define remc() (--remleft < 0 ? remmore() : *remptr++)
/*
* Back end to remote read()
*/
-static int remread(fd, buf, bufsiz)
+static ssize_t remread(fd, buf, bufsiz)
int fd;
u_char *buf;
int bufsiz;
@@ -480,7 +480,7 @@
/*
* Non-line-oriented remote read.
*/
-readrem(p, space)
+ssize_t readrem(p, space)
char *p;
register int space;
{
@@ -878,7 +878,7 @@
extern POINTER *malloc();
if ((ptr = (char *)malloc(amt)) == NULL)
- fatalerr("Cannot malloc %d bytes of memory.", amt);
+ fatalerr("Cannot malloc %zu bytes of memory.", amt);
return(ptr);
}
@@ -894,7 +894,7 @@
extern POINTER *realloc();
if ((new = (char *)realloc(baseptr, amt)) == NULL)
- fatalerr("Cannot realloc %d bytes of memory.", amt);
+ fatalerr("Cannot realloc %zu bytes of memory.", amt);
return(new);
}
@@ -910,7 +910,7 @@
extern POINTER *calloc();
if ((ptr = (char *)calloc(num, esize)) == NULL)
- fatalerr("Cannot calloc %d * %d = %d bytes of memory.",
+ fatalerr("Cannot calloc %zu * %zu = %zu bytes of memory.",
num, esize, num * esize);
return(ptr);
--- ./src/filesys.c.ORI 2012-06-12 07:35:16.000000000 +0200
+++ ./src/filesys.c 2012-06-12 08:12:20.000000000 +0200
@@ -434,8 +434,8 @@
*/
int getfilesysinfo(file, freespace, freefiles)
char *file;
- long *freespace;
- long *freefiles;
+ int64_t *freespace;
+ int64_t *freefiles;
{
#if defined(STATFS_TYPE)
static statfs_t statfsbuf;
--- ./config/config-data.h.ORI 1998-11-10 04:59:47.000000000 +0100
+++ ./config/config-data.h 2012-06-12 07:55:48.000000000 +0200
@@ -58,10 +58,10 @@
* Set default write(2) return and amount types.
*/
#if !defined(WRITE_RETURN_T)
-#define WRITE_RETURN_T int /* What write() returns */
+#define WRITE_RETURN_T ssize_t /* What write() returns */
#endif /* WRITE_RETURN_T */
#if !defined(WRITE_AMT_T)
-#define WRITE_AMT_T int /* Amount to write */
+#define WRITE_AMT_T size_t /* Amount to write */
#endif /* WRITE_AMT_T */
#endif /* __configdata_h__ */
--- ./src/client.c.ORI 2012-06-12 08:26:35.000000000 +0200
+++ ./src/client.c 2012-06-12 08:57:34.000000000 +0200
@@ -399,9 +399,9 @@
/*
* Send file info
*/
- (void) sendcmd(C_RECVREG, "%o %04o %ld %ld %ld %s %s %s",
+ (void) sendcmd(C_RECVREG, "%o %04o %lld %ld %ld %s %s %s",
opts, stb->st_mode & 07777,
- (long) stb->st_size,
+ (long long) stb->st_size,
stb->st_mtime, stb->st_atime,
user, group, rname);
if (response() < 0) {
@@ -409,8 +409,8 @@
return(-1);
}
- debugmsg(DM_MISC, "Send file '%s' %d bytes\n",
- rname, (long) stb->st_size);
+ debugmsg(DM_MISC, "Send file '%s' %ld bytes\n",
+ rname, (long long) stb->st_size);
/*
* Set remote time out alarm handler.
@@ -661,9 +661,9 @@
/*
* Gather and send basic link info
*/
- (void) sendcmd(C_RECVSYMLINK, "%o %04o %ld %ld %ld %s %s %s",
+ (void) sendcmd(C_RECVSYMLINK, "%o %04o %lld %ld %ld %s %s %s",
opts, stb->st_mode & 07777,
- (long) stb->st_size,
+ (long long) stb->st_size,
stb->st_mtime, stb->st_atime,
user, group, rname);
if (response() < 0)
@@ -843,7 +843,7 @@
/*
* Parse size
*/
- size = strtol(cp, &cp, 10);
+ size = strtoll(cp, &cp, 10);
if (*cp++ != ' ') {
error("update: size not delimited");
return(US_NOTHING);
@@ -895,8 +895,8 @@
debugmsg(DM_MISC, "update(%s,) local mode %04o remote mode %04o\n",
rname, lmode, rmode);
- debugmsg(DM_MISC, "update(%s,) size %d mtime %d owner '%s' grp '%s'\n",
- rname, (int) size, mtime, owner, group);
+ debugmsg(DM_MISC, "update(%s,) size %lld mtime %d owner '%s' grp '%s'\n",
+ rname, (long long) size, mtime, owner, group);
if (statp->st_mtime != mtime) {
if (statp->st_mtime < mtime && IS_ON(opts, DO_YOUNGER)) {
@@ -922,8 +922,8 @@
}
if (statp->st_size != size) {
- debugmsg(DM_MISC, "size does not match (%d != %d).\n",
- (int) statp->st_size, size);
+ debugmsg(DM_MISC, "size does not match (%lld != %lld).\n",
+ (long long) statp->st_size, (long long)size);
return(US_OUTDATE);
}
--- ./src/child.c.ORI 1998-11-10 05:18:57.000000000 +0100
+++ ./src/child.c 2012-06-12 08:58:16.000000000 +0200
@@ -189,7 +189,7 @@
CHILD *child;
{
char rbuf[BUFSIZ];
- int amt;
+ ssize_t amt;
debugmsg(DM_CALL, "[readchild(%s, %d, %d) start]",
child->c_name, child->c_pid, child->c_readfd);
@@ -208,7 +208,7 @@
*/
while ((amt = read(child->c_readfd, rbuf, sizeof(rbuf))) > 0) {
/* XXX remove these debug calls */
- debugmsg(DM_MISC, "[readchild(%s, %d, %d) got %d bytes]",
+ debugmsg(DM_MISC, "[readchild(%s, %d, %d) got %lld bytes]",
child->c_name, child->c_pid, child->c_readfd, amt);
(void) xwrite(fileno(stdout), rbuf, amt);
@@ -217,7 +217,7 @@
child->c_name, child->c_pid, child->c_readfd);
}
- debugmsg(DM_MISC, "readchild(%s, %d, %d) done: amt = %d errno = %d\n",
+ debugmsg(DM_MISC, "readchild(%s, %d, %d) done: amt = %lld errno = %d\n",
child->c_name, child->c_pid, child->c_readfd, amt, errno);
/*

View File

@ -1,5 +1,5 @@
--- src/Makefile.real.orig 1998-11-09 20:03:46.000000000 -0800
+++ src/Makefile.real 2014-05-29 19:25:12.420724836 -0700
--- src/Makefile.real.orig 1998-11-10 04:03:46 UTC
+++ src/Makefile.real
@@ -8,7 +8,7 @@
# $Id: Makefile.real,v 1.12 1998/11/10 04:03:46 mcooper Exp $
#
@ -9,7 +9,7 @@
HFILES = ../config/config.h ../config/config-data.h \
../config/config-def.h ../config/os-$(OS).h \
@@ -52,9 +52,9 @@
@@ -52,9 +52,9 @@ clean:
$(COMMONOBJS) $(MISSINGOBJS)
install:

View File

@ -0,0 +1,29 @@
--- src/child.c.orig 1998-11-10 04:18:57 UTC
+++ src/child.c
@@ -189,7 +189,7 @@ static void readchild(child)
CHILD *child;
{
char rbuf[BUFSIZ];
- int amt;
+ ssize_t amt;
debugmsg(DM_CALL, "[readchild(%s, %d, %d) start]",
child->c_name, child->c_pid, child->c_readfd);
@@ -208,7 +208,7 @@ static void readchild(child)
*/
while ((amt = read(child->c_readfd, rbuf, sizeof(rbuf))) > 0) {
/* XXX remove these debug calls */
- debugmsg(DM_MISC, "[readchild(%s, %d, %d) got %d bytes]",
+ debugmsg(DM_MISC, "[readchild(%s, %d, %d) got %lld bytes]",
child->c_name, child->c_pid, child->c_readfd, amt);
(void) xwrite(fileno(stdout), rbuf, amt);
@@ -217,7 +217,7 @@ static void readchild(child)
child->c_name, child->c_pid, child->c_readfd);
}
- debugmsg(DM_MISC, "readchild(%s, %d, %d) done: amt = %d errno = %d\n",
+ debugmsg(DM_MISC, "readchild(%s, %d, %d) done: amt = %lld errno = %d\n",
child->c_name, child->c_pid, child->c_readfd, amt, errno);
/*

View File

@ -0,0 +1,98 @@
--- src/client.c.orig 1998-11-10 04:08:47 UTC
+++ src/client.c
@@ -356,16 +356,16 @@ static int sendhardlink(opts, lp, rname, destdir)
rname, lp->pathname, lp->src, lp->target);
if (*lp->target == CNULL)
- (void) sendcmd(C_RECVHARDLINK, "%o %s %s",
- opts, lp->pathname, rname);
+ (void) sendcmd(C_RECVHARDLINK, "%o %d %s %s",
+ opts, strlen(lp->pathname), lp->pathname, rname);
else {
lname = buff;
strcpy(lname, remfilename(lp->src, lp->target,
lp->pathname, rname,
destdir));
debugmsg(DM_MISC, "sendhardlink: lname=%s\n", lname);
- (void) sendcmd(C_RECVHARDLINK, "%o %s %s",
- opts, lname, rname);
+ (void) sendcmd(C_RECVHARDLINK, "%o %d %s %s",
+ opts, strlen(lname), lname, rname);
}
return(response());
@@ -399,9 +399,9 @@ static int sendfile(rname, opts, stb, user, group, des
/*
* Send file info
*/
- (void) sendcmd(C_RECVREG, "%o %04o %ld %ld %ld %s %s %s",
+ (void) sendcmd(C_RECVREG, "%o %04o %lld %ld %ld %s %s %s",
opts, stb->st_mode & 07777,
- (long) stb->st_size,
+ (long long) stb->st_size,
stb->st_mtime, stb->st_atime,
user, group, rname);
if (response() < 0) {
@@ -409,8 +409,8 @@ static int sendfile(rname, opts, stb, user, group, des
return(-1);
}
- debugmsg(DM_MISC, "Send file '%s' %d bytes\n",
- rname, (long) stb->st_size);
+ debugmsg(DM_MISC, "Send file '%s' %ld bytes\n",
+ rname, (long long) stb->st_size);
/*
* Set remote time out alarm handler.
@@ -661,9 +661,9 @@ static int sendlink(rname, opts, stb, user, group, des
/*
* Gather and send basic link info
*/
- (void) sendcmd(C_RECVSYMLINK, "%o %04o %ld %ld %ld %s %s %s",
+ (void) sendcmd(C_RECVSYMLINK, "%o %04o %lld %ld %ld %s %s %s",
opts, stb->st_mode & 07777,
- (long) stb->st_size,
+ (long long) stb->st_size,
stb->st_mtime, stb->st_atime,
user, group, rname);
if (response() < 0)
@@ -761,7 +761,7 @@ static int update(rname, opts, statp)
unsigned short rmode;
char *owner = NULL, *group = NULL;
int done, n;
- u_char *cp;
+ char *cp;
debugmsg(DM_CALL, "update(%s, 0x%x, 0x%x)\n", rname, opts, statp);
@@ -843,7 +843,7 @@ static int update(rname, opts, statp)
/*
* Parse size
*/
- size = strtol(cp, &cp, 10);
+ size = strtoll(cp, &cp, 10);
if (*cp++ != ' ') {
error("update: size not delimited");
return(US_NOTHING);
@@ -895,8 +895,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 %d mtime %d owner '%s' grp '%s'\n",
- rname, (int) size, mtime, owner, group);
+ debugmsg(DM_MISC, "update(%s,) size %lld mtime %d owner '%s' grp '%s'\n",
+ rname, (long long) size, mtime, owner, group);
if (statp->st_mtime != mtime) {
if (statp->st_mtime < mtime && IS_ON(opts, DO_YOUNGER)) {
@@ -922,8 +922,8 @@ static int update(rname, opts, statp)
}
if (statp->st_size != size) {
- debugmsg(DM_MISC, "size does not match (%d != %d).\n",
- (int) statp->st_size, size);
+ debugmsg(DM_MISC, "size does not match (%lld != %lld).\n",
+ (long long) statp->st_size, (long long)size);
return(US_OUTDATE);
}

View File

@ -0,0 +1,87 @@
--- src/common.c.orig 1998-11-10 04:09:01 UTC
+++ src/common.c
@@ -108,21 +108,6 @@ extern WRITE_RETURN_T xwrite(fd, buf, len)
}
/*
- * Set program name
- */
-extern void setprogname(argv)
- char **argv;
-{
- register char *cp;
-
- if (!progname) {
- progname = strdup(argv[0]);
- if (cp = strrchr(progname, '/'))
- progname = cp + 1;
- }
-}
-
-/*
* Do run-time initialization
*/
extern int init(argc, argv, envp)
@@ -137,7 +122,8 @@ extern int init(argc, argv, envp)
if (!isserver)
(void) signal(SIGSEGV, sighandler);
- setprogname(argv);
+ if (progname == NULL)
+ progname = basename(argv[0]);
/*
* Save a copy of our argc and argv before setargs() overwrites them
@@ -393,14 +379,14 @@ extern int sendcmd(cmd, fmt, a1, a2, a3, a4, a5, a6, a
*/
static u_char rembuf[BUFSIZ];
static u_char *remptr;
-static int remleft;
+static ssize_t remleft;
#define remc() (--remleft < 0 ? remmore() : *remptr++)
/*
* Back end to remote read()
*/
-static int remread(fd, buf, bufsiz)
+static ssize_t remread(fd, buf, bufsiz)
int fd;
u_char *buf;
int bufsiz;
@@ -494,7 +480,7 @@ extern int remline(buffer, space, doclean)
/*
* Non-line-oriented remote read.
*/
-readrem(p, space)
+ssize_t readrem(p, space)
char *p;
register int space;
{
@@ -892,7 +878,7 @@ char *xmalloc(amt)
extern POINTER *malloc();
if ((ptr = (char *)malloc(amt)) == NULL)
- fatalerr("Cannot malloc %d bytes of memory.", amt);
+ fatalerr("Cannot malloc %zu bytes of memory.", amt);
return(ptr);
}
@@ -908,7 +894,7 @@ char *xrealloc(baseptr, amt)
extern POINTER *realloc();
if ((new = (char *)realloc(baseptr, amt)) == NULL)
- fatalerr("Cannot realloc %d bytes of memory.", amt);
+ fatalerr("Cannot realloc %zu bytes of memory.", amt);
return(new);
}
@@ -924,7 +910,7 @@ char *xcalloc(num, esize)
extern POINTER *calloc();
if ((ptr = (char *)calloc(num, esize)) == NULL)
- fatalerr("Cannot calloc %d * %d = %d bytes of memory.",
+ fatalerr("Cannot calloc %zu * %zu = %zu bytes of memory.",
num, esize, num * esize);
return(ptr);

View File

@ -1,54 +1,87 @@
*** src/docmd.c 1995/07/21 09:53:30 1.1.1.1
--- src/docmd.c 1995/07/21 10:07:14 1.2
***************
*** 251,259 ****
char *cmd;
{
int desc;
- #if defined(DIRECT_RCMD)
static int port = -1;
- #endif /* DIRECT_RCMD */
debugmsg(DM_MISC, "local user = %s remote user = %s\n", luser, ruser);
debugmsg(DM_MISC, "Remote command = '%s'\n", cmd);
--- 251,257 ----
***************
*** 280,290 ****
if (becomeuser() != 0)
exit(1);
#else /* !DIRECT_RCMD */
! debugmsg(DM_MISC, "Remote shell command = '%s'\n", path_remsh);
! (void) signal(SIGPIPE, SIG_IGN);
! desc = rshrcmd(&rhost, -1, luser, ruser, cmd, 0);
! if (desc > 0)
(void) signal(SIGPIPE, sighandler);
#endif /* DIRECT_RCMD */
(void) alarm(0);
--- 278,303 ----
if (becomeuser() != 0)
exit(1);
#else /* !DIRECT_RCMD */
! if (geteuid() == 0 && strcmp(path_remsh, "/usr/bin/rsh") == 0) {
! debugmsg(DM_MISC, "I am root, using rsh, therefore direct rcmd\n");
(void) signal(SIGPIPE, sighandler);
+
+ if (port < 0) {
+ struct servent *sp;
+
+ if ((sp = getservbyname("shell", "tcp")) == NULL)
+ fatalerr("shell/tcp: unknown service");
+ port = sp->s_port;
+ }
+
+ desc = rcmd(&rhost, port, luser, ruser, cmd, 0);
+ } else {
+ debugmsg(DM_MISC, "Remote shell command = '%s'\n", path_remsh);
+ (void) signal(SIGPIPE, SIG_IGN);
+ desc = rshrcmd(&rhost, -1, luser, ruser, cmd, 0);
+ if (desc > 0)
+ (void) signal(SIGPIPE, sighandler);
+ }
#endif /* DIRECT_RCMD */
(void) alarm(0);
--- src/docmd.c.orig 1998-11-10 04:08:32 UTC
+++ src/docmd.c
@@ -102,7 +102,8 @@ static void notify(rhost, to, lmod)
register struct namelist *to;
time_t lmod;
{
- register int fd, len;
+ register int fd;
+ ssize_t len;
FILE *pf, *popen();
struct stat stb;
static char buf[BUFSIZ];
@@ -261,9 +262,7 @@ static int remotecmd(rhost, luser, ruser, cmd)
char *cmd;
{
int desc;
-#if defined(DIRECT_RCMD)
static int port = -1;
-#endif /* DIRECT_RCMD */
debugmsg(DM_MISC, "local user = %s remote user = %s\n", luser, ruser);
debugmsg(DM_MISC, "Remote command = '%s'\n", cmd);
@@ -290,11 +289,26 @@ static int remotecmd(rhost, luser, ruser, cmd)
if (becomeuser() != 0)
exit(1);
#else /* !DIRECT_RCMD */
- debugmsg(DM_MISC, "Remote shell command = '%s'\n", path_remsh);
- (void) signal(SIGPIPE, SIG_IGN);
- desc = rshrcmd(&rhost, -1, luser, ruser, cmd, 0);
- if (desc > 0)
+ if (geteuid() == 0 && strcmp(path_remsh, "/usr/bin/rsh") == 0) {
+ debugmsg(DM_MISC, "I am root, using rsh, therefore direct rcmd\n");
(void) signal(SIGPIPE, sighandler);
+
+ if (port < 0) {
+ struct servent *sp;
+
+ if ((sp = getservbyname("shell", "tcp")) == NULL)
+ fatalerr("shell/tcp: unknown service");
+ port = sp->s_port;
+ }
+
+ desc = rcmd(&rhost, port, luser, ruser, cmd, 0);
+ } else {
+ debugmsg(DM_MISC, "Remote shell command = '%s'\n", path_remsh);
+ (void) signal(SIGPIPE, SIG_IGN);
+ desc = rshrcmd(&rhost, -1, luser, ruser, cmd, 0);
+ if (desc > 0)
+ (void) signal(SIGPIPE, sighandler);
+ }
#endif /* DIRECT_RCMD */
(void) alarm(0);
@@ -312,7 +326,7 @@ static int makeconn(rhost)
register char *ruser, *cp;
static char *cur_host = NULL;
extern char *locuser;
- extern long min_freefiles, min_freespace;
+ extern int64_t min_freefiles, min_freespace;
extern char *remotemsglist;
char tuser[BUFSIZ], buf[BUFSIZ];
u_char respbuff[BUFSIZ];
@@ -403,13 +417,13 @@ static int makeconn(rhost)
return(0);
}
if (min_freespace) {
- (void) sendcmd(C_SETCONFIG, "%c%d", SC_FREESPACE,
+ (void) sendcmd(C_SETCONFIG, "%c%lld", SC_FREESPACE,
min_freespace);
if (response() < 0)
return(0);
}
if (min_freefiles) {
- (void) sendcmd(C_SETCONFIG, "%c%d", SC_FREEFILES,
+ (void) sendcmd(C_SETCONFIG, "%c%lld", SC_FREEFILES,
min_freefiles);
if (response() < 0)
return(0);
@@ -611,7 +625,7 @@ okname(name)
c = *cp;
if (c & 0200)
isbad = TRUE;
- if (!isalpha(c) && !isdigit(c) && c != '_' && c != '-')
+ if (!isalpha(c) && !isdigit(c) && c != '_' && c != '-' && c != '.' )
isbad = TRUE;
}

View File

@ -1,12 +1,15 @@
--- src/filesys-os.c.dist Fri Feb 16 03:01:04 1996
+++ src/filesys-os.c Wed Feb 3 23:38:46 1999
@@ -180,4 +180,5 @@
--- src/filesys-os.c.orig 1998-11-10 04:09:59 UTC
+++ src/filesys-os.c
@@ -187,6 +187,7 @@ mntent_t *getmountent(fptr)
if (mnt->f_flags & M_RDONLY)
mntstruct.me_flags |= MEFLAG_READONLY;
#endif
+#ifdef MOUNT_NFS
switch ((ulong)((struct statfs*)mnt)->f_type) {
case MOUNT_NFS:
@@ -191,4 +192,14 @@
(void) sprintf(remote_dev, "%s", mnt->f_mntfromname);
@@ -198,6 +199,16 @@ mntent_t *getmountent(fptr)
mntstruct.me_type = METYPE_OTHER;
break;
}
+#else
@ -21,3 +24,4 @@
+#endif
mnt++;
entries_left--;

View File

@ -0,0 +1,13 @@
--- src/filesys.c.orig 1998-11-10 04:10:18 UTC
+++ src/filesys.c
@@ -430,8 +430,8 @@ int is_symlinked(path, statbuf, isvalid)
*/
int getfilesysinfo(file, freespace, freefiles)
char *file;
- long *freespace;
- long *freefiles;
+ int64_t *freespace;
+ int64_t *freefiles;
{
#if defined(STATFS_TYPE)
static statfs_t statfsbuf;

View File

@ -1,14 +1,3 @@
This patch replaces the character-buffer (which needed to be static,
BTW) with a dynamically (re)allocated one.
This reduces the memory requirements in most cases, while still
allowing LARGE lines to be properly processed.
While here, make the error-reporting a tad more useful to people
debugging their distfiles.
-mi
--- src/gram.y.orig 1998-11-10 04:10:42 UTC
+++ src/gram.y
@@ -61,6 +61,13 @@ static char copyright[] =

View File

@ -0,0 +1,33 @@
--- src/message.c.orig 1998-11-10 04:13:30 UTC
+++ src/message.c
@@ -462,8 +462,8 @@ static void msgsendnotify(msgfac, mtype, flags, msgbuf
return;
if (!msgfac->mf_fptr) {
- register char *cp;
- char *getenv();
+ const char *cp;
+ int fd;
/*
* Create and open a new temporary file
@@ -475,8 +475,8 @@ static void msgsendnotify(msgfac, mtype, flags, msgbuf
(void) sprintf(tempfile, "%s/%s", cp, _RDIST_TMP);
msgfac->mf_filename = tempfile;
- (void) mktemp(msgfac->mf_filename);
- if ((msgfac->mf_fptr = fopen(msgfac->mf_filename, "w"))==NULL)
+ fd = mkstemp(tempfile);
+ if (fd == -1 || (msgfac->mf_fptr = fdopen(fd, "w"))==NULL)
fatalerr("Cannot open notify file for writing: %s: %s.",
msgfac->mf_filename, SYSERR);
debugmsg(DM_MISC, "Created notify temp file '%s'",
@@ -513,7 +513,7 @@ extern void checkhostname()
*/
static void _message(flags, msgbuf)
int flags;
- char *msgbuf;
+ const char *msgbuf;
{
register int i, x;
register char *cp;

View File

@ -0,0 +1,53 @@
--- src/rdist.c.orig 1998-11-10 04:13:50 UTC
+++ src/rdist.c
@@ -62,8 +62,8 @@ static char copyright[] =
char *distfile = NULL; /* Name of distfile to use */
int maxchildren = MAXCHILDREN; /* Max no of concurrent PIDs */
int nflag = 0; /* Say without doing */
-long min_freespace = 0; /* Min filesys free space */
-long min_freefiles = 0; /* Min filesys free # files */
+int64_t min_freespace = 0; /* Min filesys free space */
+int64_t min_freefiles = 0; /* Min filesys free # files */
FILE *fin = NULL; /* Input file pointer */
struct group *gr = NULL; /* Static area for getgrent */
char localmsglist[] = "stdout=all:notify=all:syslog=nerror,ferror";
@@ -107,12 +107,13 @@ main(argc, argv, envp)
register char *cp;
int cmdargs = 0;
int c;
+ const char *errstr;
/*
* We initialize progname here instead of init() because
* things in msgparseopts() need progname set.
*/
- setprogname(argv);
+ progname = basename(argv[0]);
if (cp = msgparseopts(localmsglist, TRUE)) {
error("Bad builtin log option (%s): %s.",
@@ -176,10 +177,20 @@ main(argc, argv, envp)
error("\"%s\" is not a number.", optarg);
usage();
}
- if (c == 'a')
- min_freespace = atoi(optarg);
- else if (c == 'A')
- min_freefiles = atoi(optarg);
+ if (c == 'a') {
+ min_freespace = (int64_t)strtonum(optarg,
+ 0, LLONG_MAX, &errstr);
+ if (errstr)
+ fatalerr("Minimum free space is %s: "
+ "'%s'", errstr, optarg);
+ }
+ else if (c == 'A') {
+ min_freefiles = (int64_t)strtonum(optarg,
+ 0, LLONG_MAX, &errstr);
+ if (errstr)
+ fatalerr("Minimum free files is %s: "
+ "'%s'", errstr, optarg);
+ }
else if (c == 'M')
maxchildren = atoi(optarg);
else if (c == 't')

View File

@ -1,12 +1,13 @@
--- src/rshrcmd.c Mon Nov 9 23:15:07 1998
+++ src/rshrcmd.c Tue Jan 18 14:53:29 2005
@@ -42,5 +42,4 @@
--- src/rshrcmd.c.orig 1998-11-10 04:15:07 UTC
+++ src/rshrcmd.c
@@ -41,19 +41,11 @@ rshrcmd(ahost, port, luser, ruser, cmd, fd2p)
int *fd2p;
{
int cpid;
- struct hostent *hp;
int sp[2];
@@ -48,11 +47,4 @@
/* insure that we are indeed being used as we thought. */
if (fd2p != 0)
return -1;
- /* validate remote hostname. */
@ -18,10 +19,13 @@
- /* *ahost = hp->h_name;*/ /* This makes me nervous. */
/* get a socketpair we'll use for stdin and stdout. */
@@ -72,5 +64,5 @@
if (getsocketpair(AF_UNIX, SOCK_STREAM, 0, sp) < 0) {
@@ -71,7 +63,7 @@ rshrcmd(ahost, port, luser, ruser, cmd, fd2p)
/* child. we use sp[1] to be stdin/stdout, and close
sp[0]. */
(void) close(sp[0]);
- if (dup2(sp[1], 0) < 0 || dup2(0,1) < 0 || dup2(0, 2) < 0) {
+ if (dup2(sp[1], 0) < 0 || dup2(0,1) < 0) {
error("dup2 failed: %s.", SYSERR);
_exit(255);
}

View File

@ -0,0 +1,199 @@
--- src/server.c.orig 1998-11-10 04:15:31 UTC
+++ src/server.c
@@ -62,8 +62,8 @@ char *ptarget; /* pointer to end of target name */
int catname = 0; /* cat name to target name */
char *sptarget[32]; /* stack of saved ptarget's for directories */
char *fromhost = NULL; /* Client hostname */
-static long min_freespace = 0; /* Minimium free space on a filesystem */
-static long min_freefiles = 0; /* Minimium free # files on a filesystem */
+static int64_t min_freespace = 0; /* Minimium free space on a filesystem */
+static int64_t min_freefiles = 0; /* Minimium free # files on a filesystem */
int oumask; /* Old umask */
/*
@@ -645,8 +645,8 @@ static void query(name)
case S_IFLNK:
case S_IFDIR:
case S_IFREG:
- (void) sendcmd(QC_YES, "%ld %ld %o %s %s",
- (long) stb.st_size,
+ (void) sendcmd(QC_YES, "%lld %ld %o %s %s",
+ (long long) stb.st_size,
stb.st_mtime,
stb.st_mode & 07777,
getusername(stb.st_uid, target, options),
@@ -767,9 +767,9 @@ static void recvfile(new, opts, mode, owner, group, mt
/*
* Create temporary file
*/
- if ((f = creat(new, mode)) < 0) {
+ if ((f = open(new, O_CREAT|O_TRUNC|O_WRONLY|O_EXCL, mode)) < 0) {
if (errno != ENOENT || chkparent(new, opts) < 0 ||
- (f = creat(new, mode)) < 0) {
+ (f = open(new, O_CREAT|O_TRUNC|O_WRONLY|O_EXCL, mode)) < 0) {
error("%s: create failed: %s", new, SYSERR);
(void) unlink(new);
return;
@@ -783,13 +783,13 @@ static void recvfile(new, opts, mode, owner, group, mt
wrerr = 0;
olderrno = 0;
for (i = 0; i < size; i += BUFSIZ) {
- int amt = BUFSIZ;
+ off_t amt = BUFSIZ;
cp = buf;
if (i + amt > size)
amt = size - i;
do {
- int j;
+ ssize_t j;
j = readrem(cp, amt);
if (j <= 0) {
@@ -1245,18 +1245,35 @@ static void hardlink(cmd)
return;
}
- oldname = strtok(cp, " ");
- if (oldname == NULL) {
- error("hardlink: oldname name not delimited");
- return;
- }
+{ unsigned int len;
- newname = strtok((char *)NULL, " ");
- if (newname == NULL) {
- error("hardlink: new name not specified");
- return;
- }
+ if( *( cp += strspn( cp, " " ) ) == '\0' ) {
+ error("hardlink: oldnamelen name not found");
+ return;
+ }
+ len = strtoul( cp, &cp, 10 );
+
+ if( *( cp += strspn( cp, " " ) ) == '\0' ) {
+ error("hardlink: oldname not found");
+ return;
+ }
+ oldname = cp;
+ if( strlen( cp ) < len + 2 ) {
+ error("hardlink: oldname too short or nothing following found");
+ return;
+ }
+ cp += len;
+ *cp++ = '\0';
+
+ if( *( cp += strspn( cp, " " ) ) == '\0' ) {
+ error("hardlink: newname not found");
+ return;
+ }
+
+ newname = cp;
+}
+
if (exptilde(expbuf, oldname) == NULL) {
error("hardlink: tilde expansion failed");
return;
@@ -1306,6 +1323,7 @@ static void setconfig(cmd)
{
register char *cp = cmd;
char *estr;
+ const char *errstr;
switch (*cp++) {
case SC_HOSTNAME: /* Set hostname */
@@ -1322,19 +1340,15 @@ static void setconfig(cmd)
break;
case SC_FREESPACE: /* Minimium free space */
- if (!isdigit(*cp)) {
- fatalerr("Expected digit, got '%s'.", cp);
- return;
- }
- min_freespace = (unsigned long) atoi(cp);
+ min_freespace = (int64_t)strtonum(cp, 0, LLONG_MAX, &errstr);
+ if (errstr)
+ fatalerr("Minimum free space is %s: '%s'", errstr, optarg);
break;
case SC_FREEFILES: /* Minimium free files */
- if (!isdigit(*cp)) {
- fatalerr("Expected digit, got '%s'.", cp);
- return;
- }
- min_freefiles = (unsigned long) atoi(cp);
+ min_freefiles = (int64_t)strtonum(cp, 0, LLONG_MAX, &errstr);
+ if (errstr)
+ fatalerr("Minimum free files is %s: '%s'", errstr, optarg);
break;
case SC_LOGGING: /* Logging options */
@@ -1364,7 +1378,7 @@ static void recvit(cmd, type)
time_t mtime, atime;
char *owner, *group, *file;
char new[MAXPATHLEN];
- long freespace = -1, freefiles = -1;
+ int64_t freespace = -1, freefiles = -1;
char *cp = cmd;
/*
@@ -1388,7 +1402,7 @@ static void recvit(cmd, type)
/*
* Get file size
*/
- size = strtol(cp, &cp, 10);
+ size = (off_t) strtoll(cp, &cp, 10);
if (*cp++ != ' ') {
error("recvit: size not delimited");
return;
@@ -1397,7 +1411,7 @@ static void recvit(cmd, type)
/*
* Get modification time
*/
- mtime = strtol(cp, &cp, 10);
+ mtime = (time_t) strtol(cp, &cp, 10);
if (*cp++ != ' ') {
error("recvit: mtime not delimited");
return;
@@ -1441,8 +1455,8 @@ static void recvit(cmd, type)
}
debugmsg(DM_MISC,
- "recvit: opts = %04o mode = %04o size = %d mtime = %d",
- opts, mode, size, mtime);
+ "recvit: opts = %04o mode = %04o size = %lld mtime = %d",
+ opts, mode, (long long) size, mtime);
debugmsg(DM_MISC,
"recvit: owner = '%s' group = '%s' file = '%s' catname = %d isdir = %d",
owner, group, file, catname, (type == S_IFDIR) ? 1 : 0);
@@ -1486,7 +1500,7 @@ static void recvit(cmd, type)
*/
if (min_freespace || min_freefiles) {
/* Convert file size to kilobytes */
- long fsize = (long) (size / 1024);
+ int64_t fsize = (int64_t)size / 1024;
if (getfilesysinfo(target, &freespace, &freefiles) != 0)
return;
@@ -1498,15 +1512,15 @@ static void recvit(cmd, type)
if (min_freespace && (freespace >= 0) &&
(freespace - fsize < min_freespace)) {
error(
- "%s: Not enough free space on filesystem: min %d free %d",
- target, min_freespace, freespace);
+ "%s: Not enough free space on filesystem: min %lld "
+ "free %lld", target, min_freespace, freespace);
return;
}
if (min_freefiles && (freefiles >= 0) &&
(freefiles - 1 < min_freefiles)) {
error(
- "%s: Not enough free files on filesystem: min %d free %d",
- target, min_freefiles, freefiles);
+ "%s: Not enough free files on filesystem: min %lld free "
+ "%lld", target, min_freefiles, freefiles);
return;
}
}

View File

@ -1,6 +1,6 @@
--- src/setargs.c.orig Mon Nov 9 20:15:56 1998
+++ src/setargs.c Fri Nov 3 02:41:25 2000
@@ -89,6 +89,8 @@
--- src/setargs.c.orig 1998-11-10 04:15:56 UTC
+++ src/setargs.c
@@ -89,6 +89,8 @@ setargs_settup(argc, argv, envp)
LastArgv = argv[argc-1] + strlen(argv[argc-1]);
}
@ -9,7 +9,7 @@
/*
* Set process title
*/
@@ -165,5 +167,7 @@
@@ -165,5 +167,7 @@ extern void setproctitle(fmt, a1, a2, a3, a4, a5, a6)
_setproctitle(buf);
}
#endif /* !ARG_TYPE */

View File

@ -1,70 +0,0 @@
--- src/server.c.ORI 2020-06-27 09:02:15.364442000 +0200
+++ src/server.c 2020-06-27 09:12:23.010090000 +0200
@@ -1270,17 +1270,34 @@
return;
}
- oldname = strtok(cp, " ");
- if (oldname == NULL) {
- error("hardlink: oldname name not delimited");
- return;
- }
+{ unsigned int len;
- newname = strtok((char *)NULL, " ");
- if (newname == NULL) {
- error("hardlink: new name not specified");
- return;
- }
+ if( *( cp += strspn( cp, " " ) ) == '\0' ) {
+ error("hardlink: oldnamelen name not found");
+ return;
+ }
+
+ len = strtoul( cp, &cp, 10 );
+
+ if( *( cp += strspn( cp, " " ) ) == '\0' ) {
+ error("hardlink: oldname not found");
+ return;
+ }
+ oldname = cp;
+ if( strlen( cp ) < len + 2 ) {
+ error("hardlink: oldname too short or nothing following found");
+ return;
+ }
+ cp += len;
+ *cp++ = '\0';
+
+ if( *( cp += strspn( cp, " " ) ) == '\0' ) {
+ error("hardlink: newname not found");
+ return;
+ }
+
+ newname = cp;
+}
if (exptilde(expbuf, oldname) == NULL) {
error("hardlink: tilde expansion failed");
--- src/client.c.ORI 2020-06-27 09:02:15.372720000 +0200
+++ src/client.c 2020-06-27 08:32:20.000000000 +0200
@@ -359,16 +359,16 @@
rname, lp->pathname, lp->src, lp->target);
if (*lp->target == CNULL)
- (void) sendcmd(C_RECVHARDLINK, "%o %s %s",
- opts, lp->pathname, rname);
+ (void) sendcmd(C_RECVHARDLINK, "%o %d %s %s",
+ opts, strlen(lp->pathname), lp->pathname, rname);
else {
lname = buff;
strcpy(lname, remfilename(lp->src, lp->target,
lp->pathname, rname,
destdir));
debugmsg(DM_MISC, "sendhardlink: lname=%s\n", lname);
- (void) sendcmd(C_RECVHARDLINK, "%o %s %s",
- opts, lname, rname);
+ (void) sendcmd(C_RECVHARDLINK, "%o %d %s %s",
+ opts, strlen(lname), lname, rname);
}
return(response());