Project

General

Profile

Download (16 KB) Statistics
| Branch: | Tag: | Revision:
1 50d49018 Colin Smith
<?php
2
/*
3 81d8a9ad Colin Smith
	$Id$
4 dc1cd85d Scott Ullrich
5 50d49018 Colin Smith
        xmlrpc.php
6 d1a6552b Scott Ullrich
        Copyright (C) 2009, 2010 Scott Ullrich
7 50d49018 Colin Smith
        Copyright (C) 2005 Colin Smith
8
        All rights reserved.
9
10
        Redistribution and use in source and binary forms, with or without
11
        modification, are permitted provided that the following conditions are met:
12
13
        1. Redistributions of source code must retain the above copyright notice,
14
           this list of conditions and the following disclaimer.
15
16
        2. Redistributions in binary form must reproduce the above copyright
17
           notice, this list of conditions and the following disclaimer in the
18
           documentation and/or other materials provided with the distribution.
19
20
        THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
        INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
        AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
        AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
        OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
        SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
        INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
        CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
        ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 0e19e0e4 Scott Ullrich
        POSSIBILITY OF SUCH DAMAGE.
30 50d49018 Colin Smith
*/
31
32 6b07c15a Matthew Grooms
##|+PRIV
33
##|*IDENT=page-xmlrpclibrary
34
##|*NAME=XMLRPC Library page
35
##|*DESCR=Allow access to the 'XMLRPC Library' page.
36
##|*MATCH=xmlrpc.php*
37
##|-PRIV
38
39 0674f163 sullrich
require("config.inc");
40
require("functions.inc");
41
require("filter.inc");
42
require("shaper.inc");
43
require("xmlrpc_server.inc");
44
require("xmlrpc.inc");
45
require("array_intersect_key.inc");
46 50d49018 Colin Smith
47 ff664954 Scott Ullrich
/* grab sync to ip if enabled */
48 dd98e330 Scott Ullrich
if($config['installedpackages']['carpsettings']) {
49
	if ($config['installedpackages']['carpsettings']['config']) {
50
		foreach ($config['installedpackages']['carpsettings']['config'] as $carp) {
51
			$synchronizetoip = $carp['synchronizetoip'];
52
		}
53 ff664954 Scott Ullrich
	}
54
}
55
56
if($synchronizetoip) {
57
	if($synchronizetoip == $_SERVER['REMOTE_ADDR']) {
58 de63649b Rafael Lucas
		log_error(gettext("Disallowing CARP sync loop."));
59 ff664954 Scott Ullrich
		die;	
60
	}
61
}
62
63 8da3de34 Colin Smith
$xmlrpc_g = array(
64 137f46d8 Ermal
	"return" => array(
65
		"true" => new XML_RPC_Response(new XML_RPC_Value(true, $XML_RPC_Boolean)),
66
		"false" => new XML_RPC_Response(new XML_RPC_Value(false, $XML_RPC_Boolean)),
67
		"authfail" => new XML_RPC_Response(new XML_RPC_Value(gettext("Authentication failed"), $XML_RPC_String))
68
	)
69
);
70 8da3de34 Colin Smith
71
/*
72
 *   pfSense XMLRPC errors
73
 *   $XML_RPC_erruser + 1 = Auth failure
74
 */
75
$XML_RPC_erruser = 200;
76
77
/* EXPOSED FUNCTIONS */
78 de63649b Rafael Lucas
$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.");
79 c3638879 Scott Ullrich
$exec_php_sig = array(
80 137f46d8 Ermal
	array(
81
		$XML_RPC_Boolean, // First signature element is return value.
82
		$XML_RPC_String, // password
83
		$XML_RPC_String, // shell code to exec
84
	)
85
);
86 c3638879 Scott Ullrich
87
function exec_php_xmlrpc($raw_params) {
88
	global $config, $xmlrpc_g;
89 137f46d8 Ermal
90 c3638879 Scott Ullrich
	$params = xmlrpc_params_to_php($raw_params);
91 137f46d8 Ermal
	if(!xmlrpc_auth($params))
92
		return $xmlrpc_g['return']['authfail'];
93 c3638879 Scott Ullrich
	$exec_php = $params[0];
94
	eval($exec_php);
95 2c0dd581 Scott Ullrich
	if($toreturn) {
96
		$response = XML_RPC_encode($toreturn);
97
		return new XML_RPC_Response($response);
98
	} else
99
		return $xmlrpc_g['return']['true'];
100 c3638879 Scott Ullrich
}
101
102
/*****************************/
103 de63649b Rafael Lucas
$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.");
104 c3638879 Scott Ullrich
$exec_shell_sig = array(
105 137f46d8 Ermal
	array(
106
		$XML_RPC_Boolean, // First signature element is return value.
107
		$XML_RPC_String, // password
108
		$XML_RPC_String, // shell code to exec
109
	)
110
);
111 c3638879 Scott Ullrich
112
function exec_shell_xmlrpc($raw_params) {
113
	global $config, $xmlrpc_g;
114 137f46d8 Ermal
115 c3638879 Scott Ullrich
	$params = xmlrpc_params_to_php($raw_params);
116 137f46d8 Ermal
	if(!xmlrpc_auth($params))
117
		return $xmlrpc_g['return']['authfail'];
118 c3638879 Scott Ullrich
	$shell_cmd = $params[0];
119
	mwexec($shell_cmd);
120 137f46d8 Ermal
121 c3638879 Scott Ullrich
	return $xmlrpc_g['return']['true'];
122
}
123
124
/*****************************/
125 de63649b Rafael Lucas
$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.");
126 8da3de34 Colin Smith
$backup_config_section_sig = array(
127 137f46d8 Ermal
	array(
128
		$XML_RPC_Struct, // First signature element is return value.
129
		$XML_RPC_String,
130
		$XML_RPC_Array
131
	)
132
);
133 21dc3a7d Colin Smith
134 57e6d4c9 Colin Smith
function backup_config_section_xmlrpc($raw_params) {
135 03d89831 Scott Ullrich
	global $config, $xmlrpc_g;
136 137f46d8 Ermal
137 8da3de34 Colin Smith
	$params = xmlrpc_params_to_php($raw_params);
138 137f46d8 Ermal
	if(!xmlrpc_auth($params))
139
		return $xmlrpc_g['return']['authfail'];
140 03d89831 Scott Ullrich
	$val = array_intersect_key($config, array_flip($params[0]));
141 137f46d8 Ermal
142 8da3de34 Colin Smith
	return new XML_RPC_Response(XML_RPC_encode($val));
143 50d49018 Colin Smith
}
144
145 8da3de34 Colin Smith
/*****************************/
146 de63649b Rafael Lucas
$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.");
147 8da3de34 Colin Smith
$restore_config_section_sig = array(
148 137f46d8 Ermal
	array(
149
		$XML_RPC_Boolean,
150
		$XML_RPC_String,
151
		$XML_RPC_Struct
152
	)
153
);
154 21dc3a7d Colin Smith
155 57e6d4c9 Colin Smith
function restore_config_section_xmlrpc($raw_params) {
156 03d89831 Scott Ullrich
	global $config, $xmlrpc_g;
157 137f46d8 Ermal
158 57e6d4c9 Colin Smith
	$params = xmlrpc_params_to_php($raw_params);
159 19b5c3e7 Ermal
	if(!xmlrpc_auth($params))
160
		return $xmlrpc_g['return']['authfail'];
161 f51d4f98 Ermal
162 a8200dbf Ermal
	$vipbackup = array();
163 51611440 Ermal
	$oldvips = array();
164 4d775dd0 Ermal
	if (isset($params[0]['virtualip'])) {
165 19b5c3e7 Ermal
		if(is_array($config['virtualip']['vip'])) {
166 51611440 Ermal
			foreach ($config['virtualip']['vip'] as $vipindex => $vip) {
167
				if ($vip['mode'] == "carp")
168
					$oldvips[$vip['vhid']] = "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}";
169 2708a5cf Ermal
				else if ($vip['mode'] == "ipalias" && substr($vip['interface'], 0, 3) == "vip")
170
					$oldvips[$vip['subnet']] = "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}";
171
				else if (($vip['mode'] == "ipalias" || $vip['mode'] == 'proxyarp') && substr($vip['interface'], 0, 3) != "vip")
172 51611440 Ermal
					$vipbackup[] = $vip;
173
			}
174 19b5c3e7 Ermal
		}
175
	}
176 f51d4f98 Ermal
177 b019222a pierrepomes
        // For vip section, first keep items sent from the master
178 aa6699fb jim-p
	$config = array_merge_recursive_unique($config, $params[0]);
179 51611440 Ermal
180 f51d4f98 Ermal
        /* Then add ipalias and proxyarp types already defined on the backup */
181
	if (is_array($vipbackup) && !empty($vipbackup)) {
182 51611440 Ermal
		if (!is_array($config['virtualip']))
183
			$config['virtualip'] = array();
184 f51d4f98 Ermal
		if (!is_array($config['virtualip']['vip']))
185
			$config['virtualip']['vip'] = array();
186
		foreach ($vipbackup as $vip)
187 51611440 Ermal
			array_unshift($config['virtualip']['vip'], $vip);
188 a8200dbf Ermal
	}
189 51611440 Ermal
190
	/* Log what happened */
191 03d89831 Scott Ullrich
	$mergedkeys = implode(",", array_keys($params[0]));
192 3a3fb8ea Erik Fonnesbeck
	write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."),$mergedkeys));
193 51611440 Ermal
194
	/* 
195
	 * The real work on handling the vips specially
196
	 * This is a copy of intefaces_vips_configure with addition of not reloading existing/not changed carps
197
	 */
198 63f81fbd Ermal
	if (isset($params[0]['virtualip']) && is_array($config['virtualip']) && is_array($config['virtualip']['vip'])) {
199 51611440 Ermal
		$carp_setuped = false;
200 f51d4f98 Ermal
		$anyproxyarp = false;
201 51611440 Ermal
		foreach ($config['virtualip']['vip'] as $vip) {
202 2708a5cf Ermal
			if ($vip['mode'] == "carp" && isset($oldvips[$vip['vhid']])) {
203 51611440 Ermal
				if ($oldvips[$vip['vhid']] == "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}") {
204 2708a5cf Ermal
					if (does_vip_exist($vip)) {
205 19ed1624 Ermal
						unset($oldvips[$vip['vhid']]);
206 d1e03822 Ermal
						continue; // Skip reconfiguring this vips since nothing has changed.
207 19ed1624 Ermal
					}
208 92ca32cc Ermal
				}
209 19ed1624 Ermal
				unset($oldvips[$vip['vhid']]);
210 2708a5cf Ermal
			} else if ($vip['mode'] == "ipalias" && substr($vip['interface'], 0, 3) == "vip" && isset($oldvips[$vip['subnet']])) {
211
				if ($oldvips[$vip['subnet']] = "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}") {
212
					if (does_vip_exist($vip)) {
213
						unset($oldvips[$vip['subnet']]);
214
						continue; // Skip reconfiguring this vips since nothing has changed.
215
					}
216
				}
217
				unset($oldvips[$vip['subnet']]);
218 51611440 Ermal
			}
219
220
			switch ($vip['mode']) {
221
			case "proxyarp":
222
				$anyproxyarp = true;
223
				break;
224
			case "ipalias":
225
				interface_ipalias_configure(&$vip);
226
				break;
227
			case "carp":
228
				if ($carp_setuped == false)
229
                                        $carp_setuped = true;
230
				interface_carp_configure($vip);
231
				break;
232
			case "carpdev-dhcp":
233
				interface_carpdev_configure($vip);
234
				break;
235
			}
236
		}
237
		/* Cleanup remaining old carps */
238
		foreach ($oldvips as $oldvipif => $oldvippar) {
239 2708a5cf Ermal
			if (!is_ipaddr($oldvipif) && does_interface_exist("vip{$oldvipif}"))
240 51611440 Ermal
				pfSense_interface_destroy("vip{$oldvipif}");
241
		}
242
		if ($carp_setuped == true)
243
			interfaces_carp_setup();
244
		if ($anyproxyarp == true)
245
			interface_proxyarp_configure();
246
	}
247 137f46d8 Ermal
248 8da3de34 Colin Smith
	return $xmlrpc_g['return']['true'];
249 50d49018 Colin Smith
}
250
251 82ae5cfc Scott Ullrich
/*****************************/
252 de63649b Rafael Lucas
$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.");
253 82ae5cfc Scott Ullrich
$merge_config_section_sig = array(
254 137f46d8 Ermal
	array(
255
		$XML_RPC_Boolean,
256
		$XML_RPC_String,
257
		$XML_RPC_Struct
258
	)
259
);
260 82ae5cfc Scott Ullrich
261
function merge_installedpackages_section_xmlrpc($raw_params) {
262
	global $config, $xmlrpc_g;
263 137f46d8 Ermal
264 82ae5cfc Scott Ullrich
	$params = xmlrpc_params_to_php($raw_params);
265 137f46d8 Ermal
	if(!xmlrpc_auth($params))
266
		return $xmlrpc_g['return']['authfail'];
267 82ae5cfc Scott Ullrich
	$config['installedpackages'] = array_merge($config['installedpackages'], $params[0]);
268
	$mergedkeys = implode(",", array_keys($params[0]));
269 3a3fb8ea Erik Fonnesbeck
	write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."),$mergedkeys));
270 137f46d8 Ermal
271 82ae5cfc Scott Ullrich
	return $xmlrpc_g['return']['true'];
272
}
273
274 8da3de34 Colin Smith
/*****************************/
275 de63649b Rafael Lucas
$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.");
276 dc1cd85d Scott Ullrich
$merge_config_section_sig = array(
277 137f46d8 Ermal
	array(
278
		$XML_RPC_Boolean,
279
		$XML_RPC_String,
280
		$XML_RPC_Struct
281
	)
282
);
283 dc1cd85d Scott Ullrich
284
function merge_config_section_xmlrpc($raw_params) {
285
	global $config, $xmlrpc_g;
286 db748384 Scott Ullrich
	$params = xmlrpc_params_to_php($raw_params);
287
	if(!xmlrpc_auth($params))
288
		return $xmlrpc_g['return']['authfail'];
289 f9d7c5b3 Scott Ullrich
	$config_new = array_overlay($config, $params[0]);
290 db748384 Scott Ullrich
	$config = $config_new;
291
	$mergedkeys = implode(",", array_keys($params[0]));
292
	write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."), $mergedkeys));
293
	return $xmlrpc_g['return']['true'];
294 dc1cd85d Scott Ullrich
}
295
296
/*****************************/
297 de63649b Rafael Lucas
$filter_configure_doc = gettext("Basic XMLRPC wrapper for filter_configure. This method must be called with one paramater: a string containing the local system\'s password. This function returns true upon completion.");
298 8da3de34 Colin Smith
$filter_configure_sig = array(
299 137f46d8 Ermal
	array(
300
		$XML_RPC_Boolean,
301
		$XML_RPC_String
302
	)
303
);
304 07a7b08f Colin Smith
305
function filter_configure_xmlrpc($raw_params) {
306 8da3de34 Colin Smith
	global $xmlrpc_g;
307 137f46d8 Ermal
308 07a7b08f Colin Smith
	$params = xmlrpc_params_to_php($raw_params);
309 137f46d8 Ermal
	if(!xmlrpc_auth($params))
310
		return $xmlrpc_g['return']['authfail'];
311 07a7b08f Colin Smith
	filter_configure();
312 e700437b Scott Ullrich
	system_routing_configure();
313 41e6d4bd Seth Mos
	setup_gateways_monitor();
314 651c32e2 Bill Marquette
	relayd_configure();
315 c3fef0c9 jim-p
	require_once("openvpn.inc");
316
	openvpn_resync_all();
317
	services_dhcpd_configure();
318 62c4d0fb jim-p
	services_dnsmasq_configure();
319 0ce72662 jim-p
	local_sync_accounts();
320 137f46d8 Ermal
321 8da3de34 Colin Smith
	return $xmlrpc_g['return']['true'];
322 07a7b08f Colin Smith
}
323
324 8da3de34 Colin Smith
/*****************************/
325 de63649b Rafael Lucas
$carp_configure_doc = gettext("Basic XMLRPC wrapper for configuring CARP interfaces.");
326 efe7562e Scott Ullrich
$carp_configure_sig = array(
327 137f46d8 Ermal
	array(
328
		$XML_RPC_Boolean,
329
		$XML_RPC_String
330
	)
331
);
332 efe7562e Scott Ullrich
333
function interfaces_carp_configure_xmlrpc($raw_params) {
334
	global $xmlrpc_g;
335 137f46d8 Ermal
336 efe7562e Scott Ullrich
	$params = xmlrpc_params_to_php($raw_params);
337 137f46d8 Ermal
	if(!xmlrpc_auth($params))
338
		return $xmlrpc_g['return']['authfail'];
339 efe7562e Scott Ullrich
	interfaces_vips_configure();
340 137f46d8 Ermal
341 efe7562e Scott Ullrich
	return $xmlrpc_g['return']['true'];
342
}
343
344
/*****************************/
345 de63649b Rafael Lucas
$check_firmware_version_doc = gettext("Basic XMLRPC wrapper for check_firmware_version. This function will return the output of check_firmware_version upon completion.");
346 137f46d8 Ermal
347 8da3de34 Colin Smith
$check_firmware_version_sig = array(
348 137f46d8 Ermal
	array(
349
		$XML_RPC_String,
350
		$XML_RPC_String
351
	)
352
);
353 44488c3c Colin Smith
354
function check_firmware_version_xmlrpc($raw_params) {
355 b4d19b46 Bill Marquette
	global $xmlrpc_g, $XML_RPC_String;
356 137f46d8 Ermal
357 b4d19b46 Bill Marquette
	$params = xmlrpc_params_to_php($raw_params);
358 137f46d8 Ermal
	if(!xmlrpc_auth($params))
359
		return $xmlrpc_g['return']['authfail'];
360
361 8da3de34 Colin Smith
	return new XML_RPC_Response(new XML_RPC_Value(check_firmware_version(false), $XML_RPC_String));
362 44488c3c Colin Smith
}
363
364 e501de37 Ermal
/*****************************/
365 0567899d Ermal
$pfsense_firmware_version_doc = gettext("Basic XMLRPC wrapper for check_firmware_version. This function will return the output of check_firmware_version upon completion.");
366
367
$pfsense_firmware_version_sig = array (
368
        array (
369
                $XML_RPC_Struct,
370
                $XML_RPC_String
371
        )
372
);
373 e501de37 Ermal
374
function pfsense_firmware_version_xmlrpc($raw_params) {
375 0567899d Ermal
        global $xmlrpc_g;
376 e501de37 Ermal
377
        $params = xmlrpc_params_to_php($raw_params);
378
        if(!xmlrpc_auth($params))
379
                return $xmlrpc_g['return']['authfail'];
380
381 0567899d Ermal
        return new XML_RPC_Response(XML_RPC_encode(host_firmware_version()));
382 e501de37 Ermal
}
383
384 8da3de34 Colin Smith
/*****************************/
385 de63649b Rafael Lucas
$reboot_doc = gettext("Basic XMLRPC wrapper for rc.reboot.");
386 1cdca133 Colin Smith
$reboot_sig = array(array($XML_RPC_Boolean, $XML_RPC_String));
387 bd0fe65b Colin Smith
function reboot_xmlrpc($raw_params) {
388 8da3de34 Colin Smith
	global $xmlrpc_g;
389 137f46d8 Ermal
390 bd0fe65b Colin Smith
	$params = xmlrpc_params_to_php($raw_params);
391 137f46d8 Ermal
	if(!xmlrpc_auth($params))
392
		return $xmlrpc_g['return']['authfail'];
393 53cf5533 Colin Smith
	mwexec_bg("/etc/rc.reboot");
394 137f46d8 Ermal
395 8da3de34 Colin Smith
	return $xmlrpc_g['return']['true'];
396 bd0fe65b Colin Smith
}
397
398 8da3de34 Colin Smith
/*****************************/
399
$get_notices_sig = array(
400 137f46d8 Ermal
	array(
401
		$XML_RPC_Array,
402
		$XML_RPC_String
403
	),
404
	array(
405
		$XML_RPC_Array
406
	)
407
);
408 8da3de34 Colin Smith
409 d9064267 Colin Smith
function get_notices_xmlrpc($raw_params) {
410 8da3de34 Colin Smith
	global $g, $xmlrpc_g;
411 137f46d8 Ermal
412 b4d19b46 Bill Marquette
	$params = xmlrpc_params_to_php($raw_params);
413
	if(!xmlrpc_auth($params)) return $xmlrpc_g['return']['authfail'];
414 0674f163 sullrich
	require("notices.inc");
415 8da3de34 Colin Smith
	if(!$params) {
416 d9064267 Colin Smith
		$toreturn = get_notices();
417
	} else {
418 8da3de34 Colin Smith
		$toreturn = get_notices($params);
419 d9064267 Colin Smith
	}
420
	$response = new XML_RPC_Response(XML_RPC_encode($toreturn));
421 137f46d8 Ermal
422 d9064267 Colin Smith
	return $response;
423
}
424
425 67d78c87 Ermal
$xmlrpclockkey = lock('xmlrpc', LOCK_EX);
426
427 8da3de34 Colin Smith
/*****************************/
428 21dc3a7d Colin Smith
$server = new XML_RPC_Server(
429
        array(
430 137f46d8 Ermal
		'pfsense.exec_shell' => array('function' => 'exec_shell_xmlrpc',
431 0567899d Ermal
			'signature' => $exec_shell_sig,
432
			'docstring' => $exec_shell_doc),
433 137f46d8 Ermal
		'pfsense.exec_php' => array('function' => 'exec_php_xmlrpc',
434 0567899d Ermal
			'signature' => $exec_php_sig,
435
			'docstring' => $exec_php_doc),	
436 137f46d8 Ermal
		'pfsense.filter_configure' => array('function' => 'filter_configure_xmlrpc',
437 0567899d Ermal
			'signature' => $filter_configure_sig,
438
			'docstring' => $filter_configure_doc),
439 137f46d8 Ermal
		'pfsense.interfaces_carp_configure' => array('function' => 'interfaces_carp_configure_xmlrpc',
440 0567899d Ermal
			'docstring' => $carp_configure_sig),
441 137f46d8 Ermal
		'pfsense.backup_config_section' => array('function' => 'backup_config_section_xmlrpc',
442 0567899d Ermal
			'signature' => $backup_config_section_sig,
443
			'docstring' => $backup_config_section_doc),
444 137f46d8 Ermal
		'pfsense.restore_config_section' => array('function' => 'restore_config_section_xmlrpc',
445 0567899d Ermal
			'signature' => $restore_config_section_sig,
446
			'docstring' => $restore_config_section_doc),
447 137f46d8 Ermal
		'pfsense.merge_config_section' => array('function' => 'merge_config_section_xmlrpc',
448 0567899d Ermal
			'signature' => $merge_config_section_sig,
449
			'docstring' => $merge_config_section_doc),
450 137f46d8 Ermal
		'pfsense.merge_installedpackages_section_xmlrpc' => array('function' => 'merge_installedpackages_section_xmlrpc',
451 0567899d Ermal
			'signature' => $merge_config_section_sig,
452
			'docstring' => $merge_config_section_doc),							
453 137f46d8 Ermal
		'pfsense.check_firmware_version' => array('function' => 'check_firmware_version_xmlrpc',
454 0567899d Ermal
			'signature' => $check_firmware_version_sig,
455
			'docstring' => $check_firmware_version_doc),
456 e501de37 Ermal
		'pfsense.host_firmware_version' => array('function' => 'pfsense_firmware_version_xmlrpc',
457 0567899d Ermal
			'signature' => $pfsense_firmware_version_sig,
458
			'docstring' => $host_firmware_version_doc),
459 137f46d8 Ermal
		'pfsense.reboot' => array('function' => 'reboot_xmlrpc',
460 0567899d Ermal
			'signature' => $reboot_sig,
461
			'docstring' => $reboot_doc),
462 137f46d8 Ermal
		'pfsense.get_notices' => array('function' => 'get_notices_xmlrpc',
463 0567899d Ermal
			'signature' => $get_notices_sig)
464 50d49018 Colin Smith
        )
465
);
466 b298dd06 Scott Ullrich
467 67d78c87 Ermal
unlock($xmlrpclockkey);
468
469 f9d7c5b3 Scott Ullrich
    function array_overlay($a1,$a2)
470
    {
471
        foreach($a1 as $k => $v) {
472
            if(!array_key_exists($k,$a2)) continue;
473
            if(is_array($v) && is_array($a2[$k])){
474
                $a1[$k] = array_overlay($v,$a2[$k]);
475
            }else{
476
                $a1[$k] = $a2[$k];
477 0b581a8a Scott Ullrich
            }
478
        }
479 f9d7c5b3 Scott Ullrich
        return $a1;
480 0b581a8a Scott Ullrich
    }
481
482 de63649b Rafael Lucas
?>