Project

General

Profile

Download (19.3 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
	xmlrpc.php
4
*/
5
/* ====================================================================
6
 *	Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
7
 *  Copyright (c)  2005 Colin Smith
8
 *
9
 *	Redistribution and use in source and binary forms, with or without modification,
10
 *	are permitted provided that the following conditions are met:
11
 *
12
 *	1. Redistributions of source code must retain the above copyright notice,
13
 *		this list of conditions and the following disclaimer.
14
 *
15
 *	2. Redistributions in binary form must reproduce the above copyright
16
 *		notice, this list of conditions and the following disclaimer in
17
 *		the documentation and/or other materials provided with the
18
 *		distribution.
19
 *
20
 *	3. All advertising materials mentioning features or use of this software
21
 *		must display the following acknowledgment:
22
 *		"This product includes software developed by the pfSense Project
23
 *		 for use in the pfSense software distribution. (http://www.pfsense.org/).
24
 *
25
 *	4. The names "pfSense" and "pfSense Project" must not be used to
26
 *		 endorse or promote products derived from this software without
27
 *		 prior written permission. For written permission, please contact
28
 *		 coreteam@pfsense.org.
29
 *
30
 *	5. Products derived from this software may not be called "pfSense"
31
 *		nor may "pfSense" appear in their names without prior written
32
 *		permission of the Electric Sheep Fencing, LLC.
33
 *
34
 *	6. Redistributions of any form whatsoever must retain the following
35
 *		acknowledgment:
36
 *
37
 *	"This product includes software developed by the pfSense Project
38
 *	for use in the pfSense software distribution (http://www.pfsense.org/).
39
 *
40
 *	THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
41
 *	EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42
 *	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43
 *	PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
44
 *	ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45
 *	SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46
 *	NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47
 *	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48
 *	HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49
 *	STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50
 *	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51
 *	OF THE POSSIBILITY OF SUCH DAMAGE.
52
 *
53
 *	====================================================================
54
 *
55
 */
56

    
57
##|+PRIV
58
##|*IDENT=page-xmlrpclibrary
59
##|*NAME=XMLRPC Library
60
##|*DESCR=Allow access to the 'XMLRPC Library' page.
61
##|*MATCH=xmlrpc.php*
62
##|-PRIV
63

    
64
require_once("config.inc");
65
require_once("functions.inc");
66
require_once("filter.inc");
67
require_once("ipsec.inc");
68
require_once("vpn.inc");
69
require_once("shaper.inc");
70
require_once("xmlrpc_server.inc");
71
require_once("xmlrpc.inc");
72

    
73
function xmlrpc_loop_detect() {
74
	global $config;
75

    
76
	/* grab sync to ip if enabled */
77
	if ($config['hasync']) {
78
		$synchronizetoip = $config['hasync']['synchronizetoip'];
79
	}
80
	if ($synchronizetoip) {
81
		if ($synchronizetoip == $_SERVER['REMOTE_ADDR']) {
82
			return true;
83
		}
84
	}
85

    
86
	return false;
87
}
88

    
89
$xmlrpc_g = array(
90
	"return" => array(
91
		"true" => new XML_RPC_Response(new XML_RPC_Value(true, $XML_RPC_Boolean)),
92
		"false" => new XML_RPC_Response(new XML_RPC_Value(false, $XML_RPC_Boolean)),
93
		"authfail" => new XML_RPC_Response(new XML_RPC_Value(gettext("Authentication failed"), $XML_RPC_String))
94
	)
95
);
96

    
97
/*
98
 *   pfSense XMLRPC errors
99
 *   $XML_RPC_erruser + 1 = Auth failure
100
 */
101
$XML_RPC_erruser = 200;
102

    
103
/* EXPOSED FUNCTIONS */
104
$exec_php_doc = gettext("XMLRPC wrapper for eval(). This method must be called with two parameters: a string containing the local system\'s password followed by the PHP code to evaluate.");
105
$exec_php_sig = array(
106
	array(
107
		$XML_RPC_Boolean, // First signature element is return value.
108
		$XML_RPC_String, // password
109
		$XML_RPC_String, // shell code to exec
110
	)
111
);
112

    
113
function xmlrpc_authfail() {
114
	log_auth("webConfigurator authentication error for 'admin' from {$_SERVER['REMOTE_ADDR']}");
115
}
116

    
117
function exec_php_xmlrpc($raw_params) {
118
	global $config, $xmlrpc_g;
119

    
120
	$params = xmlrpc_params_to_php($raw_params);
121
	if (!xmlrpc_auth($params)) {
122
		xmlrpc_authfail();
123
		return $xmlrpc_g['return']['authfail'];
124
	}
125
	$exec_php = $params[0];
126
	eval($exec_php);
127
	if ($toreturn) {
128
		$response = XML_RPC_encode($toreturn);
129
		return new XML_RPC_Response($response);
130
	} else {
131
		return $xmlrpc_g['return']['true'];
132
	}
133
}
134

    
135
/*****************************/
136
$exec_shell_doc = gettext("XMLRPC wrapper for mwexec(). This method must be called with two parameters: a string containing the local system\'s password followed by an shell command to execute.");
137
$exec_shell_sig = array(
138
	array(
139
		$XML_RPC_Boolean, // First signature element is return value.
140
		$XML_RPC_String, // password
141
		$XML_RPC_String, // shell code to exec
142
	)
143
);
144

    
145
function exec_shell_xmlrpc($raw_params) {
146
	global $config, $xmlrpc_g;
147

    
148
	$params = xmlrpc_params_to_php($raw_params);
149
	if (!xmlrpc_auth($params)) {
150
		xmlrpc_authfail();
151
		return $xmlrpc_g['return']['authfail'];
152
	}
153
	$shell_cmd = $params[0];
154
	mwexec($shell_cmd);
155

    
156
	return $xmlrpc_g['return']['true'];
157
}
158

    
159
/*****************************/
160
$backup_config_section_doc = gettext("XMLRPC wrapper for backup_config_section. This method must be called with two parameters: a string containing the local system\'s password followed by an array containing the keys to be backed up.");
161
$backup_config_section_sig = array(
162
	array(
163
		$XML_RPC_Struct, // First signature element is return value.
164
		$XML_RPC_String,
165
		$XML_RPC_Array
166
	)
167
);
168

    
169
function backup_config_section_xmlrpc($raw_params) {
170
	global $config, $xmlrpc_g;
171

    
172
	if (xmlrpc_loop_detect()) {
173
		log_error("Disallowing CARP sync loop");
174
		return;
175
	}
176

    
177
	$params = xmlrpc_params_to_php($raw_params);
178
	if (!xmlrpc_auth($params)) {
179
		xmlrpc_authfail();
180
		return $xmlrpc_g['return']['authfail'];
181
	}
182
	$val = array_intersect_key($config, array_flip($params[0]));
183

    
184
	return new XML_RPC_Response(XML_RPC_encode($val));
185
}
186

    
187
/*****************************/
188
$restore_config_section_doc = gettext("XMLRPC wrapper for restore_config_section. This method must be called with two parameters: a string containing the local system\'s password and an array to merge into the system\'s config. This function returns true upon completion.");
189
$restore_config_section_sig = array(
190
	array(
191
		$XML_RPC_Boolean,
192
		$XML_RPC_String,
193
		$XML_RPC_Struct
194
	)
195
);
196

    
197
function restore_config_section_xmlrpc($raw_params) {
198
	global $config, $xmlrpc_g;
199

    
200
	$old_config = $config;
201
	$old_ipsec_enabled = ipsec_enabled();
202

    
203
	if (xmlrpc_loop_detect()) {
204
		log_error("Disallowing CARP sync loop");
205
		return;
206
	}
207

    
208
	$params = xmlrpc_params_to_php($raw_params);
209
	if (!xmlrpc_auth($params)) {
210
		xmlrpc_authfail();
211
		return $xmlrpc_g['return']['authfail'];
212
	}
213

    
214
	// Some sections should just be copied and not merged or we end
215
	//   up unable to sync the deletion of the last item in a section
216
	$sync_full = array('dnsmasq', 'unbound', 'ipsec', 'aliases', 'wol', 'load_balancer', 'openvpn', 'cert', 'ca', 'crl', 'schedules', 'filter', 'nat', 'dhcpd', 'dhcpv6');
217
	$sync_full_done = array();
218
	foreach ($sync_full as $syncfull) {
219
		if (isset($params[0][$syncfull])) {
220
			$config[$syncfull] = $params[0][$syncfull];
221
			unset($params[0][$syncfull]);
222
			$sync_full_done[] = $syncfull;
223
		}
224
	}
225

    
226
	$vipbackup = array();
227
	$oldvips = array();
228
	if (isset($params[0]['virtualip'])) {
229
		if (is_array($config['virtualip']['vip'])) {
230
			foreach ($config['virtualip']['vip'] as $vipindex => $vip) {
231
				if ($vip['mode'] == "carp") {
232
					$oldvips["{$vip['interface']}_vip{$vip['vhid']}"]['content'] = "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}";
233
					$oldvips["{$vip['interface']}_vip{$vip['vhid']}"]['interface'] = $vip['interface'];
234
					$oldvips["{$vip['interface']}_vip{$vip['vhid']}"]['subnet'] = $vip['subnet'];
235
				} else if ($vip['mode'] == "ipalias" && (substr($vip['interface'], 0, 4) == '_vip' || strstr($vip['interface'], "lo0"))) {
236
					$oldvips[$vip['subnet']]['content'] = "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}";
237
					$oldvips[$vip['subnet']]['interface'] = $vip['interface'];
238
					$oldvips[$vip['subnet']]['subnet'] = $vip['subnet'];
239
				} else if (($vip['mode'] == "ipalias" || $vip['mode'] == 'proxyarp') && !(substr($vip['interface'], 0, 4) == '_vip') || strstr($vip['interface'], "lo0")) {
240
					$vipbackup[] = $vip;
241
				}
242
			}
243
		}
244
	}
245

    
246
	// For vip section, first keep items sent from the master
247
	$config = array_merge_recursive_unique($config, $params[0]);
248

    
249
	/* Then add ipalias and proxyarp types already defined on the backup */
250
	if (is_array($vipbackup) && !empty($vipbackup)) {
251
		if (!is_array($config['virtualip'])) {
252
			$config['virtualip'] = array();
253
		}
254
		if (!is_array($config['virtualip']['vip'])) {
255
			$config['virtualip']['vip'] = array();
256
		}
257
		foreach ($vipbackup as $vip) {
258
			array_unshift($config['virtualip']['vip'], $vip);
259
		}
260
	}
261

    
262
	/* Log what happened */
263
	$mergedkeys = implode(",", array_merge(array_keys($params[0]), $sync_full_done));
264
	write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."), $mergedkeys));
265

    
266
	/*
267
	 * The real work on handling the vips specially
268
	 * This is a copy of intefaces_vips_configure with addition of not reloading existing/not changed carps
269
	 */
270
	if (isset($params[0]['virtualip']) && is_array($config['virtualip']) && is_array($config['virtualip']['vip'])) {
271
		$carp_setuped = false;
272
		$anyproxyarp = false;
273
		foreach ($config['virtualip']['vip'] as $vip) {
274
			if ($vip['mode'] == "carp" && isset($oldvips["{$vip['interface']}_vip{$vip['vhid']}"])) {
275
				if ($oldvips["{$vip['interface']}_vip{$vip['vhid']}"]['content'] == "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}") {
276
					if (does_vip_exist($vip)) {
277
						unset($oldvips["{$vip['interface']}_vip{$vip['vhid']}"]);
278
						continue; // Skip reconfiguring this vips since nothing has changed.
279
					}
280
				}
281
			} else if ($vip['mode'] == "ipalias" && strstr($vip['interface'], "_vip") && isset($oldvips[$vip['subnet']])) {
282
				if ($oldvips[$vip['subnet']]['content'] == "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}") {
283
					if (does_vip_exist($vip)) {
284
						unset($oldvips[$vip['subnet']]);
285
						continue; // Skip reconfiguring this vips since nothing has changed.
286
					}
287
				}
288
				unset($oldvips[$vip['subnet']]);
289
			}
290

    
291
			switch ($vip['mode']) {
292
				case "proxyarp":
293
					$anyproxyarp = true;
294
					break;
295
				case "ipalias":
296
					interface_ipalias_configure($vip);
297
					break;
298
				case "carp":
299
					if ($carp_setuped == false) {
300
						$carp_setuped = true;
301
					}
302
					interface_carp_configure($vip);
303
					break;
304
			}
305
		}
306
		/* Cleanup remaining old carps */
307
		foreach ($oldvips as $oldvipar) {
308
			$oldvipif = get_real_interface($oldvipar['interface']);
309
			if (!empty($oldvipif)) {
310
				if (is_ipaddrv6($oldvipar['subnet'])) {
311
					 mwexec("/sbin/ifconfig " . escapeshellarg($oldvipif) . " inet6 " . escapeshellarg($oldvipar['subnet']) . " delete");
312
				} else {
313
					pfSense_interface_deladdress($oldvipif, $oldvipar['subnet']);
314
				}
315
			}
316
		}
317
		if ($carp_setuped == true) {
318
			interfaces_sync_setup();
319
		}
320
		if ($anyproxyarp == true) {
321
			interface_proxyarp_configure();
322
		}
323
	}
324

    
325
	if ($old_ipsec_enabled !== ipsec_enabled()) {
326
		vpn_ipsec_configure();
327
	}
328

    
329
	unset($old_config);
330

    
331
	return $xmlrpc_g['return']['true'];
332
}
333

    
334
/*****************************/
335
$merge_installedpackages_section_doc = gettext("XMLRPC wrapper for merging package sections. This method must be called with two parameters: a string containing the local system\'s password and an array to merge into the system\'s config. This function returns true upon completion.");
336
$merge_installedpackages_section_sig = array(
337
	array(
338
		$XML_RPC_Boolean,
339
		$XML_RPC_String,
340
		$XML_RPC_Struct
341
	)
342
);
343

    
344
function merge_installedpackages_section_xmlrpc($raw_params) {
345
	global $config, $xmlrpc_g;
346

    
347
	if (xmlrpc_loop_detect()) {
348
		log_error("Disallowing CARP sync loop");
349
		return;
350
	}
351

    
352
	$params = xmlrpc_params_to_php($raw_params);
353
	if (!xmlrpc_auth($params)) {
354
		xmlrpc_authfail();
355
		return $xmlrpc_g['return']['authfail'];
356
	}
357
	$config['installedpackages'] = array_merge($config['installedpackages'], $params[0]);
358
	$mergedkeys = implode(",", array_keys($params[0]));
359
	write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."), $mergedkeys));
360

    
361
	return $xmlrpc_g['return']['true'];
362
}
363

    
364
/*****************************/
365
$merge_config_section_doc = gettext("XMLRPC wrapper for merge_config_section. This method must be called with two parameters: a string containing the local system\'s password and an array to merge into the system\'s config. This function returns true upon completion.");
366
$merge_config_section_sig = array(
367
	array(
368
		$XML_RPC_Boolean,
369
		$XML_RPC_String,
370
		$XML_RPC_Struct
371
	)
372
);
373

    
374
function merge_config_section_xmlrpc($raw_params) {
375
	global $config, $xmlrpc_g;
376

    
377
	if (xmlrpc_loop_detect()) {
378
		log_error("Disallowing CARP sync loop");
379
		return;
380
	}
381

    
382
	$params = xmlrpc_params_to_php($raw_params);
383
	if (!xmlrpc_auth($params)) {
384
		xmlrpc_authfail();
385
		return $xmlrpc_g['return']['authfail'];
386
	}
387
	$config_new = array_overlay($config, $params[0]);
388
	$config = $config_new;
389
	$mergedkeys = implode(",", array_keys($params[0]));
390
	write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."), $mergedkeys));
391
	return $xmlrpc_g['return']['true'];
392
}
393

    
394
/*****************************/
395
$filter_configure_doc = gettext("Basic XMLRPC wrapper for filter_configure. This method must be called with one parameter: a string containing the local system\'s password. This function returns true upon completion.");
396
$filter_configure_sig = array(
397
	array(
398
		$XML_RPC_Boolean,
399
		$XML_RPC_String
400
	)
401
);
402

    
403
function filter_configure_xmlrpc($raw_params) {
404
	global $xmlrpc_g, $g, $config;
405

    
406
	$params = xmlrpc_params_to_php($raw_params);
407
	if (!xmlrpc_auth($params)) {
408
		xmlrpc_authfail();
409
		return $xmlrpc_g['return']['authfail'];
410
	}
411
	filter_configure();
412
	system_routing_configure();
413
	setup_gateways_monitor();
414
	relayd_configure();
415
	require_once("openvpn.inc");
416
	openvpn_resync_all();
417

    
418
	/* The DNS Resolver and the DNS Forwarder may both be active so long as
419
	 * they are running on different ports. See ticket #5882
420
	 */
421
	$need_dhcp_start = true;
422
	if (isset($config['dnsmasq']['enable'])) {
423
		/* Configure dnsmasq but tell it NOT to restart DHCP */
424
		services_dnsmasq_configure(false);
425
	} else {
426
		/* kill any running dnsmasq since it is not enabled. */
427
		if (file_exists("{$g['varrun_path']}/dnsmasq.pid")) {
428
			sigkillbypid("{$g['varrun_path']}/dnsmasq.pid", "TERM");
429
		}
430
	}
431
	if (isset($config['unbound']['enable'])) {
432
		/* Configure unbound but tell it NOT to restart DHCP */
433
		services_unbound_configure(false);
434
	} else {
435
		/* kill any running Unbound instance since it is not enabled. */
436
		if (file_exists("{$g['varrun_path']}/unbound.pid")) {
437
			sigkillbypid("{$g['varrun_path']}/unbound.pid", "TERM");
438
		}
439
	}
440

    
441
	/* Call this separately since the above are manually set to skip the DHCP restart they normally perform.
442
	 * This avoids restarting dhcpd twice as described on ticket #3797
443
	 */
444
	services_dhcpd_configure();
445

    
446
	local_sync_accounts();
447

    
448
	return $xmlrpc_g['return']['true'];
449
}
450

    
451
/*****************************/
452
$carp_configure_doc = gettext("Basic XMLRPC wrapper for configuring CARP interfaces.");
453
$carp_configure_sig = array(
454
	array(
455
		$XML_RPC_Boolean,
456
		$XML_RPC_String
457
	)
458
);
459

    
460
function interfaces_carp_configure_xmlrpc($raw_params) {
461
	global $xmlrpc_g;
462

    
463
	if (xmlrpc_loop_detect()) {
464
		log_error("Disallowing CARP sync loop");
465
		return;
466
	}
467

    
468
	$params = xmlrpc_params_to_php($raw_params);
469
	if (!xmlrpc_auth($params)) {
470
		xmlrpc_authfail();
471
		return $xmlrpc_g['return']['authfail'];
472
	}
473
	interfaces_vips_configure();
474

    
475
	return $xmlrpc_g['return']['true'];
476
}
477

    
478
/*****************************/
479
$pfsense_firmware_version_doc = gettext("Basic XMLRPC wrapper for host_firmware_version. This function will return the output of host_firmware_version upon completion.");
480

    
481
$pfsense_firmware_version_sig = array (
482
	array (
483
		$XML_RPC_Struct,
484
		$XML_RPC_String
485
	)
486
);
487

    
488
function pfsense_firmware_version_xmlrpc($raw_params) {
489
		global $xmlrpc_g;
490

    
491
		$params = xmlrpc_params_to_php($raw_params);
492
		if (!xmlrpc_auth($params)) {
493
			xmlrpc_authfail();
494
			return $xmlrpc_g['return']['authfail'];
495
		}
496
		return new XML_RPC_Response(XML_RPC_encode(host_firmware_version()));
497
}
498

    
499
/*****************************/
500
$reboot_doc = gettext("Basic XMLRPC wrapper for rc.reboot.");
501
$reboot_sig = array(array($XML_RPC_Boolean, $XML_RPC_String));
502
function reboot_xmlrpc($raw_params) {
503
	global $xmlrpc_g;
504

    
505
	$params = xmlrpc_params_to_php($raw_params);
506
	if (!xmlrpc_auth($params)) {
507
		xmlrpc_authfail();
508
		return $xmlrpc_g['return']['authfail'];
509
	}
510
	mwexec_bg("/etc/rc.reboot");
511

    
512
	return $xmlrpc_g['return']['true'];
513
}
514

    
515
/*****************************/
516
$get_notices_sig = array(
517
	array(
518
		$XML_RPC_Array,
519
		$XML_RPC_String
520
	),
521
	array(
522
		$XML_RPC_Array
523
	)
524
);
525

    
526
function get_notices_xmlrpc($raw_params) {
527
	global $g, $xmlrpc_g;
528

    
529
	$params = xmlrpc_params_to_php($raw_params);
530
	if (!xmlrpc_auth($params)) {
531
		xmlrpc_authfail();
532
		return $xmlrpc_g['return']['authfail'];
533
	}
534
	if (!function_exists("get_notices")) {
535
		require_once("notices.inc");
536
	}
537
	if (!$params) {
538
		$toreturn = get_notices();
539
	} else {
540
		$toreturn = get_notices($params);
541
	}
542
	$response = new XML_RPC_Response(XML_RPC_encode($toreturn));
543

    
544
	return $response;
545
}
546

    
547
$xmlrpclockkey = lock('xmlrpc', LOCK_EX);
548

    
549
/*****************************/
550
$server = new XML_RPC_Server(
551
	array(
552
		'pfsense.exec_shell' => array('function' => 'exec_shell_xmlrpc',
553
			'signature' => $exec_shell_sig,
554
			'docstring' => $exec_shell_doc),
555
		'pfsense.exec_php' => array('function' => 'exec_php_xmlrpc',
556
			'signature' => $exec_php_sig,
557
			'docstring' => $exec_php_doc),
558
		'pfsense.filter_configure' => array('function' => 'filter_configure_xmlrpc',
559
			'signature' => $filter_configure_sig,
560
			'docstring' => $filter_configure_doc),
561
		'pfsense.interfaces_carp_configure' => array('function' => 'interfaces_carp_configure_xmlrpc',
562
			'signature' => $carp_configure_sig,
563
			'docstring' => $carp_configure_doc),
564
		'pfsense.backup_config_section' => array('function' => 'backup_config_section_xmlrpc',
565
			'signature' => $backup_config_section_sig,
566
			'docstring' => $backup_config_section_doc),
567
		'pfsense.restore_config_section' => array('function' => 'restore_config_section_xmlrpc',
568
			'signature' => $restore_config_section_sig,
569
			'docstring' => $restore_config_section_doc),
570
		'pfsense.merge_config_section' => array('function' => 'merge_config_section_xmlrpc',
571
			'signature' => $merge_config_section_sig,
572
			'docstring' => $merge_config_section_doc),
573
		'pfsense.merge_installedpackages_section_xmlrpc' => array('function' => 'merge_installedpackages_section_xmlrpc',
574
			'signature' => $merge_installedpackages_section_sig,
575
			'docstring' => $merge_installedpackages_section_doc),
576
		'pfsense.host_firmware_version' => array('function' => 'pfsense_firmware_version_xmlrpc',
577
			'signature' => $pfsense_firmware_version_sig,
578
			'docstring' => $pfsense_firmware_version_doc),
579
		'pfsense.reboot' => array('function' => 'reboot_xmlrpc',
580
			'signature' => $reboot_sig,
581
			'docstring' => $reboot_doc),
582
		'pfsense.get_notices' => array('function' => 'get_notices_xmlrpc',
583
			'signature' => $get_notices_sig)
584
	)
585
);
586

    
587
unlock($xmlrpclockkey);
588

    
589
function array_overlay($a1, $a2) {
590
	foreach ($a1 as $k => $v) {
591
		if (!array_key_exists($k, $a2)) {
592
			continue;
593
		}
594
		if (is_array($v) && is_array($a2[$k])) {
595
			$a1[$k] = array_overlay($v, $a2[$k]);
596
		} else {
597
			$a1[$k] = $a2[$k];
598
		}
599
	}
600
	return $a1;
601
}
602

    
603
?>
(225-225/225)