Author: rhafer
Date: Tue Aug 12 14:47:31 2008
New Revision: 49983
URL: http://svn.opensuse.org/viewcvs/yast?rev=49983&view=rev
Log:
Allow to update /etc/openldap/ldap.conf settings when creating a new database
(Fate#303399)
Modified:
trunk/ldap-server/src/LdapDatabase.ycp
trunk/ldap-server/src/LdapServer.pm
trunk/ldap-server/src/dialogs.ycp
trunk/ldap-server/src/tree_structure.ycp
Modified: trunk/ldap-server/src/LdapDatabase.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/LdapDatabase.ycp?rev=49983&r1=49982&r2=49983&view=diff
==============================================================================
--- trunk/ldap-server/src/LdapDatabase.ycp (original)
+++ trunk/ldap-server/src/LdapDatabase.ycp Tue Aug 12 14:47:31 2008
@@ -11,6 +11,7 @@
module "Database";
map baseDb = $[];
+ string ldapconf_basedn = "";
boolean createDbDir = false;
@@ -25,13 +26,7 @@
numDbs = size(dblist)-2; // don't count frontend and Config DB
}
string caption = _("New Database");
- string enctype = "SSHA";
- list enc_types = [
- `item( `id( "CRYPT"), "CRYPT", enctype == "CRYPT" ),
- `item( `id( "SMD5" ), "SMD5", enctype == "SMD5" ),
- `item( `id( "SSHA" ), "SSHA", enctype == "SSHA" ),
- `item( `id( "PLAIN" ), "PLAIN", enctype == "PLAIN" )
- ];
+
term addDbWidget =
`VBox(
`Heading( _("Basic Settings") ),
@@ -65,9 +60,6 @@
`Password( `id( `te_valid_rootpw ), `opt(`hstretch),
_("&Validate Password"), "" )
),
- `Left(
- `ComboBox( `id( `cb_cryptmethod ), _("Password &Encryption"), enc_types )
- ),
`VSpacing(0.5),
`VSquash(
`HBox(
@@ -80,6 +72,9 @@
`PushButton( `id( `pb_directory ), _("&Browse...") )
)
)
+ ),
+ `Left(
+ `CheckBox(`id( `cb_ldapconf), _("Use this database as the default for OpenLDAP clients"), true )
)
)
)
@@ -106,7 +101,14 @@
UI::ChangeWidget(`id( `te_rootdn), `Value, db["rootdn"]:"" );
UI::ChangeWidget(`id( `cb_append_basedn), `Value, append_checked );
UI::ChangeWidget(`id( `te_directory), `Value, db["directory"]:"" );
- UI::ChangeWidget(`id( `cb_cryptmethod), `Value, db["pwenctype"]:"" );
+ }
+ if ( numDbs == 0 )
+ {
+ UI::ChangeWidget(`id( `cb_ldapconf), `Value, true );
+ }
+ else
+ {
+ UI::ChangeWidget(`id( `cb_ldapconf), `Value, false );
}
symbol ret = `next;
while(true) {
@@ -147,7 +149,6 @@
string rootdn = String::CutBlanks( (string)UI::QueryWidget( `te_rootdn, `Value ) );
string rootpw = (string)UI::QueryWidget( `te_rootpw, `Value );
string directory = String::CutBlanks( (string)UI::QueryWidget( `te_directory, `Value ) );
- string cryptmethod = (string)UI::QueryWidget( `cb_cryptmethod, `Value );
//check values
if( suffix == "" )
@@ -212,7 +213,11 @@
if( rootpw != "" )
{
db = add( db, "rootpw_clear", rootpw );
- db = add( db, "pwenctype", cryptmethod );
+ db = add( db, "pwenctype", "SSHA" );
+ }
+ if( (boolean)UI::QueryWidget( `cb_ldapconf, `Value ) )
+ {
+ ldapconf_basedn = suffix;
}
baseDb = db;
break;
@@ -223,7 +228,7 @@
define symbol DbSyncProv()
{
string caption = _("Syncprov settings");
- term contents = `Label("leer");
+ term contents = `Label("");
Wizard::SetContentsButtons(caption, contents, "",
Label::BackButton(), Label::NextButton());
symbol ret = `next;
@@ -310,4 +315,8 @@
{
return createDbDir;
}
+ global define string GetLdapConfBase()
+ {
+ return ldapconf_basedn;
+ }
}
Modified: trunk/ldap-server/src/LdapServer.pm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/LdapServer.pm?rev=49983&r1=49982&r2=49983&view=diff
==============================================================================
--- trunk/ldap-server/src/LdapServer.pm (original)
+++ trunk/ldap-server/src/LdapServer.pm Tue Aug 12 14:47:31 2008
@@ -44,6 +44,9 @@
my $useLdapiForConfig = 0;
my %dbDefaults = ();
+my $ldapconf_base = "";
+my $write_ldapconf = 0;
+
my $globals_initialized = 0;
my $use_ldapi_listener = 0;
my $use_ldaps_listener = 0;
@@ -228,11 +231,40 @@
y2milestone("ConfigModified: " . $slapdConfChanged);
}
+
+ # Read base-dn from /etc/openldap/ldap.conf
+ my $base_list = SCR->Read(".etc.ldap_conf.value.\"/etc/openldap/ldap.conf\".base" );
+ $ldapconf_base = $base_list->[0];
Progress->Finish();
return 1;
}
+##
+ # @return the base DN that is currently set in /etc/openldap/ldap.conf
+ #
+BEGIN { $TYPEINFO{ReadLdapconfBase} = ["function", "string"]; }
+sub ReadLdapconfBase()
+{
+ return $ldapconf_base;
+}
+
+##
+ # @return Set base DN that shoudl we written to /etc/openldap/ldap.conf
+ #
+BEGIN { $TYPEINFO{WriteLdapConfBase} = ["function", "boolean", "string"]; }
+sub WriteLdapConfBase()
+{
+ my ($self, $basedn) = @_;
+ y2debug("WriteLdapConfBase: $basedn");
+ if ( $basedn ne "" )
+ {
+ $ldapconf_base = $basedn;
+ $write_ldapconf = 1;
+ }
+ return 1;
+}
+
sub CreateBaseObjects()
{
my $self = shift;
@@ -491,6 +523,14 @@
Progress->Finish();
return 0;
}
+ if ( $write_ldapconf )
+ {
+ y2milestone("Updating /etc/openldap/ldap.conf");
+ SCR->Write(".etc.ldap_conf.value.\"/etc/openldap/ldap.conf\".host",
+ ["localhost"]);
+ SCR->Write(".etc.ldap_conf.value.\"/etc/openldap/ldap.conf\".base",
+ [$ldapconf_base]);
+ }
Progress->Finish();
SuSEFirewall->Write();
} else {
@@ -545,6 +585,14 @@
$self->SetError( $err->{'summary'}, $err->{'description'} );
return 0;
}
+ if ( $write_ldapconf )
+ {
+ SCR->Write(".etc.ldap_conf.value.\"/etc/openldap/ldap.conf\".host",
+ ["localhost"]);
+ SCR->Write(".etc.ldap_conf.value.\"/etc/openldap/ldap.conf\".base",
+ [$ldapconf_base]);
+ y2milestone("Updated /etc/openldap/ldap.conf");
+ }
}
sleep(1);
$configured = $ret;
Modified: trunk/ldap-server/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/dialogs.ycp?rev=49983&r1=49982&r2=49983&view=diff
==============================================================================
--- trunk/ldap-server/src/dialogs.ycp (original)
+++ trunk/ldap-server/src/dialogs.ycp Tue Aug 12 14:47:31 2008
@@ -302,6 +302,7 @@
if ( ret == `next )
{
LdapServer::SetInitialDefaults(LdapDatabase::GetDatabase());
+ LdapServer::WriteLdapConfBase( LdapDatabase::GetLdapConfBase() );
}
return ret;
Modified: trunk/ldap-server/src/tree_structure.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/tree_structure.ycp?rev=49983&r1=49982&r2=49983&view=diff
==============================================================================
--- trunk/ldap-server/src/tree_structure.ycp (original)
+++ trunk/ldap-server/src/tree_structure.ycp Tue Aug 12 14:47:31 2008
@@ -532,6 +532,7 @@
callback_error = err["msg"]:"" + "\n" + err["details"]:"";
return false;
}
+ LdapServer::WriteLdapConfBase( LdapDatabase::GetLdapConfBase() );
}
else
{
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org