summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rpc/rpc-lib/src/rpcsvc.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
index 3592e02b98a..5357537f3d2 100644
--- a/rpc/rpc-lib/src/rpcsvc.c
+++ b/rpc/rpc-lib/src/rpcsvc.c
@@ -2156,7 +2156,9 @@ rpcsvc_transport_peer_check_addr (dict_t *options, char *volname,
int aret = RPCSVC_AUTH_DONTCARE;
int rjret = RPCSVC_AUTH_REJECT;
char clstr[RPCSVC_PEER_STRLEN];
+ char *tmp = NULL;
struct sockaddr_storage sastorage = {0,};
+ struct sockaddr *sockaddr = NULL;
if (!trans)
return ret;
@@ -2170,6 +2172,17 @@ rpcsvc_transport_peer_check_addr (dict_t *options, char *volname,
goto err;
}
+ sockaddr = (struct sockaddr *) &sastorage;
+ switch (sockaddr->sa_family) {
+
+ case AF_INET:
+ case AF_INET6:
+ tmp = strrchr (clstr, ':');
+ if (tmp)
+ *tmp = '\0';
+ break;
+ }
+
aret = rpcsvc_transport_peer_check_allow (options, volname, clstr);
rjret = rpcsvc_transport_peer_check_reject (options, volname, clstr);
@@ -2248,8 +2261,7 @@ rpcsvc_transport_check_volume_general (dict_t *options, rpc_transport_t *trans)
addrchk = rpcsvc_transport_peer_check_addr (options, NULL, trans);
if (namelookup)
- ret = rpcsvc_combine_gen_spec_addr_checks (addrchk,
- namechk);
+ ret = rpcsvc_combine_gen_spec_addr_checks (addrchk, namechk);
else
ret = addrchk;