summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-lib/src/rpcsvc.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
index 7cb89db..c8595ee 100644
--- a/rpc/rpc-lib/src/rpcsvc.c
+++ b/rpc/rpc-lib/src/rpcsvc.c
@@ -1925,10 +1925,13 @@ rpcsvc_transport_peer_check_search (dict_t *options, char *pattern, char *clstr)
char *addrstr = NULL;
char *dup_addrstr = NULL;
char *svptr = NULL;
+ char *fqdn = NULL;
if ((!options) || (!clstr))
return -1;
+ ret = dict_get_str (options, "client.fqdn", &fqdn);
+
if (!dict_get (options, pattern))
return -1;
@@ -1956,6 +1959,17 @@ rpcsvc_transport_peer_check_search (dict_t *options, char *pattern, char *clstr)
if (ret == 0)
goto err;
+ /* compare hostnames if applicable */
+ if (fqdn) {
+#ifdef FNM_CASEFOLD
+ ret = fnmatch (addrtok, fqdn, FNM_CASEFOLD);
+#else
+ ret = fnmatch (addrtok, fqdn, 0);
+#endif
+ if (ret == 0)
+ goto err;
+ }
+
addrtok = strtok_r (NULL, ",", &svptr);
}
@@ -2174,6 +2188,7 @@ rpcsvc_transport_peer_check_name (dict_t *options, char *volname,
int aret = RPCSVC_AUTH_REJECT;
int rjret = RPCSVC_AUTH_REJECT;
char clstr[RPCSVC_PEER_STRLEN];
+ char *hostname = NULL;
if (!trans)
return ret;
@@ -2186,6 +2201,11 @@ rpcsvc_transport_peer_check_name (dict_t *options, char *volname,
goto err;
}
+ ret = gf_get_hostname_from_ip (clstr, &hostname);
+ if (!ret)
+ ret = dict_set_dynstr (options, "client.fqdn",
+ hostname);
+
aret = rpcsvc_transport_peer_check_allow (options, volname, clstr);
rjret = rpcsvc_transport_peer_check_reject (options, volname, clstr);