Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Commit df240c0

Browse files
committed
Make the IPv4 validation regex more permissive as per Marco Wessel's suggestion (closes #5)
Make some cosmetic fixes just because I'm here.
1 parent 89f259b commit df240c0

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

etc/init.d/rcS

+6-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Maintainer: Daniil Baturin <daniil at baturin dot org>
66
#
7-
# Copyright (C) 2013 SO3Group
7+
# Copyright (C) 2013, 2017 Daniil Baturin and contributors
88
#
99
# This program is free software; you can redistribute it and/or modify
1010
# it under the terms of the GNU General Public License version 2 as
@@ -25,7 +25,7 @@
2525
# Value is chosen rather arbitrary
2626
sleep 10
2727
echo
28-
echo "Loading EMRK 0.9a"
28+
echo "Loading EMRK 0.9d"
2929

3030
echo "Mounting filesystems"
3131
mount -a
@@ -167,8 +167,6 @@ echo
167167
echo "This tool is distributed under the terms of"
168168
echo "GNU General Public License and other licenses"
169169
echo
170-
echo "Brought to you by SO3 Group"
171-
echo
172170
echo "WARNING: This tool is not developed, officially"
173171
echo "supported or endorsed by Ubiquiti Networks!"
174172
echo
@@ -209,7 +207,7 @@ if [ $? == 0 ]; then
209207
DHCP_OK=1
210208
NET_OK=1
211209
else
212-
echo "DHCP configuration attemp failes!"
210+
echo "DHCP configuration attemp failed!"
213211
fi
214212
fi
215213

@@ -247,8 +245,9 @@ if [ $DHCP_OK != 1 ]; then
247245
# Set DNS server
248246
while true; do
249247
read -p "Enter DNS server address: " DNS
250-
# XXX: this regex sucks
251-
echo $DNS | grep -E "[1-2][0-9]{,2}\.(0|[0-9]{1,3})\.(0|[0-9]{1,3})\.([0-9]{1,3})" > /dev/null
248+
# XXX: overly permissive regex to protect just against
249+
# obvious typos
250+
echo $DNS | grep -E "[0-9.]+" > /dev/null
252251
if [ $? == 0 ]; then
253252
echo "nameserver $DNS" > /etc/resolv.conf
254253
break

0 commit comments

Comments
 (0)