rpcb_svc_4.c revision 3582b7c1ba378300f8cf7361514e9287401900fe
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* The server procedure for the version 4 rpcbind.
*
*/
#include <stdio.h>
#include <unistd.h>
#include <netconfig.h>
#include <syslog.h>
#include <netdir.h>
#include <string.h>
#include <stdlib.h>
#include "rpcbind.h"
static void free_rpcb_entry_list();
/*
* Called by svc_getreqset. There is a separate server handle for
* every transport that it waits on.
*/
void
{
union {
char *rpcbproc_uaddr2taddr_4_arg;
struct netbuf rpcbproc_taddr2uaddr_4_arg;
} argument;
char *result;
char *(*local)();
case NULLPROC:
/*
* Null proc call
*/
#ifdef RPCBIND_DEBUG
#endif
(char *)NULL);
return;
case RPCBPROC_SET:
/*
* Check to see whether the message came from
* loopback transports (for security reasons)
*/
return;
}
local = (char *(*)()) rpcbproc_set_com;
break;
case RPCBPROC_UNSET:
/*
* Check to see whether the message came from
* loopback transports (for security reasons)
*/
return;
}
local = (char *(*)()) rpcbproc_unset_com;
break;
case RPCBPROC_GETADDR:
local = (char *(*)()) rpcbproc_getaddr_4;
break;
case RPCBPROC_GETVERSADDR:
#ifdef RPCBIND_DEBUG
#endif
local = (char *(*)()) rpcbproc_getversaddr_4;
break;
case RPCBPROC_DUMP:
#ifdef RPCBIND_DEBUG
#endif
local = (char *(*)()) rpcbproc_dump_4;
break;
case RPCBPROC_INDIRECT:
#ifdef RPCBIND_DEBUG
#endif
return;
/* case RPCBPROC_CALLIT: */
case RPCBPROC_BCAST:
#ifdef RPCBIND_DEBUG
#endif
return;
case RPCBPROC_GETTIME:
#ifdef RPCBIND_DEBUG
#endif
local = (char *(*)()) rpcbproc_gettime_com;
break;
case RPCBPROC_UADDR2TADDR:
#ifdef RPCBIND_DEBUG
#endif
local = (char *(*)()) rpcbproc_uaddr2taddr_com;
break;
case RPCBPROC_TADDR2UADDR:
#ifdef RPCBIND_DEBUG
#endif
local = (char *(*)()) rpcbproc_taddr2uaddr_com;
break;
case RPCBPROC_GETADDRLIST:
#ifdef RPCBIND_DEBUG
#endif
local = (char *(*)()) rpcbproc_getaddrlist_4;
break;
case RPCBPROC_GETSTAT:
#ifdef RPCBIND_DEBUG
#endif
local = (char *(*)()) rpcbproc_getstat;
break;
default:
return;
}
(char *)&argument)) {
if (debugging)
return;
}
result)) {
if (debugging) {
if (doabort) {
}
}
}
(char *)&argument)) {
if (debugging) {
if (doabort) {
}
}
}
}
/*
* Lookup the mapping for a program, version and return its
* address. Assuming that the caller wants the address of the
* server running on the transport on which the request came.
* Even if a service with a different version number is available,
* it will return that address. The client should check with an
* clnt_call to verify whether the service is the one that is desired.
* We also try to resolve the universal address in terms of
* address of the caller.
*/
/* ARGSUSED */
char **
int rpcbversnum; /* unused here */
{
#ifdef RPCBIND_DEBUG
char *uaddr;
#endif
(ulong_t)RPCB_ALLVERS));
}
/*
* Lookup the mapping for a program, version and return its
* address. Assuming that the caller wants the address of the
* server running on the transport on which the request came.
*
* We also try to resolve the universal address in terms of
* address of the caller.
*/
/* ARGSUSED */
char **
{
#ifdef RPCBIND_DEBUG
char *uaddr;
#endif
(ulong_t)RPCB_ONEVERS));
}
/*
* Lookup the mapping for a program, version and return the
* addresses for all transports in the current transport family.
* We return a merged address.
*/
/* ARGSUSED */
{
static rpcb_entry_list_ptr rlist;
rpcb_entry *a;
/*
* Deal with a possible window during which we could return an IPv6
* address when the caller wanted IPv4. See the comments in
* rpcbproc_getaddr_com() for more details.
*/
struct sockaddr_in6 *rmtaddr;
"IPv4 GETADDRLIST request mapped "
"to IPv6: ignoring");
return (NULL);
}
}
return (NULL);
} else {
}
#ifdef RPCBIND_DEBUG
#endif
goto fail;
!= 0) {
continue; /* not same proto family */
}
#ifdef RPCBIND_DEBUG
#endif
#ifdef RPCBIND_DEBUG
#endif
continue;
} else if (!maddr[0]) {
#ifdef RPCBIND_DEBUG
#endif
/*
* The server died, remove this rpcb_map element from
* the list and free it.
*/
#ifdef PORTMAP
#endif
(void) delete_rbl(rbl);
else
continue;
}
#ifdef RPCBIND_DEBUG
#endif
/*
* Add it to rlist.
*/
goto fail;
a = &rp->rpcb_entry_map;
} else {
}
}
}
#ifdef RPCBIND_DEBUG
}
#endif
/*
* XXX: getaddrlist info is also being stuffed into getaddr.
* Perhaps wrong, but better than it not getting counted at all.
*/
return (&rlist);
return (NULL);
}
/*
* Free only the allocated structure, rest is all a pointer to some
* other data somewhere else.
*/
void
{
}
}
/* VARARGS */
{
return ((rpcblist_ptr *)&list_rbl);
}