Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jan 2001 13:21:08 -0500 (EST)
From:      petef@databits.net
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/24540: add '-c' flag to src/bin/domainname to clear domainname
Message-ID:  <200101221821.f0MIL8250925@electron.databits.net>

next in thread | raw e-mail | index | archive | help

>Number:         24540
>Category:       bin
>Synopsis:       add '-c' flag to src/bin/domainname to clear domainname
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 22 10:30:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Pete Fritchman
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Databits Network Services, Inc.
>Environment:

FreeBSD 5.0-CURRENT

>Description:

Add the "-c" flag to domainname to allow clearing of the current YP/NIS
domain.

>How-To-Repeat:

Set a domainname with domainname(1) and try to clear it using domainname(1).

>Fix:


Index: domainname.1
===================================================================
RCS file: /home/ncvs/src/bin/domainname/domainname.1,v
retrieving revision 1.11
diff -u -r1.11 domainname.1
--- domainname.1	2000/12/14 11:39:33	1.11
+++ domainname.1	2001/01/22 18:17:47
@@ -40,6 +40,7 @@
 .Nd set or print name of current YP/NIS domain
 .Sh SYNOPSIS
 .Nm
+.Op Fl c
 .Op Ar ypdomain
 .Sh DESCRIPTION
 .Nm Domainname
@@ -49,6 +50,13 @@
 .Pa /etc/rc.network ,
 normally run at boot
 time.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl c
+Clear the current YP/NIS domain.  Note that programs accessing 
+the password database cache the domain, and will need to be 
+restarted to see the change.
 .Sh NOTA BENE
 The YP/NIS (formerly ``Yellow Pages'' but renamed for legal reasons)
 domain name does not necessarily have anything to do with the Domain

Index: domainname.c
===================================================================
RCS file: /home/ncvs/src/bin/domainname/domainname.c,v
retrieving revision 1.12
diff -u -r1.12 domainname.c
--- domainname.c	1999/08/27 23:14:08	1.12
+++ domainname.c	2001/01/22 18:17:49
@@ -63,8 +63,13 @@
 	int ch;
 	char domainname[MAXHOSTNAMELEN];
 
-	while ((ch = getopt(argc, argv, "")) != -1)
+	while ((ch = getopt(argc, argv, "c")) != -1)
 		switch (ch) {
+		case 'c':
+			if (setdomainname("", 1))
+				err(1, "setdomainname");
+			exit(0);
+			break;
 		default:
 			usage();
 		}
@@ -88,6 +93,6 @@
 void
 usage()
 {
-	(void)fprintf(stderr, "usage: domainname [ypdomain]\n");
+	(void)fprintf(stderr, "usage: domainname [-c] [ypdomain]\n");
 	exit(1);
 }

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101221821.f0MIL8250925>