summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7573b3b)
raw | patch | inline | side by side (parent: 7573b3b)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 20 Jun 2008 08:33:55 +0000 (08:33 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 20 Jun 2008 08:33:55 +0000 (08:33 +0000) |
Add commandline to run_as result.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11390 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11390 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/modules/GosaSupportDaemon.pm | patch | blob | history | |
gosa-si/server/events/gosaTriggered.pm | patch | blob | history |
index d4c7ee49559296c98a65c4b062ba7fc70ec1a365..e5da00754d74c02bd5947b4cef8936cfdc6cf761 100644 (file)
if(! -x $sudo_cmd) {
&main::daemon_log("ERROR: The sudo utility is not available! Please fix this!");
}
- open(PIPE, "$sudo_cmd su - $uid -c '$command' |");
+ my $cmd_line= "$sudo_cmd su - $uid -c '$command'";
+ open(PIPE, "$cmd_line |");
my $result = {'resultCode' => $?};
+ $result->{'command'} = $cmd_line;
push @{$result->{'output'}}, <PIPE>;
return $result;
}
index c51515022eef41b1a7640bca852c0fd5f17ee737..6703714c9ccec539dca266a3245f4444a9d257dc 100644 (file)
} else {
my $command = "$gpg --list-keys";
my $output = &run_as($main::dak_user, $command);
+ &main::daemon_log("$session_id DEBUG: ".$output->{'command'}, 7);
my $i=0;
foreach (@{$output->{'output'}}) {
if ($_ =~ m/^pub\s.*$/) {
($keys[$i]->{'pub'}->{'length'}, $keys[$i]->{'pub'}->{'uid'}, $keys[$i]->{'pub'}->{'created'}) = ($1, $2, $3)
if $_ =~ m/^pub\s*?(\w*?)\/(\w*?)\s(\d{4}-\d{2}-\d{2})/;
- $keys[$1]->{'pub'}->{'expires'} = $1 if $_ =~ m/^pub\s*?\w*?\/\w*?\s\d{4}-\d{2}-\d{2}\s\[expires:\s(\d{4}-\d{2}-\d{2})\]/;
+ $keys[$i]->{'pub'}->{'expires'} = $1 if $_ =~ m/^pub\s*?\w*?\/\w*?\s\d{4}-\d{2}-\d{2}\s\[expires:\s(\d{4}-\d{2}-\d{2})\]/;
+ $keys[$i]->{'pub'}->{'expired'} = $1 if $_ =~ m/^pub\s*?\w*?\/\w*?\s\d{4}-\d{2}-\d{2}\s\[expired:\s(\d{4}-\d{2}-\d{2})\]/;
} elsif ($_ =~ m/^sub\s.*$/) {
($keys[$i]->{'sub'}->{'length'}, $keys[$i]->{'sub'}->{'uid'}, $keys[$i]->{'sub'}->{'created'}) = ($1, $2, $3)
if $_ =~ m/^sub\s*?(\w*?)\/(\w*?)\s(\d{4}-\d{2}-\d{2})/;
- $keys[$1]->{'sub'}->{'expires'} = $1 if $_ =~ m/^pub\s*?\w*?\/\w*?\s\d{4}-\d{2}-\d{2}\s\[expires:\s(\d{4}-\d{2}-\d{2})\]/;
+ $keys[$i]->{'sub'}->{'expires'} = $1 if $_ =~ m/^pub\s*?\w*?\/\w*?\s\d{4}-\d{2}-\d{2}\s\[expires:\s(\d{4}-\d{2}-\d{2})\]/;
+ $keys[$i]->{'sub'}->{'expired'} = $1 if $_ =~ m/^pub\s*?\w*?\/\w*?\s\d{4}-\d{2}-\d{2}\s\[expired:\s(\d{4}-\d{2}-\d{2})\]/;
} elsif ($_ =~ m/^uid\s.*$/) {
push @{$keys[$i]->{'uid'}}, $1 if $_ =~ m/^uid\s*?([^\s].*?)$/;
} elsif ($_ =~ m/^$/) {
my $i=0;
foreach my $key (@keys) {
+ # &main::daemon_log(Dumper($key));
&add_content2xml_hash($out_hash, "answer".$i++, $key);
}
my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0];
close($keyfile);
my $command = "$gpg --import /tmp/gosa_si_tmp_dak_key";
my $output = &run_as($main::dak_user, $command);
+ &main::daemon_log("$session_id DEBUG: ".$output->{'command'}, 7);
unlink("/tmp/gosa_si_tmp_dak_key");
if($output->{'resultCode'} != 0) {
my $target = @{$msg_hash->{'target'}}[0];
my $header= @{$msg_hash->{'header'}}[0];
my $session_id = @{$msg_hash->{'session_id'}}[0];
- my $key = @{$msg_hash->{'uid'}}[0];
+ my $key = @{$msg_hash->{'keyid'}}[0];
# build return message with twisted target and source
my $out_hash = &main::create_xml_hash("answer_$header", $target, $source);
&add_content2xml_hash($out_hash, "session_id", $session_id);
if(&run_as($main::dak_user, "$gpg --list-keys $key")->{'resultCode'} == 0) {
my $command = "$gpg --batch --yes --delete-key $key";
my $output = &run_as($main::dak_user, $command);
+ &main::daemon_log("$session_id DEBUG: ".$output->{'command'}, 7);
} else {
&add_content2xml_hash($out_hash, "error", "DAK key with id '$key' was not found in keyring");
}