diff options
author | Rinku Kothiya <rkothiya@redhat.com> | 2019-01-01 21:06:05 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2019-01-18 17:13:13 +0000 |
commit | 0687b0beb5cc58d5aac9e203f0feebcd7e9eea03 (patch) | |
tree | 1816ba8a7868956702f4a6f7ecc338c4d66654b7 /cli | |
parent | ebaf09a2a329517936232510e117debc3795e80b (diff) |
core: Feature added to accept CidrIp in auth.allow
Added functionality to gluster volume set auth.allow command to
accept CIDR IP addresses. Modified few functions to isolate cidr
feature so that it prevents other gluster commands such as peer
probe to use cidr format ip. The functions are modified in such
a way that they have an option to enable accepting of cidr
format for other gluster commands if required in furture.
updates: bz#1138841
Change-Id: Ie6734002a7078f1820e5df42d404411cce945e8b
Credits: Mohit Agrawal
Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/cli-cmd-parser.c | 6 | ||||
-rw-r--r-- | cli/src/cli-cmd-peer.c | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index b29b3e9bd29..d9913f678a0 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -144,7 +144,7 @@ cli_cmd_bricks_parse(const char **words, int wordcount, int brick_index, GF_FREE(tmp_host); goto out; } - if (!valid_internet_address(host_name, _gf_false)) { + if (!valid_internet_address(host_name, _gf_false, _gf_false)) { cli_err( "internet address '%s' does not conform to " "standards", @@ -3615,7 +3615,7 @@ cli_cmd_volume_statedump_options_parse(const char **words, int wordcount, } ip_addr = strtok(tmp, ":"); pid = strtok(NULL, ":"); - if (valid_internet_address(ip_addr, _gf_true) && pid && + if (valid_internet_address(ip_addr, _gf_true, _gf_false) && pid && gf_valid_pid(pid, strlen(pid))) { ret = gf_asprintf(&option_str, "%s %s %s", words[3], ip_addr, pid); if (ret < 0) { @@ -3809,7 +3809,7 @@ extract_hostname_path_from_token(const char *tmp_words, char **hostname, ret = -1; goto out; } - if (!valid_internet_address(host_name, _gf_false)) { + if (!valid_internet_address(host_name, _gf_false, _gf_false)) { cli_err( "internet address '%s' does not conform to " "standards", diff --git a/cli/src/cli-cmd-peer.c b/cli/src/cli-cmd-peer.c index 6c7a7ea2794..e42a1139b87 100644 --- a/cli/src/cli-cmd-peer.c +++ b/cli/src/cli-cmd-peer.c @@ -60,7 +60,7 @@ cli_cmd_peer_probe_cbk(struct cli_state *state, struct cli_cmd_word *word, if (ret) goto out; - ret = valid_internet_address((char *)words[2], _gf_false); + ret = valid_internet_address((char *)words[2], _gf_false, _gf_false); if (ret == 1) { ret = 0; } else { |