mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 20:40:05 +00:00
Remove duplicate version of pmap_getport from NIS code.
This commit is contained in:
parent
f3dcc2f9a5
commit
2f3e3dc75f
@ -1,3 +1,12 @@
|
||||
2010-09-01 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* sunrpc/pm_getport.c (__libc_rpc_getport): New function. This is
|
||||
mainly the body of pmap_getport. Add parameters to specify timeouts.
|
||||
(pmap_getport): Use __libc_rpc_getport.
|
||||
* sunrpc/Versions: Export __libc_rpc_getport with GLIBC_PRIVATE.
|
||||
* include/rpc/pmap_clnt.h: Declare __libc_rpc_getport.
|
||||
* nis/nis_findserv.c: Remove pmap_getport copy. Use __libc_rpc_getport.
|
||||
|
||||
2010-08-31 Andreas Schwab <schwab@linux-m68k.org>
|
||||
|
||||
* sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list: Add
|
||||
|
@ -8,5 +8,10 @@ libc_hidden_proto (pmap_unset)
|
||||
/* Defined in pm_getport.c. */
|
||||
extern int __get_socket (struct sockaddr_in *saddr)
|
||||
attribute_hidden internal_function;
|
||||
extern u_short __libc_rpc_getport (struct sockaddr_in *address, u_long program,
|
||||
u_long version, u_int protocol,
|
||||
time_t timeout_sec, time_t tottimeout_sec)
|
||||
internal_function;
|
||||
libc_hidden_proto (__libc_rpc_getport)
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1997, 1998, 2000, 2001, 2010 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
||||
|
||||
@ -47,15 +47,6 @@ struct cu_data
|
||||
};
|
||||
|
||||
|
||||
/* The following is the original routine from sunrpc/pm_getport.c.
|
||||
The only change is the much shorter timeout. */
|
||||
/*
|
||||
* pmap_getport.c
|
||||
* Client interface to pmap rpc service.
|
||||
*
|
||||
* Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Find the mapped port for program,version.
|
||||
* Calls the pmap service remotely to do the lookup.
|
||||
@ -65,39 +56,7 @@ u_short
|
||||
__pmap_getnisport (struct sockaddr_in *address, u_long program,
|
||||
u_long version, u_int protocol)
|
||||
{
|
||||
const struct timeval timeout = {1, 0};
|
||||
const struct timeval tottimeout = {1, 0};
|
||||
u_short port = 0;
|
||||
int socket = -1;
|
||||
CLIENT *client;
|
||||
struct pmap parms;
|
||||
|
||||
address->sin_port = htons (PMAPPORT);
|
||||
client = clntudp_bufcreate (address, PMAPPROG, PMAPVERS, timeout, &socket,
|
||||
RPCSMALLMSGSIZE, RPCSMALLMSGSIZE);
|
||||
if (client != (CLIENT *) NULL)
|
||||
{
|
||||
parms.pm_prog = program;
|
||||
parms.pm_vers = version;
|
||||
parms.pm_prot = protocol;
|
||||
parms.pm_port = 0; /* not needed or used */
|
||||
if (CLNT_CALL (client, PMAPPROC_GETPORT, (xdrproc_t) xdr_pmap,
|
||||
(caddr_t) & parms, (xdrproc_t) xdr_u_short,
|
||||
(caddr_t) & port, tottimeout) != RPC_SUCCESS)
|
||||
{
|
||||
rpc_createerr.cf_stat = RPC_PMAPFAILURE;
|
||||
clnt_geterr (client, &rpc_createerr.cf_error);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (port == 0)
|
||||
rpc_createerr.cf_stat = RPC_PROGNOTREGISTERED;
|
||||
}
|
||||
CLNT_DESTROY (client);
|
||||
}
|
||||
/* (void)close(socket); CLNT_DESTROY already closed it */
|
||||
address->sin_port = 0;
|
||||
return port;
|
||||
return __libc_rpc_getport (address, program, version, protocol, 1, 1);
|
||||
}
|
||||
|
||||
/* This is now the public function, which should find the fastest server */
|
||||
|
@ -117,6 +117,6 @@ libc {
|
||||
xdr_quad_t; xdr_u_quad_t;
|
||||
}
|
||||
GLIBC_PRIVATE {
|
||||
__libc_clntudp_bufcreate;
|
||||
__libc_clntudp_bufcreate; __libc_rpc_getport;
|
||||
}
|
||||
}
|
||||
|
@ -39,11 +39,6 @@
|
||||
#include <rpc/pmap_clnt.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
static const struct timeval timeout =
|
||||
{5, 0};
|
||||
static const struct timeval tottimeout =
|
||||
{60, 0};
|
||||
|
||||
/*
|
||||
* Create a socket that is locally bound to a non-reserve port. For
|
||||
* any failures, -1 is returned which will cause the RPC code to
|
||||
@ -81,16 +76,24 @@ __get_socket (struct sockaddr_in *saddr)
|
||||
|
||||
/*
|
||||
* Find the mapped port for program,version.
|
||||
* Internal version with additional parameters.
|
||||
* Calls the pmap service remotely to do the lookup.
|
||||
* Returns 0 if no map exists.
|
||||
*/
|
||||
u_short
|
||||
pmap_getport (address, program, version, protocol)
|
||||
internal_function
|
||||
__libc_rpc_getport (address, program, version, protocol, timeout_sec,
|
||||
tottimeout_sec)
|
||||
struct sockaddr_in *address;
|
||||
u_long program;
|
||||
u_long version;
|
||||
u_int protocol;
|
||||
time_t timeout_sec;
|
||||
time_t tottimeout_sec;
|
||||
{
|
||||
const struct timeval timeout = {timeout_sec, 0};
|
||||
const struct timeval tottimeout = {tottimeout_sec, 0};
|
||||
|
||||
u_short port = 0;
|
||||
int socket = -1;
|
||||
CLIENT *client;
|
||||
@ -137,4 +140,21 @@ pmap_getport (address, program, version, protocol)
|
||||
address->sin_port = 0;
|
||||
return port;
|
||||
}
|
||||
libc_hidden_def (__libc_rpc_getport)
|
||||
|
||||
|
||||
/*
|
||||
* Find the mapped port for program,version.
|
||||
* Calls the pmap service remotely to do the lookup.
|
||||
* Returns 0 if no map exists.
|
||||
*/
|
||||
u_short
|
||||
pmap_getport (address, program, version, protocol)
|
||||
struct sockaddr_in *address;
|
||||
u_long program;
|
||||
u_long version;
|
||||
u_int protocol;
|
||||
{
|
||||
return __libc_rpc_getport (address, program, version, protocol, 5, 60);
|
||||
}
|
||||
libc_hidden_def (pmap_getport)
|
||||
|
Loading…
Reference in New Issue
Block a user