summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 815cfe6)
raw | patch | inline | side by side (parent: 815cfe6)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 9 Jan 2008 17:56:19 +0000 (17:56 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 9 Jan 2008 17:56:19 +0000 (17:56 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8278 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index 3993ca464557399385db4e0e6682a69bda32388e..2d4b84d484fd688d59c0346a4bad91f4469077cc 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
chomp($msg);
if($level <= $verbose){
print LOG_HANDLE "$level $msg\n";
- if(defined $foreground) { print $msg."\n" }
+ if($foreground) { print $msg."\n" }
}
}
# close( LOG_HANDLE );
# RETURNS: nothing
# DESCRIPTION: nomen est omen
#===============================================================================
-sub print_known_daemons {
- my ($tmp) = @_ ;
- print "####################################\n";
- print "# status of known_daemons\n";
- $shmda->shlock(LOCK_EX);
- my @hosts = keys %$known_daemons;
- foreach my $host (@hosts) {
- my $status = $known_daemons->{$host}->{status} ;
- my $passwd = $known_daemons->{$host}->{passwd};
- my $timestamp = $known_daemons->{$host}->{timestamp};
- print "$host\n";
- print "\tstatus: $status\n";
- print "\tpasswd: $passwd\n";
- print "\ttimestamp: $timestamp\n";
- }
- $shmda->shunlock(LOCK_EX);
- print "####################################\n";
- return;
-}
+#sub print_known_daemons {
+# my ($tmp) = @_ ;
+# print "####################################\n";
+# print "# status of known_daemons\n";
+# $shmda->shlock(LOCK_EX);
+# my @hosts = keys %$known_daemons;
+# foreach my $host (@hosts) {
+# my $status = $known_daemons->{$host}->{status} ;
+# my $passwd = $known_daemons->{$host}->{passwd};
+# my $timestamp = $known_daemons->{$host}->{timestamp};
+# print "$host\n";
+# print "\tstatus: $status\n";
+# print "\tpasswd: $passwd\n";
+# print "\ttimestamp: $timestamp\n";
+# }
+# $shmda->shunlock(LOCK_EX);
+# print "####################################\n";
+# return;
+#}
#=== FUNCTION ================================================================
daemon_log("$0 started!", 1);
# Just fork, if we"re not in foreground mode
-if( ! $foreground ) { $pid = fork(); }
-else { $pid = $$; }
+if( ! $foreground ) {
+ $pid = fork();
+} else {
+ $pid = $$;
+}
# Do something useful - put our PID into the pid_file
if( 0 != $pid ) {
open( LOCK_FILE, ">$pid_file" );
print LOCK_FILE "$pid\n";
-close( LOCK_FILE );
- if( !$foreground ) { exit( 0 ) };
+ close( LOCK_FILE );
+ if( !$foreground ) {
+ exit( 0 )
+ };
}
# connect to gosa-si job queue
}
- if($arp_activ eq "on" && vec($rout, fileno $arp_fifo, 1)) {
- my $in_msg = <$arp_fifo>;
- chomp($in_msg);
- print "arp_activ: msg: $in_msg\n";
- my $act_passwd = $known_daemons->{$bus_address}->{passwd};
- print "arp_activ: arp_passwd: $act_passwd\n";
-
- my $in_msg_hash = $xml->XMLin($in_msg, ForceArray=>1);
-
- my $target = &get_content_from_xml_hash($in_msg_hash, 'target');
-
- if ($target eq $server_address) {
- print "arp_activ: forward to server\n";
- my $arp_cipher = &create_ciphering($act_passwd);
- my $crypted_msg = &encrypt_msg($in_msg, $arp_cipher);
- &activating_child($crypted_msg, $server_ip);
- } else {
- print "arp_activ: send to bus\n";
- &send_msg_hash2address($in_msg_hash, $bus_address);
- }
- print "\n";
- }
+# if($arp_activ eq "on" && vec($rout, fileno $arp_fifo, 1)) {
+# my $in_msg = <$arp_fifo>;
+# chomp($in_msg);
+# print "arp_activ: msg: $in_msg\n";
+# my $act_passwd = $known_daemons->{$bus_address}->{passwd};
+# print "arp_activ: arp_passwd: $act_passwd\n";
+#
+# my $in_msg_hash = $xml->XMLin($in_msg, ForceArray=>1);
+#
+# my $target = &get_content_from_xml_hash($in_msg_hash, 'target');
+#
+# if ($target eq $server_address) {
+# print "arp_activ: forward to server\n";
+# my $arp_cipher = &create_ciphering($act_passwd);
+# my $crypted_msg = &encrypt_msg($in_msg, $arp_cipher);
+# &activating_child($crypted_msg, $server_ip);
+# } else {
+# print "arp_activ: send to bus\n";
+# &send_msg_hash2address($in_msg_hash, $bus_address);
+# }
+# print "\n";
+# }
# check input fhd of all modules
daemon_log("cannot read from $actual_ip", 5);
}
}
- #close($client);
-
}
}
}
# add target
- print "select: target: $target\n";
&add_content2xml_hash($out_msg_hash, "target", $target);
# add new header
my $out_header = $job_msg_hash->{header}[0];
$out_header =~ s/job_/gosa_/;
- print "select: header: $out_header\n";
delete $out_msg_hash->{header};
&add_content2xml_hash($out_msg_hash, "header", $out_header);
index 9f341ec5e132ab1eb83f06fb8da75227d6bb1649..db717fa7d4baabe4b79e20c67b1aeb5ea356d074 100644 (file)
if (exists $arg->{$col_name}) {
push(@add_list, $arg->{$col_name});
}
- # use default values for column values
-# } else {
-# my $default_val = "none";
-# if ($col_name eq "timestamp") {
-# $default_val = "19700101000000";
-# }
-# push(@add_list, $default_val);
-# }
}
my $sql_statement = " INSERT INTO $table VALUES ('".join("', '", @add_list)."')";
- print " INSERT INTO $table VALUES ('".join("', '", @add_list)."')\n";
my $db_res = $obj->{dbh}->do($sql_statement);
- print " DB result: $db_res\n";
return 0;
}
index eea707322b1140f74b22f5d9ca1cd3b0c4d928cc..255022e3d9262f09f3d39f16fd5bfa9e5576642e 100644 (file)
return "<xml><1>1</1></xml>";
}
$update_hash->{update} = [ { status=>$msg_hash->{update}[0]->{status} } ];
- #$update_hash->{update} = $msg_hash->{update};
# execute db query
my $db_res = $main::job_db->update_dbentry($update_hash);
index 7797dc404d0d23d05ded81969dc896aab4534448..e3bee1793155dd72a64d39f11c4f1de303720e15 100644 (file)
timestamp=>&get_time,
} );
if ($res == 3) {
- $res = $main::known_clients_db->update_dbentry( {table=>'known_clients',
- where=>'hostname',
- hostname=>$source,
- events=>$events,
- macaddress=>$mac_address,
- status=>'registered',
- hostkey=>$new_passwd,
- timestamp=>&get_time,
- } );
+ my $update_hash = { table=>'known_clients' };
+ $update_hash->{where} = [ { hostname=>[$source] } ],
+ $update_hash->{update} = [ { events=>[$events],
+ macaddress=>[$mac_address],
+ status=>['registered'],
+ hostkey=>[$new_passwd],
+ timestamp=>[&get_time],
+ } ];
+ $res = $main::known_clients_db->update_dbentry( $update_hash );
}
- if ($res > 0) {
+ if ($res != 1) {
&main::daemon_log("ERROR: cannot add entry to known_clients: $res");
return;
}
&send_msg_hash2address($out_hash, $source, $new_passwd);
# notify registered client to bus
- $out_hash = &create_xml_hash("new_client", $server_address, $bus_address, $source);
- &send_msg_hash2address($out_hash, $bus_address);
+ if( $bus_activ eq "on") {
+ &main::daemon_log("send bus msg that client '$source' has registerd at server '$server_address'", 3);
+ $out_hash = &create_xml_hash("new_client", $server_address, $bus_address, $source);
+ &send_msg_hash2address($out_hash, $bus_address);
+ }
# give the new client his ldap config
&new_ldap_config($source);
# Sanity check
if ($mesg->count != 1) {
- &main::daemon_log("WARNING: client mac address $macaddress not found/not unique", 1);
+ &main::daemon_log("WARNING: client mac address $macaddress not found/not unique in ldap search", 1);
+ &main::daemon_log("\tbase: $ldap_base", 1);
+ &main::daemon_log("\tscope: sub", 1);
+ &main::daemon_log("\tattrs: dn, gotoLdapServer", 1);
+ &main::daemon_log("\tfilter: (&(objectClass=GOhard)(macaddress=$macaddress))", 1);
return;
}
index b52a4d8f3581e198671e2d74d04faac70fd284a4..0384e9535d004910b95fc7518fdeed07ad6b5724 100755 (executable)
--- a/gosa-si/tests/client.php
+++ b/gosa-si/tests/client.php
#$data = "<xml><header>gosa_ping</header><source>10.89.1.155:20082</source><target></target><mac>11:22:33:44:55</mac></xml>";
#$data = "<xml> <header>job_ping</header> <source>10.89.1.155:20083</source><mac>00:1B:77:04:8A:6C</mac> <timestamp>19700101000000</timestamp> </xml>";
#$data = "<xml> <header>job_sayHello</header> <source>10.89.1.155:20083</source><mac>00:1B:77:04:8A:6C</mac> <timestamp>20130102133900</timestamp> </xml>";
- $data = "<xml> <header>job_ping</header> <source>10.89.1.155:20083</source><mac>00:1B:77:04:8A:6C</mac> <timestamp>20130102133900</timestamp> </xml>";
+ #$data = "<xml> <header>job_ping</header> <source>10.89.1.155:20083</source><mac>00:1B:77:04:8A:6C</mac> <timestamp>20130102133900</timestamp> </xml>";
# delete
#$data = "<xml> <header>gosa_delete_jobdb_entry</header> <where>headertag</where> <headertag>sayHello</headertag> </xml>";
#$data = "<xml><header>gosa_query_jobdb</header><where>status</where><status>waiting</status></xml>";
# clear
- #$data = "<xml> <header>gosa_clear_jobdb</header> </xml>";
+ $data = "<xml> <header>gosa_clear_jobdb</header> </xml>";
$sock->write($data);