Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 May 2003 10:10:32 +0900
From:      TOMITA Yoshinori <yoshint@flab.fujitsu.co.jp>
To:        freebsd-current@freebsd.org
Subject:   Re: passwd NIS+ YP compat mode
Message-ID:  <ywlptm3ri47.fsf@palomino.proc.flab.fujitsu.co.jp>
In-Reply-To: <ywln0h8imlv.fsf@palomino.proc.flab.fujitsu.co.jp> (TOMITA Yoshinori's message of "Tue, 27 May 2003 21:46:04 %2B0900")
References:  <ywln0h8imlv.fsf@palomino.proc.flab.fujitsu.co.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
>> On Tue, 27 May 2003 21:46:04 +0900, TOMITA Yoshinori
>> <yoshint@flab.fujitsu.co.jp> said:

T> Hello all,
T> After cvsup-ed today 2003-5-27 and make buildworld and so on,
T> NIS passwd database are completely ignored.
T> But NIS group database seems to be used as usual.

T> Out NIS server is actually NIS+ in YP comaptible mode.
T> I traced the function getpwnam() and reached following code.

T> What can I do ?


T> ==[getpwent.c]=============================================================
T> static int
T> nis_map(char *domain, enum nss_lookup_type how, char *buffer, size_t bufsize,
T>     int *master)

T>    ...

T> 	rv = yp_order(domain, buffer, &order); <------ this returns YPERR_YPERR
T> 	if (rv == 0)
T> 		return (NS_SUCCESS);

T> ==[yplib.c]=================================================================

T> int
T> yp_order(char *indomain, char *inmap, int *outorder)

T>    ...

T> 	/*
T> 	 * NIS+ in YP compat mode doesn't support the YPPROC_ORDER
T> 	 * procedure.
T> 	 */
T> 	if (r == RPC_PROCUNAVAIL) {
T> 		return(YPERR_YPERR); <------- Here
T> 	}
T> ============================================================================



I hope this patch will solve this problem for users living under NIS+
servers.

I guess yp_order() is used to check masswd.by* or master.passwd.by*
databese really exists. yp_master() can be used for this purpose.  But
I do not know the cost of yp_master() compared to yp_order().


--- /usr/src/lib/libc/gen/getpwent.c.bak	Tue May 27 08:47:24 2003
+++ /usr/src/lib/libc/gen/getpwent.c	Wed May 28 09:35:50 2003
@@ -938,14 +938,15 @@
 nis_map(char *domain, enum nss_lookup_type how, char *buffer, size_t bufsize,
     int *master)
 {
-	int	rv, order;
+	int	rv;
+	char	*outname;
 
 	*master = 0;
 	if (geteuid() == 0) {
 		if (snprintf(buffer, bufsize, "master.passwd.by%s",
 		    (how == nss_lt_id) ? "uid" : "name") >= bufsize)
 			return (NS_UNAVAIL);
-		rv = yp_order(domain, buffer, &order);
+		rv = yp_master(domain, buffer, &outname);
 		if (rv == 0) {
 			*master = 1;
 			return (NS_SUCCESS);
@@ -954,7 +955,7 @@
 	if (snprintf(buffer, bufsize, "passwd.by%s",
 	    (how == nss_lt_id) ? "uid" : "name") >= bufsize)
 		return (NS_UNAVAIL);
-	rv = yp_order(domain, buffer, &order);
+	rv = yp_master(domain, buffer, &outname);
 	if (rv == 0)
 		return (NS_SUCCESS);
 	return (NS_UNAVAIL);



-- 
---
TOMITA Yoshinori



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