mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-26 02:20:51 +01:00
yppush_main.c:
- Remove unused 'pid' member from the jobs structure. (This was left over from an earlier incarnation of the program that used multiple processes.) - Remove #ifdef'ed longjmp() stuff. - Print warning message if the 'pushing' host is not the master for a map being pushed but don't bail out. (While yppush should only be used on an NIS master, using it elsewhere is not an unpardonable sin.) yppush.8: - Fix a couple of mind-os. Makefile - Change format to hopefully ease bootstrapping. (Suggested by wollman.) Other Makefiles should follow.
This commit is contained in:
parent
49481ba074
commit
92a11b8721
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15016
@ -4,23 +4,25 @@ PROG= yppush
|
|||||||
SRCS= yp_clnt.c ypxfr_getmap.c yp_dblookup.c yppush_svc.c \
|
SRCS= yp_clnt.c ypxfr_getmap.c yp_dblookup.c yppush_svc.c \
|
||||||
yp_error.c ypxfr_misc.c yppush_main.c
|
yp_error.c ypxfr_misc.c yppush_main.c
|
||||||
|
|
||||||
.PATH: ${.CURDIR}/../ypserv ${.CURDIR}/../../libexec/ypxfr
|
|
||||||
|
|
||||||
MAN8= yppush.8
|
MAN8= yppush.8
|
||||||
|
|
||||||
CFLAGS+=-I. -I${.CURDIR}/../../libexec/ypxfr
|
CFLAGS+=-I. -I${.CURDIR}/../../libexec/ypxfr
|
||||||
|
|
||||||
|
RPCDIR= ${.CURDIR}/../../include/rpcsvc
|
||||||
|
RPCGEN= rpcgen -C
|
||||||
|
|
||||||
|
.PATH: ${RPCDIR} ${.CURDIR}/../../usr.sbin/ypserv \
|
||||||
|
${.CURDIR}/../../libexec/ypxfr
|
||||||
|
|
||||||
CLEANFILES= yp.h yp_clnt.c yppush_svc.c
|
CLEANFILES= yp.h yp_clnt.c yppush_svc.c
|
||||||
|
|
||||||
RPCSRC= ${.DESTDIR}/usr/include/rpcsvc/yp.x
|
yppush_svc.c: yp.x yp.h
|
||||||
RPCGEN= rpcgen -C
|
${RPCGEN} -DYPPUSH_ONLY -m -o ${.TARGET} ${RPCDIR}/yp.x
|
||||||
|
|
||||||
yppush_svc.c: ${RPCSRC} yp.h
|
yp_clnt.c: yp.x yp.h
|
||||||
${RPCGEN} -DYPPUSH_ONLY -m -o ${.TARGET} ${RPCSRC}
|
${RPCGEN} -DYPSERV_ONLY -l -o ${.TARGET} ${RPCDIR}/yp.x
|
||||||
|
|
||||||
yp_clnt.c: ${RPCSRC} yp.h
|
yp.h: yp.x
|
||||||
${RPCGEN} -DYPSERV_ONLY -l -o ${.TARGET} ${RPCSRC}
|
${RPCGEN} -h -o ${.TARGET} ${RPCDIR}/yp.x
|
||||||
|
|
||||||
yp.h: ${RPCSRC}
|
|
||||||
${RPCGEN} -h -o ${.TARGET} ${RPCSRC}
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" $Id: yppush.8,v 1.2 1996/01/30 13:52:45 mpp Exp $
|
.\" $Id: yppush.8,v 1.3 1996/02/11 22:38:02 mpp Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd February 5, 1995
|
.Dd February 5, 1995
|
||||||
.Dt YPPUSH 8
|
.Dt YPPUSH 8
|
||||||
@ -149,7 +149,7 @@ the system administrator decides to store the NIS maps somewhere else.
|
|||||||
.It Fl v
|
.It Fl v
|
||||||
Verbose mode: causes
|
Verbose mode: causes
|
||||||
.Nm yppush
|
.Nm yppush
|
||||||
to print debugging messages as it runs. Note specifying this flag twice
|
to print debugging messages as it runs. Specifying this flag twice
|
||||||
makes
|
makes
|
||||||
.Nm yppush
|
.Nm yppush
|
||||||
even more verbose.
|
even more verbose.
|
||||||
@ -165,7 +165,7 @@ a particular NIS domain.
|
|||||||
.Xr ypxfr 8
|
.Xr ypxfr 8
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
The mechanism for transferring NIS maps in NIS v1 is different
|
The mechanism for transferring NIS maps in NIS v1 is different
|
||||||
that that in NIS version 2. This version of
|
than that in NIS version 2. This version of
|
||||||
.Nm yppush
|
.Nm yppush
|
||||||
has support for transferring maps to NIS v2 systems only.
|
has support for transferring maps to NIS v2 systems only.
|
||||||
.Sh AUTHOR
|
.Sh AUTHOR
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: yppush_main.c,v 1.25 1996/01/27 19:44:48 wpaul Exp $
|
* $Id: yppush_main.c,v 1.26 1996/04/03 00:27:53 wpaul Exp wpaul $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -37,9 +37,6 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#ifdef LONGJMP
|
|
||||||
#include <setjmp.h>
|
|
||||||
#endif
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
@ -56,7 +53,7 @@ struct dom_binding {};
|
|||||||
#include "yppush_extern.h"
|
#include "yppush_extern.h"
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] = "$Id: yppush_main.c,v 1.25 1996/01/27 19:44:48 wpaul Exp $";
|
static const char rcsid[] = "$Id: yppush_main.c,v 1.26 1996/04/03 00:27:53 wpaul Exp wpaul $";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *progname = "yppush";
|
char *progname = "yppush";
|
||||||
@ -72,16 +69,11 @@ unsigned long yppush_transid = 0;
|
|||||||
int yppush_timeout = 80; /* Default timeout. */
|
int yppush_timeout = 80; /* Default timeout. */
|
||||||
int yppush_jobs = 0; /* Number of allowed concurrent jobs. */
|
int yppush_jobs = 0; /* Number of allowed concurrent jobs. */
|
||||||
int yppush_running_jobs = 0; /* Number of currently running jobs. */
|
int yppush_running_jobs = 0; /* Number of currently running jobs. */
|
||||||
#ifdef LONGJMP
|
|
||||||
int yppush_pausing = 0; /* Flag set when longjmp()s are allowed. */
|
|
||||||
jmp_buf env;
|
|
||||||
#endif
|
|
||||||
int yppush_alarm_tripped = 0;
|
int yppush_alarm_tripped = 0;
|
||||||
|
|
||||||
/* Structure for holding information about a running job. */
|
/* Structure for holding information about a running job. */
|
||||||
struct jobs {
|
struct jobs {
|
||||||
unsigned long tid;
|
unsigned long tid;
|
||||||
int pid;
|
|
||||||
int sock;
|
int sock;
|
||||||
int port;
|
int port;
|
||||||
ypxfrstat stat;
|
ypxfrstat stat;
|
||||||
@ -159,10 +151,6 @@ static void yppush_exit(now)
|
|||||||
|
|
||||||
/* Let all the information trickle in. */
|
/* Let all the information trickle in. */
|
||||||
while(!now && still_pending) {
|
while(!now && still_pending) {
|
||||||
#ifdef LONGJMP
|
|
||||||
yppush_pausing++;
|
|
||||||
setjmp(env); /* more magic */
|
|
||||||
#endif
|
|
||||||
jptr = yppush_joblist;
|
jptr = yppush_joblist;
|
||||||
still_pending = 0;
|
still_pending = 0;
|
||||||
while (jptr) {
|
while (jptr) {
|
||||||
@ -186,9 +174,6 @@ static void yppush_exit(now)
|
|||||||
yppush_alarm_tripped = 0;
|
yppush_alarm_tripped = 0;
|
||||||
alarm(YPPUSH_RESPONSE_TIMEOUT);
|
alarm(YPPUSH_RESPONSE_TIMEOUT);
|
||||||
pause();
|
pause();
|
||||||
#ifdef LONGJMP
|
|
||||||
yppush_pausing = 0;
|
|
||||||
#endif
|
|
||||||
alarm(0);
|
alarm(0);
|
||||||
if (yppush_alarm_tripped == 1) {
|
if (yppush_alarm_tripped == 1) {
|
||||||
yp_error("timed out");
|
yp_error("timed out");
|
||||||
@ -287,10 +272,6 @@ static void async_handler(sig)
|
|||||||
alarm(0);
|
alarm(0);
|
||||||
yppush_alarm_tripped++;
|
yppush_alarm_tripped++;
|
||||||
kill(getpid(), SIGALRM);
|
kill(getpid(), SIGALRM);
|
||||||
#ifdef LONGJMP
|
|
||||||
if (yppush_pausing)
|
|
||||||
longjmp(env, 1);
|
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -511,37 +492,21 @@ int yppush_foreach(status, key, keylen, val, vallen, data)
|
|||||||
* wait for one of them to finish so we can reuse its slot.
|
* wait for one of them to finish so we can reuse its slot.
|
||||||
*/
|
*/
|
||||||
if (yppush_jobs <= 1) {
|
if (yppush_jobs <= 1) {
|
||||||
#ifdef LONGJMP
|
|
||||||
yppush_pausing++;
|
|
||||||
while (!setjmp(env) && yppush_running_jobs) {
|
|
||||||
#else
|
|
||||||
yppush_alarm_tripped = 0;
|
yppush_alarm_tripped = 0;
|
||||||
while (!yppush_alarm_tripped && yppush_running_jobs) {
|
while (!yppush_alarm_tripped && yppush_running_jobs) {
|
||||||
#endif
|
|
||||||
alarm(yppush_timeout);
|
alarm(yppush_timeout);
|
||||||
yppush_alarm_tripped = 0;
|
yppush_alarm_tripped = 0;
|
||||||
pause();
|
pause();
|
||||||
alarm(0);
|
alarm(0);
|
||||||
}
|
}
|
||||||
#ifdef LONGJMP
|
|
||||||
yppush_pausing = 0;
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
#ifdef LONGJMP
|
|
||||||
yppush_pausing++;
|
|
||||||
while (!setjmp(env) && yppush_running_jobs >= yppush_jobs) {
|
|
||||||
#else
|
|
||||||
yppush_alarm_tripped = 0;
|
yppush_alarm_tripped = 0;
|
||||||
while (!yppush_alarm_tripped && yppush_running_jobs >= yppush_jobs) {
|
while (!yppush_alarm_tripped && yppush_running_jobs >= yppush_jobs) {
|
||||||
#endif
|
|
||||||
alarm(yppush_timeout);
|
alarm(yppush_timeout);
|
||||||
yppush_alarm_tripped = 0;
|
yppush_alarm_tripped = 0;
|
||||||
pause();
|
pause();
|
||||||
alarm(0);
|
alarm(0);
|
||||||
}
|
}
|
||||||
#ifdef LONGJMP
|
|
||||||
yppush_pausing = 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cleared for takeoff: set everything in motion. */
|
/* Cleared for takeoff: set everything in motion. */
|
||||||
@ -656,8 +621,11 @@ main(argc,argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(myname, data.data, data.size)) {
|
if (strncmp(myname, data.data, data.size)) {
|
||||||
yp_error("this host is not the master for %s",yppush_mapname);
|
yp_error("warning: this host is not the master for %s",
|
||||||
|
yppush_mapname);
|
||||||
|
#ifdef NITPICKY
|
||||||
yppush_exit(1);
|
yppush_exit(1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
yppush_master = strdup(data.data);
|
yppush_master = strdup(data.data);
|
||||||
|
Loading…
Reference in New Issue
Block a user