Project

General

Profile

Bug #16773 » 16773.patch

Jim Pingle, 04/07/2026 06:26 PM

View differences:

src/etc/inc/captiveportal.inc
1806 1806
               $listenporthttp = $cpcfg['listenporthttp'] ? $cpcfg['listenporthttp'] : ($cpcfg['zoneid'] + 8000);
1807 1807
               $ifip = portal_ip_from_client_ip($cliip);
1808 1808
               if (!$ifip) {
1809
                       $ourhostname = config_get_path('system/hostname') . config_get_path('system/domain');
1809
                       $ourhostname = config_get_path('system/hostname') . '.' . config_get_path('system/domain');
1810 1810
               } else {
1811 1811
                       $ourhostname = (is_ipaddrv6($ifip)) ? "[{$ifip}]" : "{$ifip}";
1812 1812
               }
src/usr/local/captiveportal/index.php
230 230
	}
231 231

  
232 232
} elseif ($_POST['accept'] || $cpcfg['auth_method'] === 'radmac') {
233
	
234
		if ($cpcfg['auth_method'] === 'radmac' && !isset($_POST['accept'])) {
235
			$user = $clientmac; 
236
			$passwd = $cpcfg['radmac_secret'];
237
			$context = 'radmac'; // Radius MAC authentication
238
		} elseif (!empty(trim($_POST['auth_user2']))) { 
239
			$user = trim($_POST['auth_user2']);
240
			$passwd = $_POST['auth_pass2'];
241
			$context = 'second'; // Assume users to use the first context if auth_user2 is empty/does not exist
242
		} else {
243
			$user = trim($_POST['auth_user']);
244
			$passwd = $_POST['auth_pass'];
245
			$context = 'first';
246
		}
247
	
233

  
234
	if ($cpcfg['auth_method'] == 'none') {
235
		$user = '';
236
		$passwd = '';
237
		$context = 'none';
238
	} elseif ($cpcfg['auth_method'] === 'radmac' && !isset($_POST['accept'])) {
239
		$user = $clientmac;
240
		$passwd = $cpcfg['radmac_secret'];
241
		$context = 'radmac'; // Radius MAC authentication
242
	} elseif (!empty(trim($_POST['auth_user2']))) {
243
		$user = trim($_POST['auth_user2']);
244
		$passwd = $_POST['auth_pass2'];
245
		$context = 'second'; // Assume users to use the first context if auth_user2 is empty/does not exist
246
	} else {
247
		$user = trim($_POST['auth_user']);
248
		$passwd = $_POST['auth_pass'];
249
		$context = 'first';
250
	}
251

  
248 252
	$pipeno = captiveportal_get_next_dn_ruleno('auth', 2000, 64500, true);
249 253
	/* if the pool is empty, return appropriate message and exit */
250 254
	if (is_null($pipeno)) {
src/usr/local/www/status_captiveportal.php
289 289
		endif;
290 290
?>
291 291
					<td>
292
						<a href="?zone=<?=htmlspecialchars($cpzone)?>&amp;showact=<?=htmlspecialchars($_REQUEST['showact'])?>&amp;act=del&amp;id=<?=htmlspecialchars($cpent[5])?>" usepost><i class="fa-solid fa-trash-can" title="<?=gettext("Disconnect this User")?>"></i></a>
292
						<a href="?zone=<?=urlencode($cpzone)?>&amp;showact=<?=urlencode($_REQUEST['showact'])?>&amp;act=del&amp;id=<?=urlencode($cpent[5])?>" usepost><i class="fa-solid fa-trash-can" title="<?=gettext("Disconnect this User")?>"></i></a>
293 293
					</td>
294 294
				</tr>
295 295
<?php
src/usr/local/www/widgets/widgets/captive_portal_status.widget.php
32 32
require_once("functions.inc");
33 33
require_once("captiveportal.inc");
34 34

  
35
$cpzone = $_GET['zone'];
36
if (isset($_POST['zone'])) {
37
	$cpzone = $_POST['zone'];
38
}
39
$cpzone = strtolower($cpzone);
40

  
41
if (isset($cpzone) && !empty($cpzone)) {
42
	$cpzoneid = config_get_path("captiveportal/{$cpzone}/zoneid");
43
}
44

  
45
if (($_GET['act'] == "del") && !empty($cpzone) && isset($cpzoneid)) {
46
	captiveportal_disconnect_client($_GET['id'], 6);
47
}
48
unset($cpzone);
49

  
50 35
flush();
51 36

  
52 37
if (!function_exists('clientcmp')) {
......
83 68
		<tbody>
84 69
	<?php foreach ($cpdb_all as $cpent): ?>
85 70
		<tr>
86
			<td><?=$cpent[2];?></td>
87
			<td><?=$cpent[3];?></td>
88
			<td><?=$cpent[4];?></td>
89
			<td><?=date("m/d/Y H:i:s", $cpent[0]);?></td>
71
			<td><?=htmlspecialchars($cpent[2]);?></td>
72
			<td><?=htmlspecialchars($cpent[3]);?></td>
73
			<td><?=htmlspecialchars($cpent[4]);?></td>
74
			<td><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent[0]));?></td>
90 75
			<td>
91 76
<?php
92 77
			if ($cpent[11] && ($cpent[11] > 0)):
93
				echo date("m/d/Y H:i:s", $cpent[11]);
78
				echo htmlspecialchars(date("m/d/Y H:i:s", $cpent[11]));
94 79
			else:
95 80
				echo "&nbsp;";
96 81
			endif;
97 82
?>
98 83
			</td>
99 84
			<td>
100
				<a href="?order=<?=htmlspecialchars($_GET['order']);?>&amp;showact=<?=$showact;?>&amp;act=del&amp;zone=<?=$cpent[10];?>&amp;id=<?=$cpent[5];?>">
85
				<a href="status_captiveportal.php?order=<?=urlencode($_GET['order']);?>&amp;showact=<?=urlencode($showact);?>&amp;act=del&amp;zone=<?=urlencode($cpent[10]);?>&amp;id=<?=urlencode($cpent[5]);?>" usepost>
101 86
					<i class="fa-solid fa-trash-can" title="<?=gettext("delete");?>"></i>
102 87
				</a>
103 88
			</td>
(2-2/2)