diff --git a/gosa-core/include/class_gosaSupportDaemon.inc b/gosa-core/include/class_gosaSupportDaemon.inc
index 503b8f0cfd3d9745bda6a7ffb1dae3b843f3f907..774d0e633190eeedfd8e15c86366e677de28dd06 100644 (file)
"<header>gosa_krb5_get_principal</header>".
"<principal>".$name."</principal>".
"<source>GOSA</source>".
- "<target>GOSA</target>".
+ "<target>".$server."</target>".
"</xml>";
return($this->_send($xml_msg,TRUE));
}
- /*! \brief Creates/Updates a given principal with a set of configuration settings.
+ /*! \brief Creates a given principal with a set of configuration settings.
+ For a list of configurable attributes have a look at 'krb5_get_principal()'.
+ (Uses the GOsa support daemon instead of the ldap database.)
+ @pram String The name of the principal to update. (e.g. peter@EXAMPLE.DE)
+ @return Boolean TRUE on success else FALSE.
+ */
+ public function krb5_add_principal($server,$name,$values)
+ {
+ $ret = FALSE;
+
+ /* Check if the given name is a valid request value
+ */
+ if(!is_string($name) || empty($name)){
+ trigger_error("The given principal name is not of type string or it is empty.");
+ return($ret);
+ }
+ if(!is_array($values) || !count($values)){
+ trigger_error("No valid update settings given. The parameter must be of type array and must contain at least one entry");
+ 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 $key => $value){
+ if(empty($key) || is_numeric($key)){
+ trigger_error("Invalid configuration attribute given '".$key."=".$value."'.");
+ return($ret);
+ }
+ if(is_array($value)){
+ foreach($value as $val){
+ $attrs.= "<$key>$val</$key>\n";
+ }
+ }else{
+ $attrs.= "<$key>$value</$key>\n";
+ }
+ }
+
+ /* Prepare request event
+ */
+ $xml_msg =
+ "<xml>".
+ "<header>gosa_krb5_create_principal</header>".
+ "<principal>".$name."</principal>".
+ $attrs.
+ "<source>GOSA</source>".
+ "<target>".$server."</target>".
+ "</xml>";
+
+ return($this->_send($xml_msg,TRUE) == TRUE && !$this->is_error());
+ }
+
+
+ /*! \brief Updates a given principal with a set of configuration settings.
For a list of configurable attributes have a look at 'krb5_get_principal()'.
(Uses the GOsa support daemon instead of the ldap database.)
@pram String The name of the principal to update. (e.g. peter@EXAMPLE.DE)
}
$attrs = "";
- foreach($values as $name => $value){
- if(empty($name) || is_numeric($name)){
- trigger_error("Invalid configuration attribute given '".$name."=".$value."'.");
+ foreach($values as $key => $value){
+ if(empty($key) || is_numeric($key)){
+ trigger_error("Invalid configuration attribute given '".$key."=".$value."'.");
return($ret);
}
- $attrs = "<$name>$value</$name>\n";
+ if(is_array($value)){
+ foreach($value as $val){
+ $attrs.= "<$key>$val</$key>\n";
+ }
+ }else{
+ $attrs.= "<$key>$value</$key>\n";
+ }
}
/* Prepare request event
"<principal>".$name."</principal>".
$attrs.
"<source>GOSA</source>".
- "<target>GOSA</target>".
+ "<target>".$server."</target>".
"</xml>";
return($this->_send($xml_msg,TRUE) == TRUE && !$this->is_error());
"<header>gosa_krb5_del_principal</header>".
"<principal>".$name."</principal>".
"<source>GOSA</source>".
- "<target>GOSA</target>".
+ "<target>".$server."</target>".
"</xml>";
return($this->_send($xml_msg,TRUE) == TRUE && !$this->is_error());
"<header>gosa_krb5_del_policy</header>".
"<policy>".$name."</policy>".
"<source>GOSA</source>".
- "<target>GOSA</target>".
+ "<target>".$server."</target>".
"</xml>";
return($this->_send($xml_msg,TRUE) == TRUE && !$this->is_error());
}