summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 666ad0e)
raw | patch | inline | side by side (parent: 666ad0e)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 30 Apr 2008 11:37:43 +0000 (11:37 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 30 Apr 2008 11:37:43 +0000 (11:37 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10739 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/class_gosaSupportDaemon.inc | patch | blob | history |
diff --git a/gosa-core/include/class_gosaSupportDaemon.inc b/gosa-core/include/class_gosaSupportDaemon.inc
index f11ffb925406b4c759ae993dbf101a0546f3bd43..774d0e633190eeedfd8e15c86366e677de28dd06 100644 (file)
}
- /*! \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