Project

General

Profile

Download (19 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("config.inc");
65
require("functions.inc");
66
require_once("filter.inc");
67
require("ipsec.inc");
68
require("vpn.inc");
69
require("shaper.inc");
70
require("xmlrpc_server.inc");
71
require("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
	/*
215
	 * Make sure it doesn't end up with both dnsmasq and unbound enabled
216
	 * simultaneously in secondary
217
	 * */
218
	if (isset($params[0]['unbound']['enable']) && isset($config['dnsmasq']['enable'])) {
219
		unset($config['dnsmasq']['enable']);
220
		services_dnsmasq_configure();
221
	} else if (isset($params[0]['dnsmasq']['enable']) && isset($config['unbound']['enable'])) {
222
		unset($config['unbound']['enable']);
223
		services_unbound_configure();
224
	}
225

    
226
	// Some sections should just be copied and not merged or we end
227
	//   up unable to sync the deletion of the last item in a section
228
	$sync_full = array('dnsmasq', 'unbound', 'ipsec', 'aliases', 'wol', 'load_balancer', 'openvpn', 'cert', 'ca', 'crl', 'schedules', 'filter', 'nat', 'dhcpd', 'dhcpv6');
229
	$sync_full_done = array();
230
	foreach ($sync_full as $syncfull) {
231
		if (isset($params[0][$syncfull])) {
232
			$config[$syncfull] = $params[0][$syncfull];
233
			unset($params[0][$syncfull]);
234
			$sync_full_done[] = $syncfull;
235
		}
236
	}
237

    
238
	$vipbackup = array();
239
	$oldvips = array();
240
	if (isset($params[0]['virtualip'])) {
241
		if (is_array($config['virtualip']['vip'])) {
242
			foreach ($config['virtualip']['vip'] as $vipindex => $vip) {
243
				if ($vip['mode'] == "carp") {
244
					$oldvips["{$vip['interface']}_vip{$vip['vhid']}"]['content'] = "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}";
245
					$oldvips["{$vip['interface']}_vip{$vip['vhid']}"]['interface'] = $vip['interface'];
246
					$oldvips["{$vip['interface']}_vip{$vip['vhid']}"]['subnet'] = $vip['subnet'];
247
				} else if ($vip['mode'] == "ipalias" && (substr($vip['interface'], 0, 4) == '_vip' || strpos($vip['interface'], "lo0"))) {
248
					$oldvips[$vip['subnet']]['content'] = "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}";
249
					$oldvips[$vip['subnet']]['interface'] = $vip['interface'];
250
					$oldvips[$vip['subnet']]['subnet'] = $vip['subnet'];
251
				} else if (($vip['mode'] == "ipalias" || $vip['mode'] == 'proxyarp') && !(substr($vip['interface'], 0, 4) == '_vip') || strpos($vip['interface'], "lo0")) {
252
					$vipbackup[] = $vip;
253
				}
254
			}
255
		}
256
	}
257

    
258
	// For vip section, first keep items sent from the master
259
	$config = array_merge_recursive_unique($config, $params[0]);
260

    
261
	/* Then add ipalias and proxyarp types already defined on the backup */
262
	if (is_array($vipbackup) && !empty($vipbackup)) {
263
		if (!is_array($config['virtualip'])) {
264
			$config['virtualip'] = array();
265
		}
266
		if (!is_array($config['virtualip']['vip'])) {
267
			$config['virtualip']['vip'] = array();
268
		}
269
		foreach ($vipbackup as $vip) {
270
			array_unshift($config['virtualip']['vip'], $vip);
271
		}
272
	}
273

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

    
278
	/*
279
	 * The real work on handling the vips specially
280
	 * This is a copy of intefaces_vips_configure with addition of not reloading existing/not changed carps
281
	 */
282
	if (isset($params[0]['virtualip']) && is_array($config['virtualip']) && is_array($config['virtualip']['vip'])) {
283
		$carp_setuped = false;
284
		$anyproxyarp = false;
285
		foreach ($config['virtualip']['vip'] as $vip) {
286
			if ($vip['mode'] == "carp" && isset($oldvips["{$vip['interface']}_vip{$vip['vhid']}"])) {
287
				if ($oldvips["{$vip['interface']}_vip{$vip['vhid']}"]['content'] == "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}") {
288
					if (does_vip_exist($vip)) {
289
						unset($oldvips["{$vip['interface']}_vip{$vip['vhid']}"]);
290
						continue; // Skip reconfiguring this vips since nothing has changed.
291
					}
292
				}
293
			} else if ($vip['mode'] == "ipalias" && strstr($vip['interface'], "_vip") && isset($oldvips[$vip['subnet']])) {
294
				if ($oldvips[$vip['subnet']]['content'] == "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}") {
295
					if (does_vip_exist($vip)) {
296
						unset($oldvips[$vip['subnet']]);
297
						continue; // Skip reconfiguring this vips since nothing has changed.
298
					}
299
				}
300
				unset($oldvips[$vip['subnet']]);
301
			}
302

    
303
			switch ($vip['mode']) {
304
				case "proxyarp":
305
					$anyproxyarp = true;
306
					break;
307
				case "ipalias":
308
					interface_ipalias_configure($vip);
309
					break;
310
				case "carp":
311
					if ($carp_setuped == false) {
312
						$carp_setuped = true;
313
					}
314
					interface_carp_configure($vip);
315
					break;
316
			}
317
		}
318
		/* Cleanup remaining old carps */
319
		foreach ($oldvips as $oldvipar) {
320
			$oldvipif = get_real_interface($oldvipar['interface']);
321
			if (!empty($oldvipif)) {
322
				if (is_ipaddrv6($oldvipar['subnet'])) {
323
					 mwexec("/sbin/ifconfig " . escapeshellarg($oldvipif) . " inet6 " . escapeshellarg($oldvipar['subnet']) . " delete");
324
				} else {
325
					pfSense_interface_deladdress($oldvipif, $oldvipar['subnet']);
326
				}
327
			}
328
		}
329
		if ($carp_setuped == true) {
330
			interfaces_sync_setup();
331
		}
332
		if ($anyproxyarp == true) {
333
			interface_proxyarp_configure();
334
		}
335
	}
336

    
337
	if ($old_ipsec_enabled !== ipsec_enabled()) {
338
		vpn_ipsec_configure();
339
	}
340

    
341
	unset($old_config);
342

    
343
	return $xmlrpc_g['return']['true'];
344
}
345

    
346
/*****************************/
347
$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.");
348
$merge_installedpackages_section_sig = array(
349
	array(
350
		$XML_RPC_Boolean,
351
		$XML_RPC_String,
352
		$XML_RPC_Struct
353
	)
354
);
355

    
356
function merge_installedpackages_section_xmlrpc($raw_params) {
357
	global $config, $xmlrpc_g;
358

    
359
	if (xmlrpc_loop_detect()) {
360
		log_error("Disallowing CARP sync loop");
361
		return;
362
	}
363

    
364
	$params = xmlrpc_params_to_php($raw_params);
365
	if (!xmlrpc_auth($params)) {
366
		xmlrpc_authfail();
367
		return $xmlrpc_g['return']['authfail'];
368
	}
369
	$config['installedpackages'] = array_merge($config['installedpackages'], $params[0]);
370
	$mergedkeys = implode(",", array_keys($params[0]));
371
	write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."), $mergedkeys));
372

    
373
	return $xmlrpc_g['return']['true'];
374
}
375

    
376
/*****************************/
377
$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.");
378
$merge_config_section_sig = array(
379
	array(
380
		$XML_RPC_Boolean,
381
		$XML_RPC_String,
382
		$XML_RPC_Struct
383
	)
384
);
385

    
386
function merge_config_section_xmlrpc($raw_params) {
387
	global $config, $xmlrpc_g;
388

    
389
	if (xmlrpc_loop_detect()) {
390
		log_error("Disallowing CARP sync loop");
391
		return;
392
	}
393

    
394
	$params = xmlrpc_params_to_php($raw_params);
395
	if (!xmlrpc_auth($params)) {
396
		xmlrpc_authfail();
397
		return $xmlrpc_g['return']['authfail'];
398
	}
399
	$config_new = array_overlay($config, $params[0]);
400
	$config = $config_new;
401
	$mergedkeys = implode(",", array_keys($params[0]));
402
	write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."), $mergedkeys));
403
	return $xmlrpc_g['return']['true'];
404
}
405

    
406
/*****************************/
407
$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.");
408
$filter_configure_sig = array(
409
	array(
410
		$XML_RPC_Boolean,
411
		$XML_RPC_String
412
	)
413
);
414

    
415
function filter_configure_xmlrpc($raw_params) {
416
	global $xmlrpc_g, $config;
417

    
418
	$params = xmlrpc_params_to_php($raw_params);
419
	if (!xmlrpc_auth($params)) {
420
		xmlrpc_authfail();
421
		return $xmlrpc_g['return']['authfail'];
422
	}
423
	filter_configure();
424
	system_routing_configure();
425
	setup_gateways_monitor();
426
	relayd_configure();
427
	require_once("openvpn.inc");
428
	openvpn_resync_all();
429
	if (isset($config['dnsmasq']['enable'])) {
430
		services_dnsmasq_configure();
431
	} elseif (isset($config['unbound']['enable'])) {
432
		services_unbound_configure();
433
	} else {
434
		# Both calls above run services_dhcpd_configure(), then we just
435
		# need to call it when they are not called to avoid restarting dhcpd
436
		# twice, as described on ticket #3797
437
		services_dhcpd_configure();
438
	}
439
	local_sync_accounts();
440

    
441
	return $xmlrpc_g['return']['true'];
442
}
443

    
444
/*****************************/
445
$carp_configure_doc = gettext("Basic XMLRPC wrapper for configuring CARP interfaces.");
446
$carp_configure_sig = array(
447
	array(
448
		$XML_RPC_Boolean,
449
		$XML_RPC_String
450
	)
451
);
452

    
453
function interfaces_carp_configure_xmlrpc($raw_params) {
454
	global $xmlrpc_g;
455

    
456
	if (xmlrpc_loop_detect()) {
457
		log_error("Disallowing CARP sync loop");
458
		return;
459
	}
460

    
461
	$params = xmlrpc_params_to_php($raw_params);
462
	if (!xmlrpc_auth($params)) {
463
		xmlrpc_authfail();
464
		return $xmlrpc_g['return']['authfail'];
465
	}
466
	interfaces_vips_configure();
467

    
468
	return $xmlrpc_g['return']['true'];
469
}
470

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

    
474
$pfsense_firmware_version_sig = array (
475
	array (
476
		$XML_RPC_Struct,
477
		$XML_RPC_String
478
	)
479
);
480

    
481
function pfsense_firmware_version_xmlrpc($raw_params) {
482
		global $xmlrpc_g;
483

    
484
		$params = xmlrpc_params_to_php($raw_params);
485
		if (!xmlrpc_auth($params)) {
486
			xmlrpc_authfail();
487
			return $xmlrpc_g['return']['authfail'];
488
		}
489
		return new XML_RPC_Response(XML_RPC_encode(host_firmware_version()));
490
}
491

    
492
/*****************************/
493
$reboot_doc = gettext("Basic XMLRPC wrapper for rc.reboot.");
494
$reboot_sig = array(array($XML_RPC_Boolean, $XML_RPC_String));
495
function reboot_xmlrpc($raw_params) {
496
	global $xmlrpc_g;
497

    
498
	$params = xmlrpc_params_to_php($raw_params);
499
	if (!xmlrpc_auth($params)) {
500
		xmlrpc_authfail();
501
		return $xmlrpc_g['return']['authfail'];
502
	}
503
	mwexec_bg("/etc/rc.reboot");
504

    
505
	return $xmlrpc_g['return']['true'];
506
}
507

    
508
/*****************************/
509
$get_notices_sig = array(
510
	array(
511
		$XML_RPC_Array,
512
		$XML_RPC_String
513
	),
514
	array(
515
		$XML_RPC_Array
516
	)
517
);
518

    
519
function get_notices_xmlrpc($raw_params) {
520
	global $g, $xmlrpc_g;
521

    
522
	$params = xmlrpc_params_to_php($raw_params);
523
	if (!xmlrpc_auth($params)) {
524
		xmlrpc_authfail();
525
		return $xmlrpc_g['return']['authfail'];
526
	}
527
	if (!function_exists("get_notices")) {
528
		require("notices.inc");
529
	}
530
	if (!$params) {
531
		$toreturn = get_notices();
532
	} else {
533
		$toreturn = get_notices($params);
534
	}
535
	$response = new XML_RPC_Response(XML_RPC_encode($toreturn));
536

    
537
	return $response;
538
}
539

    
540
$xmlrpclockkey = lock('xmlrpc', LOCK_EX);
541

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

    
580
unlock($xmlrpclockkey);
581

    
582
function array_overlay($a1, $a2) {
583
	foreach ($a1 as $k => $v) {
584
		if (!array_key_exists($k, $a2)) {
585
			continue;
586
		}
587
		if (is_array($v) && is_array($a2[$k])) {
588
			$a1[$k] = array_overlay($v, $a2[$k]);
589
		} else {
590
			$a1[$k] = $a2[$k];
591
		}
592
	}
593
	return $a1;
594
}
595

    
596
?>
(229-229/229)