summaryrefslogtreecommitdiffstats
path: root/usr.sbin/yp_mkdb/yp_mkdb.c
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1996-10-24 14:52:50 +0000
committerwpaul <wpaul@FreeBSD.org>1996-10-24 14:52:50 +0000
commit9c6283900efaae98b4b1c0550f8c919e1178314a (patch)
treec8c087441553eece26bc4637913c07bea7fa7793 /usr.sbin/yp_mkdb/yp_mkdb.c
parent3c73db06367c732cd65bf80fdf8ad149989d89d3 (diff)
downloadFreeBSD-src-9c6283900efaae98b4b1c0550f8c919e1178314a.zip
FreeBSD-src-9c6283900efaae98b4b1c0550f8c919e1178314a.tar.gz
Add -b and -s flags for adding YP_INTERDOMAIN and YP_SECURE entries to
map databases. Also document said flags in the man page. Adding YP_INTERDOMAIN to a map causes ypserv(8) to do a DNS lookup when a yp_match() on the map fails. (This affects only the hosts.by* maps; for all other maps it's ignored.) The YP_SECURE entry causes ypserv(8) to restrict access to the map so that only clients making requests from reserved ports can get at it. Our ypserv doesn't currently support these features so they're silently ignored for the moment, but this will change. :)
Diffstat (limited to 'usr.sbin/yp_mkdb/yp_mkdb.c')
-rw-r--r--usr.sbin/yp_mkdb/yp_mkdb.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/usr.sbin/yp_mkdb/yp_mkdb.c b/usr.sbin/yp_mkdb/yp_mkdb.c
index 39f2630..37c6fb3 100644
--- a/usr.sbin/yp_mkdb/yp_mkdb.c
+++ b/usr.sbin/yp_mkdb/yp_mkdb.c
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: yp_mkdb.c,v 1.5 1996/06/03 03:12:32 wpaul Exp $
+ * $Id: yp_mkdb.c,v 1.5 1996/06/03 03:12:32 wpaul Exp wpaul $
*/
#include <stdio.h>
@@ -50,7 +50,7 @@
#include "ypxfr_extern.h"
#ifndef lint
-static const char rcsid[] = "$Id: yp_mkdb.c,v 1.5 1996/06/03 03:12:32 wpaul Exp $";
+static const char rcsid[] = "$Id: yp_mkdb.c,v 1.5 1996/06/03 03:12:32 wpaul Exp wpaul $";
#endif
char *yp_dir = ""; /* No particular default needed. */
@@ -62,8 +62,8 @@ static void usage()
{
fprintf(stderr, "usage: %s -c\n", progname);
fprintf(stderr, "usage: %s -u dbname\n", progname);
- fprintf(stderr, "usage: %s [-c] [-i inputfile] [-o outputfile]\n",
- progname);
+ fprintf(stderr, "usage: %s [-c] [-b] [-s] [-i inputfile] \
+[-o outputfile]\n", progname);
fprintf(stderr, " [-d domainname ] [-m mastername] \
inputfile dbname\n");
exit(1);
@@ -112,6 +112,8 @@ main (argc, argv)
char *infilename = NULL;
char *outfilename = NULL;
char *mastername = NULL;
+ int interdom = 0;
+ int secure = 0;
DB *dbp;
DBT key, data;
char buf[10240];
@@ -119,7 +121,7 @@ main (argc, argv)
FILE *ifp;
char hname[MAXHOSTNAMELEN + 2];
- while ((ch = getopt(argc, argv, "uhcd:i:o:m:")) != EOF) {
+ while ((ch = getopt(argc, argv, "uhcbsd:i:o:m:")) != EOF) {
switch(ch) {
case 'u':
un++;
@@ -127,6 +129,12 @@ main (argc, argv)
case 'c':
clear++;
break;
+ case 'b':
+ interdom++;
+ break;
+ case 's':
+ secure++;
+ break;
case 'd':
domain = optarg;
break;
@@ -189,6 +197,22 @@ main (argc, argv)
if ((dbp = open_db(map, O_RDWR|O_EXLOCK|O_EXCL|O_CREAT)) == NULL)
err(1, "open_db(%s) failed", map);
+ if (interdom) {
+ key.data = "YP_INTERDOMAIN";
+ key.size = sizeof("YP_INTERDOMAIN") - 1;
+ data.data = "";
+ data.size = 0;
+ yp_put_record(dbp, &key, &data, 0);
+ }
+
+ if (secure) {
+ key.data = "YP_SECURE";
+ key.size = sizeof("YP_SECURE") - 1;
+ data.data = "";
+ data.size = 0;
+ yp_put_record(dbp, &key, &data, 0);
+ }
+
key.data = "YP_MASTER_NAME";
key.size = sizeof("YP_MASTER_NAME") - 1;
data.data = mastername;
OpenPOWER on IntegriCloud