Bugzilla – Attachment 475894 Details for
Bug 690237
yast2-dns-server fails to setup LDAP config
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
Proposed patch
ldap_init.diff (text/plain), 2.85 KB, created by
Lukas Ocilka
on 2012-02-13 17:10:25 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Lukas Ocilka
Created:
2012-02-13 17:10:25 UTC
Size:
2.85 KB
patch
obsolete
>Index: DnsServer.pm >=================================================================== >--- DnsServer.pm (revision 67409) >+++ DnsServer.pm (working copy) >@@ -1281,7 +1281,10 @@ > # authenticate to LDAP > if ($use_ldap) > { >- LdapPrepareToWrite (); >+ unless (LdapPrepareToWrite ()) { >+ y2error ("Cannot write to LDAP"); >+ return 0; >+ } > } > > foreach my $z (@zones) { >@@ -1790,6 +1793,31 @@ > return; > } > >+# Checks whether all required schemas are correctly included >+# Gets an LDAP Domain as a parameter >+# Returns boolean >+sub LdapSchemasPresent ($) { >+ my $ldap_domain = shift; >+ my $ret = 1; >+ local $Data::Dumper::Indent = 0; >+ >+ my $default_config = "ou=ldapconfig,".$ldap_domain; >+ my $dc_ret = Ldap->GetLDAPEntry ($default_config); >+ y2milestone ("LDAP: Default config (".$default_config.") found: ".Dumper($dc_ret)); >+ >+ # Record not found >+ $ret = 0 if (! defined $dc_ret || keys(%{$dc_ret}) == 0); >+ >+ my $dns_zone = "ou=DNS,".$ldap_domain; >+ my $dz_ret = Ldap->GetLDAPEntry ($dns_zone); >+ y2milestone ("LDAP: DNS (".$dns_zone.") found: ".Dumper($dz_ret)); >+ >+ # Record not found >+ $ret = 0 if (! defined $dz_ret || keys(%{$dz_ret}) == 0); >+ >+ return $ret; >+} >+ > BEGIN { $TYPEINFO{LdapPrepareToWrite} = ["function", "boolean"];} > sub LdapPrepareToWrite { > my $self = shift; >@@ -1805,6 +1833,7 @@ > || 0 != scalar (@{NetworkInterfaces->Locate ("IPADDR", $ldap_server)})) > { > y2milestone ("LDAP server is local, checking included schemas"); >+ LdapServerAccess->AddLdapSchemas(["/etc/openldap/schema/yast.schema"],1); > LdapServerAccess->AddLdapSchemas(["/etc/openldap/schema/dnszone.schema"],1); > } > else >@@ -1856,6 +1885,14 @@ > } > Ldap->SetGUI(YaST::YCP::Boolean(1)); > >+ # If non-local server is used, schemas are not handled but required anyway >+ # BNC #710430 and BNC #690237 >+ unless (LdapSchemasPresent($ldap_domain)) { >+ y2error ("Required schemas not found."); >+ Report->Error (__("Required LDAP schemas (yast, dnszone) are not included.\nCannot write to LDAP.")); >+ return 0; >+ } >+ > # find suseDnsConfiguration object > %ldap_query = ( > "base_dn" => $ldap_config_dn, >@@ -1886,7 +1923,7 @@ > my $err = SCR->Read (".ldap.error") || {}; > my $err_descr = Dumper ($err); > y2error ("Error descr: $err_descr"); >- return; >+ return 0; > } > %found = %ldap_object; > } >@@ -1912,7 +1949,7 @@ > my $err = SCR->Read (".ldap.error") || {}; > my $err_descr = Dumper ($err); > y2error ("Error descr: $err_descr"); >- return; >+ return 0; > } > @bases = ("ou=DNS,$ldap_domain"); > } >@@ -1947,9 +1984,11 @@ > my $err = SCR->Read (".ldap.error") || {}; > my $err_descr = Dumper ($err); > y2error ("Error descr: $err_descr"); >- return; >+ return 0; > } > } >+ >+ return 1; > } > > BEGIN { $TYPEINFO{LdapStore} = ["function", "void" ]; }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 690237
:
426855
| 475894 |
493326