yp.c (294543) | yp.c (296376) |
---|---|
1/* $OpenBSD: yp.c,v 1.14 2015/02/11 01:26:00 pelikan Exp $ */ | 1/* $OpenBSD: yp.c,v 1.14 2015/02/11 01:26:00 pelikan Exp $ */ |
2/* $FreeBSD: head/usr.sbin/ypldap/yp.c 294543 2016-01-22 03:02:38Z araujo $ */ | 2/* $FreeBSD: head/usr.sbin/ypldap/yp.c 296376 2016-03-04 02:14:32Z araujo $ */ |
3/* 4 * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 206 unchanged lines hidden (view full) --- 217 case YPPROC_ALL: 218 log_debug("ypproc_all"); 219 if (yp_check(req) == -1) 220 return; 221 cb = (void *)ypproc_all_2_svc; 222 break; 223 case YPPROC_MASTER: 224 log_debug("ypproc_master"); | 3/* 4 * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 206 unchanged lines hidden (view full) --- 217 case YPPROC_ALL: 218 log_debug("ypproc_all"); 219 if (yp_check(req) == -1) 220 return; 221 cb = (void *)ypproc_all_2_svc; 222 break; 223 case YPPROC_MASTER: 224 log_debug("ypproc_master"); |
225 xdr_argument = (xdrproc_t) xdr_ypreq_nokey; 226 xdr_result = (xdrproc_t) xdr_ypresp_master; |
|
225 if (yp_check(req) == -1) 226 return; 227 cb = (void *)ypproc_master_2_svc; 228 break; 229 case YPPROC_ORDER: 230 log_debug("ypproc_order"); 231 if (yp_check(req) == -1) 232 return; --- 321 unchanged lines hidden (view full) --- 554 svcerr_auth(req->rq_xprt, AUTH_FAILED); 555 return (NULL); 556} 557 558ypresp_master * 559ypproc_master_2_svc(ypreq_nokey *arg, struct svc_req *req) 560{ 561 static struct ypresp_master res; | 227 if (yp_check(req) == -1) 228 return; 229 cb = (void *)ypproc_master_2_svc; 230 break; 231 case YPPROC_ORDER: 232 log_debug("ypproc_order"); 233 if (yp_check(req) == -1) 234 return; --- 321 unchanged lines hidden (view full) --- 556 svcerr_auth(req->rq_xprt, AUTH_FAILED); 557 return (NULL); 558} 559 560ypresp_master * 561ypproc_master_2_svc(ypreq_nokey *arg, struct svc_req *req) 562{ 563 static struct ypresp_master res; |
564 static char master[YPMAXPEER + 1]; |
|
562 | 565 |
566 bzero(&res, sizeof(res)); |
|
563 if (yp_valid_domain(arg->domain, (struct ypresp_val *)&res) == -1) 564 return (&res); | 567 if (yp_valid_domain(arg->domain, (struct ypresp_val *)&res) == -1) 568 return (&res); |
569 570 if (gethostname(master, sizeof(master)) == 0) { 571 res.peer = (peername)master; 572 res.stat = YP_TRUE; 573 } else 574 res.stat = YP_NOKEY; |
|
565 | 575 |
566 res.stat = YP_YPERR; | |
567 return (&res); 568} 569 570ypresp_maplist * 571ypproc_maplist_2_svc(domainname *arg, struct svc_req *req) 572{ 573 size_t i; 574 static struct { --- 75 unchanged lines hidden --- | 576 return (&res); 577} 578 579ypresp_maplist * 580ypproc_maplist_2_svc(domainname *arg, struct svc_req *req) 581{ 582 size_t i; 583 static struct { --- 75 unchanged lines hidden --- |