Project

General

Profile

Download (18 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	guiconfig.inc
5
	by Scott Ullrich, Copyright 2004, All rights reserved.
6
	originally based on of m0n0wall (http://m0n0.ch/wall)
7

    
8
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
9
	All rights reserved.
10

    
11
	Redistribution and use in source and binary forms, with or without
12
	modification, are permitted provided that the following conditions are met:
13

    
14
	1. Redistributions of source code must retain the above copyright notice,
15
	   this list of conditions and the following disclaimer.
16

    
17
	2. Redistributions in binary form must reproduce the above copyright
18
	   notice, this list of conditions and the following disclaimer in the
19
	   documentation and/or other materials provided with the distribution.
20

    
21
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
25
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
	POSSIBILITY OF SUCH DAMAGE.
31
*/
32

    
33
/* make sure nothing is cached */
34
if (!$omit_nocacheheaders) {
35
	header("Expires: 0");
36
	header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
37
	header("Cache-Control: no-store, no-cache, must-revalidate");
38
	header("Cache-Control: post-check=0, pre-check=0", false);
39
	header("Pragma: no-cache");
40
}
41

    
42
/* Include authentication routines */
43
/* THIS MUST BE ABOVE ALL OTHER CODE */
44
require_once("auth.inc");
45

    
46
/* parse the configuration and include all configuration functions */
47
require_once("config.inc");
48
require_once("functions.inc");
49

    
50
/*
51
 *   if user has selected a custom template, use it.
52
 *   otherwise default to pfsense tempalte
53
 */
54
if($config['theme'] <> "")
55
        $g['theme'] = $config['theme'];
56
else
57
        $g['theme'] = "pfsense";
58

    
59
$d_pppoeuserdirty_path = $g['varrun_path'] . "/vpn-pppoe-users-edit.dirty";
60
$d_hostsdirty_path = $g['varrun_path'] . "/hosts.dirty";
61
$d_natconfdirty_path = $g['varrun_path'] . "/nat.conf.dirty";
62
$d_filterconfdirty_path = $g['varrun_path'] . "/filter.conf.dirty";
63
$d_ipsecconfdirty_path = $g['varrun_path'] . "/ipsec.conf.dirty";
64
$d_shaperconfdirty_path = $g['varrun_path'] . "/shaper.conf.dirty";
65
$d_pptpuserdirty_path = $g['varrun_path'] . "/pptpd.user.dirty";
66
$d_dnsmasqdirty_path = $g['varrun_path'] . "/dnsmasq.dirty";
67
$d_staticmapsdirty_path = $g['varrun_path'] . "/staticmaps.dirty";
68
$d_staticroutesdirty_path = $g['varrun_path'] . "/staticroutes.dirty";
69
$d_aliasesdirty_path = $g['varrun_path'] . "/aliases.dirty";
70
$d_proxyarpdirty_path = $g['varrun_path'] . "/proxyarp.dirty";
71
$d_fwupenabled_path = $g['varrun_path'] . "/fwup.enabled";
72
$d_firmwarelock_path = $g['varrun_path'] . "/firmware.lock";
73
$d_sysrebootreqd_path = $g['varrun_path'] . "/sysreboot.reqd";
74
$d_passthrumacsdirty_path = $g['varrun_path'] . "/passthrumacs.dirty";
75
$d_allowedipsdirty_path = $g['varrun_path'] . "/allowedips.dirty";
76
$d_ovpnclidirty_path = $g['varrun_path'] . "/ovpnclient.dirty";
77
$d_vipconfdirty_path = $g['varrun_path'] . "/vip.conf.dirty";
78
$d_poolconfdirty_path = $g['varrun_path'] . "/pool.conf.dirty";
79
$d_vsconfdirty_path = $g['varrun_path'] . "/vs.conf.dirty";
80
/* used by progress bar */
81
$lastseen = "-1";
82

    
83
if (file_exists($d_firmwarelock_path)) {
84
	if (!$d_isfwfile) {
85
		header("Location: system_firmware.php");
86
		exit;
87
	} else {
88
		return;
89
	}
90
}
91

    
92
/* some well knows ports */
93
$wkports = array(3389 => "MS RDP", 21 => "FTP", 22 => "SSH", 23 => "Telnet", 25 => "SMTP",
94
		53 => "DNS", 80 => "HTTP", 110 => "POP3", 143 => "IMAP", 443 => "HTTPS");
95

    
96
$specialnets = array("lan" => "LAN net", "pptp" => "PPTP clients");
97

    
98
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
99
	$specialnets['opt' . $i] = $config['interfaces']['opt' . $i]['descr'] . " net";
100
}
101

    
102
$medias = array("auto" => "autoselect", "100full" => "100BASE-TX full-duplex",
103
	"100half" => "100BASE-TX half-duplex", "10full" => "10BASE-T full-duplex",
104
	"10half" => "10BASE-T half-duplex");
105

    
106
/* platforms that support firmware updating */
107
$fwupplatforms = array('pfSense', 'net45xx', 'net48xx', 'generic-pc', 'wrap');
108

    
109
/* IPsec defines */
110
$my_identifier_list = array('myaddress' => 'My IP address',
111
				'address' => 'IP address',
112
				'fqdn' => 'Domain name',
113
				'user_fqdn' => 'User FQDN',
114
				'dyn_dns' => 'Dynamic DNS');
115

    
116
$p1_ealgos = array('des' => 'DES', '3des' => '3DES', 'blowfish' => 'Blowfish',
117
                                        'cast128' => 'CAST128');
118
$p2_ealgos = array('des' => 'DES', '3des' => '3DES', 'blowfish' => 'Blowfish',
119
                                        'cast128' => 'CAST128', 'rijndael' => 'Rijndael (AES)');
120
$p1_halgos = array('sha1' => 'SHA1', 'md5' => 'MD5');
121
$p1_authentication_methods = array('pre_shared_key' => 'Pre-shared key', 'rsasig' => 'RSA signature');
122
$p2_halgos = array('hmac_sha1' => 'SHA1', 'hmac_md5' => 'MD5');
123
$p2_protos = array('esp' => 'ESP', 'ah' => 'AH');
124
$p2_pfskeygroups = array('0' => 'off', '1' => '1', '2' => '2', '5' => '5');
125

    
126
function do_input_validation($postdata, $reqdfields, $reqdfieldsn, $input_errors) {
127

    
128
	/* check for bad control characters */
129
	foreach ($postdata as $pn => $pd) {
130
		if (is_string($pd) && preg_match("/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f]/", $pd)) {
131
			$input_errors[] = "The field '" . $pn . "' contains invalid characters.";
132
		}
133
	}
134

    
135
	for ($i = 0; $i < count($reqdfields); $i++) {
136
		if (!$_POST[$reqdfields[$i]]) {
137
			$input_errors[] = "The field '" . $reqdfieldsn[$i] . "' is required.";
138
		}
139
	}
140
}
141

    
142
function print_input_errors($input_errors) {
143
	global $g;
144
	echo "<p><table border=\"0\" cellspacing=\"0\" cellpadding=\"4\" width=\"100%\">\n";
145
	echo "<tr><td bgcolor=\"#990000\" width=\"36\" align=\"center\" valign=\"top\"><img src=\"./themes/".$g['theme']."/images/icons/icon_error.gif\" width=\"28\" height=\"32\"></td>\n";
146
	echo "<td bgcolor=\"#FFD9D1\" style=\"padding-left: 8px; padding-top: 6px\">";
147

    
148
	echo "<span class=\"errmsg\"><p>The following input errors were detected:<ul>\n";
149
	foreach ($input_errors as $ierr) {
150
		echo "<li>" . htmlspecialchars($ierr) . "</li>\n";
151
	}
152
	echo "</ul></span>";
153

    
154
	echo "</td></tr></table></p>";
155
}
156

    
157
function exec_rc_script($scriptname) {
158

    
159
	global $d_sysrebootreqd_path;
160

    
161
	if (file_exists($d_sysrebootreqd_path))
162
		return 0;
163

    
164
	exec($scriptname . " >/dev/null 2>&1", $execoutput, $retval);
165
	return $retval;
166
}
167

    
168
function exec_rc_script_async($scriptname) {
169

    
170
	global $d_sysrebootreqd_path;
171

    
172
	if (file_exists($d_sysrebootreqd_path))
173
		return 0;
174

    
175
	exec("nohup " . $scriptname . " >/dev/null 2>&1 &", $execoutput, $retval);
176
	return $retval;
177
}
178

    
179
function verify_gzip_file($fname) {
180

    
181
    $returnvar = mwexec("/usr/bin/gzip -t " . escapeshellarg($fname));
182
	if ($returnvar != 0)
183
		return 0;
184
	else
185
		return 1;
186
}
187

    
188
function print_info_box_np($msg) {
189
	global $g;
190
	echo "<table height=\"32\" width=\"100%\">\n";
191
	echo "  <tr>\n";
192
	echo "   <td>\n";
193
	echo "      <div style='background-color:#990000' id='redbox'>\n";
194
	echo "       <table width='100%'><tr><td width='8%'>\n";
195
	echo "        &nbsp;&nbsp;&nbsp;<img style='vertical-align:middle' src=\"./themes/".$g['theme']."/images/icons/icon_exclam.gif\" width=\"28\" height=\"32\">\n";
196
	echo "        </td>\n";
197
	echo "        <td width='70%'><font color='white'><b>{$msg}</b></font>\n";
198
	echo "        </td>";
199
	if(stristr($msg, "apply") == true) {
200
		echo "         <td>";
201
		echo "           <input name=\"apply\" type=\"submit\" class=\"formbtn\" id=\"apply\" value=\"Apply changes\">\n";
202
		echo "         </td>";
203
	}
204
	echo "        </tr></table>\n";
205
	echo "       </div>\n";
206
	echo "    </td>\n";
207
	echo "</table>\n";
208
	echo "<script type=\"text/javascript\">\n";
209
	echo "NiftyCheck();\n";
210
	echo "Rounded(\"div#redbox\",\"all\",\"#FFF\",\"#990000\",\"smooth\");\n";
211
	echo "Rounded(\"td#blackbox\",\"all\",\"#FFF\",\"#000000\",\"smooth\");\n";
212
	echo "</script>\n";
213
	echo "\n<br>\n";
214
}
215

    
216
function print_info_box($msg) {
217
	echo "<p>";
218
	print_info_box_np($msg);
219
	echo "</p>";
220
}
221

    
222
function format_bytes($bytes) {
223
	if ($bytes >= 1073741824) {
224
		return sprintf("%.2f GB", $bytes/1073741824);
225
	} else if ($bytes >= 1048576) {
226
		return sprintf("%.2f MB", $bytes/1048576);
227
	} else if ($bytes >= 1024) {
228
		return sprintf("%.0f KB", $bytes/1024);
229
	} else {
230
		return sprintf("%d bytes", $bytes);
231
	}
232
}
233

    
234
function get_std_save_message($ok) {
235
	global $d_sysrebootreqd_path;
236

    
237
	return "The changes have been applied successfully.";
238
}
239

    
240
function pprint_address($adr) {
241
	global $specialnets;
242

    
243
	if (isset($adr['any'])) {
244
		$padr = "*";
245
	} else if ($adr['network']) {
246
		$padr = $specialnets[$adr['network']];
247
	} else {
248
		$padr = $adr['address'];
249
	}
250

    
251
	if (isset($adr['not']))
252
		$padr = "! " . $padr;
253

    
254
	return $padr;
255
}
256

    
257
function pprint_port($port) {
258
	global $wkports;
259

    
260
	$pport = "";
261

    
262
	if (!$port)
263
		echo "*";
264
	else {
265
		$srcport = explode("-", $port);
266
		if ((!$srcport[1]) || ($srcport[0] == $srcport[1])) {
267
			$pport = $srcport[0];
268
			if ($wkports[$srcport[0]]) {
269
				$pport .= " (" . $wkports[$srcport[0]] . ")";
270
			}
271
		} else
272
			$pport .= $srcport[0] . " - " . $srcport[1];
273
	}
274

    
275
	return $pport;
276
}
277

    
278
/* sort by interface only, retain the original order of rules that apply to
279
   the same interface */
280
function filter_rules_sort() {
281
	global $config;
282

    
283
	/* mark each rule with the sequence number (to retain the order while sorting) */
284
	for ($i = 0; isset($config['filter']['rule'][$i]); $i++)
285
		$config['filter']['rule'][$i]['seq'] = $i;
286

    
287
	function filtercmp($a, $b) {
288
		if ($a['interface'] == $b['interface'])
289
			return $a['seq'] - $b['seq'];
290
		else
291
			return -strcmp($a['interface'], $b['interface']);
292
	}
293

    
294
	usort($config['filter']['rule'], "filtercmp");
295

    
296
	/* strip the sequence numbers again */
297
	for ($i = 0; isset($config['filter']['rule'][$i]); $i++)
298
		unset($config['filter']['rule'][$i]['seq']);
299
}
300

    
301
function nat_rules_sort() {
302
	global $config;
303

    
304
	function natcmp($a, $b) {
305
		if ($a['external-address'] == $b['external-address']) {
306
			if ($a['protocol'] == $b['protocol']) {
307
				if ($a['external-port'] == $b['external-port']) {
308
					return 0;
309
				} else {
310
					return ($a['external-port'] - $b['external-port']);
311
				}
312
			} else {
313
				return strcmp($a['protocol'], $b['protocol']);
314
			}
315
		} else if (!$a['external-address'])
316
			return 1;
317
		else if (!$b['external-address'])
318
			return -1;
319
		else
320
			return ipcmp($a['external-address'], $b['external-address']);
321
	}
322

    
323
	usort($config['nat']['rule'], "natcmp");
324
}
325

    
326
function nat_1to1_rules_sort() {
327
	global $g, $config;
328

    
329
	function nat1to1cmp($a, $b) {
330
		return ipcmp($a['external'], $b['external']);
331
	}
332

    
333
	usort($config['nat']['onetoone'], "nat1to1cmp");
334
}
335

    
336
function nat_server_rules_sort() {
337
	global $g, $config;
338

    
339
	function natservercmp($a, $b) {
340
		return ipcmp($a['ipaddr'], $b['ipaddr']);
341
	}
342

    
343
	usort($config['nat']['servernat'], "natservercmp");
344
}
345

    
346
function nat_out_rules_sort() {
347
	global $g, $config;
348

    
349
	function natoutcmp($a, $b) {
350
		return strcmp($a['source']['network'], $b['source']['network']);
351
	}
352

    
353
	usort($config['nat']['advancedoutbound']['rule'], "natoutcmp");
354
}
355

    
356
function pptpd_users_sort() {
357
	global $g, $config;
358

    
359
	function usercmp($a, $b) {
360
		return strcasecmp($a['name'], $b['name']);
361
	}
362

    
363
	usort($config['pptpd']['user'], "usercmp");
364
}
365

    
366
function pppoe_users_sort() {
367
	global $g, $config;
368

    
369
	function usercmp($a, $b) {
370
		return strcasecmp($a['name'], $b['name']);
371
	}
372

    
373
	usort($config['pppoe']['user'], "usercmp");
374
}
375

    
376
function staticroutes_sort() {
377
	global $g, $config;
378

    
379
	function staticroutecmp($a, $b) {
380
		return strcmp($a['network'], $b['network']);
381
	}
382

    
383
	usort($config['staticroutes']['route'], "staticroutecmp");
384
}
385

    
386
function hosts_sort() {
387
	global $g, $config;
388

    
389
	function hostcmp($a, $b) {
390
		return strcasecmp($a['host'], $b['host']);
391
	}
392

    
393
	usort($config['dnsmasq']['hosts'], "hostcmp");
394
}
395

    
396
function staticmaps_sort($if) {
397
	global $g, $config;
398

    
399
	function staticmapcmp($a, $b) {
400
		return ipcmp($a['ipaddr'], $b['ipaddr']);
401
	}
402

    
403
	usort($config['dhcpd'][$if]['staticmap'], "staticmapcmp");
404
}
405

    
406
function aliases_sort() {
407
	global $g, $config;
408

    
409
	function aliascmp($a, $b) {
410
		return strcmp($a['name'], $b['name']);
411
	}
412

    
413
	usort($config['aliases']['alias'], "aliascmp");
414
}
415

    
416
function ipsec_mobilekey_sort() {
417
	global $g, $config;
418

    
419
	function mobilekeycmp($a, $b) {
420
		return strcmp($a['ident'][0], $b['ident'][0]);
421
	}
422

    
423
	usort($config['ipsec']['mobilekey'], "mobilekeycmp");
424
}
425

    
426
function proxyarp_sort() {
427
	global $g, $config;
428

    
429
	function proxyarpcmp($a, $b) {
430
		if (isset($a['network']))
431
			list($ast,$asn) = explode("/", $a['network']);
432
		else if (isset($a['range'])) {
433
			$ast = $a['range']['from'];
434
			$asn = 32;
435
		}
436
		if (isset($b['network']))
437
			list($bst,$bsn) = explode("/", $b['network']);
438
		else if (isset($b['range'])) {
439
			$bst = $b['range']['from'];
440
			$bsn = 32;
441
		}
442
		if (ipcmp($ast, $bst) == 0)
443
			return ($asn - $bsn);
444
		else
445
			return ipcmp($ast, $bst);
446
	}
447

    
448
	usort($config['proxyarp']['proxyarpnet'], "proxyarpcmp");
449
}
450

    
451
function passthrumacs_sort() {
452
	global $g, $config;
453

    
454
	function passthrumacscmp($a, $b) {
455
		return strcmp($a['mac'], $b['mac']);
456
	}
457

    
458
	usort($config['captiveportal']['passthrumac'],"passthrumacscmp");
459
}
460

    
461
function allowedips_sort() {
462
	global $g, $config;
463

    
464
	function allowedipscmp($a, $b) {
465
		return strcmp($a['ip'], $b['ip']);
466
	}
467

    
468
	usort($config['captiveportal']['allowedip'],"allowedipscmp");
469
}
470

    
471
function wol_sort() {
472
	global $g, $config;
473

    
474
	function wolcmp($a, $b) {
475
		return strcmp($a['descr'], $b['descr']);
476
	}
477

    
478
	usort($config['wol']['wolentry'], "wolcmp");
479
}
480

    
481
function gentitle($pgname) {
482
	global $config;
483
	return $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pgname;
484
}
485

    
486
/* update the changedesc and changecount(er) variables */
487
function update_changedesc($update) {
488
	global $changedesc;
489
	global $changecount;
490

    
491
	$changedesc .= " {$update}";
492
	$changecount++;
493
}
494

    
495
function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert = "") {
496
	global $g, $config;
497
        $sor = isset($config['syslog']['reverse']) ? "-r" : "";
498
	exec("/usr/sbin/clog {$logfile} | /usr/bin/tail {$sor} -n {$tail}", $logarr);
499
	if($grepfor <> "") {  	 
500
                 $i = 0; 	 
501
                 foreach($grepfor as $agrep) { 	 
502
                         $regexp = "/" . $agrep . "/i"; 	 
503
                         if($grepinvert[$i] == true) { 	 
504
                                 $logarr = preg_grep($regexp, $logarr, PREG_GREP_INVERT); 	 
505
                         } else { 	 
506
                                 $logarr = preg_grep($regexp, $logarr); 	 
507
                         } 	 
508
                         $i++; 	 
509
                 } 	 
510
        }
511
        foreach ($logarr as $logent) {
512
                $logent = preg_split("/\s+/", $logent, 6);
513
                echo "<tr valign=\"top\">\n";
514
                if ($withorig) {
515
                        echo "<td class=\"listlr\" nowrap>" . htmlspecialchars(join(" ", array_slice($logent, 0, 3))) . "</td>\n";
516
                        echo "<td class=\"listr\">" . htmlspecialchars($logent[4] . " " . $logent[5]) . "</td>\n";
517
                } else {
518
                        echo "<td class=\"listlr\" colspan=\"2\">" . htmlspecialchars($logent[5]) . "</td>\n";
519
                }
520
                echo "</tr>\n";
521
        }
522
}
523

    
524
/* Check if variable has changed, update and log if it has
525
 * returns true if var changed
526
 * varname = variable name in plain text
527
 * orig = original value
528
 * new = new value
529
 */
530
function update_if_changed($varname, & $orig, $new) {
531
	if (is_array($orig) && is_array($new)) {
532
		$a_diff = array_diff($orig, $new);
533
		foreach ($a_diff as $diff) {
534
			update_changedesc("removed {$varname}: \"{$diff}\"");
535
		}
536
		$a_diff = array_diff($new, $orig);
537
		foreach ($a_diff as $diff) {
538
			update_changedesc("added {$varname}: \"{$diff}\"");
539
		}
540
		$orig = $new;
541
		return true;
542
			
543
	} else { 
544
		if ($orig != $new) {
545
			update_changedesc("{$varname}: \"{$orig}\" -> \"{$new}\"");
546
			$orig = $new;
547
			return true;
548
		}
549
	}
550
	return false;
551
}
552

    
553
function address_to_pconfig($adr, &$padr, &$pmask, &$pnot, &$pbeginport, &$pendport) {
554

    
555
        if (isset($adr['any']))
556
                $padr = "any";
557
        else if ($adr['network'])
558
                $padr = $adr['network'];
559
        else if ($adr['address']) {
560
                list($padr, $pmask) = explode("/", $adr['address']);
561
                if (!$pmask)
562
                        $pmask = 32;
563
        }
564

    
565
        if (isset($adr['not']))
566
                $pnot = 1;
567
        else
568
                $pnot = 0;
569

    
570
        if ($adr['port']) {
571
                list($pbeginport, $pendport) = explode("-", $adr['port']);
572
                if (!$pendport)
573
                        $pendport = $pbeginport;
574
        } else {
575
                if(alias_expand($pbeginport) <> "" || alias_expand($pendport) <> "") {
576
                        /* Item is a port alias */
577
                } else {
578
                        $pbeginport = "any";
579
                        $pendport = "any";
580
                }
581
        }
582
}
583

    
584
function pconfig_to_address(&$adr, $padr, $pmask, $pnot=false, $pbeginport=0, $pendport=0) {
585

    
586
        $adr = array();
587

    
588
        if ($padr == "any")
589
                $adr['any'] = true;
590
        else if (is_specialnet($padr))
591
                $adr['network'] = $padr;
592
        else {
593
                $adr['address'] = $padr;
594
                if ($pmask != 32)
595
                        $adr['address'] .= "/" . $pmask;
596
        }
597

    
598
        if ($pnot)
599
                $adr['not'] = true;
600
        else
601
                unset($adr['not']);
602

    
603
        if (($pbeginport != 0) && ($pbeginport != "any")) {
604
                if ($pbeginport != $pendport)
605
                        $adr['port'] = $pbeginport . "-" . $pendport;
606
                else
607
                        $adr['port'] = $pbeginport;
608
        }
609

    
610
        if(alias_expand($pbeginport)) {
611
                $adr['port'] = $pbeginport;
612
        }
613
}
614

    
615
function is_specialnet($net) {
616
        global $specialsrcdst;
617

    
618
        if (in_array($net, $specialsrcdst) || strstr($net, "opt"))
619
                return true;
620
        else
621
                return false;
622
}
623

    
624
function ipsec_ca_sort() {
625
        global $g, $config;
626

    
627
        function ipseccacmp($a, $b) {
628
                return strcmp($a['ident'], $b['ident']);
629
        }
630

    
631
        usort($config['ipsec']['cacert'], "ipseccacmp");
632
}
633

    
634

    
635
?>
(52-52/143)