summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-lib
diff options
context:
space:
mode:
authorRajesh Amaravathi <rajesh@redhat.com>2012-03-13 13:13:11 +0530
committerVijay Bellur <vijay@gluster.com>2012-03-14 03:10:57 -0700
commit718a8ab91f6b9bd84da52c2029707f48e9fecaa4 (patch)
treefe9183b6d1380832c49ad0b471e7d70a75381ffb /rpc/rpc-lib
parent91b4c34805f69c30c4730352eee873cee0dc17ee (diff)
rpc-lib/rpcsvc: nfs auth corrections
in comparing ip addresses during authentication, we need to take only the ip address of the client instead of the transport endpoint (ip:port). Change-Id: If48eca37edea1d69deb150720fbaea0ea2443a00 BUG: 771845 Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com> Reviewed-on: http://review.gluster.com/2929 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'rpc/rpc-lib')
-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;