diff options
author | araujo <araujo@FreeBSD.org> | 2016-03-04 02:14:32 +0000 |
---|---|---|
committer | araujo <araujo@FreeBSD.org> | 2016-03-04 02:14:32 +0000 |
commit | fa3cdda2542d27ac605b5ebc2de9a56e8274c907 (patch) | |
tree | bbc1d2103df0f4f6f3c33a001ce03eedb9843493 /usr.sbin | |
parent | ac542b0dbaa4e5a4edc59cee03b0c5424fa5dd0c (diff) | |
download | FreeBSD-src-fa3cdda2542d27ac605b5ebc2de9a56e8274c907.zip FreeBSD-src-fa3cdda2542d27ac605b5ebc2de9a56e8274c907.tar.gz |
Implement the 'master' request.
Obtained from: OpenBSD (r1.15)
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ypldap/yp.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/ypldap/yp.c b/usr.sbin/ypldap/yp.c index 2868c8f..c5e8edd 100644 --- a/usr.sbin/ypldap/yp.c +++ b/usr.sbin/ypldap/yp.c @@ -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); } |