Four patches for PR bin/73422

Trond Endrestøl Trond.Endrestol at fagskolen.gjovik.no
Tue Mar 28 15:21:21 UTC 2006


Hi,

I'm not sure if this is the correct list, maybe this belongs -bugs.


Anyway, I took a look at 6.1-PRE to see if the nasty NIS bugs are
still present, and I believe they are. See PR bin/73422 for more
information.

I present the following four patches and I hope you'll consider making
them part of the upcoming 6.1-RELEASE.


Trond Endrestøl.

----

*** /etc/rc.d/nisdomain.orig	Wed Feb  1 21:43:28 2006
--- /etc/rc.d/nisdomain	Mon Mar 27 08:30:07 2006
***************
*** 34,40 ****

  name="nisdomain"
  start_cmd="nisdomain_start"
! stop_cmd=":"

  nisdomain_start()
  {
--- 34,40 ----

  name="nisdomain"
  start_cmd="nisdomain_start"
! stop_cmd="nisdomain_stop"

  nisdomain_start()
  {
***************
*** 48,53 ****
--- 48,61 ----
  		echo "Setting NIS domain: `/bin/domainname`."
  		;;
  	esac
+ }
+
+ nisdomain_stop()
+ {
+ 	# Unset the domainname in any case
+ 	#
+ 	domainname ''
+ 	echo "Unsetting NIS domain."
  }

  load_rc_config $name

*** /usr/src/usr.sbin/rpcbind/Makefile.orig	Thu Mar 16 21:52:31 2006
--- /usr/src/usr.sbin/rpcbind/Makefile	Tue Mar 28 16:47:41 2006
***************
*** 19,24 ****
--- 19,28 ----
  CFLAGS+= -DINET6
  .endif

+ .if defined(NO_NIS)
+ CFLAGS+= -DNO_NIS
+ .endif
+
  DPADD=	${LIBWRAP} ${LIBUTIL}
  LDADD=	-lwrap -lutil

*** /usr/src/usr.sbin/rpcbind/security.c.orig	Mon Dec 16 23:24:26 2002
--- /usr/src/usr.sbin/rpcbind/security.c	Tue Mar 28 16:52:21 2006
***************
*** 165,171 ****
--- 165,173 ----
  	char	procbuf[32];
  	char   *progname;
  	char	progbuf[32];
+ #ifdef NO_NIS
  	char fromname[NI_MAXHOST];
+ #endif
  	struct rpcent *rpc;
  	static const char *procmap[] = {
  	/* RPCBPROC_NULL */		"null",
***************
*** 193,198 ****
--- 195,201 ----

  		/* Try to map program number to name. */

+ #ifdef NO_NIS
  		if (prognum == 0) {
  			progname = "";
  		} else if ((rpc = getrpcbynumber((int) prognum))) {
***************
*** 201,206 ****
--- 204,217 ----
  			snprintf(progname = progbuf, sizeof(progbuf), "%u",
  			    (unsigned)prognum);
  		}
+ #else
+ 		if (prognum == 0) {
+ 			progname = "";
+ 		} else {
+ 			snprintf(progname = progbuf, sizeof(progbuf), "%u",
+ 			    (unsigned)prognum);
+ 		}
+ #endif

  		/* Try to map procedure number to name. */

***************
*** 213,226 ****
--- 224,244 ----

  		/* Write syslog record. */

+ #ifdef NO_NIS
  		if (addr->sa_family == AF_LOCAL)
  			strcpy(fromname, "local");
  		else
  			getnameinfo(addr, addr->sa_len, fromname,
  			    sizeof fromname, NULL, 0, NI_NUMERICHOST);
+ #endif

+ #ifdef NO_NIS
  		syslog(severity, "connect from %s to %s(%s)%s",
  			fromname, procname, progname, text);
+ #else
+ 		syslog(severity, "connect from %s to %s(%s)%s",
+ 			inet_ntoa(((struct sockaddr_in *)addr)->sin_addr), procname, progname, text);
+ #endif
  		_exit(0);
  	}
  }

*** /usr/src/usr.sbin/ypbind/ypbind.c.orig	Sun Oct 17 21:33:33 2004
--- /usr/src/usr.sbin/ypbind/ypbind.c	Mon Mar 27 08:23:09 2006
***************
*** 388,398 ****
  	if (flock(yplockfd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK)
  		errx(1, "another ypbind is already running. Aborting");

- 	/* XXX domainname will be overriden if we use restricted mode */
- 	yp_get_default_domain(&domain_name);
- 	if (domain_name[0] == '\0')
- 		errx(1, "domainname not set. Aborting");
-
  	for (i = 1; i<argc; i++) {
  		if (strcmp("-ypset", argv[i]) == 0)
  			ypsetmode = YPSET_ALL;
--- 388,393 ----
***************
*** 406,411 ****
--- 401,413 ----
  			yp_manycast++;
  		else
  			errx(1, "unknown option: %s", argv[i]);
+ 	}
+
+ 	if (domain_name == NULL || domain_name[0] == '\0') {
+ 		/* XXX domainname will be overriden if we use restricted mode */
+ 		yp_get_default_domain(&domain_name);
+ 		if (domain_name[0] == '\0')
+ 			errx(1, "domainname not set. Aborting");
  	}

  	/* blow away everything in BINDINGDIR (if it exists) */

----
-- 
----------------------------------------------------------------------
Trond Endrestøl                          |   trond at fagskolen.gjovik.no
Patron of The Art of Computer Programming|   FreeBSD 4.8-S & Pine 4.55


More information about the freebsd-stable mailing list