Author: araujo
Date: Fri Mar  4 02:14:32 2016
New Revision: 296376
URL: https://svnweb.freebsd.org/changeset/base/296376

Log:
  Implement the 'master' request.
  
  Obtained from:        OpenBSD (r1.15)

Modified:
  head/usr.sbin/ypldap/yp.c

Modified: head/usr.sbin/ypldap/yp.c
==============================================================================
--- head/usr.sbin/ypldap/yp.c   Fri Mar  4 01:31:13 2016        (r296375)
+++ head/usr.sbin/ypldap/yp.c   Fri Mar  4 02:14:32 2016        (r296376)
@@ -222,6 +222,8 @@ yp_dispatch(struct svc_req *req, SVCXPRT
                break;
        case YPPROC_MASTER:
                log_debug("ypproc_master");
+               xdr_argument = (xdrproc_t) xdr_ypreq_nokey;
+               xdr_result = (xdrproc_t) xdr_ypresp_master;
                if (yp_check(req) == -1)
                        return;
                cb = (void *)ypproc_master_2_svc;
@@ -559,11 +561,18 @@ ypresp_master *
 ypproc_master_2_svc(ypreq_nokey *arg, struct svc_req *req)
 {
        static struct ypresp_master      res;
+       static char master[YPMAXPEER + 1];
 
+       bzero(&res, sizeof(res));
        if (yp_valid_domain(arg->domain, (struct ypresp_val *)&res) == -1)
                return (&res);
+       
+       if (gethostname(master, sizeof(master)) == 0) {
+               res.peer = (peername)master;
+               res.stat = YP_TRUE;
+       } else
+               res.stat = YP_NOKEY;
 
-       res.stat = YP_YPERR;
        return (&res);
 }
 
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to