Re: passwd NIS+ YP compat mode

From: Thyer, Matthew <Matthew.Thyer_at_dsto.defence.gov.au>
Date: Mon, 23 Jun 2003 12:03:32 +0930
Yoshinori's patch for FreeBSD NIS clients of Solaris NIS+ servers in YP compatibility mode works for me.

Please commit this before 5 becomes -STABLE (I'm shocked the bug has made it into 5.1).

Solaris NIS+ servers in YP compatibility is a very common configuration in larger enterprises.


On Tue, 27 May 2003 18:09:29 -0700, TOMITA Yoshinori wrote:

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
_at__at_ -938,14 +938,15 _at__at_
 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);
_at__at_ -954,7 +955,7 _at__at_
        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
Received on Sun Jun 22 2003 - 17:36:29 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:12 UTC