Skip to content

Commit

Permalink
fix: Fix software publisher analysis in software inventory on MacOSX
Browse files Browse the repository at this point in the history
  • Loading branch information
g-bougard committed May 3, 2024
1 parent 4e52de0 commit b5c8b66
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 49 deletions.
4 changes: 2 additions & 2 deletions lib/GLPI/Agent/Task/Inventory/MacOS/Softwares.pm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ sub _getSoftwaresList {
if ($source eq 'Apple' || ($app->{'Location'} && $app->{'Location'} =~ m{/System/Library/(CoreServices|Frameworks)/})) {
$soft->{PUBLISHER} = 'Apple';
} elsif ($source eq 'Identified Developer' && $app->{'Signed by'}) {
my ($developer) = $app->{'Signed by'} =~ /^Developer ID Application: ([^,]*),/;
my ($developer) = $app->{'Signed by'} =~ /^Developer ID Application: ([^,]*),?/;
$developer = $1 if !empty($developer) && $developer =~ /^(.*)\s+\(.*\)$/;
$developer =~ s/\s*Incorporated.*/ Inc./i unless empty($developer);
$developer =~ s/\s*Corporation.*//i unless empty($developer);
Expand All @@ -87,7 +87,7 @@ sub _getSoftwaresList {
$publisher =~ s/\s*All rights reserved\.?\s*//i;
$publisher =~ s/\s*Incorporated.*/ Inc./i;
$publisher =~ s/\s*Corporation.*//i;
$publisher =~ s/\s*\d+(-\d+)?\s*//g;
$publisher =~ s/\s*\d+(\s*-\s*\d+)?\s*//g;
$soft->{PUBLISHER} = $publisher unless empty($publisher);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1756,7 +1756,7 @@ $results = [
'ARCH' => '32-bit (Unsupported)',
'INSTALLDATE' => '07/09/2020',
'NAME' => 'PhotoshopdotcomInspirationBrowser',
'PUBLISHER' => '-Adobe Systems Inc.',
'PUBLISHER' => 'Adobe Systems Inc.',
'SYSTEM_CATEGORY' => 'Applications/Adobe',
'VERSION' => '3.07'
},
Expand Down
Loading

0 comments on commit b5c8b66

Please sign in to comment.