diff options
author | ru <ru@FreeBSD.org> | 2006-08-13 19:57:32 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2006-08-13 19:57:32 +0000 |
commit | 1ca146c4506ba4101ebba61a4cc126f023c1ee2f (patch) | |
tree | 5016e6b0cf2df320d02f2e4772a4030b081dfb01 /usr.sbin | |
parent | bf1530d9f73dd9c208fac46cf76a0db7da6864a6 (diff) | |
download | FreeBSD-src-1ca146c4506ba4101ebba61a4cc126f023c1ee2f.zip FreeBSD-src-1ca146c4506ba4101ebba61a4cc126f023c1ee2f.tar.gz |
Don't push a map on a master server which will fail anyway.
PR: bin/72881
Submitted by: thomas (slightly coloured by me)
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/yppush/yppush_main.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.sbin/yppush/yppush_main.c b/usr.sbin/yppush/yppush_main.c index 951f413..59108db 100644 --- a/usr.sbin/yppush/yppush_main.c +++ b/usr.sbin/yppush/yppush_main.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <strings.h> #include <time.h> #include <unistd.h> #include <sys/socket.h> @@ -60,6 +61,7 @@ char *yp_dir = _PATH_YP; char *yppush_mapname = NULL; /* Map to transfer. */ char *yppush_domain = NULL; /* Domain in which map resides. */ char *yppush_master = NULL; /* Master NIS server for said domain. */ +int skip_master = 0; /* Do not attempt to push map to master. */ int verbose = 0; /* Toggle verbose mode. */ unsigned long yppush_transid = 0; int yppush_timeout = 80; /* Default timeout. */ @@ -480,6 +482,8 @@ yppush_foreach(int status, char *key, int keylen, char *val, int vallen, return (status); snprintf(server, sizeof(server), "%.*s", vallen, val); + if (skip_master && strcasecmp(server, yppush_master) == 0) + return (0); /* * Restrict the number of concurrent jobs. If yppush_jobs number @@ -615,7 +619,13 @@ main(int argc, char *argv[]) yppush_exit(1); } - if (strncmp(myname, data.data, data.size)) { + if (strncasecmp(myname, data.data, data.size) == 0) { + /* I am master server, and no explicit host list was + specified: do not push map to myself -- this will + fail with YPPUSH_AGE anyway. */ + if (yppush_hostlist == NULL) + skip_master = 1; + } else { yp_error("warning: this host is not the master for %s", yppush_mapname); #ifdef NITPICKY |