From owner-freebsd-current@FreeBSD.ORG Thu Aug 30 15:47:01 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 54773106566C for ; Thu, 30 Aug 2012 15:47:01 +0000 (UTC) (envelope-from zeising@daemonic.se) Received: from mail.lysator.liu.se (mail.lysator.liu.se [IPv6:2001:6b0:17:f0a0::3]) by mx1.freebsd.org (Postfix) with ESMTP id A3C608FC12 for ; Thu, 30 Aug 2012 15:47:00 +0000 (UTC) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 3F85F4000B for ; Thu, 30 Aug 2012 17:46:59 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id 3236740023; Thu, 30 Aug 2012 17:46:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bernadotte.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.3.1 X-Spam-Score: 0.0 Received: from mx.daemonic.se (mx.daemonic.se [IPv6:2001:470:dca9:0:1::3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 82FF74000B for ; Thu, 30 Aug 2012 17:46:58 +0200 (CEST) Received: from mailscanner.daemonic.se (mailscanner.daemonic.se [IPv6:2001:470:dca9:0:1::6]) by mx.daemonic.se (Postfix) with ESMTPS id 3X77Nx6JQwz8gtM for ; Thu, 30 Aug 2012 17:46:57 +0200 (CEST) X-Virus-Scanned: amavisd-new at daemonic.se Received: from mx.daemonic.se ([10.1.0.3]) (using TLS with cipher CAMELLIA256-SHA) by mailscanner.daemonic.se (mailscanner.daemonic.se [10.1.0.6]) (amavisd-new, port 10025) with ESMTPS id N8VLecXbj1cl for ; Thu, 30 Aug 2012 17:46:55 +0200 (CEST) Received: from mail.daemonic.se (mail.daemonic.se [10.1.0.4]) by mx.daemonic.se (Postfix) with ESMTPS id 3X77Nv347Nz8gtL for ; Thu, 30 Aug 2012 17:46:55 +0200 (CEST) Received: from tifa.daemonic.se (dhcp-128-232-140-88.eduroam.csx.cam.ac.uk [128.232.140.88]) by mail.daemonic.se (Postfix) with ESMTPSA id 3X77Nv2CCRz9Ctj for ; Thu, 30 Aug 2012 17:46:55 +0200 (CEST) Received: from tifa.daemonic.se (localhost [127.0.0.1]) by tifa.daemonic.se (Postfix) with ESMTP id CFB96228F2 for ; Thu, 30 Aug 2012 16:46:53 +0100 (BST) Message-ID: <503F8AED.9050508@daemonic.se> Date: Thu, 30 Aug 2012 16:46:53 +0100 From: Niclas Zeising User-Agent: Mutt/1.5.21 MIME-Version: 1.0 To: current@freebsd.org Content-Type: multipart/mixed; boundary="------------090307030006060708090008" X-Virus-Scanned: ClamAV using ClamSMTP X-Mailman-Approved-At: Thu, 30 Aug 2012 17:00:03 +0000 Cc: Subject: [PATCH] make it possible for yp_mkdb to send YPPROC_CLEAR to arbitrary host X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2012 15:47:01 -0000 This is a multi-part message in MIME format. --------------090307030006060708090008 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit I have a patch that makes it possible to send an YPPROC_CLEAR to any host, not just localhost. YPPROC_CLEAR is basically used to flush NIS connections, so that clients pick up changes done in the NIS maps right away. Currently yp_mkdb can send this to localhost, but if the NIS-server is in a jail, there is no localhost. This way YPPROC_CLEAR can be sent to the NIS server in jails as well. The patch is attached and also in bin/169911 [1] Regards -- Niclas Zeising [1] http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/169911 --------------090307030006060708090008 Content-Type: text/x-patch; name="usr.sbin.yp_mkdb.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="usr.sbin.yp_mkdb.c.diff" Index: head/usr.sbin/yp_mkdb/yp_mkdb.c =================================================================== --- head/usr.sbin/yp_mkdb/yp_mkdb.c (revision 238532) +++ head/usr.sbin/yp_mkdb/yp_mkdb.c (working copy) @@ -57,11 +57,12 @@ static void usage(void) { - fprintf(stderr, "%s\n%s\n%s\n%s\n", - "usage: yp_mkdb -c", + fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n", + "usage: yp_mkdb [-c | -C hostname]", " yp_mkdb -u dbname", - " yp_mkdb [-c] [-b] [-s] [-f] [-i inputfile] [-o outputfile]", - " [-d domainname ] [-m mastername] inputfile dbname"); + " yp_mkdb [-c | -C hostname] [-b] [-s] [-f] [-i inputfile]", + " [-o outputfile] [-d domainname ] [-m mastername]", + " inputfile dbname"); exit(1); } @@ -105,6 +106,7 @@ char *infile = NULL; char *map = NULL; char *domain = NULL; + char *clearhost = "localhost"; char *infilename = NULL; char *outfilename = NULL; char *mastername = NULL; @@ -117,7 +119,7 @@ FILE *ifp; char hname[MAXHOSTNAMELEN + 2]; - while ((ch = getopt(argc, argv, "uhcbsfd:i:o:m:")) != -1) { + while ((ch = getopt(argc, argv, "uhcC:bsfd:i:o:m:")) != -1) { switch (ch) { case 'f': filter_plusminus++; @@ -128,6 +130,10 @@ case 'c': clear++; break; + case 'C': + clear++; + clearhost = optarg; + break; case 'b': interdom++; break; @@ -156,6 +162,9 @@ argc -= optind; argv += optind; + if (clear > 1) + usage(); + if (un) { map = argv[0]; if (map == NULL) @@ -332,7 +341,7 @@ char in = 0; char *out = NULL; int stat; - if ((stat = callrpc("localhost", YPPROG,YPVERS, YPPROC_CLEAR, + if ((stat = callrpc(clearhost, YPPROG,YPVERS, YPPROC_CLEAR, (xdrproc_t)xdr_void, &in, (xdrproc_t)xdr_void, out)) != RPC_SUCCESS) { warnx("failed to send 'clear' to local ypserv: %s", Index: head/usr.sbin/yp_mkdb/yp_mkdb.8 =================================================================== --- head/usr.sbin/yp_mkdb/yp_mkdb.8 (revision 238532) +++ head/usr.sbin/yp_mkdb/yp_mkdb.8 (working copy) @@ -42,7 +42,7 @@ .Nm .Fl u Ar dbname .Nm -.Op Fl c +.Op Fl c | Fl C Ar hostname .Op Fl b .Op Fl s .Op Fl f @@ -111,6 +111,12 @@ .Nm will send the signal only after the new database has been successfully created. +.It Fl C +As +.Fl c +but send the YPPROC_CLEAR to the specified +.Ar hostname +instead. .It Fl b Cause .Nm --------------090307030006060708090008--