From 211785f29904995324bfd3c7fa4b35a498bf632a Mon Sep 17 00:00:00 2001 From: Santosh Kumar Pradhan Date: Fri, 30 May 2014 12:37:23 +0530 Subject: rpc: Reconfigure() does not work for auth-reject Problem: If volume is set for rpc-auth.addr..reject with value as "host1", ideally the NFS mount from "host1" should FAIL. It works as expected. But when the volume is RESET, then previous value set for auth-reject should go off, and further NFS mount from "host1" should PASS. But it FAILs because of stale value in dict for key "rpc-auth.addr..reject". It does not impact rpc-auth.addr..allow key because, each time NFS volfile gets generated, allow key ll have "*" as default value. But reject key does not have default value. FIX: Delete the OLD value for key irrespective of anything. Add NEW value for the key, if and only if that is SET in the reconfigured new volfile. Signed-off-by: Santosh Kumar Pradhan Change-Id: Ie80bd16cd1f9e32c51f324f2236122f6d118d860 BUG: 1103050 Reviewed-on: http://review.gluster.org/7931 Reviewed-by: Niels de Vos Tested-by: Gluster Build System Reviewed-by: Rajesh Joseph Reviewed-by: Anand Avati --- rpc/rpc-lib/src/rpcsvc.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'rpc/rpc-lib/src/rpcsvc.c') diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c index c443a2e6a10..72cf230b19f 100644 --- a/rpc/rpc-lib/src/rpcsvc.c +++ b/rpc/rpc-lib/src/rpcsvc.c @@ -1988,11 +1988,17 @@ rpcsvc_reconfigure_options (rpcsvc_t *svc, dict_t *options) return (-1); } - /* If found the srchkey, delete old key/val pair - * and set the key with new value. + /* key-string: rpc-auth.addr..allow + * + * IMP: Delete the OLD key/value pair from dict. + * And set the NEW key/value pair IFF the option is SET + * in reconfigured volfile. + * + * NB: If rpc-auth.addr..allow is not SET explicitly, + * build_nfs_graph() sets it as "*" i.e. anonymous. */ + dict_del (svc->options, srchkey); if (!dict_get_str (options, srchkey, &keyval)) { - dict_del (svc->options, srchkey); ret = dict_set_str (svc->options, srchkey, keyval); if (ret < 0) { gf_log (GF_RPCSVC, GF_LOG_ERROR, @@ -2016,11 +2022,16 @@ rpcsvc_reconfigure_options (rpcsvc_t *svc, dict_t *options) return (-1); } - /* If found the srchkey, delete old key/val pair - * and set the key with new value. + /* key-string: rpc-auth.addr..reject + * + * IMP: Delete the OLD key/value pair from dict. + * And set the NEW key/value pair IFF the option is SET + * in reconfigured volfile. + * + * NB: No default value for reject key. */ + dict_del (svc->options, srchkey); if (!dict_get_str (options, srchkey, &keyval)) { - dict_del (svc->options, srchkey); ret = dict_set_str (svc->options, srchkey, keyval); if (ret < 0) { gf_log (GF_RPCSVC, GF_LOG_ERROR, -- cgit