summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volgen.c
diff options
context:
space:
mode:
authorRajesh Amaravathi <rajesh@redhat.com>2012-02-21 13:39:29 +0530
committerVijay Bellur <vijay@gluster.com>2012-02-21 03:19:02 -0800
commit0344a8a12e7675bee24c770d71eff52db6b2d128 (patch)
treef3213af53d3434813c1c3919428d5af802f224f7 /xlators/mgmt/glusterd/src/glusterd-volgen.c
parent6a6abb5367f46bab4a7363db9e181c845a334cdb (diff)
glusterd/auth: 3.2.x compatibility
volumes created with GlusterFS 3.2.x will be compatible with GlusterFS 3.3 w.r.t auth.allow enhancements Change-Id: I615e46d648e1270a7b856cd71fab24cfe791ddb8 BUG: 795634 Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com> Reviewed-on: http://review.gluster.com/2779 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krishnan Parthasarathi <kp@gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c71
1 files changed, 44 insertions, 27 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 9bd1a2d1b14..bc856bebfaf 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -1552,6 +1552,8 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
int ret = 0;
char *xlator = NULL;
char *loglevel = NULL;
+ char *username = NULL;
+ char *password = NULL;
char index_basepath[PATH_MAX] = {0};
char key[1024] = {0};
@@ -1635,6 +1637,10 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
ret = pump = 0;
if (ret)
return -1;
+
+ username = glusterd_auth_get_username (volinfo);
+ password = glusterd_auth_get_password (volinfo);
+
if (pump) {
txl = first_of (graph);
@@ -1647,15 +1653,17 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (NULL == ptranst)
return -1;
- ret = xlator_set_option (rbxl, "username",
- glusterd_auth_get_username (volinfo));
- if (ret)
- return -1;
+ if (username) {
+ ret = xlator_set_option (rbxl, "username", username);
+ if (ret)
+ return -1;
+ }
- ret = xlator_set_option (rbxl, "password",
- glusterd_auth_get_password (volinfo));
- if (ret)
- return -1;
+ if (password) {
+ ret = xlator_set_option (rbxl, "password", password);
+ if (ret)
+ return -1;
+ }
ret = xlator_set_option (rbxl, "transport-type", ptranst);
GF_FREE (ptranst);
@@ -1702,21 +1710,24 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (ret)
return -1;
- memset (key, 0, sizeof (key));
- snprintf (key, sizeof (key), "auth.login.%s.allow", path);
- ret = xlator_set_option (xl, key,
- glusterd_auth_get_username (volinfo));
- if (ret)
- return -1;
+ if (username) {
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "auth.login.%s.allow", path);
- memset (key, 0, sizeof (key));
- snprintf (key, sizeof (key), "auth.login.%s.password",
- glusterd_auth_get_username (volinfo));
+ ret = xlator_set_option (xl, key, username);
+ if (ret)
+ return -1;
+ }
- ret = xlator_set_option (xl, key,
- glusterd_auth_get_password (volinfo));
- if (ret)
- return -1;
+ if (password) {
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "auth.login.%s.password",
+ username);
+
+ ret = xlator_set_option (xl, key, password);
+ if (ret)
+ return -1;
+ }
ret = volgen_graph_set_options_generic (graph, set_dict,
(xlator && loglevel) ? (void *)set_dict : volinfo,
@@ -2099,14 +2110,20 @@ volgen_graph_build_clients (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
if (!ret && client_type == GF_CLIENT_TRUSTED) {
str = glusterd_auth_get_username (volinfo);
- ret = xlator_set_option (xl, "username", str);
- if (ret)
- goto out;
+ if (str) {
+ ret = xlator_set_option (xl, "username",
+ str);
+ if (ret)
+ goto out;
+ }
str = glusterd_auth_get_password (volinfo);
- ret = xlator_set_option (xl, "password", str);
- if (ret)
- goto out;
+ if (str) {
+ ret = xlator_set_option (xl, "password",
+ str);
+ if (ret)
+ goto out;
+ }
}
i++;