summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1996-07-25 05:31:04 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1996-07-25 05:31:04 +0000
commita051acee57a27a547746c93ffe492db4dcd785b7 (patch)
tree87438b429c37df04c19fdc25dfa47365da5b48fc /usr.bin
parent6320a12b698c60883333ef439725ea36b143e3c0 (diff)
Updated to rdist 6.1.3. Used real snprintf() (instead of string length
in the format) since we have it.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/rdist/child.c9
-rw-r--r--usr.bin/rdist/client.c16
-rw-r--r--usr.bin/rdist/config.h9
-rw-r--r--usr.bin/rdist/lookup.c7
-rw-r--r--usr.bin/rdist/message.c29
-rw-r--r--usr.bin/rdist/version.h4
-rw-r--r--usr.bin/rdistd/server.c29
7 files changed, 72 insertions, 31 deletions
diff --git a/usr.bin/rdist/child.c b/usr.bin/rdist/child.c
index 0e862779009..cfb6e47e3e6 100644
--- a/usr.bin/rdist/child.c
+++ b/usr.bin/rdist/child.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: child.c,v 1.3 1996/06/26 05:38:07 deraadt Exp $ */
+/* $OpenBSD: child.c,v 1.4 1996/07/25 05:30:59 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -35,7 +35,7 @@
#ifndef lint
static char RCSid[] =
-"$OpenBSD: child.c,v 1.3 1996/06/26 05:38:07 deraadt Exp $";
+"$OpenBSD: child.c,v 1.4 1996/07/25 05:30:59 millert Exp $";
static char sccsid[] = "@(#)docmd.c 5.1 (Berkeley) 6/6/85";
@@ -390,8 +390,9 @@ extern void waitup()
debugmsg(DM_MISC, "waitup() Call select(), activechildren=%d\n",
activechildren);
- count = select(FD_SETSIZE, &rchildfds, (fd_set *) NULL,
- (fd_set *) NULL, (struct timeval *) NULL);
+ count = select(FD_SETSIZE, (SELECT_FD_TYPE *) &rchildfds,
+ (SELECT_FD_TYPE *) NULL, (SELECT_FD_TYPE *) NULL,
+ (struct timeval *) NULL);
debugmsg(DM_MISC, "waitup() select returned %d activechildren = %d\n",
count, activechildren);
diff --git a/usr.bin/rdist/client.c b/usr.bin/rdist/client.c
index 8b2cc7226f9..d81a5bb3868 100644
--- a/usr.bin/rdist/client.c
+++ b/usr.bin/rdist/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.3 1996/06/26 05:38:08 deraadt Exp $ */
+/* $OpenBSD: client.c,v 1.4 1996/07/25 05:31:00 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -35,7 +35,7 @@
#ifndef lint
static char RCSid[] =
-"$OpenBSD: client.c,v 1.3 1996/06/26 05:38:08 deraadt Exp $";
+"$OpenBSD: client.c,v 1.4 1996/07/25 05:31:00 millert Exp $";
static char sccsid[] = "@(#)client.c";
@@ -531,6 +531,12 @@ static int rmchk(opts)
message(MT_INFO, "%s", s);
break;
+ case C_NOTEMSG:
+ if (n > 0)
+ message(MT_NOTICE, "%s", s);
+ break;
+ /* Goto top of loop */
+
case C_ERRMSG:
message(MT_NERROR, "%s", s);
return(didupdate);
@@ -707,6 +713,12 @@ static int sendlink(rname, opts, stb, user, group, destdir)
message(MT_INFO, "%s", s);
break;
+ case C_NOTEMSG:
+ if (n > 0)
+ message(MT_NOTICE, "%s", s);
+ break;
+ /* Goto top of loop */
+
case C_ERRMSG:
message(MT_NERROR, "%s", s);
return(-1);
diff --git a/usr.bin/rdist/config.h b/usr.bin/rdist/config.h
index 76ea817fafc..06e24fb69b1 100644
--- a/usr.bin/rdist/config.h
+++ b/usr.bin/rdist/config.h
@@ -1,4 +1,4 @@
-/* * $OpenBSD: config.h,v 1.4 1996/06/26 05:38:10 deraadt Exp $*/
+/* * $OpenBSD: config.h,v 1.5 1996/07/25 05:31:01 millert Exp $*/
/*
* Copyright (c) 1993 Michael A. Cooper
* Copyright (c) 1993 Regents of the University of California.
@@ -125,4 +125,11 @@
#define SL_NOTICE LOG_NOTICE /* General notices */
#define SL_DEBUG LOG_DEBUG /* Debugging */
+/*
+ * Arg types to select(2)
+ */
+#ifndef SELECT_FD_TYPE
+#define SELECT_FD_TYPE fd_set
+#endif
+
#endif /* __config_h__ */
diff --git a/usr.bin/rdist/lookup.c b/usr.bin/rdist/lookup.c
index 81cb98510ba..10b69524c2a 100644
--- a/usr.bin/rdist/lookup.c
+++ b/usr.bin/rdist/lookup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lookup.c,v 1.6 1996/07/12 07:23:59 mickey Exp $ */
+/* $OpenBSD: lookup.c,v 1.7 1996/07/25 05:31:01 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -35,7 +35,7 @@
#ifndef lint
static char RCSid[] =
-"$OpenBSD: lookup.c,v 1.6 1996/07/12 07:23:59 mickey Exp $";
+"$OpenBSD: lookup.c,v 1.7 1996/07/25 05:31:01 millert Exp $";
static char sccsid[] = "@(#)lookup.c 5.1 (Berkeley) 6/6/85";
@@ -148,7 +148,8 @@ lookup(name, action, value) /* %% in name. Ignore quotas in name */
continue;
if (action != LOOKUP) {
if (action != INSERT || s->s_type != CONST) {
- (void) snprintf(ebuf, sizeof(ebuf), "%s redefined", name);
+ (void) snprintf(ebuf, sizeof(ebuf),
+ "%s redefined", name);
yyerror(ebuf);
}
}
diff --git a/usr.bin/rdist/message.c b/usr.bin/rdist/message.c
index a54c4ebfb86..6523faf60f6 100644
--- a/usr.bin/rdist/message.c
+++ b/usr.bin/rdist/message.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: message.c,v 1.4 1996/06/26 05:38:14 deraadt Exp $ */
+/* $OpenBSD: message.c,v 1.5 1996/07/25 05:31:02 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -35,7 +35,7 @@
#ifndef lint
static char RCSid[] =
-"$OpenBSD: message.c,v 1.4 1996/06/26 05:38:14 deraadt Exp $";
+"$OpenBSD: message.c,v 1.5 1996/07/25 05:31:02 millert Exp $";
static char sccsid[] = "@(#)common.c";
@@ -119,7 +119,8 @@ extern void msgprconfig()
debugmsg(DM_MISC, "Current message logging config:");
for (i = 0; msgfacility[i].mf_name; ++i) {
- (void) sprintf(buf, " %s=", msgfacility[i].mf_name);
+ (void) snprintf(buf, sizeof(buf),
+ " %s=", msgfacility[i].mf_name);
for (x = 0; msgtypes[x].mt_name; ++x)
if (IS_ON(msgfacility[i].mf_msgtypes,
msgtypes[x].mt_type)) {
@@ -180,7 +181,7 @@ static char *setmsgtypes(msgfac, str)
*/
if (isserver && (msgfac->mf_msgfac != MF_SYSLOG &&
msgfac->mf_msgfac != MF_FILE)) {
- (void) sprintf(ebuf,
+ (void) snprintf(ebuf, sizeof(ebuf),
"The \"%s\" message facility cannot be used by the server.",
msgfac->mf_name);
return(ebuf);
@@ -247,8 +248,9 @@ static char *setmsgtypes(msgfac, str)
strcasecmp(word, "debug") == 0)
debug = DM_ALL;
} else {
- (void) sprintf(ebuf, "Message type \"%s\" is invalid.",
- word);
+ (void) snprintf(ebuf, sizeof(ebuf),
+ "Message type \"%s\" is invalid.",
+ word);
return(ebuf);
}
}
@@ -291,9 +293,9 @@ extern char *msgparseopts(msgstr, doset)
return("No message type specified");
if ((msgfac = getmsgfac(word)) == NULL) {
- (void) sprintf(ebuf,
- "%s is not a valid message facility",
- word);
+ (void) snprintf(ebuf, sizeof(ebuf),
+ "%s is not a valid message facility",
+ word);
return(ebuf);
}
@@ -543,16 +545,15 @@ static void _message(flags, msgbuf)
/*
* Special cases
*/
- if (isserver && IS_ON(flags, MT_REMOTE))
+ if (isserver && IS_ON(flags, MT_NOTICE)) {
+ msgsendstdout((MSGFACILITY *)NULL, MT_NOTICE, flags, mbuf);
+ return;
+ } else if (isserver && IS_ON(flags, MT_REMOTE))
msgsendstdout((MSGFACILITY *)NULL, MT_REMOTE, flags, mbuf);
else if (isserver && IS_ON(flags, MT_NERROR))
msgsendstdout((MSGFACILITY *)NULL, MT_NERROR, flags, mbuf);
else if (isserver && IS_ON(flags, MT_FERROR))
msgsendstdout((MSGFACILITY *)NULL, MT_FERROR, flags, mbuf);
- else if (isserver && IS_ON(flags, MT_NOTICE)) {
- msgsendstdout((MSGFACILITY *)NULL, MT_NOTICE, flags, mbuf);
- return;
- }
/*
* For each Message Facility, check each Message Type to see
diff --git a/usr.bin/rdist/version.h b/usr.bin/rdist/version.h
index f6d944ccd47..4793409ef57 100644
--- a/usr.bin/rdist/version.h
+++ b/usr.bin/rdist/version.h
@@ -1,4 +1,4 @@
-/* * $OpenBSD: version.h,v 1.3 1996/06/26 05:38:19 deraadt Exp $*/
+/* * $OpenBSD: version.h,v 1.4 1996/07/25 05:31:02 millert Exp $*/
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
@@ -50,7 +50,7 @@
/*
* Patch level
*/
-#define PATCHLEVEL 2
+#define PATCHLEVEL 3
/*
* Distribution status
diff --git a/usr.bin/rdistd/server.c b/usr.bin/rdistd/server.c
index da6472128a3..f49fc842651 100644
--- a/usr.bin/rdistd/server.c
+++ b/usr.bin/rdistd/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.4 1996/06/26 05:38:24 deraadt Exp $ */
+/* $OpenBSD: server.c,v 1.5 1996/07/25 05:31:03 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -34,7 +34,7 @@
*/
#ifndef lint
static char RCSid[] =
-"$OpenBSD: server.c,v 1.4 1996/06/26 05:38:24 deraadt Exp $";
+"$OpenBSD: server.c,v 1.5 1996/07/25 05:31:03 millert Exp $";
static char sccsid[] = "@(#)server.c 5.3 (Berkeley) 6/7/86";
@@ -393,7 +393,13 @@ static int removefile(statb)
return(-1);
}
removed:
- message(MT_CHANGE|MT_REMOTE, "%s: removed", target);
+ /*
+ * We use MT_NOTICE instead of MT_CHANGE because this function is
+ * sometimes called by other functions that are suppose to return a
+ * single ack() back to the client (rdist). This is a kludge until
+ * the Rdist protocol is re-done. Sigh.
+ */
+ message(MT_NOTICE|MT_REMOTE, "%s: removed", target);
return(0);
}
@@ -750,6 +756,7 @@ static void recvfile(new, opts, mode, owner, group, mtime, atime, size)
off_t i;
register char *cp;
char *savefile = NULL;
+ static struct stat statbuff;
/*
* Create temporary file
@@ -913,6 +920,18 @@ static void recvfile(new, opts, mode, owner, group, mtime, atime, size)
}
/*
+ * If the target is a directory, we need to remove it first
+ * before we can rename the new file.
+ */
+ if ((stat(target, &statbuff) == 0) && S_ISDIR(statbuff.st_mode)) {
+ char *saveptr = ptarget;
+
+ ptarget = &target[strlen(target)];
+ removefile(&statbuff);
+ ptarget = saveptr;
+ }
+
+ /*
* Install new (temporary) file as the actual target
*/
if (rename(new, target) < 0) {
@@ -1339,7 +1358,7 @@ static void recvit(cmd, type)
time_t mtime, atime;
char *owner, *group, *file;
char new[MAXPATHLEN];
- int freespace = -1, freefiles = -1;
+ long freespace = -1, freefiles = -1;
char *cp = cmd;
/*
@@ -1461,7 +1480,7 @@ static void recvit(cmd, type)
*/
if (min_freespace || min_freefiles) {
/* Convert file size to kilobytes */
- int fsize = size / 1024;
+ long fsize = (long) (size / 1024);
if (getfilesysinfo(target, &freespace, &freefiles) != 0)
return;