mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-01 14:55:10 +00:00
Fix two bugs
- rpc was failing when passing arrays because the perl is_utf8 string flag was set even though its only sending numbers but newer HTTP::Message checks for this is_utf8 and if it finds it aborts. - fix local profiles local profiles were failing because 1.) the parameters to serialize_profile were bad 2.) the file location was not getting updated so they would get written back to the inactive profiles directory
This commit is contained in:
@@ -289,6 +289,13 @@ sub fetch_usernames_from_uids ($) {
|
|||||||
}
|
}
|
||||||
if (@uids) {
|
if (@uids) {
|
||||||
my $repo_client = get_repo_client( $repo_url );
|
my $repo_client = get_repo_client( $repo_url );
|
||||||
|
#RPC::XML will serialize the array into XML with the is_utf8 flag set
|
||||||
|
#which causes, HTTP:Message to fail. Looping on the array elements
|
||||||
|
#stops this from happening, and since these are all numbers it
|
||||||
|
#will not cause problems.
|
||||||
|
my $foo (@uids) {
|
||||||
|
Encode::_utf8_off($foo);
|
||||||
|
}
|
||||||
my $res = $repo_client->send_request('LoginNamesFromUserIds', [@uids]);
|
my $res = $repo_client->send_request('LoginNamesFromUserIds', [@uids]);
|
||||||
if (did_result_succeed($res)) {
|
if (did_result_succeed($res)) {
|
||||||
my @usernames = @{ $res->value };
|
my @usernames = @{ $res->value };
|
||||||
|
@@ -726,7 +726,7 @@ sub create_new_profile {
|
|||||||
# if the executable exists on this system, pull in extra dependencies
|
# if the executable exists on this system, pull in extra dependencies
|
||||||
if (-f $fqdbin) {
|
if (-f $fqdbin) {
|
||||||
my $hashbang = head($fqdbin);
|
my $hashbang = head($fqdbin);
|
||||||
if ($hashband && $hashbang =~ /^#!\s*(\S+)/) {
|
if ($hashbang && $hashbang =~ /^#!\s*(\S+)/) {
|
||||||
my $interpreter = get_full_path($1);
|
my $interpreter = get_full_path($1);
|
||||||
$profile->{$fqdbin}{allow}{path}->{$interpreter}{mode} = str_to_mode("ix");
|
$profile->{$fqdbin}{allow}{path}->{$interpreter}{mode} = str_to_mode("ix");
|
||||||
$profile->{$fqdbin}{allow}{path}->{$interpreter}{audit} = 0;
|
$profile->{$fqdbin}{allow}{path}->{$interpreter}{audit} = 0;
|
||||||
@@ -795,12 +795,13 @@ sub get_profile {
|
|||||||
# set the profile to complain mode
|
# set the profile to complain mode
|
||||||
my $uname = gettext( "Inactive local profile for ") . $fqdbin;
|
my $uname = gettext( "Inactive local profile for ") . $fqdbin;
|
||||||
$inactive_profile->{$fqdbin}{$fqdbin}{flags} = "complain";
|
$inactive_profile->{$fqdbin}{$fqdbin}{flags} = "complain";
|
||||||
|
# inactive profiles store where they came from
|
||||||
|
delete $inactive_profile->{$fqdbin}{$fqdbin}{filename};
|
||||||
$profile_hash{$uname} =
|
$profile_hash{$uname} =
|
||||||
{
|
{
|
||||||
"username" => $uname,
|
"username" => $uname,
|
||||||
"profile_type" => "INACTIVE_LOCAL",
|
"profile_type" => "INACTIVE_LOCAL",
|
||||||
"profile" => serialize_profile(
|
"profile" => serialize_profile($inactive_profile->{$fqdbin},
|
||||||
${%$inactive_profile}{$fqdbin},
|
|
||||||
$fqdbin
|
$fqdbin
|
||||||
),
|
),
|
||||||
"profile_data" => $inactive_profile,
|
"profile_data" => $inactive_profile,
|
||||||
|
Reference in New Issue
Block a user