From 35998844040cf713f229e896524a1a6be249e31d Mon Sep 17 00:00:00 2001 From: Junaid Date: Tue, 12 Apr 2011 08:19:27 +0000 Subject: features/quota: Validate the quota options. and donot include into the client volfile. Signed-off-by: Junaid Signed-off-by: Anand Avati BUG: 2541 (insufficient option validation in quota translator) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2541 --- xlators/features/quota/src/quota.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'xlators') diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 80d4181e5d0..2b238b2b559 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -2546,6 +2546,34 @@ quota_forget (xlator_t *this, inode_t *inode) return 0; } +int +validate_options (xlator_t *this, char **op_errstr) +{ + int ret = 0; + volume_opt_list_t *vol_opt = NULL; + volume_opt_list_t *tmp; + + if (!this) { + gf_log (this->name, GF_LOG_DEBUG, "'this' not a valid ptr"); + ret =-1; + goto out; + } + + if (list_empty (&this->volume_options)) + goto out; + + vol_opt = list_entry (this->volume_options.next, + volume_opt_list_t, list); + list_for_each_entry_safe (vol_opt, tmp, &this->volume_options, list) { + ret = validate_xlator_volume_options_attacherr (this, + vol_opt->given_opt, + op_errstr); + } + +out: + + return ret; +} int32_t quota_parse_options (quota_priv_t *priv, xlator_t *this, dict_t *options) -- cgit