From bbe00cbe9021d6e8db7d39969f71206a908638b0 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 24 Apr 2008 12:08:32 +0000 Subject: [PATCH] Prepared principal functions git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10672 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_gosaSupportDaemon.inc | 55 ++++++++++++++++--- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/gosa-core/include/class_gosaSupportDaemon.inc b/gosa-core/include/class_gosaSupportDaemon.inc index 90cd20060..e4772236c 100644 --- a/gosa-core/include/class_gosaSupportDaemon.inc +++ b/gosa-core/include/class_gosaSupportDaemon.inc @@ -1217,6 +1217,13 @@ class gosaSupportDaemon { $res = array(); + /* Check if the given server is a valid mac address + */ + if(!tests::is_mac($server)){ + trigger_error("The given server address '".$server."' is invalid, it must be a valid mac address"); + return($ret); + } + /* Prepare request event */ $xml_msg = @@ -1235,7 +1242,7 @@ class gosaSupportDaemon @pram String The name of the requested principal. (e.g. peter@EXAMPLE.DE) @return Array A list containing the names of all configured principals. */ - public function krb5_get_principal($name) + public function krb5_get_principal($server,$name) { $ret = array(); @@ -1246,6 +1253,13 @@ class gosaSupportDaemon return($ret); } + /* Check if the given server is a valid mac address + */ + if(!tests::is_mac($server)){ + trigger_error("The given server address '".$server."' is invalid, it must be a valid mac address"); + return($ret); + } + /* Prepare request event */ $xml_msg = @@ -1266,7 +1280,7 @@ class gosaSupportDaemon @pram String The name of the principal to update. (e.g. peter@EXAMPLE.DE) @return Boolean TRUE on success else FALSE. */ - public function krb5_set_principal($name,$values) + public function krb5_set_principal($server,$name,$values) { $ret = FALSE; @@ -1281,6 +1295,13 @@ class gosaSupportDaemon return($ret); } + /* Check if the given server is a valid mac address + */ + if(!tests::is_mac($server)){ + trigger_error("The given server address '".$server."' is invalid, it must be a valid mac address"); + return($ret); + } + $attrs = ""; foreach($values as $name => $value){ if(empty($name) || is_numeric($name)){ @@ -1301,7 +1322,7 @@ class gosaSupportDaemon "GOSA". ""; - return($this->_send($xml_msg,TRUE)); + return($this->_send($xml_msg,TRUE) == TRUE && !$this->is_error()); } @@ -1310,7 +1331,7 @@ class gosaSupportDaemon @pram String The name of the principal. (e.g. peter@EXAMPLE.DE) @return Boollean TRUE on success else FALSE */ - public function krb5_del_principal($name) + public function krb5_del_principal($server,$name) { $ret = FALSE; @@ -1321,6 +1342,13 @@ class gosaSupportDaemon return($ret); } + /* Check if the given server is a valid mac address + */ + if(!tests::is_mac($server)){ + trigger_error("The given server address '".$server."' is invalid, it must be a valid mac address"); + return($ret); + } + /* Prepare request event */ $xml_msg = @@ -1330,9 +1358,8 @@ class gosaSupportDaemon "GOSA". "GOSA". ""; - - return($this->_send($xml_msg,TRUE)); + return($this->_send($xml_msg,TRUE) == TRUE && !$this->is_error()); } @@ -1344,6 +1371,13 @@ class gosaSupportDaemon { $res = array(); + /* Check if the given server is a valid mac address + */ + if(!tests::is_mac($server)){ + trigger_error("The given server address '".$server."' is invalid, it must be a valid mac address"); + return($ret); + } + /* Prepare request event */ $xml_msg = @@ -1538,10 +1572,17 @@ class gosaSupportDaemon (Uses the GOsa support daemon instead of the ldap database.) @return Boolean TRUE on success else FALSE */ - public function krb5_del_policy($name) + public function krb5_del_policy($server,$name) { $ret = FALSE; + /* Check if the given server is a valid mac address + */ + if(!tests::is_mac($server)){ + trigger_error("The given server address '".$server."' is invalid, it must be a valid mac address"); + return($ret); + } + /* Check if the given name is a valid request value */ if(!is_string($name) || empty($name)){ -- 2.30.2