Project

General

Profile

« Previous | Next » 

Revision 6cd14b43

Added by Chris Buechler about 10 years ago

Add more validation for wireless config settings. Ticket #4516

View differences:

usr/local/www/interfaces.php
810 810
				$input_errors[] = gettext("Secondary 802.1X Authentication Server Port must be a valid port number (1-65535).");
811 811
			}
812 812
		}
813
		if (isset($_POST['channel']) && !is_numericint($_POST['channel'])) {
814
			if (!is_numericint($_POST['channel'])) {
815
				$input_errors[] = gettext("Invalid channel specified.");
816
			} else {
817
				if ($_POST['channel'] > 255 || $_POST['channel'] < 0) {
818
					$input_errors[] = gettext("Channel must be between 0-255.");
819
				}
820
			}
821
		}
822
		if (!empty($_POST['distance']) && !is_numericint($_POST['distance'])) {
823
			$input_errors[] = gettext("Distance must be an integer.");
824
		}
825
		if (isset($_POST['standard']) && (stristr($_POST['standard'], '11na') || stristr($_POST['standard'], '11a'))) {
826
			if ($_POST['channel'] != 0 && $_POST['channel'] < 15) {
827
				$input_errors[] = gettext("Channel selected is not valid for 802.11a or 802.11na.");
828
			}
829
		}
830
		if (isset($_POST['standard']) && ($_POST['standard'] = "11b" || $_POST['standard'] = "11g")) {
831
			if ($_POST['channel'] > 14) {
832
				$input_errors[] = gettext("Channel selected is not valid for 802.11b or 802.11g.");
833
			}
834
		}
813 835
		/* loop through keys and enforce size */
814 836
		for ($i = 1; $i <= 4; $i++) {
815 837
			if ($_POST['key' . $i]) {

Also available in: Unified diff