summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2011-02-18 01:27:31 +0000
committerAnand V. Avati <avati@dev.gluster.com>2011-02-22 02:10:55 -0800
commitea0634bf88dd63294559c2e4542b73b772b7ec56 (patch)
treea0faa879a9fa370b5d48ca696eb4c795bf7cc961 /cli
parent2795f3e03a299daf88e3172b068511d41c493247 (diff)
Validate peer probe command's hostname/ip address.
Note, if an ip octet range exceeds 255, though this fails as a valid ipv4 address, it is still a valid hostname. valid chars are: 'a'-'z', '0' - '9', '-', '.' with a max of 255 chars. Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2194 (gluster peer probe on a ip octet value bigger than 255 has no validation) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2194
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-peer.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/src/cli-cmd-peer.c b/cli/src/cli-cmd-peer.c
index ca89592d613..0c4d54dc155 100644
--- a/cli/src/cli-cmd-peer.c
+++ b/cli/src/cli-cmd-peer.c
@@ -71,6 +71,14 @@ 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]);
+ if (ret == 1) {
+ ret = 0;
+ } else {
+ cli_usage_out (word->pattern);
+ parse_error = 1;
+ goto out;
+ }
/* if (words[3]) {
ret = dict_set_str (dict, "port", (char *)words[3]);
if (ret)