Revert part of revision 1.10, as it broke portmap lookups for IPv4

TCP clients. The problem was that a struct netconfig returned by
getnetconfigent() was being treated as a handle for __rpc_getconf(),
which certainly isn't right.

The tirpc-99 code uses __rpc_setconf("udp")/__rpc_getconf() to find
the IPv4 udp netconfig, but our implementation of these functions
seem happy to return IPv6 entries, so we can't use them. By reverting
to the old version, we are hard-coding the name of the udp4 netid.

Tracked down by:	Bakul Shah <bakul@bitblocks.com>
This commit is contained in:
Ian Dowse 2002-07-26 07:52:21 +00:00
parent 1c367fb5b2
commit bb1ca86f24

View File

@ -685,7 +685,7 @@ __rpcbind_is_up()
nconf = NULL;
localhandle = setnetconfig();
while (nconf = getnetconfig(localhandle)){
while ((nconf = getnetconfig(localhandle)) != NULL) {
if (nconf->nc_protofmly != NULL &&
strcmp(nconf->nc_protofmly, NC_LOOPBACK) == 0)
break;
@ -777,19 +777,13 @@ __rpcb_findaddr_timed(program, version, nconf, host, clpp, tp)
*/
if (strcmp(nconf->nc_proto, NC_TCP) == 0) {
struct netconfig *newnconf;
void *handle;
if ((handle = getnetconfigent("udp")) == NULL) {
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
return (NULL);
}
if ((newnconf = __rpc_getconf(handle)) == NULL) {
__rpc_endconf(handle);
if ((newnconf = getnetconfigent("udp")) == NULL) {
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
return (NULL);
}
client = getclnthandle(host, newnconf, &parms.r_addr);
__rpc_endconf(handle);
freenetconfigent(newnconf);
} else {
client = getclnthandle(host, nconf, &parms.r_addr);
}