Project

General

Profile

« Previous | Next » 

Revision b1862963

Added by Jim Pingle over 6 years ago

Restore the RADIUS NAS ID option to Captive Portal. Fixes #8998

Keeps the default of using CaptivePortal-<zonename> when not set,
otherwise uses the value supplied by the user as with older versions.

(cherry picked from commit b1cc8f3143f7253bb3acdcdf8c18f9effaf3bce5)

View differences:

src/etc/inc/captiveportal.inc
1606 1606
		foreach ($auth_servers as $authcfg) {
1607 1607
			if ($authlevel < 3) {
1608 1608
				$radmac_error = false;
1609
				$attributes = array("nas_identifier" => "CaptivePortal-{$cpzone}",
1609
				$attributes = array("nas_identifier" => empty($cpcfg["radiusnasid"]) ? "CaptivePortal-{$cpzone}" : $cpcfg["radiusnasid"],
1610 1610
					"nas_port_type" => RADIUS_ETHERNET,
1611 1611
					"nas_port" => $pipeno,
1612 1612
					"framed_ip" => $clientip);
......
2683 2683
	}
2684 2684
	$nasmac = get_interface_mac(find_ip_interface($nasip));
2685 2685
	$racct->putAttribute(RADIUS_NAS_IP_ADDRESS, $nasip, "addr");
2686
	$racct->putAttribute(RADIUS_NAS_IDENTIFIER, "CaptivePortal-{$cpzone}");
2686

  
2687
	$racct->putAttribute(RADIUS_NAS_IDENTIFIER, empty($cpcfg["radiusnasid"]) ? "CaptivePortal-{$cpzone}" : $cpcfg["radiusnasid"] );
2687 2688

  
2688 2689
	if (is_int($ruleno)) {
2689 2690
		$racct->putAttribute(RADIUS_NAS_PORT_TYPE, RADIUS_ETHERNET);
src/usr/local/www/services_captiveportal.php
180 180
	$pconfig['radmac_format'] = $a_cp[$cpzone]['radmac_format'];
181 181
	$pconfig['reverseacct'] = isset($a_cp[$cpzone]['reverseacct']);
182 182
	$pconfig['includeidletime'] = isset($a_cp[$cpzone]['includeidletime']);
183
	$pconfig['radiusnasid'] = $a_cp[$cpzone]['radiusnasid'];
183 184
	$pconfig['page'] = array();
184 185
	if ($a_cp[$cpzone]['page']['htmltext']) {
185 186
		$pconfig['page']['htmltext'] = $a_cp[$cpzone]['page']['htmltext'];
......
312 313
	if (isset($_POST['radacct_enable']) && !in_array($_POST['reauthenticateacct'], array('none', 'stopstart', 'stopstartfreeradius', 'interimupdate'))) {
313 314
		$input_errors[] = gettext("You need to select an option for Accounting Updates !");
314 315
	}
316
	if (trim($_POST['radiusnasid']) !== "" && !preg_match("/^[\x21-\x7e]{3,253}$/i", trim($_POST['radiusnasid']))) {
317
		$input_errors[] = gettext("The NAS-Identifier must be 3-253 characters long and should only contain ASCII characters.");
318
	}
315 319

  
316 320
	if (!$input_errors) {
317 321
		$newcp =& $a_cp[$cpzone];
......
390 394
		$newcp['radmac_format'] = $_POST['radmac_format'] ? $_POST['radmac_format'] : false;
391 395
		$newcp['reverseacct'] = $_POST['reverseacct'] ? true : false;
392 396
		$newcp['includeidletime'] = $_POST['includeidletime'] ? true : false;
397
		$newcp['radiusnasid'] = trim($_POST['radiusnasid']);
393 398
		if ($_POST['customhtml']) {
394 399
			$newcp['customhtml'] = true;
395 400
		} else {
......
916 921
			"This setting is useful if you want to provide multiple authentication method to your users. If you don't need multiple authentication method, then leave this setting empty.");
917 922
$section->add($group);
918 923

  
924
$section->addInput(new Form_Input(
925
	'radiusnasid',
926
	'NAS Identifier',
927
	'text',
928
	$pconfig['radiusnasid']
929
))->setHelp('Specify a NAS identifier to override the default value (CaptivePortal-%s)', $cpzone);
930

  
919 931
$section->addInput(new Form_Checkbox(
920 932
	'reauthenticate',
921 933
	'Reauthenticate Users',
......
1141 1153
		hideInput('radmac_format', hide);
1142 1154
		hideCheckbox('radiusperuserbw', hide);
1143 1155
		hideCheckbox('radiustraffic_quota', hide);
1156
		hideInput('radiusnasid', hide);
1144 1157
	}
1145 1158

  
1146 1159
	function hideHTTPS() {

Also available in: Unified diff