diff options
| author | Csaba Henk <csaba@gluster.com> | 2010-10-09 15:46:40 +0000 | 
|---|---|---|
| committer | Anand V. Avati <avati@dev.gluster.com> | 2010-10-26 22:55:42 -0700 | 
| commit | 81e718ab513e2cdf1b1e22b268c5798752d79cc1 (patch) | |
| tree | 253af7974cfabae9b97fe7fb0f8d5e6820ba21cd /xlators | |
| parent | b66f4598f4dafb6479232b20c5c521ab0da4e84a (diff) | |
server: parse more precisely when validating auth options
Signed-off-by: Csaba Henk <csaba@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1885 (auth validator in server parses too sloppily)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1885
Diffstat (limited to 'xlators')
| -rw-r--r-- | xlators/protocol/server/src/server.c | 34 | 
1 files changed, 15 insertions, 19 deletions
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index 85abfb54d..6c763e7fb 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -340,36 +340,32 @@ out:  int  validate_auth_options (xlator_t *this, dict_t *dict)  { -        int            ret = -1;          int            error = 0;          xlator_list_t *trav = NULL;          data_pair_t   *pair = NULL; -        char          *saveptr = NULL; -        char          *tmp = NULL; -        char          *key_cpy = NULL; +        char          *tail = NULL;          trav = this->children;          while (trav) {                  error = -1;                  for (pair = dict->members_list; pair; pair = pair->next) { -                        key_cpy = gf_strdup (pair->key); -                        tmp = strtok_r (key_cpy, ".", &saveptr); -                        ret = strcmp (tmp, "auth"); -                        if (ret == 0) { -                                /* for module type */ -                                tmp = strtok_r (NULL, ".", &saveptr); -                                if (!tmp) -                                        break; -                                /* for volume name */ -                                tmp = strtok_r (NULL, ".", &saveptr); -                        } - -                        if (strcmp (tmp, trav->xlator->name) == 0) { +                        tail = strtail (pair->key, "auth."); +                        if (!tail) +                                continue; +                        /* fast fwd thru module type */ +                        tail = strchr (tail, '.'); +                        if (!tail) +                                continue; +                        tail++; + +                        tail = strtail (tail, trav->xlator->name); +                        if (!tail) +                                continue; + +                        if (*tail == '.') {                                  error = 0; -                                GF_FREE (key_cpy);                                  break;                          } -                        GF_FREE (key_cpy);                  }                  if (-1 == error) {                          gf_log (this->name, GF_LOG_ERROR,  | 
