From: janw Date: Wed, 12 Mar 2008 11:54:52 +0000 (+0000) Subject: Only include sources in sources.list which are hosted on the server itself. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=766bc8330cb11d859b7fe818f7ff23674835bed5;p=gosa.git Only include sources in sources.list which are hosted on the server itself. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9705 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index 0f0aa84d4..4c540d879 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -77,7 +77,7 @@ our $no_arp; our $verbose; our $forground; our $cfg_file; -our ($ldap_handle, $ldap_uri, $ldap_base, $ldap_admin_dn, $ldap_admin_password ); +our ($ldap_handle, $ldap_uri, $ldap_base, $ldap_admin_dn, $ldap_admin_password, $ldap_server_dn); # specifies the verbosity of the daemon_log @@ -1771,22 +1771,33 @@ sub session_run_done { } sub create_sources_list { - my $result=""; - - my $query_result= $fai_server_db->select_dbentry('SELECT * FROM '.$fai_server_tn); - if($query_result) { - my $fh; - $result= '/tmp/gosa_si_tmp_sources_list'; - open($fh, ">$result") or return undef; - while (my ($hit_num, $hit) = each %{$query_result}) { - my $line = "deb ".$hit->{'server'}." ".$hit->{'release'}; - my $sections= $hit->{'sections'}; - $sections =~ s/,/ /g; - $line.= " $sections"; - print $fh $line."\n"; + my $result="/tmp/gosa_si_tmp_sources_list"; + + # Remove old file + if(stat($result)) { + unlink($result); + } + + my $fh; + open($fh, ">$result") or return undef; + if(defined($ldap_server_dn) && length($ldap_server_dn)>0) { + my $mesg=$ldap_handle->search( + base => $ldap_server_dn, + scope => 'base', + attrs => 'FAIrepository', + ); + + if($mesg->count) { + foreach my $entry(@{$mesg->{'entries'}}) { + my ($server, $tag, $release, $sections)= split /\|/, $entry->get_value('FAIrepository'); + my $line = "deb $server $release"; + $sections =~ s/,/ /g; + $line.= " $sections"; + print $fh $line."\n"; + } } - close($fh); } + close($fh); return $result; }