From owner-freebsd-bugs@FreeBSD.ORG Fri Aug 11 22:50:20 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 08AF416A4DA for ; Fri, 11 Aug 2006 22:50:20 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id ACD2C43D45 for ; Fri, 11 Aug 2006 22:50:19 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k7BMoJ15033734 for ; Fri, 11 Aug 2006 22:50:19 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k7BMoJuB033733; Fri, 11 Aug 2006 22:50:19 GMT (envelope-from gnats) Date: Fri, 11 Aug 2006 22:50:19 GMT Message-Id: <200608112250.k7BMoJuB033733@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Thomas Quinot Cc: Subject: bin/72881 : yppush pushes map to local server [PATCH] X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Thomas Quinot List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2006 22:50:20 -0000 The following reply was made to PR bin/72881; it has been noted by GNATS. From: Thomas Quinot To: bug-followup@freebsd.org Cc: Subject: bin/72881 : yppush pushes map to local server [PATCH] Date: Sat, 12 Aug 2006 00:40:37 +0200 The patch below is a proposed fix for this PR. When running yppush on a NIS master, it skips pushing the map to itself. Tested locally. Thomas. Index: yppush_main.c =================================================================== RCS file: /space/mirror/ncvs/src/usr.sbin/yppush/yppush_main.c,v retrieving revision 1.20 diff -u -r1.20 yppush_main.c --- yppush_main.c 12 Apr 2005 15:02:57 -0000 1.20 +++ yppush_main.c 11 Aug 2006 22:36:07 -0000 @@ -60,6 +60,7 @@ 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 +481,9 @@ return (status); snprintf(server, sizeof(server), "%.*s", vallen, val); + if (skip_master && !strcasecmp (server, yppush_master)) { + return 0; + } /* * Restrict the number of concurrent jobs. If yppush_jobs number @@ -615,7 +619,13 @@ yppush_exit(1); } - if (strncmp(myname, data.data, data.size)) { + if (!strncasecmp(myname, data.data, data.size)) { + /* 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 @@ -652,13 +662,13 @@ /* set initial transaction ID */ yppush_transid = time((time_t *)NULL); - if (yppush_hostlist) { + if (yppush_hostlist != NULL) { /* * Host list was specified on the command line: * kick off the transfers by hand. */ tmp = yppush_hostlist; - while (tmp) { + while (tmp != NULL) { yppush_foreach(YP_TRUE, NULL, 0, tmp->name, strlen(tmp->name), NULL); tmp = tmp->next;