summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 437237d)
raw | patch | inline | side by side (parent: 437237d)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 3 Mar 2008 10:53:50 +0000 (10:53 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 3 Mar 2008 10:53:50 +0000 (10:53 +0000) |
Added option "force-hostname" to client and server. If set, the Environment Variable $HOSTNAME will be used for registration, a force-hostname gets added to the registration hash.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9238 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9238 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/gosa-si-client | patch | blob | history | |
gosa-si/modules/SIPackages.pm | patch | blob | history | |
gosa-si/server/events/siTriggered.pm | patch | blob | history |
diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client
index afb51ba26278252d4e612aff59ff96e33899348a..abda025bdbc8b80370cec7278cb3dd8e4929500e 100755 (executable)
--- a/gosa-si/gosa-si-client
+++ b/gosa-si/gosa-si-client
our $client_ip;
our $client_mac_address;
our $client_dnsname;
+our $client_force_hostname;
our $server_key;
# default variables
"pam-config" => [\$pam_config, "/etc/pam_ldap.conf"],
"nss-config" => [\$nss_config, "/etc/libnss_ldap.conf"],
"fai-logpath" => [\$fai_logpath, "/var/log/fai/fai.log"],
+ "force-hostname" => [\$client_force_hostname, "false"],
},
"server" => {
"ip" => [\$server_ip, "127.0.0.1"],
&add_content2xml_hash($register_hash, "events", $events);
&add_content2xml_hash($register_hash, "gotoHardwareChecksum", $gotoHardwareChecksum);
+ # Add $HOSTNAME from ENV if force-hostname is set
+ if( defined($client_force_hostname) &&
+ $client_force_hostname eq "true") {
+ if(defined($ENV{HOSTNAME}) &&
+ length($ENV{HOSTNAME}) >0 ) {
+ &add_content2xml_hash($register_hash, "force-hostname", $ENV{HOSTNAME});
+ } else {
+ &main::daemon_log("force-hostname was set to true, but no \$HOSTNAME was found in Environment!",0);
+ }
+ }
+
# send xml hash to server with general server passwd
my $res = &send_msg_hash_to_target($register_hash, $server, $default_server_key);
if($res == 0) {
index c176086778b1cade2a78d596907038b3d6e5dff8..3858263834afcf1fd268b431245139cee09fb52b 100644 (file)
&add_content2xml_hash($out_hash, "timestamp", $act_timestamp);
my $new_client_out = &create_xml_string($out_hash);
push(@out_msg_l, $new_client_out);
- &main::daemon_log("INFO: send bus msg that client '$source' has registerd at server '$server_address'", 5);
+ &main::daemon_log("INFO: send bus msg that client '$source' has registered at server '$server_address'", 5);
}
# give the new client his ldap config
index 488cc14f10fc26fbddf1c0b46ef0b4d0bbf7655f..c6728266c59d97bc5f8edb3f469b8060e27c0232 100644 (file)
# We need to create a base entry first (if not done from ArpHandler)
if($mesg->count == 0) {
- &main::daemon_log("INFO: Need to create a new LDAP Entry for client $address", 6);
+ &main::daemon_log("INFO: Need to create a new LDAP Entry for client $address", 4);
my $ipaddress= $1 if $address =~ /^([0-9\.]*?):.*$/;
- my $dnsname= gethostbyaddr(inet_aton($ipaddress), AF_INET) || $ipaddress;
+ my $dnsname;
+ if (defined($msg_hash->{'force-hostname'}) &&
+ defined($msg_hash->{'force-hostname'}[0]) &&
+ length($msg_hash->{'force-hostname'}[0]) > 0){
+ $dnsname= $msg_hash->{'force-hostname'}[0];
+ &main::daemon_log("INFO: Using forced hostname $dnsname for client $address", 4);
+ } else {
+ gethostbyaddr(inet_aton($ipaddress), AF_INET) || $ipaddress;
+ }
+
my $cn = (($dnsname =~ /^(\d){1,3}\.(\d){1,3}\.(\d){1,3}\.(\d){1,3}/) ? $dnsname : sprintf "%s", $dnsname =~ /([^\.]+)\.?/);
my $dn = "cn=$cn,ou=incoming,$ldap_base";
&main::daemon_log("INFO: Creating entry for $dn",5);