diff --git a/init/updateboot.pl b/init/updateboot.pl index 1ad0909d9..06f355b68 100755 --- a/init/updateboot.pl +++ b/init/updateboot.pl @@ -41,6 +41,7 @@ if ($product) { &flush_file_lines($temp); copy_source_dest($temp, "$systemd_root/$product.service"); + &set_ownership_permissions(0, 0, 0644, "$systemd_root/$product.service"); $reload_daemon->(); if ($status eq "disabled") { @@ -70,7 +71,7 @@ if ($product) { } &flush_file_lines($temp); ©_source_dest($temp, "/etc/init.d/$product"); - chmod(0755, "/etc/init.d/$product"); + &set_ownership_permissions(0, 0, 0755, "/etc/init.d/$product"); &unlink_file($temp); if ($status == 2 || $want_boot) { &enable_at_boot($product); @@ -99,6 +100,7 @@ if ($product) { } elsif (-d "/etc/init.d") { copy_source_dest("$root_directory/webmin-init", "/etc/init.d/$product"); + &set_ownership_permissions(0, 0, 0755, "/etc/init.d/$product"); system("chkconfig --add $product >/dev/null 2>&1"); } } diff --git a/systemd/systemd-lib.pl b/systemd/systemd-lib.pl index e1b7b4888..fd9b3db2d 100644 --- a/systemd/systemd-lib.pl +++ b/systemd/systemd-lib.pl @@ -2552,6 +2552,32 @@ my $out = backquote_logged($cmd." 2>&1 &1 &1 sub { '1x')); is(ref($a), 'ARRAY', 'array -> arrayref'); is_deeply($a, [1, 'x'], 'array elements parsed in order'); + + # Scalar tags must retain their type when a nested value is later encoded. + require JSON::PP; + my $typed = parse_xml_value(value_tree( + 'integer1800boolean1double2.5string1800')); + is(JSON::PP->new->canonical->encode($typed), + '{"boolean":1,"double":2.5,"integer":1800,"string":"1800"}', + 'nested scalar types preserved for JSON'); }; # Round-trip: encode_xml_value then parse_xml_value should reproduce the diff --git a/xmlrpc-lib.pl b/xmlrpc-lib.pl index 02a37963f..d0d5f0edd 100644 --- a/xmlrpc-lib.pl +++ b/xmlrpc-lib.pl @@ -18,7 +18,14 @@ my ($base64) = &find_xmls("base64", $value, 1); my ($struct) = &find_xmls("struct", $value, 1); my ($array) = &find_xmls("array", $value, 1); if ($scalar) { - return $scalar->[1]->[2] // ""; + my ($type, $content) = ($scalar->[0], $scalar->[1]->[2] // ""); + $type = lc($type); + + return int($content) if ($type eq "int" || $type eq "i4"); + return $content ? 1 : 0 if ($type eq "boolean"); + return $content + 0.0 if ($type eq "double"); + + return $content; } elsif ($date) { # Need to decode date