summaryrefslogtreecommitdiffstats
path: root/usr.bin/rpcinfo/rpcinfo.c
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2002-02-05 19:26:04 +0000
committeralfred <alfred@FreeBSD.org>2002-02-05 19:26:04 +0000
commit4b6dfb0371e69053a084f9be4527d00c21ff21b2 (patch)
treed0bfae22d41f9e22feb21e5677a4049209d6314a /usr.bin/rpcinfo/rpcinfo.c
parent903f014bc1c0d907f00f5ee5cd8d683b823d9081 (diff)
downloadFreeBSD-src-4b6dfb0371e69053a084f9be4527d00c21ff21b2.zip
FreeBSD-src-4b6dfb0371e69053a084f9be4527d00c21ff21b2.tar.gz
The clnt_create(KEYSERVSOCK, CRYPT_PROG, CRYPT_VERS, "unix") hacks
were removed and replaced them with clnt_tp_create, now the af_local support is fixed. I also removed the hack how rpcinfo contacted rpcbind, now we can relay on clnt_tp_create create the client-handle for us. Only rpcbind itself needs a hardcoded socket-path. Submitted by: mbr Also add $FreeBSD
Diffstat (limited to 'usr.bin/rpcinfo/rpcinfo.c')
-rw-r--r--usr.bin/rpcinfo/rpcinfo.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/usr.bin/rpcinfo/rpcinfo.c b/usr.bin/rpcinfo/rpcinfo.c
index 38abe2f..6ae9d4f 100644
--- a/usr.bin/rpcinfo/rpcinfo.c
+++ b/usr.bin/rpcinfo/rpcinfo.c
@@ -321,22 +321,24 @@ main(int argc, char **argv)
static CLIENT *
local_rpcb(u_long prog, u_long vers)
{
- struct netbuf nbuf;
- struct sockaddr_un sun;
- int sock;
-
- memset(&sun, 0, sizeof sun);
- sock = socket(AF_LOCAL, SOCK_STREAM, 0);
- if (sock < 0)
- return NULL;
-
- sun.sun_family = AF_LOCAL;
- strcpy(sun.sun_path, _PATH_RPCBINDSOCK);
- nbuf.len = sun.sun_len = SUN_LEN(&sun);
- nbuf.maxlen = sizeof (struct sockaddr_un);
- nbuf.buf = &sun;
-
- return clnt_vc_create(sock, &nbuf, prog, vers, 0, 0);
+ void *localhandle;
+ struct netconfig *nconf;
+ CLIENT *clnt;
+
+ localhandle = setnetconfig();
+ while ((nconf = getnetconfig(localhandle)) != NULL) {
+ if (nconf->nc_protofmly != NULL &&
+ strcmp(nconf->nc_protofmly, NC_LOOPBACK) == 0)
+ break;
+ }
+ if (nconf == NULL) {
+ warnx("getnetconfig: %s", nc_sperror());
+ return (NULL);
+ }
+
+ clnt = clnt_tp_create(NULL, prog, vers, nconf);
+ endnetconfig(localhandle);
+ return clnt;
}
#ifdef PORTMAP
OpenPOWER on IntegriCloud