From efb5fda88f16498336c828d80a5fe21808dc2da9 Mon Sep 17 00:00:00 2001 From: janw Date: Fri, 13 Jun 2008 12:24:53 +0000 Subject: [PATCH] Various Fixes. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11332 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/gosa-si-server | 4 +- gosa-si/modules/GosaPackages.pm | 2 +- gosa-si/server/events/gosaTriggered.pm | 54 +++++++++++++++++--------- 3 files changed, 39 insertions(+), 21 deletions(-) diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index 40f666d1a..262d1afd1 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -101,6 +101,7 @@ our ($ldap_uri, $ldap_base, $ldap_admin_dn, $ldap_admin_password, $ldap_server_d # dak variables our $dak_base_directory; our $dak_signing_keys_directory; +our $dak_queue_directory; our $dak_user; # specifies the verbosity of the daemon_log @@ -238,7 +239,8 @@ my $max_children = 2; "messaging-db-loop-delay" => [\$messaging_db_loop_delay, 3], "key" => [\$GosaPackages_key, "none"], "dak-base" => [\$dak_base_directory, "/srv/archive"], - "dak-keyring" => [\$dak_signing_keys_directory, "/srv/archive/s3kr1t"], + "dak-keyring" => [\$dak_signing_keys_directory, "/srv/archive/keyrings"], + "dak-queue" => [\$dak_queue_directory, "/srv/archive/queue"], "dak-user" => [\$dak_user, "deb-dak"], }, "ClientPackages" => { diff --git a/gosa-si/modules/GosaPackages.pm b/gosa-si/modules/GosaPackages.pm index 8c05daf39..5587dd218 100644 --- a/gosa-si/modules/GosaPackages.pm +++ b/gosa-si/modules/GosaPackages.pm @@ -318,7 +318,7 @@ sub process_gosa_msg { &main::daemon_log("$session_id ERROR: GosaPackages: no event handler or core function defined for '$header'", 1); @out_msg_l = (); } elsif ($out_msg_l[0] eq 'knownclienterror') { - &main::daemon_log("$session_id ERROR: no event handler found for '$header', check client registraion events!", 1); + &main::daemon_log("$session_id ERROR: no event handler found for '$header', check client registration events!", 1); &main::daemon_log("$session_id ERROR: no or more than 1 hits are found at known_clients_db with sql query: '$sql_events'", 1); &main::daemon_log("$session_id ERROR: processing is aborted and message will not be forwarded", 1); @out_msg_l = (); diff --git a/gosa-si/server/events/gosaTriggered.pm b/gosa-si/server/events/gosaTriggered.pm index e692aaa75..0b35e500e 100644 --- a/gosa-si/server/events/gosaTriggered.pm +++ b/gosa-si/server/events/gosaTriggered.pm @@ -36,6 +36,7 @@ my @events = ( "get_dak_keyring", "import_dak_key", "remove_dak_key", +# "get_dak_queue", ); @EXPORT = @events; @@ -867,16 +868,14 @@ sub get_dak_keyring { my @keys; my %data; - my $pubring = $main::dak_signing_keys_directory."/dot-gnupg/pubring.gpg"; - my $secring = $main::dak_signing_keys_directory."/dot-gnupg/secring.gpg"; + my $keyring = $main::dak_signing_keys_directory."/keyring.gpg"; my $gpg_cmd = `which gpg`; chomp $gpg_cmd; - my $gpg = "$gpg_cmd --no-default-keyring --no-random-seed --keyring $pubring --secret-keyring $secring"; + my $gpg = "$gpg_cmd --no-default-keyring --no-random-seed --keyring $keyring"; # Check if the keyrings are in place and readable if( - &run_as($main::dak_user, "test -r $pubring")->{'resultCode'} != 0 || - &run_as($main::dak_user, "test -r $secring")->{'resultCode'} != 0 + &run_as($main::dak_user, "test -r $keyring")->{'resultCode'} != 0 ) { &main::daemon_log("ERROR: Dak Keyrings are unreadable!"); } else { @@ -919,22 +918,21 @@ sub import_dak_key { my %data; - my $pubring = $main::dak_signing_keys_directory."/dot-gnupg/pubring.gpg"; - my $secring = $main::dak_signing_keys_directory."/dot-gnupg/secring.gpg"; + my $keyring = $main::dak_signing_keys_directory."/keyring.gpg"; my $gpg_cmd = `which gpg`; chomp $gpg_cmd; - my $gpg = "$gpg_cmd --no-default-keyring --no-random-seed --keyring $pubring --secret-keyring $secring"; + my $gpg = "$gpg_cmd --no-default-keyring --no-random-seed --keyring $keyring"; # Check if the keyrings are in place and writable if( - &run_as($main::dak_user, "test -w $pubring")->{'resultCode'} != 0 || - &run_as($main::dak_user, "test -w $secring")->{'resultCode'} != 0 + &run_as($main::dak_user, "test -w $keyring")->{'resultCode'} != 0 ) { - &main::daemon_log("ERROR: Dak Keyrings are not writable!"); + &main::daemon_log("ERROR: Dak Keyring is not writable!"); } else { - open(keyfile, ">/tmp/gosa_si_tmp_dak_key"); - print keyfile $key; - close(keyfile); + my $keyfile; + open($keyfile, ">/tmp/gosa_si_tmp_dak_key"); + print $keyfile $key; + close($keyfile); my $command = "$gpg --import /tmp/gosa_si_tmp_dak_key"; my $output = &run_as($main::dak_user, $command); unlink("/tmp/gosa_si_tmp_dak_key"); @@ -959,16 +957,14 @@ sub remove_dak_key { my %data; - my $pubring = $main::dak_signing_keys_directory."/dot-gnupg/pubring.gpg"; - my $secring = $main::dak_signing_keys_directory."/dot-gnupg/secring.gpg"; + my $keyring = $main::dak_signing_keys_directory."/keyring.gpg"; my $gpg_cmd = `which gpg`; chomp $gpg_cmd; - my $gpg = "$gpg_cmd --no-default-keyring --no-random-seed --keyring $pubring --secret-keyring $secring"; + my $gpg = "$gpg_cmd --no-default-keyring --no-random-seed --keyring $keyring"; # Check if the keyrings are in place and writable if( - &run_as($main::dak_user, "test -w $pubring")->{'resultCode'} != 0 || - &run_as($main::dak_user, "test -w $secring")->{'resultCode'} != 0 + &run_as($main::dak_user, "test -w $keyring")->{'resultCode'} != 0 ) { &main::daemon_log("ERROR: Dak Keyrings are not writable!"); } else { @@ -987,5 +983,25 @@ sub remove_dak_key { } +#sub get_dak_queue { +# my ($msg, $msg_hash, $session_id) = @_; +# my %data; +# my $source = @{$msg_hash->{'source'}}[0]; +# my $target = @{$msg_hash->{'target'}}[0]; +# my $header= @{$msg_hash->{'header'}}[0]; +# +# my %data; +# +# foreach my $dir ("unchecked", "new", "accepted") { +# foreach my $file(<"$main::dak_queue_directory/$dir/*.changes">) { +# } +# } +# +# my $out_msg = &build_msg("get_dak_queue", $target, $source, \%data); +# my @out_msg_l = ($out_msg); +# return @out_msg_l; +#} + + # vim:ts=4:shiftwidth:expandtab 1; -- 2.30.2