Skip to content

Commit 2ecf480

Browse files
authored
Merge pull request ossec#2200 from atomicturtle/issue747
Issue747
2 parents 7193a6b + bd3b128 commit 2ecf480

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,8 @@ ConfigureClient()
379379
while [ 1 ]; do
380380
$ECHO " 3.1- ${serveraddr}: "
381381
read ADDRANSWER
382-
# Is it an IP?
383-
echo $ADDRANSWER | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" > /dev/null 2>&1
382+
# Is it an IP (v4 or v6)?
383+
echo $ADDRANSWER | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$|^[0-9a-fA-F:]+:[0-9a-fA-F:]+$" > /dev/null 2>&1
384384
if [ $? = 0 ]; then
385385
echo ""
386386
IP=$ADDRANSWER
@@ -859,7 +859,7 @@ AddWhite()
859859
for ip in ${IPS};
860860
do
861861
if [ ! "X${ip}" = "X" ]; then
862-
echo $ip | grep -Ei "^[0-9a-f.:/]{5,20}$" > /dev/null 2>&1
862+
echo $ip | grep -Ei "^[0-9a-f.:/]{2,48}$" > /dev/null 2>&1
863863
if [ $? = 0 ]; then
864864
echo " <allow_list>${ip}</allow_list>" >>$NEWCONFIG
865865
fi

src/config/global-config.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,7 @@ int Read_Global(XML_NODE node, void *configp, void *mailp)
374374
/* Windows do not need it */
375375
#ifndef WIN32
376376

377-
const char *ip_address_regex =
378-
"^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}/?"
379-
"([0-9]{0,2}|[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})$";
380-
381-
if (Config && OS_PRegex(node[i]->content, ip_address_regex)) {
377+
if (Config && OS_IsValidIP(node[i]->content, NULL)) {
382378
allow_size++;
383379
Config->allow_list = (os_ip **)
384380
realloc(Config->allow_list, sizeof(os_ip *)*allow_size);

0 commit comments

Comments
 (0)