summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/librpc/pmap_getport.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1/dietlibc/librpc/pmap_getport.c')
-rw-r--r--mdk-stage1/dietlibc/librpc/pmap_getport.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/mdk-stage1/dietlibc/librpc/pmap_getport.c b/mdk-stage1/dietlibc/librpc/pmap_getport.c
index 174dca41a..f26cb7621 100644
--- a/mdk-stage1/dietlibc/librpc/pmap_getport.c
+++ b/mdk-stage1/dietlibc/librpc/pmap_getport.c
@@ -55,28 +55,32 @@ static struct timeval tottimeout = { 60, 0 };
* Calls the pmap service remotely to do the lookup.
* Returns 0 if no map exists.
*/
-u_short pmap_getport(address, program, version, protocol)
+unsigned short pmap_getport(address, program, version, protocol)
struct sockaddr_in *address;
-u_long program;
-u_long version;
-u_int protocol;
+unsigned long program;
+unsigned long version;
+unsigned int protocol;
{
- u_short port = 0;
+ unsigned short port = 0;
int socket = -1;
register CLIENT *client;
struct pmap parms;
- address->sin_port = htons(PMAPPORT);
- client = clntudp_bufcreate(address, PMAPPROG,
- PMAPVERS, timeout, &socket, RPCSMALLMSGSIZE,
+ address->sin_port = htons((unsigned short)PMAPPORT);
+ if (protocol == IPPROTO_TCP)
+ client = clnttcp_create(address, PMAPPROG, PMAPVERS, &socket,
+ RPCSMALLMSGSIZE, RPCSMALLMSGSIZE);
+ else
+ 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) {
+ if (CLNT_CALL(client, PMAPPROC_GETPORT, (xdrproc_t)xdr_pmap, (char*)&parms,
+ (xdrproc_t)xdr_u_short, (char*)&port, tottimeout) != RPC_SUCCESS) {
rpc_createerr.cf_stat = RPC_PMAPFAILURE;
clnt_geterr(client, &rpc_createerr.cf_error);
} else if (port == 0) {