Implement the 'master' request.

Obtained from:	OpenBSD (r1.15)
This commit is contained in:
Marcelo Araujo 2016-03-04 02:14:32 +00:00
parent e8cf8358d0
commit 619d20a133
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=296376

View File

@ -222,6 +222,8 @@ yp_dispatch(struct svc_req *req, SVCXPRT *trans)
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);
}