diff options
author | Nicolas Planel <nplanel@mandriva.com> | 2003-10-29 16:07:11 +0000 |
---|---|---|
committer | Nicolas Planel <nplanel@mandriva.com> | 2003-10-29 16:07:11 +0000 |
commit | de47eb59bb829423b1d0f47ba13099073999b3cb (patch) | |
tree | 827f35c4666e15ec66edae7c1fa05d963324602b /mdk-stage1/dietlibc/librpc/pmap_getport.c | |
parent | 1fece42e9c460ca017fc4facad380f05163d8977 (diff) | |
download | drakx-backup-do-not-use-topic/Corpo_2_1.tar drakx-backup-do-not-use-topic/Corpo_2_1.tar.gz drakx-backup-do-not-use-topic/Corpo_2_1.tar.bz2 drakx-backup-do-not-use-topic/Corpo_2_1.tar.xz drakx-backup-do-not-use-topic/Corpo_2_1.zip |
Corporate Server 2.1.1 releasetopic/Corpo_2_1
Diffstat (limited to 'mdk-stage1/dietlibc/librpc/pmap_getport.c')
-rw-r--r-- | mdk-stage1/dietlibc/librpc/pmap_getport.c | 24 |
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) { |