From 0d9a38bb576beac24d0694633a79cff7e8c11a9f Mon Sep 17 00:00:00 2001 From: Varun Shastry Date: Mon, 29 Oct 2012 16:21:24 +0530 Subject: features/quota: Failure of quota commands if the dir-name contains ':' in it PROBLEM: The first colon in the limit string is used to separate the path and the limit-value. The ':' in the path was the source of problem. FIX: Search for the last colon and separate based on the same. Added regression test. TEST: Create and set quota on directories with names containing ':' in start, middle and end. Change-Id: I363c8ad4cbfd02c23fc73974bef9aa8bc362d29c BUG: 848251 Signed-off-by: Varun Shastry Reviewed-on: http://review.gluster.org/4137 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/features/quota/src/quota.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'xlators/features/quota') diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index b60e37d9c..928fd3837 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -3025,14 +3025,17 @@ quota_parse_limits (quota_priv_t *priv, xlator_t *this, dict_t *xl_options, char *path = NULL, *saveptr = NULL; uint64_t value = 0; limits_t *quota_lim = NULL, *old = NULL; + char *last_colon= NULL; ret = dict_get_str (xl_options, "limit-set", &str); if (str) { - path = strtok_r (str, ":", &saveptr); + path = strtok_r (str, ",", &saveptr); while (path) { - str_val = strtok_r (NULL, ",", &saveptr); + last_colon = strrchr (path, ':'); + *last_colon = '\0'; + str_val = last_colon + 1; ret = gf_string2bytesize (str_val, &value); if (ret != 0) @@ -3066,7 +3069,7 @@ quota_parse_limits (quota_priv_t *priv, xlator_t *this, dict_t *xl_options, } UNLOCK (&priv->lock); - path = strtok_r (NULL, ":", &saveptr); + path = strtok_r (NULL, ",", &saveptr); } } else { gf_log (this->name, GF_LOG_INFO, -- cgit