#include <rpc/pmap_prot.h>
#ifdef HAVE_LIBTIRPC
-#include <tirpc/netconfig.h>
-#include <tirpc/rpc/rpcb_prot.h>
+#include <netconfig.h>
+#include <rpc/rpcb_prot.h>
#endif
#include "nfsrpc.h"
#endif /* !HAVE_LIBTIRPC */
#ifdef HAVE_LIBTIRPC
-const static rpcvers_t default_rpcb_version = RPCBVERS_4;
+static const rpcvers_t default_rpcb_version = RPCBVERS_4;
#else /* !HAVE_LIBTIRPC */
-const static rpcvers_t default_rpcb_version = PMAPVERS;
+static const rpcvers_t default_rpcb_version = PMAPVERS;
#endif /* !HAVE_LIBTIRPC */
#ifdef HAVE_DECL_AI_ADDRCONFIG
* client. Otherwise returns NULL, and rpc_createerr.cf_stat is set to
* reflect the error.
*/
-static CLIENT *nfs_gp_get_rpcbclient(const struct sockaddr *sap,
+static CLIENT *nfs_gp_get_rpcbclient(struct sockaddr *sap,
const socklen_t salen,
const unsigned short transport,
const rpcvers_t version,
"sunrpc",
NULL,
};
- struct sockaddr_storage address;
- struct sockaddr *saddr = (struct sockaddr *)&address;
rpcprog_t rpcb_prog = nfs_getrpcbyname(RPCBPROG, rpcb_pgmtbl);
- memcpy(saddr, sap, (size_t)salen);
- nfs_gp_set_port(saddr, nfs_gp_get_rpcb_port(transport));
-
- return nfs_get_rpcclient(saddr, salen, transport, rpcb_prog,
+ nfs_gp_set_port(sap, nfs_gp_get_rpcb_port(transport));
+ return nfs_get_rpcclient(sap, salen, transport, rpcb_prog,
version, timeout);
}
/*
* Initialize the rpcb argument for a GETADDR request.
*
- * The rpcbind daemon ignores the parms.r_owner field in GETADDR
- * requests, but we plant an eye-catcher to help distinguish these
- * requests in network traces.
- *
* Returns 1 if successful, and caller must free strings pointed
* to by r_netid and r_addr; otherwise 0.
*/
parms->r_vers = version;
parms->r_netid = netid;
parms->r_addr = addr;
- parms->r_owner = "nfs-utils"; /* eye-catcher */
+ parms->r_owner = "";
return 1;
}
}
/**
- * nfs_rcp_ping - Determine if RPC service is responding to requests
+ * nfs_rpc_ping - Determine if RPC service is responding to requests
* @sap: pointer to address of server to query (port is already filled in)
* @salen: length of server address
* @program: requested RPC program number
const rpcprog_t program, const rpcvers_t version,
const unsigned short protocol, const struct timeval *timeout)
{
+ struct sockaddr_storage address;
+ struct sockaddr *saddr = (struct sockaddr *)&address;
CLIENT *client;
struct timeval tout = { -1, 0 };
int result = 0;
if (timeout != NULL)
tout = *timeout;
- client = nfs_get_rpcclient(sap, salen, protocol, program, version, &tout);
+ memcpy(saddr, sap, (size_t)salen);
+ client = nfs_get_rpcclient(saddr, salen, protocol,
+ program, version, &tout);
if (client != NULL) {
result = nfs_gp_ping(client, tout);
CLNT_DESTROY(client);
const rpcvers_t version,
const unsigned short protocol)
{
+ struct sockaddr_storage address;
+ struct sockaddr *saddr = (struct sockaddr *)&address;
struct timeval timeout = { -1, 0 };
unsigned short port = 0;
CLIENT *client;
- client = nfs_gp_get_rpcbclient(sap, salen, protocol,
+ memcpy(saddr, sap, (size_t)salen);
+ client = nfs_gp_get_rpcbclient(saddr, salen, protocol,
default_rpcb_version, &timeout);
if (client != NULL) {
- port = nfs_gp_getport(client, sap, salen, program,
+ port = nfs_gp_getport(client, saddr, salen, program,
version, protocol, timeout);
CLNT_DESTROY(client);
}
const unsigned short protocol,
const struct timeval *timeout)
{
+ struct sockaddr_storage address;
+ struct sockaddr *saddr = (struct sockaddr *)&address;
CLIENT *client;
struct rpcb parms;
struct timeval tout = { -1, 0 };
if (timeout != NULL)
tout = *timeout;
- client = nfs_gp_get_rpcbclient(sap, salen, transport, RPCBVERS_4, &tout);
+ memcpy(saddr, sap, (size_t)salen);
+ client = nfs_gp_get_rpcbclient(saddr, salen, transport,
+ RPCBVERS_4, &tout);
if (client != NULL) {
if (nfs_gp_init_rpcb_parms(addr, addrlen, program, version,
protocol, &parms) != 0) {
const unsigned long protocol,
const struct timeval *timeout)
{
+ struct sockaddr_in address;
+ struct sockaddr *saddr = (struct sockaddr *)&address;
CLIENT *client;
struct pmap parms = {
.pm_prog = program,
if (timeout != NULL)
tout = *timeout;
- client = nfs_gp_get_rpcbclient((struct sockaddr *)sin,
- (socklen_t)sizeof(*sin),
+ memcpy(saddr, sin, sizeof(address));
+ client = nfs_gp_get_rpcbclient(saddr, (socklen_t)sizeof(*sin),
transport, PMAPVERS, &tout);
if (client != NULL) {
port = nfs_gp_pmap_getport(client, &parms, tout);