Project

General

Profile

Download (18.9 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 page
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

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

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

    
213
	/*
214
	 * Make sure it doesn't end up with both dnsmasq and unbound enabled
215
	 * simultaneously in secondary
216
	 * */
217
	if (isset($params[0]['unbound']['enable']) && isset($config['dnsmasq']['enable'])) {
218
		unset($config['dnsmasq']['enable']);
219
		services_dnsmasq_configure();
220
	} else if (isset($params[0]['dnsmasq']['enable']) && isset($config['unbound']['enable'])) {
221
		unset($config['unbound']['enable']);
222
		services_unbound_configure();
223
	}
224

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

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

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

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

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

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

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

    
336
	if (isset($old_config['ipsec']['enable']) !== isset($config['ipsec']['enable'])) {
337
		vpn_ipsec_configure();
338
	}
339

    
340
	unset($old_config);
341

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
536
	return $response;
537
}
538

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

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

    
578
unlock($xmlrpclockkey);
579

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

    
594
?>
(228-228/228)