Code

Added krb5 stubs
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 23 Apr 2008 06:34:15 +0000 (06:34 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 23 Apr 2008 06:34:15 +0000 (06:34 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10621 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/server/events/gosaTriggered.pm
gosa-si/tests/client.php

index f6950552ca4db9fc85df921cc43aafaf5f327883..63e7ce832937e59d7c0a6d5e36309f7f2abe5af8 100644 (file)
@@ -31,7 +31,15 @@ my @events = (
     "recreate_fai_release_db",
     "recreate_packages_list_db",
     "send_user_msg", 
-       "get_available_kernel",
+    "get_available_kernel",
+    "krb5_list_principals",
+    "krb5_list_policies",
+    "krb5_get_principal",
+    "krb5_set_principal",
+    "krb5_del_principal",
+    "krb5_get_policy",
+    "krb5_set_policy",
+    "krb5_del_policy",
     );
 @EXPORT = @events;
 
@@ -247,9 +255,6 @@ sub recreate_fai_release_db {
 sub recreate_packages_list_db {
        my ($msg, $msg_hash, $session_id) = @_ ;
        my $out_msg;
-       my $header = @{$msg_hash->{'header'}}[0];
-       my $source = @{$msg_hash->{'source'}}[0];
-       my $target = @{$msg_hash->{'target'}}[0];
 
        my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
        if( defined $jobdb_id) {
@@ -258,7 +263,7 @@ sub recreate_packages_list_db {
                my $res = $main::job_db->exec_statement($sql_statement);
        }
 
-       &main::create_packages_list_db(undef,undef,undef);
+       &main::create_packages_list_db;
 
        my @out_msg_l = ( $out_msg );
        return @out_msg_l;
@@ -716,4 +721,60 @@ sub get_available_kernel {
 }
 
 
+sub krb5_list_principals {
+        my ($msg, $msg_hash, $session_id) = @_;
+        $msg =~ s/gosa_krb5/krb5/g;
+        return ( $msg );
+}
+
+
+sub krb5_set_principal {
+        my ($msg, $msg_hash, $session_id) = @_;
+        $msg =~ s/gosa_krb5/krb5/g;
+        return ( $msg );
+}
+
+
+sub krb5_get_principal {
+        my ($msg, $msg_hash, $session_id) = @_;
+        $msg =~ s/gosa_krb5/krb5/g;
+        return ( $msg );
+}
+
+
+sub krb5_del_principal {
+        my ($msg, $msg_hash, $session_id) = @_;
+        $msg =~ s/gosa_krb5/krb5/g;
+        return ( $msg );
+}
+
+
+sub krb5_list_policies {
+        my ($msg, $msg_hash, $session_id) = @_;
+        $msg =~ s/gosa_krb5/krb5/g;
+        return ( $msg );
+}
+
+
+sub krb5_get_policy {
+        my ($msg, $msg_hash, $session_id) = @_;
+        $msg =~ s/gosa_krb5/krb5/g;
+        return ( $msg );
+}
+
+
+sub krb5_set_policy {
+        my ($msg, $msg_hash, $session_id) = @_;
+        $msg =~ s/gosa_krb5/krb5/g;
+        return ( $msg );
+}
+
+
+sub krb5_del_policy {
+        my ($msg, $msg_hash, $session_id) = @_;
+        $msg =~ s/gosa_krb5/krb5/g;
+        return ( $msg );
+}
+
+
 1;
index 1c40df4f612827feb717d016a8a97099730800ad..7a92a4c0b5da30ced6135cfb3e27b7eec7e0a63e 100755 (executable)
@@ -9,108 +9,110 @@ $zahl= 1;
 for($count = 1; $count <= $zahl; $count++)
 {
 
-$sock = new Socket_Client("127.0.0.1","20081",TRUE,1);
-$sock->setEncryptionKey("secret-gosa-password");
-
-if($sock->connected()){
-       /* Prepare a hunge bunch of data to be send */
-
-# jobdb add
-#$data = "<xml> <header>gosa_network_completition</header> <source>GOSA</source><target>GOSA</target><hostname>ws-muc-2</hostname></xml>";
-#$data = "<xml> <header>job_sayHello</header> <source>10.89.1.155:20083</source><target>00:01:6c:9d:b9:fa</target><mac>00:1B:77:04:8A:6C</mac> <timestamp>20130102133908</timestamp> </xml>";
-#$data = "<xml> <header>job_ping</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <macaddress>00:01:6c:9d:b9:fa</macaddress><timestamp>19700101000000</timestamp> </xml>";
-
-
-# jobdb delete
-#$data = "<xml> <header>gosa_delete_jobdb_entry</header> <source>GOSA</source> <target>GOSA</target> <where><clause><phrase><id>1</id></phrase></clause></where></xml>";
-
-# smbhash
-#$data = "<xml> <header>gosa_gen_smb_hash</header> <source>GOSA</source><target>GOSA</target><password>tester</password></xml>";
-
-# Reload ldap config
-#$data = "<xml> <header>gosa_trigger_reload_ldap_config</header> <source>GOSA</source><target>00:01:6c:9d:b9:fa</target></xml>";
-
-# jobdb update  
-#$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <source>GOSA</source> <target>GOSA</target> <where><clause><phrase> <id>1</id></phrase></clause></where> <update><timestamp>19700101000000</timestamp></update></xml>";
-#$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <source>GOSA</source><target>GOSA</target><where><clause><phrase> <macaddress>00:01:6c:9d:b9:fa</macaddress></phrase></clause> </where> <update><status>processing</status> <result>update</result></update></xml>";
-
-# jobdb query
-#$data = "<xml><header>gosa_query_jobdb</header><source>GOSA</source> <target>GOSA</target><where><clause><connector>and</connector><phrase><operator>gt</operator><ROWID>0</ROWID></phrase><phrase><operator>le</operator><ROWID>5</ROWID></phrase></clause></where></xml>";
-#$data = "<xml><header>gosa_query_jobdb</header><source>GOSA</source> <target>GOSA</target> <where> <clause> <phrase> <operator>like</operator> <timestamp>%0102%</timestamp> </phrase> </clause> </where> </xml>";
-#$data= "<xml><header>gosa_query_jobdb</header><source>GOSA</source> <target>GOSA</target><where><clause><phrase><headertag>ping</headertag></phrase></clause></where><limit><from>0</from><to>3</to></limit></xml>";
-#$data= "<xml><header>gosa_query_jobdb</header><source>GOSA</source> <target>GOSA</target><where><clause><phrase><HEADERTAG>trigger_action_reinstall</HEADERTAG></phrase></clause></where><limit><from>0</from><to>25</to></limit><orderby>timestamp DESC</orderby></xml>";
-#$data= "<xml><header>gosa_query_jobdb</header><source>GOSA</source> <target>GOSA</target></xml>";
-#$data= "<xml><header>gosa_query_fai_server</header><source>GOSA</source> <target>GOSA</target></xml>";
-#$data= "<xml><header>gosa_query_fai_release</header><source>GOSA</source> <target>GOSA</target></xml>";
-#$data= "<xml><header>gosa_query_packages_list</header><source>GOSA</source> <target>GOSA</target></xml>";
-
-
-# jobdb count
-#$data = "<xml> <header>gosa_count_jobdb</header><source>GOSA</source> <target>GOSA</target></xml>";
-#$data = "<xml> <header>gosa_count_fai_server</header><source>GOSA</source> <target>GOSA</target></xml>";
-#$data = "<xml> <header>gosa_count_fai_release</header><source>GOSA</source> <target>GOSA</target></xml>";
-
-# jobdb clear
-#$data = "<xml> <header>gosa_clear_jobdb</header> <source>GOSA</source> <target>GOSA</target></xml>";
-
-# set gosa-si-client to 'activated'
-#$data = "<xml> <header>job_set_activated_for_installation</header> <target>10.89.1.31:20083</target> <source>GOSA</source> <macaddress>00:01:6c:9d:b9:fa</macaddress><timestamp>22220101000000</timestamp></xml>";
-
-
-# trigger jobs at client
-#$data = "<xml> <header>gosa_detect_hardware</header> <target>10.89.1.31:20083</target> <source>10.89.1.31:20081</source> </xml>";
-#$data = "<xml> <header>gosa_new_key_for_client</header> <target>00:01:6c:9d:b9:fa</target> <source>10.89.1.31:20081</source> </xml>";
-#$data = "<xml> <header>job_trigger_action_wake</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> <timestamp>19700101000000</timestamp></xml>";
-#$data = "<xml> <header>gosa_trigger_action_faireboot</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> </xml>";
-#$data = "<xml> <header>gosa_trigger_action_reboot</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> </xml>";
-#$data = "<xml> <header>job_trigger_action_reinstall</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <macaddress>00:01:6c:9d:b9:fa</macaddress> <timestamp>19700101000000</timestamp> </xml>";
-#$data = "<xml> <header>job_trigger_action_instant_update</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> <timestamp>19700101000000</timestamp> </xml>";
-#$data = "<xml> <header>gosa_ping</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> </xml>";
-
-
-# get_login_usr_for_client
-#$data = "<xml> <header>gosa_get_login_usr_for_client</header> <target>GOSA</target> <source>GOSA</source> <client>00:01:6c:9d:b9:fa</client></xml>";
-
-# get_client_for_login_usr
-#$data = "<xml> <header>gosa_get_client_for_login_usr</header> <target>GOSA</target> <source>GOSA</source> <usr>harald</usr></xml>";
-
-##################
-# recreate fai dbs
-#$data = "<xml> <header>gosa_recreate_fai_server_db</header> <target>GOSA</target> <source>GOSA</source></xml>"; 
-$data = "<xml> <header>gosa_recreate_fai_release_db</header> <target>GOSA</target> <source>GOSA</source></xml>"; 
-#$data = "<xml> <header>gosa_recreate_packages_list_db</header> <target>GOSA</target> <source>GOSA</source></xml>"; 
-
-###########
-# messaging 
-#$data = "<xml> <header>gosa_send_user_msg</header> <target>GOSA</target> <source>GOSA</source> <subject>eine wichtige nachricht</subject> <from>admin</from> <to>rettenbe</to> <delivery_time>20130101235959</delivery_time> <message>kaffeepause</message> </xml>"; 
-
-
-################
-# logHandling.pm
-# all date and mac parameter accept regular expression as input unless other instructions are given
-# show_log_by_mac, show_log_by_date, show_log_by_date_and_mac, show_log_files_by_date_and_mac, 
-# get_log_file_by_date_and_mac, delete_log_by_date_and_mac, get_recent_log_by_mac
-#$data = "<xml> <header>gosa_show_log_by_mac</header> <target>GOSA</target> <source>GOSA</source> <mac>00:01:6C:9D:B9:FA</mac> <mac>00:01:6c:9d:b9:fb</mac> </xml>"; 
-#$data = "<xml> <header>gosa_show_log_by_date</header> <target>GOSA</target> <source>GOSA</source> <date>20080313</date> <date>20080323</date> </xml>"; 
-#$data = "<xml> <header>gosa_show_log_by_date_and_mac</header> <target>GOSA</target> <source>GOSA</source> <date>200803</date> <mac>00:01:6c:9d:b9:FA</mac> </xml>"; 
-#$data = "<xml> <header>gosa_delete_log_by_date_and_mac</header> <target>GOSA</target> <source>GOSA</source>  <mac>00:01:6c:9d:b9:fa</mac></xml>"; 
-#$data = "<xml> <header>gosa_get_recent_log_by_mac</header> <target>GOSA</target> <source>GOSA</source> <mac>00:01:6c:9d:b9:fa</mac></xml>"; 
-# exact date and mac are required as input
-#$data = "<xml> <header>gosa_show_log_files_by_date_and_mac</header> <target>GOSA</target> <source>GOSA</source> <date>install_20080311_090900</date> <mac>00:01:6c:9d:b9:fa</mac> </xml>"; 
-#$data = "<xml> <header>gosa_get_log_file_by_date_and_mac</header> <target>GOSA</target> <source>GOSA</source> <date>install_20080311_090900</date> <mac>00:01:6c:9d:b9:fa</mac> <log_file>boot.log</log_file></xml>"; 
-
-#########
-# testing
-#$data = "<xml> <header>gosa_query_packages_list</header><source>GOSA</source> <target>GOSA</target></xml>";
+  $sock = new Socket_Client("127.0.0.1","20081",TRUE,1);
+  $sock->setEncryptionKey("secret-gosa-password");
+
+  if($sock->connected()){
+
+    /* Prepare a hunge bunch of data to be send */
+    # jobdb add
+    #$data = "<xml> <header>gosa_network_completition</header> <source>GOSA</source><target>GOSA</target><hostname>ws-muc-2</hostname></xml>";
+    #$data = "<xml> <header>job_sayHello</header> <source>10.89.1.155:20083</source><target>00:01:6c:9d:b9:fa</target><mac>00:1B:77:04:8A:6C</mac> <timestamp>20130102133908</timestamp> </xml>";
+    #$data = "<xml> <header>job_ping</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <macaddress>00:01:6c:9d:b9:fa</macaddress><timestamp>19700101000000</timestamp> </xml>";
+
+    # jobdb delete
+    #$data = "<xml> <header>gosa_delete_jobdb_entry</header> <source>GOSA</source> <target>GOSA</target> <where><clause><phrase><id>1</id></phrase></clause></where></xml>";
+
+    # smbhash
+    #$data = "<xml> <header>gosa_gen_smb_hash</header> <source>GOSA</source><target>GOSA</target><password>tester</password></xml>";
+
+    # Reload ldap config
+    #$data = "<xml> <header>gosa_trigger_reload_ldap_config</header> <source>GOSA</source><target>00:01:6c:9d:b9:fa</target></xml>";
+
+    # jobdb update  
+    #$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <source>GOSA</source> <target>GOSA</target> <where><clause><phrase> <id>1</id></phrase></clause></where> <update><timestamp>19700101000000</timestamp></update></xml>";
+    #$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <source>GOSA</source><target>GOSA</target><where><clause><phrase> <macaddress>00:01:6c:9d:b9:fa</macaddress></phrase></clause> </where> <update><status>processing</status> <result>update</result></update></xml>";
+
+    # jobdb query
+    #$data = "<xml><header>gosa_query_jobdb</header><source>GOSA</source> <target>GOSA</target><where><clause><connector>and</connector><phrase><operator>gt</operator><ROWID>0</ROWID></phrase><phrase><operator>le</operator><ROWID>5</ROWID></phrase></clause></where></xml>";
+    #$data = "<xml><header>gosa_query_jobdb</header><source>GOSA</source> <target>GOSA</target> <where> <clause> <phrase> <operator>like</operator> <timestamp>%0102%</timestamp> </phrase> </clause> </where> </xml>";
+    #$data= "<xml><header>gosa_query_jobdb</header><source>GOSA</source> <target>GOSA</target><where><clause><phrase><headertag>ping</headertag></phrase></clause></where><limit><from>0</from><to>3</to></limit></xml>";
+    #$data= "<xml><header>gosa_query_jobdb</header><source>GOSA</source> <target>GOSA</target><where><clause><phrase><HEADERTAG>trigger_action_reinstall</HEADERTAG></phrase></clause></where><limit><from>0</from><to>25</to></limit><orderby>timestamp DESC</orderby></xml>";
+    #$data= "<xml><header>gosa_query_jobdb</header><source>GOSA</source> <target>GOSA</target></xml>";
+    #$data= "<xml><header>gosa_query_fai_server</header><source>GOSA</source> <target>GOSA</target></xml>";
+    #$data= "<xml><header>gosa_query_fai_release</header><source>GOSA</source> <target>GOSA</target></xml>";
+    #$data= "<xml><header>gosa_query_packages_list</header><source>GOSA</source> <target>GOSA</target></xml>";
+
+
+    # jobdb count
+    #$data = "<xml> <header>gosa_count_jobdb</header><source>GOSA</source> <target>GOSA</target></xml>";
+    #$data = "<xml> <header>gosa_count_fai_server</header><source>GOSA</source> <target>GOSA</target></xml>";
+    #$data = "<xml> <header>gosa_count_fai_release</header><source>GOSA</source> <target>GOSA</target></xml>";
+
+    # jobdb clear
+    #$data = "<xml> <header>gosa_clear_jobdb</header> <source>GOSA</source> <target>GOSA</target></xml>";
+
+    # set gosa-si-client to 'activated'
+    #$data = "<xml> <header>job_set_activated_for_installation</header> <target>10.89.1.31:20083</target> <source>GOSA</source> <macaddress>00:01:6c:9d:b9:fa</macaddress><timestamp>22220101000000</timestamp></xml>";
+
+
+    # trigger jobs at client
+    #$data = "<xml> <header>gosa_detect_hardware</header> <target>10.89.1.31:20083</target> <source>10.89.1.31:20081</source> </xml>";
+    #$data = "<xml> <header>gosa_new_key_for_client</header> <target>00:01:6c:9d:b9:fa</target> <source>10.89.1.31:20081</source> </xml>";
+    #$data = "<xml> <header>job_trigger_action_wake</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> <timestamp>19700101000000</timestamp></xml>";
+    #$data = "<xml> <header>gosa_trigger_action_faireboot</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> </xml>";
+    #$data = "<xml> <header>gosa_trigger_action_reboot</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> </xml>";
+    #$data = "<xml> <header>job_trigger_action_reinstall</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <macaddress>00:01:6c:9d:b9:fa</macaddress> <timestamp>19700101000000</timestamp> </xml>";
+    #$data = "<xml> <header>job_trigger_action_instant_update</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> <timestamp>19700101000000</timestamp> </xml>";
+    #$data = "<xml> <header>gosa_ping</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> </xml>";
+
+
+    # get_login_usr_for_client
+    #$data = "<xml> <header>gosa_get_login_usr_for_client</header> <target>GOSA</target> <source>GOSA</source> <client>00:01:6c:9d:b9:fa</client></xml>";
+
+    # get_client_for_login_usr
+    #$data = "<xml> <header>gosa_get_client_for_login_usr</header> <target>GOSA</target> <source>GOSA</source> <usr>harald</usr></xml>";
+
+    ##################
+    # recreate fai dbs
+    #$data = "<xml> <header>gosa_recreate_fai_server_db</header> <target>GOSA</target> <source>GOSA</source></xml>"; 
+    #$data = "<xml> <header>gosa_recreate_fai_release_db</header> <target>GOSA</target> <source>GOSA</source></xml>"; 
+    #$data = "<xml> <header>gosa_recreate_packages_list_db</header> <target>GOSA</target> <source>GOSA</source></xml>"; 
+
+    ###########
+    # messaging 
+    #$data = "<xml> <header>gosa_send_user_msg</header> <target>GOSA</target> <source>GOSA</source> <subject>eine wichtige nachricht</subject> <from>admin</from> <to>rettenbe</to> <delivery_time>20130101235959</delivery_time> <message>kaffeepause</message> </xml>"; 
+
+
+    ################
+    # logHandling.pm
+    # all date and mac parameter accept regular expression as input unless other instructions are given
+    # show_log_by_mac, show_log_by_date, show_log_by_date_and_mac, show_log_files_by_date_and_mac, 
+    # get_log_file_by_date_and_mac, delete_log_by_date_and_mac, get_recent_log_by_mac
+    #$data = "<xml> <header>gosa_show_log_by_mac</header> <target>GOSA</target> <source>GOSA</source> <mac>00:01:6C:9D:B9:FA</mac> <mac>00:01:6c:9d:b9:fb</mac> </xml>"; 
+    #$data = "<xml> <header>gosa_show_log_by_date</header> <target>GOSA</target> <source>GOSA</source> <date>20080313</date> <date>20080323</date> </xml>"; 
+    #$data = "<xml> <header>gosa_show_log_by_date_and_mac</header> <target>GOSA</target> <source>GOSA</source> <date>200803</date> <mac>00:01:6c:9d:b9:FA</mac> </xml>"; 
+    #$data = "<xml> <header>gosa_delete_log_by_date_and_mac</header> <target>GOSA</target> <source>GOSA</source>  <mac>00:01:6c:9d:b9:fa</mac></xml>"; 
+    #$data = "<xml> <header>gosa_get_recent_log_by_mac</header> <target>GOSA</target> <source>GOSA</source> <mac>00:01:6c:9d:b9:fa</mac></xml>"; 
+    # exact date and mac are required as input
+    #$data = "<xml> <header>gosa_show_log_files_by_date_and_mac</header> <target>GOSA</target> <source>GOSA</source> <date>install_20080311_090900</date> <mac>00:01:6c:9d:b9:fa</mac> </xml>"; 
+    #$data = "<xml> <header>gosa_get_log_file_by_date_and_mac</header> <target>GOSA</target> <source>GOSA</source> <date>install_20080311_090900</date> <mac>00:01:6c:9d:b9:fa</mac> <log_file>boot.log</log_file></xml>"; 
+
+    #########
+    # testing
+    #$data = "<xml> <header>gosa_query_packages_list</header><source>GOSA</source> <target>GOSA</target></xml>";
+
+    # Kerberos test query
+    $data = "<xml> <header>gosa_krb5_list_principals</header> <target>00:0C:29:DD:CD:2A</target> <source>GOSA</source></xml>"; 
 
     $sock->write($data);
     $answer = "nothing";
-       $answer = $sock->read();
-    
+    $answer = $sock->read();
+
     echo "$count: $answer\n";
-       $sock->close(); 
-}else{
-       echo "... FAILED!\n";
-}
+    $sock->close();    
+  }else{
+    echo "... FAILED!\n";
+  }
 }
 ?>