summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2016-01-24 08:28:13 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2016-01-24 08:28:13 +0000
commit5259bc4d183239f976be6eb01e4762d17a7f679f (patch)
tree332821e8cb7966ef7600f61f00bd09eb8ad4e0bb /usr.sbin
parent74566f9e0b6027bf78678de8ac7557773acbc388 (diff)
Implement the 'master' request. ok jmatthew@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ypldap/yp.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.sbin/ypldap/yp.c b/usr.sbin/ypldap/yp.c
index 0445b328f47..0c92649f727 100644
--- a/usr.sbin/ypldap/yp.c
+++ b/usr.sbin/ypldap/yp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: yp.c,v 1.14 2015/02/11 01:26:00 pelikan Exp $ */
+/* $OpenBSD: yp.c,v 1.15 2016/01/24 08:28:12 matthieu Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
*
@@ -223,7 +223,8 @@ yp_dispatch(struct svc_req *req, SVCXPRT *trans)
cb = (void *)ypproc_all_2_svc;
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;
@@ -561,11 +562,16 @@ 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);
-
- res.stat = YP_YPERR;
+ if (gethostname(master, sizeof(master)) == 0) {
+ res.peer = (peername)master;
+ res.stat = YP_TRUE;
+ } else
+ res.stat = YP_NOKEY;
return (&res);
}