1ce0e08e2SPeter Avalos /*
2*bd91f5c3SJustin C. Sherrill * Copyright (c) 2009, Sun Microsystems, Inc.
3*bd91f5c3SJustin C. Sherrill * All rights reserved.
4ce0e08e2SPeter Avalos *
5*bd91f5c3SJustin C. Sherrill * Redistribution and use in source and binary forms, with or without
6*bd91f5c3SJustin C. Sherrill * modification, are permitted provided that the following conditions are met:
7*bd91f5c3SJustin C. Sherrill * - Redistributions of source code must retain the above copyright notice,
8*bd91f5c3SJustin C. Sherrill * this list of conditions and the following disclaimer.
9*bd91f5c3SJustin C. Sherrill * - Redistributions in binary form must reproduce the above copyright notice,
10*bd91f5c3SJustin C. Sherrill * this list of conditions and the following disclaimer in the documentation
11*bd91f5c3SJustin C. Sherrill * and/or other materials provided with the distribution.
12*bd91f5c3SJustin C. Sherrill * - Neither the name of Sun Microsystems, Inc. nor the names of its
13*bd91f5c3SJustin C. Sherrill * contributors may be used to endorse or promote products derived
14*bd91f5c3SJustin C. Sherrill * from this software without specific prior written permission.
15ce0e08e2SPeter Avalos *
16*bd91f5c3SJustin C. Sherrill * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17*bd91f5c3SJustin C. Sherrill * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*bd91f5c3SJustin C. Sherrill * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*bd91f5c3SJustin C. Sherrill * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20*bd91f5c3SJustin C. Sherrill * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21*bd91f5c3SJustin C. Sherrill * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22*bd91f5c3SJustin C. Sherrill * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23*bd91f5c3SJustin C. Sherrill * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24*bd91f5c3SJustin C. Sherrill * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25*bd91f5c3SJustin C. Sherrill * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26*bd91f5c3SJustin C. Sherrill * POSSIBILITY OF SUCH DAMAGE.
27ce0e08e2SPeter Avalos *
28ce0e08e2SPeter Avalos * @(#)pmap_svc.c 1.14 93/07/05 SMI; 1.23 89/04/05 Copyr 1984 Sun Micro
29ce0e08e2SPeter Avalos * $NetBSD: pmap_svc.c,v 1.2 2000/10/20 11:49:40 fvdl Exp $
30ce0e08e2SPeter Avalos * $FreeBSD: src/usr.sbin/rpcbind/pmap_svc.c,v 1.5 2007/11/07 10:53:39 kevlo Exp $
31ce0e08e2SPeter Avalos */
32ce0e08e2SPeter Avalos /*
33ce0e08e2SPeter Avalos * Copyright (c) 1984 - 1991 by Sun Microsystems, Inc.
34ce0e08e2SPeter Avalos */
35ce0e08e2SPeter Avalos
36ce0e08e2SPeter Avalos /*
37ce0e08e2SPeter Avalos * pmap_svc.c
38ce0e08e2SPeter Avalos * The server procedure for the version 2 portmaper.
39ce0e08e2SPeter Avalos * All the portmapper related interface from the portmap side.
40ce0e08e2SPeter Avalos */
41ce0e08e2SPeter Avalos
42ce0e08e2SPeter Avalos #ifdef PORTMAP
43ce0e08e2SPeter Avalos #include <sys/types.h>
44ce0e08e2SPeter Avalos #include <sys/socket.h>
45ce0e08e2SPeter Avalos #include <stdio.h>
46ce0e08e2SPeter Avalos #include <rpc/rpc.h>
47ce0e08e2SPeter Avalos #include <rpc/pmap_prot.h>
48ce0e08e2SPeter Avalos #include <rpc/rpcb_prot.h>
49ce0e08e2SPeter Avalos #ifdef RPCBIND_DEBUG
50ce0e08e2SPeter Avalos #include <stdlib.h>
51ce0e08e2SPeter Avalos #endif
52ce0e08e2SPeter Avalos #include "rpcbind.h"
53ce0e08e2SPeter Avalos
54ce0e08e2SPeter Avalos static struct pmaplist *find_service_pmap(rpcprog_t, rpcvers_t, rpcprot_t);
55ce0e08e2SPeter Avalos static bool_t pmapproc_change(struct svc_req *, SVCXPRT *, u_long);
56ce0e08e2SPeter Avalos static bool_t pmapproc_getport(struct svc_req *, SVCXPRT *);
57ce0e08e2SPeter Avalos static bool_t pmapproc_dump(struct svc_req *, SVCXPRT *);
58ce0e08e2SPeter Avalos
59ce0e08e2SPeter Avalos /*
60ce0e08e2SPeter Avalos * Called for all the version 2 inquiries.
61ce0e08e2SPeter Avalos */
62ce0e08e2SPeter Avalos void
pmap_service(struct svc_req * rqstp,SVCXPRT * xprt)63ce0e08e2SPeter Avalos pmap_service(struct svc_req *rqstp, SVCXPRT *xprt)
64ce0e08e2SPeter Avalos {
65ce0e08e2SPeter Avalos rpcbs_procinfo(RPCBVERS_2_STAT, rqstp->rq_proc);
66ce0e08e2SPeter Avalos switch (rqstp->rq_proc) {
67ce0e08e2SPeter Avalos case PMAPPROC_NULL:
68ce0e08e2SPeter Avalos /*
69ce0e08e2SPeter Avalos * Null proc call
70ce0e08e2SPeter Avalos */
71ce0e08e2SPeter Avalos #ifdef RPCBIND_DEBUG
72ce0e08e2SPeter Avalos if (debugging)
73ce0e08e2SPeter Avalos fprintf(stderr, "PMAPPROC_NULL\n");
74ce0e08e2SPeter Avalos #endif
75ce0e08e2SPeter Avalos check_access(xprt, rqstp->rq_proc, NULL, PMAPVERS);
76ce0e08e2SPeter Avalos if ((!svc_sendreply(xprt, (xdrproc_t) xdr_void, NULL)) &&
77ce0e08e2SPeter Avalos debugging) {
78ce0e08e2SPeter Avalos if (doabort) {
79ce0e08e2SPeter Avalos rpcbind_abort();
80ce0e08e2SPeter Avalos }
81ce0e08e2SPeter Avalos }
82ce0e08e2SPeter Avalos break;
83ce0e08e2SPeter Avalos
84ce0e08e2SPeter Avalos case PMAPPROC_SET:
85ce0e08e2SPeter Avalos /*
86ce0e08e2SPeter Avalos * Set a program, version to port mapping
87ce0e08e2SPeter Avalos */
88ce0e08e2SPeter Avalos pmapproc_change(rqstp, xprt, rqstp->rq_proc);
89ce0e08e2SPeter Avalos break;
90ce0e08e2SPeter Avalos
91ce0e08e2SPeter Avalos case PMAPPROC_UNSET:
92ce0e08e2SPeter Avalos /*
93ce0e08e2SPeter Avalos * Remove a program, version to port mapping.
94ce0e08e2SPeter Avalos */
95ce0e08e2SPeter Avalos pmapproc_change(rqstp, xprt, rqstp->rq_proc);
96ce0e08e2SPeter Avalos break;
97ce0e08e2SPeter Avalos
98ce0e08e2SPeter Avalos case PMAPPROC_GETPORT:
99ce0e08e2SPeter Avalos /*
100ce0e08e2SPeter Avalos * Lookup the mapping for a program, version and return its
101ce0e08e2SPeter Avalos * port number.
102ce0e08e2SPeter Avalos */
103ce0e08e2SPeter Avalos pmapproc_getport(rqstp, xprt);
104ce0e08e2SPeter Avalos break;
105ce0e08e2SPeter Avalos
106ce0e08e2SPeter Avalos case PMAPPROC_DUMP:
107ce0e08e2SPeter Avalos /*
108ce0e08e2SPeter Avalos * Return the current set of mapped program, version
109ce0e08e2SPeter Avalos */
110ce0e08e2SPeter Avalos #ifdef RPCBIND_DEBUG
111ce0e08e2SPeter Avalos if (debugging)
112ce0e08e2SPeter Avalos fprintf(stderr, "PMAPPROC_DUMP\n");
113ce0e08e2SPeter Avalos #endif
114ce0e08e2SPeter Avalos pmapproc_dump(rqstp, xprt);
115ce0e08e2SPeter Avalos break;
116ce0e08e2SPeter Avalos
117ce0e08e2SPeter Avalos case PMAPPROC_CALLIT:
118ce0e08e2SPeter Avalos /*
119ce0e08e2SPeter Avalos * Calls a procedure on the local machine. If the requested
120ce0e08e2SPeter Avalos * procedure is not registered this procedure does not return
121ce0e08e2SPeter Avalos * error information!!
122ce0e08e2SPeter Avalos * This procedure is only supported on rpc/udp and calls via
123ce0e08e2SPeter Avalos * rpc/udp. It passes null authentication parameters.
124ce0e08e2SPeter Avalos */
125ce0e08e2SPeter Avalos rpcbproc_callit_com(rqstp, xprt, PMAPPROC_CALLIT, PMAPVERS);
126ce0e08e2SPeter Avalos break;
127ce0e08e2SPeter Avalos
128ce0e08e2SPeter Avalos default:
129ce0e08e2SPeter Avalos svcerr_noproc(xprt);
130ce0e08e2SPeter Avalos break;
131ce0e08e2SPeter Avalos }
132ce0e08e2SPeter Avalos }
133ce0e08e2SPeter Avalos
134ce0e08e2SPeter Avalos /*
135ce0e08e2SPeter Avalos * returns the item with the given program, version number. If that version
136ce0e08e2SPeter Avalos * number is not found, it returns the item with that program number, so that
137ce0e08e2SPeter Avalos * the port number is now returned to the caller. The caller when makes a
138ce0e08e2SPeter Avalos * call to this program, version number, the call will fail and it will
139ce0e08e2SPeter Avalos * return with PROGVERS_MISMATCH. The user can then determine the highest
140ce0e08e2SPeter Avalos * and the lowest version number for this program using clnt_geterr() and
141ce0e08e2SPeter Avalos * use those program version numbers.
142ce0e08e2SPeter Avalos */
143ce0e08e2SPeter Avalos static struct pmaplist *
find_service_pmap(rpcprog_t prog,rpcvers_t vers,rpcprot_t prot)144ce0e08e2SPeter Avalos find_service_pmap(rpcprog_t prog, rpcvers_t vers, rpcprot_t prot)
145ce0e08e2SPeter Avalos {
146ce0e08e2SPeter Avalos struct pmaplist *hit = NULL;
147ce0e08e2SPeter Avalos struct pmaplist *pml;
148ce0e08e2SPeter Avalos
149ce0e08e2SPeter Avalos for (pml = list_pml; pml != NULL; pml = pml->pml_next) {
150ce0e08e2SPeter Avalos if ((pml->pml_map.pm_prog != prog) ||
151ce0e08e2SPeter Avalos (pml->pml_map.pm_prot != prot))
152ce0e08e2SPeter Avalos continue;
153ce0e08e2SPeter Avalos hit = pml;
154ce0e08e2SPeter Avalos if (pml->pml_map.pm_vers == vers)
155ce0e08e2SPeter Avalos break;
156ce0e08e2SPeter Avalos }
157ce0e08e2SPeter Avalos return (hit);
158ce0e08e2SPeter Avalos }
159ce0e08e2SPeter Avalos
160ce0e08e2SPeter Avalos static bool_t
pmapproc_change(struct svc_req * rqstp __unused,SVCXPRT * xprt,unsigned long op)161ce0e08e2SPeter Avalos pmapproc_change(struct svc_req *rqstp __unused, SVCXPRT *xprt, unsigned long op)
162ce0e08e2SPeter Avalos {
163ce0e08e2SPeter Avalos struct pmap reg;
164ce0e08e2SPeter Avalos RPCB rpcbreg;
165ce0e08e2SPeter Avalos long ans;
166ce0e08e2SPeter Avalos struct sockaddr_in *who;
167ce0e08e2SPeter Avalos uid_t uid;
168ce0e08e2SPeter Avalos char uidbuf[32];
169ce0e08e2SPeter Avalos
170ce0e08e2SPeter Avalos #ifdef RPCBIND_DEBUG
171ce0e08e2SPeter Avalos if (debugging)
172ce0e08e2SPeter Avalos fprintf(stderr, "%s request for (%lu, %lu) : ",
173ce0e08e2SPeter Avalos op == PMAPPROC_SET ? "PMAP_SET" : "PMAP_UNSET",
174ce0e08e2SPeter Avalos reg.pm_prog, reg.pm_vers);
175ce0e08e2SPeter Avalos #endif
176ce0e08e2SPeter Avalos
177ce0e08e2SPeter Avalos if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (char *)®)) {
178ce0e08e2SPeter Avalos svcerr_decode(xprt);
179ce0e08e2SPeter Avalos return (FALSE);
180ce0e08e2SPeter Avalos }
181ce0e08e2SPeter Avalos
182ce0e08e2SPeter Avalos if (!check_access(xprt, op, ®, PMAPVERS)) {
183ce0e08e2SPeter Avalos svcerr_weakauth(xprt);
184ce0e08e2SPeter Avalos return FALSE;
185ce0e08e2SPeter Avalos }
186ce0e08e2SPeter Avalos
187ce0e08e2SPeter Avalos who = svc_getcaller(xprt);
188ce0e08e2SPeter Avalos
189ce0e08e2SPeter Avalos /*
190ce0e08e2SPeter Avalos * Can't use getpwnam here. We might end up calling ourselves
191ce0e08e2SPeter Avalos * and looping.
192ce0e08e2SPeter Avalos */
193ce0e08e2SPeter Avalos if (__rpc_get_local_uid(xprt, &uid) < 0)
194ce0e08e2SPeter Avalos rpcbreg.r_owner = "unknown";
195ce0e08e2SPeter Avalos else if (uid == 0)
196ce0e08e2SPeter Avalos rpcbreg.r_owner = "superuser";
197ce0e08e2SPeter Avalos else {
198ce0e08e2SPeter Avalos /* r_owner will be strdup-ed later */
199ce0e08e2SPeter Avalos snprintf(uidbuf, sizeof uidbuf, "%d", uid);
200ce0e08e2SPeter Avalos rpcbreg.r_owner = uidbuf;
201ce0e08e2SPeter Avalos }
202ce0e08e2SPeter Avalos
203ce0e08e2SPeter Avalos rpcbreg.r_prog = reg.pm_prog;
204ce0e08e2SPeter Avalos rpcbreg.r_vers = reg.pm_vers;
205ce0e08e2SPeter Avalos
206ce0e08e2SPeter Avalos if (op == PMAPPROC_SET) {
207ce0e08e2SPeter Avalos char buf[32];
208ce0e08e2SPeter Avalos
209ce0e08e2SPeter Avalos snprintf(buf, sizeof buf, "0.0.0.0.%d.%d",
210ce0e08e2SPeter Avalos (int)((reg.pm_port >> 8) & 0xff),
211ce0e08e2SPeter Avalos (int)(reg.pm_port & 0xff));
212ce0e08e2SPeter Avalos rpcbreg.r_addr = buf;
213ce0e08e2SPeter Avalos if (reg.pm_prot == IPPROTO_UDP) {
214ce0e08e2SPeter Avalos rpcbreg.r_netid = udptrans;
215ce0e08e2SPeter Avalos } else if (reg.pm_prot == IPPROTO_TCP) {
216ce0e08e2SPeter Avalos rpcbreg.r_netid = tcptrans;
217ce0e08e2SPeter Avalos } else {
218ce0e08e2SPeter Avalos ans = FALSE;
219ce0e08e2SPeter Avalos goto done_change;
220ce0e08e2SPeter Avalos }
221ce0e08e2SPeter Avalos ans = map_set(&rpcbreg, rpcbreg.r_owner);
222ce0e08e2SPeter Avalos } else if (op == PMAPPROC_UNSET) {
223ce0e08e2SPeter Avalos bool_t ans1, ans2;
224ce0e08e2SPeter Avalos
225ce0e08e2SPeter Avalos rpcbreg.r_addr = NULL;
226ce0e08e2SPeter Avalos rpcbreg.r_netid = tcptrans;
227ce0e08e2SPeter Avalos ans1 = map_unset(&rpcbreg, rpcbreg.r_owner);
228ce0e08e2SPeter Avalos rpcbreg.r_netid = udptrans;
229ce0e08e2SPeter Avalos ans2 = map_unset(&rpcbreg, rpcbreg.r_owner);
230ce0e08e2SPeter Avalos ans = ans1 || ans2;
231ce0e08e2SPeter Avalos } else {
232ce0e08e2SPeter Avalos ans = FALSE;
233ce0e08e2SPeter Avalos }
234ce0e08e2SPeter Avalos done_change:
235ce0e08e2SPeter Avalos if ((!svc_sendreply(xprt, (xdrproc_t) xdr_long, (caddr_t) &ans)) &&
236ce0e08e2SPeter Avalos debugging) {
237ce0e08e2SPeter Avalos fprintf(stderr, "portmap: svc_sendreply\n");
238ce0e08e2SPeter Avalos if (doabort) {
239ce0e08e2SPeter Avalos rpcbind_abort();
240ce0e08e2SPeter Avalos }
241ce0e08e2SPeter Avalos }
242ce0e08e2SPeter Avalos #ifdef RPCBIND_DEBUG
243ce0e08e2SPeter Avalos if (debugging)
244ce0e08e2SPeter Avalos fprintf(stderr, "%s\n", ans == TRUE ? "succeeded" : "failed");
245ce0e08e2SPeter Avalos #endif
246ce0e08e2SPeter Avalos if (op == PMAPPROC_SET)
247ce0e08e2SPeter Avalos rpcbs_set(RPCBVERS_2_STAT, ans);
248ce0e08e2SPeter Avalos else
249ce0e08e2SPeter Avalos rpcbs_unset(RPCBVERS_2_STAT, ans);
250ce0e08e2SPeter Avalos return (TRUE);
251ce0e08e2SPeter Avalos }
252ce0e08e2SPeter Avalos
253ce0e08e2SPeter Avalos /* ARGSUSED */
254ce0e08e2SPeter Avalos static bool_t
pmapproc_getport(struct svc_req * rqstp __unused,SVCXPRT * xprt)255ce0e08e2SPeter Avalos pmapproc_getport(struct svc_req *rqstp __unused, SVCXPRT *xprt)
256ce0e08e2SPeter Avalos {
257ce0e08e2SPeter Avalos struct pmap reg;
258ce0e08e2SPeter Avalos long lport;
259ce0e08e2SPeter Avalos int port = 0;
260ce0e08e2SPeter Avalos struct pmaplist *fnd;
261ce0e08e2SPeter Avalos #ifdef RPCBIND_DEBUG
262ce0e08e2SPeter Avalos char *uaddr;
263ce0e08e2SPeter Avalos #endif
264ce0e08e2SPeter Avalos
265ce0e08e2SPeter Avalos if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (char *)®)) {
266ce0e08e2SPeter Avalos svcerr_decode(xprt);
267ce0e08e2SPeter Avalos return (FALSE);
268ce0e08e2SPeter Avalos }
269ce0e08e2SPeter Avalos
270ce0e08e2SPeter Avalos if (!check_access(xprt, PMAPPROC_GETPORT, ®, PMAPVERS)) {
271ce0e08e2SPeter Avalos svcerr_weakauth(xprt);
272ce0e08e2SPeter Avalos return FALSE;
273ce0e08e2SPeter Avalos }
274ce0e08e2SPeter Avalos
275ce0e08e2SPeter Avalos #ifdef RPCBIND_DEBUG
276ce0e08e2SPeter Avalos if (debugging) {
277ce0e08e2SPeter Avalos uaddr = taddr2uaddr(rpcbind_get_conf(xprt->xp_netid),
278ce0e08e2SPeter Avalos svc_getrpccaller(xprt));
279ce0e08e2SPeter Avalos fprintf(stderr, "PMAP_GETPORT req for (%lu, %lu, %s) from %s :",
280ce0e08e2SPeter Avalos reg.pm_prog, reg.pm_vers,
281ce0e08e2SPeter Avalos reg.pm_prot == IPPROTO_UDP ? "udp" : "tcp", uaddr);
282ce0e08e2SPeter Avalos free(uaddr);
283ce0e08e2SPeter Avalos }
284ce0e08e2SPeter Avalos #endif
285ce0e08e2SPeter Avalos fnd = find_service_pmap(reg.pm_prog, reg.pm_vers, reg.pm_prot);
286ce0e08e2SPeter Avalos if (fnd) {
287ce0e08e2SPeter Avalos char serveuaddr[32], *ua;
288ce0e08e2SPeter Avalos int h1, h2, h3, h4, p1, p2;
289ce0e08e2SPeter Avalos char *netid;
290ce0e08e2SPeter Avalos
291ce0e08e2SPeter Avalos if (reg.pm_prot == IPPROTO_UDP) {
292ce0e08e2SPeter Avalos ua = udp_uaddr;
293ce0e08e2SPeter Avalos netid = udptrans;
294ce0e08e2SPeter Avalos } else {
295ce0e08e2SPeter Avalos ua = tcp_uaddr; /* To get the len */
296ce0e08e2SPeter Avalos netid = tcptrans;
297ce0e08e2SPeter Avalos }
298ce0e08e2SPeter Avalos if (ua == NULL) {
299ce0e08e2SPeter Avalos goto sendreply;
300ce0e08e2SPeter Avalos }
301ce0e08e2SPeter Avalos if (sscanf(ua, "%d.%d.%d.%d.%d.%d", &h1, &h2, &h3,
302ce0e08e2SPeter Avalos &h4, &p1, &p2) == 6) {
303ce0e08e2SPeter Avalos p1 = (fnd->pml_map.pm_port >> 8) & 0xff;
304ce0e08e2SPeter Avalos p2 = (fnd->pml_map.pm_port) & 0xff;
305ce0e08e2SPeter Avalos snprintf(serveuaddr, sizeof serveuaddr,
306ce0e08e2SPeter Avalos "%d.%d.%d.%d.%d.%d", h1, h2, h3, h4, p1, p2);
307ce0e08e2SPeter Avalos if (is_bound(netid, serveuaddr)) {
308ce0e08e2SPeter Avalos port = fnd->pml_map.pm_port;
309ce0e08e2SPeter Avalos } else { /* this service is dead; delete it */
310ce0e08e2SPeter Avalos delete_prog(reg.pm_prog);
311ce0e08e2SPeter Avalos }
312ce0e08e2SPeter Avalos }
313ce0e08e2SPeter Avalos }
314ce0e08e2SPeter Avalos sendreply:
315ce0e08e2SPeter Avalos lport = port;
316ce0e08e2SPeter Avalos if ((!svc_sendreply(xprt, (xdrproc_t) xdr_long, (caddr_t)&lport)) &&
317ce0e08e2SPeter Avalos debugging) {
318ce0e08e2SPeter Avalos fprintf(stderr, "portmap: svc_sendreply\n");
319ce0e08e2SPeter Avalos if (doabort) {
320ce0e08e2SPeter Avalos rpcbind_abort();
321ce0e08e2SPeter Avalos }
322ce0e08e2SPeter Avalos }
323ce0e08e2SPeter Avalos #ifdef RPCBIND_DEBUG
324ce0e08e2SPeter Avalos if (debugging)
325ce0e08e2SPeter Avalos fprintf(stderr, "port = %d\n", port);
326ce0e08e2SPeter Avalos #endif
327ce0e08e2SPeter Avalos rpcbs_getaddr(RPCBVERS_2_STAT, reg.pm_prog, reg.pm_vers,
328ce0e08e2SPeter Avalos reg.pm_prot == IPPROTO_UDP ? udptrans : tcptrans,
329ce0e08e2SPeter Avalos port ? udptrans : "");
330ce0e08e2SPeter Avalos
331ce0e08e2SPeter Avalos return (TRUE);
332ce0e08e2SPeter Avalos }
333ce0e08e2SPeter Avalos
334ce0e08e2SPeter Avalos /* ARGSUSED */
335ce0e08e2SPeter Avalos static bool_t
pmapproc_dump(struct svc_req * rqstp __unused,SVCXPRT * xprt)336ce0e08e2SPeter Avalos pmapproc_dump(struct svc_req *rqstp __unused, SVCXPRT *xprt)
337ce0e08e2SPeter Avalos {
338ce0e08e2SPeter Avalos if (!svc_getargs(xprt, (xdrproc_t)xdr_void, NULL)) {
339ce0e08e2SPeter Avalos svcerr_decode(xprt);
340ce0e08e2SPeter Avalos return (FALSE);
341ce0e08e2SPeter Avalos }
342ce0e08e2SPeter Avalos
343ce0e08e2SPeter Avalos if (!check_access(xprt, PMAPPROC_DUMP, NULL, PMAPVERS)) {
344ce0e08e2SPeter Avalos svcerr_weakauth(xprt);
345ce0e08e2SPeter Avalos return FALSE;
346ce0e08e2SPeter Avalos }
347ce0e08e2SPeter Avalos
348ce0e08e2SPeter Avalos if ((!svc_sendreply(xprt, (xdrproc_t) xdr_pmaplist_ptr,
349ce0e08e2SPeter Avalos (caddr_t)&list_pml)) && debugging) {
350ce0e08e2SPeter Avalos if (debugging)
351ce0e08e2SPeter Avalos fprintf(stderr, "portmap: svc_sendreply\n");
352ce0e08e2SPeter Avalos if (doabort) {
353ce0e08e2SPeter Avalos rpcbind_abort();
354ce0e08e2SPeter Avalos }
355ce0e08e2SPeter Avalos }
356ce0e08e2SPeter Avalos return (TRUE);
357ce0e08e2SPeter Avalos }
358ce0e08e2SPeter Avalos
359ce0e08e2SPeter Avalos #endif /* PORTMAP */
360