From 73a3a531dbd4640ac08ee2f78cbd192a19a8d188 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 16 Jun 2008 09:39:19 +0000 Subject: [PATCH] Updated dak import git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11337 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_gosaSupportDaemon.inc | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/gosa-core/include/class_gosaSupportDaemon.inc b/gosa-core/include/class_gosaSupportDaemon.inc index 797d56f48..478eee9c7 100644 --- a/gosa-core/include/class_gosaSupportDaemon.inc +++ b/gosa-core/include/class_gosaSupportDaemon.inc @@ -1872,6 +1872,46 @@ class gosaSupportDaemon return(array()); } } + + + /*! \brief Imports the given key into the specified keyring (Servers mac address) + @param String The servers mac address + @param String The gpg key. + @return Boolean TRUE on success else FALSE + */ + public function DAK_import_key($server,$key) + { + /* Ensure that we send the event to a valid mac address + */ + if(!is_string($server) || !tests::is_mac($server)){ + trigger_error("No valid mac address given '".$server."'."); + return; + } + + /* Check if there is some cleanup required before importing the key. + There may be some Header lines like: + -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.4.6 (GNU/Linux) + */ + if(preg_match("/".normalizePreg("BEGIN PGP PUBLIC KEY BLOCK")."/",$key)){ + + /* Remove header */ + $key = preg_replace("/^.*\n\n/sim","",$key); + /* Remove footer */ + $key = preg_replace("/-----.*$/sim","",$key); + } + + /* Create query + */ + $xml_msg = " +
gosa_import_dak_key
+ ".$server." + ".$key." + GOSA +
"; + + $res = $this->_send($xml_msg,TRUE); + return($this->is_error()); + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -- 2.30.2