rpcb_svc_com.c revision 3582b7c1ba378300f8cf7361514e9287401900fe
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * CDDL HEADER START
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * The contents of this file are subject to the terms of the
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Common Development and Distribution License (the "License").
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * You may not use this file except in compliance with the License.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * See the License for the specific language governing permissions
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * and limitations under the License.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * When distributing Covered Code, include this CDDL HEADER in each
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * If applicable, add the following below this CDDL HEADER, with the
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * fields enclosed by brackets "[]" replaced with your own identifying
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * information: Portions Copyright [yyyy] [name of copyright owner]
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * CDDL HEADER END
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Use is subject to license terms.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/* All Rights Reserved */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * University Copyright- Copyright (c) 1982, 1986, 1988
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * The Regents of the University of California
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * All Rights Reserved
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * University Acknowledgment- Portions of this document are derived from
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * software developed by the University of California, Berkeley, and its
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * contributors.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#pragma ident "%Z%%M% %I% %E% SMI"
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * The commom server procedure for the rpcbind.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#endif /* PORTMAP */
#include "rpcbind.h"
char *getowner();
static void handle_reply();
static int netbufcmp();
static int free_slot_by_xid();
static int free_slot_by_index();
static int check_rmtcalls();
static void netbuffree();
static void find_versions();
static int rpcb_rmtcalls;
bool_t *
int rpcbversnum;
#ifdef RPCBIND_DEBUG
#ifdef RPCBIND_DEBUG
return (&ans);
char *owner;
return (TRUE);
return (FALSE);
return (FALSE);
return (FALSE);
#ifdef PORTMAP
return (TRUE);
bool_t *
int rpcbversnum;
#ifdef RPCBIND_DEBUG
#ifdef RPCBIND_DEBUG
return (&ans);
char *owner;
#ifdef PORTMAP
int ans = 0;
#ifdef PORTMAP
#ifdef PORTMAP
if (ans)
unsigned long prog;
#ifdef PORTMAP
static char *uaddr;
return (NULL);
} else if (!uaddr[0]) {
#ifdef RPCBIND_DEBUG
return (&uaddr);
ulong_t *
struct netbuf *
char **uaddrp;
if (taddr) {
return (&nbuf);
return (taddr);
static char *uaddr;
#ifdef CHEW_FDS
int fd;
return (&uaddr);
return (&uaddr);
struct encap_parms {
char *args;
static bool_t
struct r_rmtcall_args {
char *rmt_uaddr;
static bool_t
return (FALSE);
static bool_t
#ifdef PORTMAP
return (FALSE);
return (FALSE);
return (FALSE);
static bool_t
struct rmtcallfd_list {
int fd;
char *netid;
int fd;
if (debugging)
if (debugging)
if (debugging)
sizeof (struct rmtcallfd_list));
if (debugging) {
return (fd);
char *netid;
static SVCXPRT *
int fd;
return (NULL);
struct svc_dg_data {
/* XXX: optbuf should be the first field, used by ti_opts.c code */
struct r_rmtcall_args a;
int outlen;
char *uaddr;
int stat;
#ifdef notyet
if (debugging)
if (debugging)
goto error;
if (!allow_indirect)
goto error;
#ifdef RPCBIND_DEBUG
if (uaddr)
switch (a.rmt_prog) {
case KEY_PROG:
if (debugging)
a.rmt_proc);
goto error;
case AUTOFS_PROG:
if (debugging)
a.rmt_proc);
goto error;
case MOUNTPROG:
if (debugging)
a.rmt_proc);
goto error;
case NFSAUTH_PROG:
if (debugging)
a.rmt_proc);
goto error;
case NFS_ACL_PROGRAM:
if (debugging)
a.rmt_proc);
goto error;
case NFS_PROGRAM:
if (debugging)
a.rmt_proc);
goto error;
case RPCBPROG:
switch (a.rmt_proc) {
case RPCBPROC_SET:
case RPCBPROC_UNSET:
case RPCBPROC_CALLIT:
case RPCBPROC_INDIRECT:
if (debugging)
goto error;
case RQUOTAPROG:
if (debugging)
a.rmt_proc);
goto error;
case YPPASSWDPROG:
if (debugging)
a.rmt_proc);
goto error;
case YPU_PROG:
if (debugging)
a.rmt_proc);
goto error;
case YPBINDPROG:
if (debugging)
a.rmt_proc);
goto error;
case YPPROG:
switch (a.rmt_proc) {
case YPPROC_FIRST:
case YPPROC_NEXT:
case YPPROC_MATCH:
case YPPROC_ALL:
if (debugging)
a.rmt_proc);
goto error;
#ifdef RPCBIND_DEBUG
goto error;
#ifdef RPCBIND_DEBUG
goto error;
#ifdef RPCBIND_DEBUG
goto error;
if (debugging)
goto error;
if (stat)
#ifdef ND_DEBUG
goto error;
if (debugging)
goto error;
if (debugging)
goto error;
#ifdef DEBUG_RMTCALL
#ifdef notyet
if (debugging)
goto error;
if (debugging)
goto error;
if (debugging)
goto error;
if (debugging)
goto error;
if (debugging)
goto error;
if (debugging)
goto error;
if (debugging)
goto error;
if (outbuf_alloc)
if (!na) {
goto error;
if (debugging)
goto error;
goto out;
out:
if (buf_alloc)
if (outbuf_alloc)
if (na)
struct finfo {
int flag;
int forward_fd;
char *uaddr;
static ulong_t
int forward_fd;
char *uaddr;
if (lastxid == 0) {
for (i = 0; i < NFORWARD; i++) {
caller_addr))) {
(void) free_slot_by_index(i);
entry = i;
j = entry;
(void) free_slot_by_index(j);
static struct finfo *
char *uaddr;
i += NFORWARD;
return (&FINFO[i]);
return (NULL);
char *uaddr;
int entry;
if (entry < 0)
int index;
static struct netbuf *
if (np) {
return (np);
static bool_t
int fd;
return (TRUE);
if (rpcb_rmtcalls == 0)
return (FALSE);
for (i = 0; i < NFORWARD; i++)
(void) free_slot_by_index(i);
return (TRUE);
return (FALSE);
#ifdef SVC_RUN_DEBUG
register struct pollfd *p;
p = pollfds;
n++, in++) {
p->revents = 0;
poll_ret = 0;
#ifdef SVC_RUN_DEBUG
if (debugging) {
if (p->events)
#ifdef SVC_RUN_DEBUG
if (debugging) {
if (p->revents)
int nfds;
int j, ncallbacks_found = 0;
if (rpcb_rmtcalls == 0)
for (j = 0; j < nfds; j++) {
#ifdef DEBUG_RMTCALL
if (debugging)
return (ncallbacks_found);
int fd;
char *buffer;
struct r_rmtcall_args a;
#ifdef SVC_RUN_DEBUG
if (debugging)
goto done;
for (i = 0; i < NFORWARD; i++) {
if (i == NFORWARD) {
#ifdef SVC_RUN_DEBUG
if (debugging) {
if (debugging)
goto done;
int moreflag;
moreflag = 0;
errno = 0;
if (debugging)
goto done;
if (res < 0) {
if (debugging)
if (debugging)
goto done;
goto done;
#ifdef DEBUG_MORE
if (debugging)
goto done;
if (debugging)
goto done;
goto done;
#ifdef SVC_RUN_DEBUG
if (debugging) {
if (debugging)
goto done;
#ifdef SVC_RUN_DEBUG
if (uaddr)
if (debugging) {
done:
if (uaddr)
if (tr_data)
#ifdef SVC_RUN_DEBUG
if (debugging) {
int lowv = 0;
int highv = 0;
if (lowv == 0) {
static rpcblist_ptr
return (hit);
char *owner;
switch (uid) {
return (owner);
#ifdef PORTMAP
long prot;