Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.2:Test
libtirpc
libtirpc-getpmaphandle.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libtirpc-getpmaphandle.patch of Package libtirpc
commit 258824b705df18d171eaf072cfda692504e3649e Author: Olaf Kirch <okir@suse.de> Date: Mon Aug 23 12:58:41 2010 +0200 Introduce new helper function getpmaphandle This moves some code for creation of PMAP handles out of the getaddr code and into a function of its own. Signed-off-by: Olaf Kirch <okir@suse.de> Index: libtirpc-0.1.9/src/rpcb_clnt.c =================================================================== --- libtirpc-0.1.9.orig/src/rpcb_clnt.c +++ libtirpc-0.1.9/src/rpcb_clnt.c @@ -423,6 +423,44 @@ getclnthandle(host, nconf, targaddr) return (client); } +/* + * Create a PMAP client handle. + */ +static CLIENT * +getpmaphandle(nconf, hostname, tgtaddr) + const struct netconfig *nconf; + const char *hostname; + char **tgtaddr; +{ + CLIENT *client = NULL; + rpcvers_t pmapvers = 2; + + /* + * Try UDP only - there are some portmappers out + * there that use UDP only. + */ + if (nconf == NULL || strcmp(nconf->nc_proto, NC_TCP) == 0) { + struct netconfig *newnconf; + + if ((newnconf = getnetconfigent("udp")) == NULL) { + rpc_createerr.cf_stat = RPC_UNKNOWNPROTO; + return NULL; + } + client = getclnthandle(hostname, newnconf, tgtaddr); + freenetconfigent(newnconf); + } else if (strcmp(nconf->nc_proto, NC_UDP) == 0) { + if (strcmp(nconf->nc_protofmly, NC_INET) != 0) + return NULL; + client = getclnthandle(hostname, nconf, tgtaddr); + } + + /* Set version */ + if (client != NULL) + CLNT_CONTROL(client, CLSET_VERS, (char *)&pmapvers); + + return client; +} + /* XXX */ #define IN4_LOCALHOST_STRING "127.0.0.1" #define IN6_LOCALHOST_STRING "::1" @@ -828,33 +866,20 @@ __rpcb_findaddr_timed(program, version, if (strcmp(nconf->nc_protofmly, NC_INET) == 0) { u_short port = 0; struct netbuf remote; - rpcvers_t pmapvers = 2; struct pmap pmapparms; - /* - * Try UDP only - there are some portmappers out - * there that use UDP only. - */ - if (strcmp(nconf->nc_proto, NC_TCP) == 0) { - struct netconfig *newnconf; + if (strcmp(nconf->nc_proto, NC_UDP) != 0 + && strcmp(nconf->nc_proto, NC_TCP) != 0) + goto try_rpcbind; - if ((newnconf = getnetconfigent("udp")) == NULL) { - rpc_createerr.cf_stat = RPC_UNKNOWNPROTO; - return (NULL); - } - client = getclnthandle(host, newnconf, &parms.r_addr); - freenetconfigent(newnconf); - } else { - client = getclnthandle(host, nconf, &parms.r_addr); - } + client = getpmaphandle(nconf, host, &parms.r_addr); if (client == NULL) return (NULL); /* - * Set version and retry timeout. + * Set retry timeout. */ CLNT_CONTROL(client, CLSET_RETRY_TIMEOUT, (char *)&rpcbrmttime); - CLNT_CONTROL(client, CLSET_VERS, (char *)&pmapvers); pmapparms.pm_prog = program; pmapparms.pm_vers = version; @@ -899,7 +924,7 @@ __rpcb_findaddr_timed(program, version, } - //try_rpcbind: + try_rpcbind: #endif /* PORTMAP */ if ((address == NULL) || (address->len == 0)) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor