diff options
author | Nirbhay Choubey <nirbhay@skysql.com> | 2014-07-09 11:07:23 -0400 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@skysql.com> | 2014-07-09 11:07:23 -0400 |
commit | dc377fcbc0a3da99e02aa55000ab491d01c63fc4 (patch) | |
tree | 1ad5669b0e1ad17a6bd28fb8895cd33533a37668 /sql/wsrep_sst.cc | |
parent | 3d1ac121771d61f9d1c944a1caa4e449527725fc (diff) | |
download | mariadb-git-dc377fcbc0a3da99e02aa55000ab491d01c63fc4.tar.gz |
Merge of patch for MDEV-6411 from maria-5.5-galera.
Diffstat (limited to 'sql/wsrep_sst.cc')
-rw-r--r-- | sql/wsrep_sst.cc | 51 |
1 files changed, 32 insertions, 19 deletions
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 9b81e0fe22d..acc1a6e1e26 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -123,31 +123,44 @@ bool wsrep_sst_auth_check (sys_var *self, THD* thd, set_var* var) { return 0; } + static bool sst_auth_real_set (const char* value) { - const char* v = strdup (value); + const char* v= NULL; - if (v) - { - if (sst_auth_real) free (const_cast<char*>(sst_auth_real)); - sst_auth_real = v; + if (value) + { + v= my_strdup(value, MYF(0)); + } + else // its NULL + { + wsrep_sst_auth_free(); + return 0; + } - if (strlen(sst_auth_real)) - { - if (wsrep_sst_auth) - { - my_free ((void*)wsrep_sst_auth); - wsrep_sst_auth = my_strdup(WSREP_SST_AUTH_MASK, MYF(0)); - //strncpy (wsrep_sst_auth, WSREP_SST_AUTH_MASK, - // sizeof(wsrep_sst_auth) - 1); - } - else - wsrep_sst_auth = my_strdup (WSREP_SST_AUTH_MASK, MYF(0)); - } - return 0; + if (v) + { + // set sst_auth_real + if (sst_auth_real) { my_free((void *) sst_auth_real); } + sst_auth_real = v; + + // mask wsrep_sst_auth + if (strlen(sst_auth_real)) + { + if (wsrep_sst_auth) { my_free((void*) wsrep_sst_auth); } + wsrep_sst_auth= my_strdup(WSREP_SST_AUTH_MASK, MYF(0)); } + return 0; + } + return 1; +} - return 1; +void wsrep_sst_auth_free() +{ + if (wsrep_sst_auth) { my_free((void *) wsrep_sst_auth); } + if (sst_auth_real) { my_free((void *) sst_auth_real); } + wsrep_sst_auth= NULL; + sst_auth_real= NULL; } bool wsrep_sst_auth_update (sys_var *self, THD* thd, enum_var_type type) |