diff options
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-geo-rep.c | 13 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-geo-rep.h | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c index 0de477be206..8d11d95d915 100644 --- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c +++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c @@ -585,7 +585,7 @@ struct dictidxmark { struct slave_vol_config { char old_slvhost[_POSIX_HOST_NAME_MAX+1]; - char old_slvuser[_POSIX_LOGIN_NAME_MAX]; + char old_slvuser[LOGIN_NAME_MAX]; unsigned old_slvidx; char slave_voluuid[GF_UUID_BUF_SIZE]; }; @@ -2919,6 +2919,14 @@ get_slavehost_from_voluuid (dict_t *dict, char *key, data_t *value, void *data) /* To go past username in non-root geo-rep session */ tmp = strchr (slave_host, '@'); if (tmp) { + if ((tmp - slave_host) >= LOGIN_NAME_MAX) { + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_SLAVE_VOL_PARSE_FAIL, + "Invalid slave user length in %s", + slave_host); + ret = -2; + goto out; + } strncpy (slave_vol->old_slvuser, slave_host, (tmp - slave_host)); slave_vol->old_slvuser[(tmp - slave_host) + 1] @@ -3337,7 +3345,8 @@ glusterd_op_stage_gsync_create (dict_t *dict, char **op_errstr) } } else if (ret == -2) { snprintf (errmsg, sizeof (errmsg), "get_slavehost_from_voluuid" - " failed %s %s!!", slave_host, slave_vol); + " failed for %s::%s. Please check the glusterd logs.", + slave_host, slave_vol); gf_msg (this->name, GF_LOG_INFO, 0, GD_MSG_FORCE_CREATE_SESSION, "get_slavehost_from_voluuid failed %s %s!!", slave_host, slave_vol); diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.h b/xlators/mgmt/glusterd/src/glusterd-geo-rep.h index 0524ec48fca..045bc2e4ba7 100644 --- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.h +++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.h @@ -20,7 +20,7 @@ /* slave info format: * <master host uuid>:ssh://{<slave_user>@}<slave host>::<slave volume> \ * :<slave volume uuid> */ -#define VOLINFO_SLAVE_URL_MAX (_POSIX_LOGIN_NAME_MAX + (2*GF_UUID_BUF_SIZE) \ +#define VOLINFO_SLAVE_URL_MAX (LOGIN_NAME_MAX + (2*GF_UUID_BUF_SIZE) \ + SLAVE_URL_INFO_MAX + 10) typedef struct glusterd_gsync_status_temp { |