SHA256
1
0
forked from pool/libtirpc
libtirpc/011-authdes_create.patch

40 lines
1.1 KiB
Diff
Raw Normal View History

diff --git a/src/rpc_soc.c b/src/rpc_soc.c
index e146ed4..9d555d3 100644
--- a/src/rpc_soc.c
+++ b/src/rpc_soc.c
@@ -531,7 +531,6 @@ authdes_create(servername, window, syncaddr, ckey)
struct sockaddr *syncaddr; /* optional hostaddr to sync with */
des_block *ckey; /* optional conversation key to use */
{
- AUTH *dummy;
AUTH *nauth;
char hostname[NI_MAXHOST];
@@ -540,16 +539,20 @@ authdes_create(servername, window, syncaddr, ckey)
* Change addr to hostname, because that is the way
* new interface takes it.
*/
- if (getnameinfo(syncaddr, sizeof(syncaddr), hostname,
- sizeof hostname, NULL, 0, 0) != 0)
- goto fallback;
-
+ switch (syncaddr->sa_family) {
+ case AF_INET:
+ if (getnameinfo(syncaddr, sizeof(struct sockaddr_in), hostname,
+ sizeof hostname, NULL, 0, 0) != 0)
+ goto fallback;
+ break;
+ default:
+ goto fallback;
+ }
nauth = authdes_seccreate(servername, window, hostname, ckey);
return (nauth);
}
fallback:
- dummy = authdes_seccreate(servername, window, NULL, ckey);
- return (dummy);
+ return authdes_seccreate(servername, window, NULL, ckey);
}
/*