[yast-commit] r48646 - in /trunk/ldap-server/src: LdapServer.pm dialogs.ycp
Author: rhafer Date: Fri Jun 27 16:00:24 2008 New Revision: 48646 URL: http://svn.opensuse.org/viewcvs/yast?rev=48646&view=rev Log: Set rootpw upon database creation Modified: trunk/ldap-server/src/LdapServer.pm trunk/ldap-server/src/dialogs.ycp Modified: trunk/ldap-server/src/LdapServer.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/LdapServer.pm?rev=48646&r1=48645&r2=48646&view=diff ============================================================================== --- trunk/ldap-server/src/LdapServer.pm (original) +++ trunk/ldap-server/src/LdapServer.pm Fri Jun 27 16:00:24 2008 @@ -542,6 +542,8 @@ y2milestone("basedn: $basedn"); $dbDefaults{'basedn'} = $basedn; $dbDefaults{'rootdn'} = "cn=admin,".$basedn; + $dbDefaults{'rootpw'} = ""; + $dbDefaults{'rootpw_clear'} = ""; $dbDefaults{'pwenctype'} = "SSHA"; $dbDefaults{'serviceEnabled'} = YaST::YCP::Boolean(0); $dbDefaults{'slpRegister'} = YaST::YCP::Boolean(0); @@ -551,23 +553,26 @@ BEGIN { $TYPEINFO {ReadFromDefaults} = ["function", "boolean"]; } sub ReadFromDefaults { + my $self = shift; + my $pwHash = $self->HashPassword($dbDefaults{'pwenctype'}, $dbDefaults{'rootpw_clear'} ); my $database = { 'type' => 'bdb', 'suffix' => $dbDefaults{'basedn'}, 'rootdn' => $dbDefaults{'rootdn'}, + 'rootpw' => $pwHash, 'directory' => '/var/lib/ldap' }; my $cfgdatabase = { 'type' => 'config', - 'rootdn' => 'cn=config', - 'rootpw' => 'secret' + 'rootdn' => 'cn=config' }; @schema = ( "core", "cosine", "inetorgperson" ); - push @databases, ( $cfgdatabase, $database ); - SCR->Execute('.ldapserver.initGlobals' ); SCR->Execute('.ldapserver.initSchema', \@schema ); - SCR->Execute('.ldapserver.initDatabases', \@databases ); + SCR->Execute('.ldapserver.initDatabases', [ $cfgdatabase, $database ] ); + my $rc = SCR->Read('.ldapserver.databases'); + y2milestone("Databases: ". Data::Dumper->Dump([$rc])); + @databases = @{$rc}; return 1; } @@ -727,7 +732,14 @@ return $rc; } - +## + # Get all ldap-server settings from the first parameter + # (For use by autoinstallation.) + # @param hashalgorithm a string defining the hashing algorithm (can be one of + # "CRYPT", "SMD5", "SHA", "SSHA" and "PLAIN" + # @param cleartext the cleartext password + # @return The hashed password value (Format: {hashmethod}hashedpassword ) + # BEGIN { $TYPEINFO {HashPassword} = ["function", "string", "string", "string" ] ; } sub HashPassword { Modified: trunk/ldap-server/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/dialogs.ycp?rev=48646&r1=48645&r2=48646&view=diff ============================================================================== --- trunk/ldap-server/src/dialogs.ycp (original) +++ trunk/ldap-server/src/dialogs.ycp Fri Jun 27 16:00:24 2008 @@ -329,26 +329,26 @@ else if( ret == `next ) { //validate/update rootpw - defaults["rootpw"] = (string)UI::QueryWidget( `id( `te_rootpw ), `Value ); - if ( defaults["rootpw"]:"" == "" ) + defaults["rootpw_clear"] = (string)UI::QueryWidget( `id( `te_rootpw ), `Value ); + if ( defaults["rootpw_clear"]:"" == "" ) { Popup::Error( _("Please enter a password for the Administrator user") ); continue; } - if( defaults["rootpw"]:"" != "" ) + if( defaults["rootpw_clear"]:"" != "" ) { - if( defaults["rootpw"]:"" != UI::QueryWidget( `id( `te_valid_rootpw ), `Value ) ) + if( defaults["rootpw_clear"]:"" != UI::QueryWidget( `id( `te_valid_rootpw ), `Value ) ) { /* error popup */ Popup::Error( _("Password validation failed.") ); - defaults["rootpw"] = ""; + defaults["rootpw_clear"] = ""; continue; } } //update enctype string enctype = (string)UI::QueryWidget( `id( `cmb_cryptmethod ), `Value ); y2debug( "changing enctype to %1", enctype ); -// LdapServerConf::enctype = enctype; + defaults["pwenctype"] = enctype; //update Base DN defaults["basedn"] = (string)UI::QueryWidget( `id( `te_basedn ), `Value ); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
rhafer@svn.opensuse.org