summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaushal M <kaushal@redhat.com>2012-04-11 13:40:28 +0530
committerVijay Bellur <vijay@gluster.com>2012-04-13 01:02:07 -0700
commit5c67b2c99de39c988be7c5fffd504fdbaae74a01 (patch)
tree9493dec7eb63a75e6ab06cb536223212ebe77ddf
parent362c5283ace6f048d0404a8a390faeb014ebe351 (diff)
glusterd: IPv4 auth improvment
Check if last character of an IPv4 address is valid to prevent successful validation of addresses with '.' as last character. Change-Id: I0af6c288e12a47986ce3f8b02c317b99767e69e6 BUG: 811458 Signed-off-by: Kaushal M <kaushal@redhat.com> Reviewed-on: http://review.gluster.com/3124 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
-rw-r--r--libglusterfs/src/common-utils.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index c5080246a2f..c190049122c 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -1660,6 +1660,13 @@ valid_ipv4_address (char *address, int length, gf_boolean_t wildcard_acc)
int is_wildcard = 0;
tmp = gf_strdup (address);
+
+ /* To prevent cases where last character is '.' */
+ if (!isdigit (tmp[length - 1]) && (tmp[length - 1] != '*')) {
+ ret = 0;
+ goto out;
+ }
+
prev = tmp;
prev = strtok_r (tmp, ".", &ptr);