[yast-commit] r44075 - in /trunk/users: ./ package/ src/
Author: jsuchome
Date: Thu Jan 31 16:31:16 2008
New Revision: 44075
URL: http://svn.opensuse.org/viewcvs/yast?rev=44075&view=rev
Log:
- unified function names for RootAlias handling
- first steps for implementation of FATE 302980,
"Simplified user config during installation" :
- added inst_user_first.ycp, client for user configuration in first
stage of installation
- UsersSimple.pm is module for saving the data gathered from firs
stage
- inst_root, inst_auth, inst_user updated to check for first stage
configuration data
- 2.16.7
Added:
trunk/users/src/UsersSimple.pm
trunk/users/src/inst_user_first.ycp (with props)
trunk/users/src/users_finish.ycp (with props)
Modified:
trunk/users/VERSION
trunk/users/package/yast2-users.changes
trunk/users/src/Makefile.am
trunk/users/src/Users.pm
trunk/users/src/dialogs.ycp
trunk/users/src/inst_auth.ycp
trunk/users/src/inst_root.ycp
trunk/users/src/inst_user.ycp
Modified: trunk/users/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/VERSION?rev=44075&r1=44074&r2=44075&view=diff
==============================================================================
--- trunk/users/VERSION (original)
+++ trunk/users/VERSION Thu Jan 31 16:31:16 2008
@@ -1 +1 @@
-2.16.7
+2.16.8
Modified: trunk/users/package/yast2-users.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/package/yast2-users.changes?rev=44075&r1=44074&r2=44075&view=diff
==============================================================================
--- trunk/users/package/yast2-users.changes (original)
+++ trunk/users/package/yast2-users.changes Thu Jan 31 16:31:16 2008
@@ -1,4 +1,18 @@
-------------------------------------------------------------------
+Thu Jan 31 16:11:28 CET 2008 - jsuchome@suse.cz
+
+- unified function names for RootAlias handling
+- first steps for implementation of FATE 302980,
+ "Simplified user config during installation" :
+- added inst_user_first.ycp, client for user configuration in first
+ stage of installation
+- UsersSimple.pm is module for saving the data gathered from firs
+ stage
+- inst_root, inst_auth, inst_user updated to check for first stage
+ configuration data
+- 2.16.7
+
+-------------------------------------------------------------------
Tue Jan 29 14:56:17 CET 2008 - jsuchome@suse.cz
- "User Management" is "User and Group Management" now in control
Modified: trunk/users/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/src/Makefile.am?rev=44075&r1=44074&r2=44075&view=diff
==============================================================================
--- trunk/users/src/Makefile.am (original)
+++ trunk/users/src/Makefile.am Thu Jan 31 16:31:16 2008
@@ -18,6 +18,7 @@
UsersUI.ycp \
UsersPasswd.pm \
UsersPlugins.pm \
+ UsersSimple.pm \
UsersPluginLDAPAll.pm \
UsersPluginLDAPShadowAccount.pm \
UsersPluginLDAPPasswordPolicy.pm \
@@ -37,6 +38,8 @@
groups.ycp \
inst_root.ycp \
inst_user.ycp \
+ inst_user_first.ycp \
+ users_finish.ycp \
inst_auth.ycp \
users_auto.ycp \
users_plugin_ldap_all.ycp \
Modified: trunk/users/src/Users.pm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/src/Users.pm?rev=44075&r1=44074&r2=44075&view=diff
==============================================================================
--- trunk/users/src/Users.pm (original)
+++ trunk/users/src/Users.pm Thu Jan 31 16:31:16 2008
@@ -238,6 +238,7 @@
YaST::YCP::Import ("UsersPasswd");
YaST::YCP::Import ("UsersPlugins");
YaST::YCP::Import ("UsersRoutines");
+YaST::YCP::Import ("UsersSimple");
YaST::YCP::Import ("UsersUI");
##-------------------------------------------------------------------------
@@ -351,7 +352,7 @@
sub SetRootMail {
my $self = shift;
my $root_a = shift;
- y2warning ("this function is obsolete, use RemoveRootMail/AddRootMail instead");
+ y2warning ("this function is obsolete, use RemoveRootAlias/AddRootAlias instead");
foreach my $alias (split (/,/, $root_a)) {
$alias =~ s/[ \t]//g;
$root_aliases{$alias} = 1;
@@ -365,16 +366,16 @@
}
# remove the given user from root's aliases set
-BEGIN { $TYPEINFO{RemoveRootMail} = ["function", "void", "string"]; }
-sub RemoveRootMail {
+BEGIN { $TYPEINFO{RemoveRootAlias} = ["function", "void", "string"]; }
+sub RemoveRootAlias {
my $self = shift;
my $u = shift;
delete $root_aliases{$u} if (defined $root_aliases{$u});
}
# add the given user to root's aliases set
-BEGIN { $TYPEINFO{AddRootMail} = ["function", "void", "string"]; }
-sub AddRootMail {
+BEGIN { $TYPEINFO{AddRootAlias} = ["function", "void", "string"]; }
+sub AddRootAlias {
my $self = shift;
my $u = shift;
$root_aliases{$u} = 1;
@@ -1873,7 +1874,7 @@
if (Autologin->user () eq $username) {
Autologin->Disable ();
}
- $self->RemoveRootMail ($username);
+ $self->RemoveRootAlias ($username);
my $type = $user_in_work{"type"};
my $plugins = $user_in_work{"plugins"};
@@ -4710,49 +4711,37 @@
}
##-------------------------------------------------------------------------
-##----------------- check routines (TODO move outside...) ---------
-
-# "-" means range! -> at the begining or at the end!
-# now CHARACTER_CLASS from /etc/login.defs is used
-my $valid_logname_chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-";
-
-my $valid_password_chars = "[-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#\$%^&*() ,;:._+/|?{}=\['\"`~<>]|]";# the ']' is or-ed...
-
-# error popup
-my $valid_password_message = __("The password may only contain the following characters:
-0-9, a-z, A-Z, and any of \"`~!\@#\$%^&* ,.;:._-+/|\?='{[(<>)]}\\\".
-Try again.");
-
-my $valid_home_chars = "[0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/_.-]";
+##----------------- check routines ----------------------------------------
##------------------------------------
BEGIN { $TYPEINFO{ValidLognameChars} = ["function", "string"]; }
sub ValidLognameChars {
- return $valid_logname_chars;
+ return UsersSimple->ValidLognameChars ();
}
##------------------------------------
BEGIN { $TYPEINFO{ValidPasswordChars} = ["function", "string"]; }
sub ValidPasswordChars {
- return $valid_password_chars;
+ return UsersSimple->ValidPasswordChars ();
+}
+
+##------------------------------------
+BEGIN { $TYPEINFO{ValidHomeChars} = ["function", "string"]; }
+sub ValidHomeChars {
+ return UsersSimple->ValidHomeChars ();
}
##------------------------------------
BEGIN { $TYPEINFO{ValidPasswordMessage} = ["function", "string"]; }
sub ValidPasswordMessage {
- return $valid_password_message;
+ return UsersSimple->ValidPasswordMessage ();
}
##------------------------------------
# Return the part of help text about valid password characters
BEGIN { $TYPEINFO{ValidPasswordHelptext} = ["function", "string"]; }
sub ValidPasswordHelptext {
- # help text (default part shown in more places)
- return __("<p>
-For the password, use only characters that can be found on an English keyboard
-layout. In cases of system error, it may be necessary to log in without a
-localized keyboard layout.
-</p>");
+ return UsersSimple->ValidPasswordHelptext ();
}
##------------------------------------
@@ -5006,11 +4995,12 @@
}
my $filtered = $pw;
+ my $valid_password_chars = $self->ValidPasswordChars ();
$filtered =~ s/$valid_password_chars//g;
$filtered =~ s/\\//g; # bug 175706
if ($filtered ne "") {
- return $valid_password_message;
+ return $self->ValidPasswordMessage ();
}
return "";
}
@@ -5228,6 +5218,7 @@
my $type = UsersCache->GetUserType ();
my $first = substr ($home, 0, 1);
my $filtered = $home;
+ my $valid_home_chars= $self->ValidHomeChars ();
$filtered =~ s/$valid_home_chars//g;
if ($filtered ne "" || $first ne "/" || $home =~ m/\/\./) {
Added: trunk/users/src/UsersSimple.pm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/src/UsersSimple.pm?rev=44075&view=auto
==============================================================================
--- trunk/users/src/UsersSimple.pm (added)
+++ trunk/users/src/UsersSimple.pm Thu Jan 31 16:31:16 2008
@@ -0,0 +1,362 @@
+#! /usr/bin/perl -w
+#
+# File: modules/UsersSimple.pm
+# Package: Configuration of users and groups
+# Summary: module for first stage user configuration
+#
+# $Id$
+#
+
+package UsersSimple;
+
+use strict;
+
+use YaST::YCP qw(:LOGGING sformat);
+use YaPI;
+
+textdomain("users");
+
+our %TYPEINFO;
+
+# What client to call after authentication dialog during installation:
+# could be "users","nis" or "ldap", for more see inst_auth.ycp
+my $after_auth = "users";
+
+# If kerberos configuration should be called after authentication
+# during installation (F120214)
+my $run_krb_config = 0;
+
+my $root_password = "";
+
+my $root_password_written = 0;
+
+# data of user configured during installation
+my %user = ();
+
+
+# password encryption method
+my $encryption_method = "md5";
+
+# mail alias for root
+my $root_alias = "";
+
+my %min_pass_length = (
+ "local" => 5,
+ "system" => 5
+);
+
+my %max_pass_length = (
+ "local" => 8,
+ "system" => 8
+);
+
+# Number of sigificant characters in the password for given encryption method
+my %max_lengths = (
+ "des" => 8,
+ "md5" => 127,
+ "blowfish" => 72,
+);
+
+# name of user that should be logged in automatically
+my $autologin_user = "";
+
+##------------------------------------
+##------------------- global imports
+
+YaST::YCP::Import ("Directory");
+YaST::YCP::Import ("SCR");
+YaST::YCP::Import ("UsersUI");
+
+# check the boolean value, return 0 or 1
+sub bool {
+
+ my $param = $_[0];
+ if (!defined $param) {
+ return 0;
+ }
+ if (ref ($param) eq "YaST::YCP::Boolean") {
+ return $param->value();
+ }
+ return $param;
+}
+
+##------------------------------------
+# return the value of current encryption method
+BEGIN { $TYPEINFO{EncryptionMethod} = ["function", "string"];}
+sub EncryptionMethod {
+ return $encryption_method;
+}
+
+##------------------------------------
+# set new encryption method
+BEGIN { $TYPEINFO{SetEncryptionMethod} = ["function", "void", "string"];}
+sub SetEncryptionMethod {
+
+ my $self = shift;
+ my $method = shift;
+ if ($encryption_method ne $method) {
+ $encryption_method = $method;
+ if (defined $max_lengths{$encryption_method}) {
+ $max_pass_length{"local"} = $max_lengths{$encryption_method};
+ }
+ }
+}
+
+BEGIN { $TYPEINFO{GetAutologinUser} = ["function", "string"]; }
+sub GetAutologinUser {
+ return $autologin_user;
+}
+
+BEGIN { $TYPEINFO{AutologinUsed} = ["function", "boolean"]; }
+sub AutologinUsed {
+ return bool ($autologin_user ne "");
+}
+
+BEGIN { $TYPEINFO{SetAutologinUser} = ["function", "void", "string"]; }
+sub SetAutologinUser {
+ my $self = shift;
+ $autologin_user = shift;
+}
+
+BEGIN { $TYPEINFO{GetRootAlias} = ["function", "string"]; }
+sub GetRootAlias {
+ return $root_alias;
+}
+
+BEGIN { $TYPEINFO{SetRootAlias} = ["function", "void", "string"]; }
+sub SetRootAlias {
+ my $self = shift;
+ $root_alias = shift;
+}
+
+BEGIN { $TYPEINFO{AfterAuth} = ["function", "string"];}
+sub AfterAuth {
+ return $after_auth;
+}
+
+BEGIN { $TYPEINFO{SetAfterAuth} = ["function", "void", "string"];}
+sub SetAfterAuth {
+ my $self = shift;
+ $after_auth = $_[0];
+}
+
+# return the value of run_krb_config (should the kerberos config be run?)
+BEGIN { $TYPEINFO{KerberosConfiguration} = ["function", "boolean"];}
+sub KerberosConfiguration {
+ return bool ($run_krb_config);
+}
+
+# set the new value for run_krb_config
+BEGIN { $TYPEINFO{SetKerberosConfiguration} = ["function", "void", "boolean"];}
+sub SetKerberosConfiguration {
+ my $self = shift;
+ my $krb = shift;
+ $run_krb_config = bool ($krb) if (defined $krb);
+}
+
+
+
+##------------------------------------
+# Returns the map of user configured during installation
+# @return the map of user
+BEGIN { $TYPEINFO{GetUser} = [ "function",
+ ["map", "string", "any" ]];
+}
+sub GetUser {
+
+ return \%user;
+}
+
+##------------------------------------
+# Saves the user data into the map
+# @param data user initial data (could be an empty map)
+BEGIN { $TYPEINFO{SetUser} = ["function",
+ "string",
+ ["map", "string", "any" ]]; # data to fill in
+}
+sub SetUser {
+
+ my $self = shift;
+ my $data = shift;
+ if (defined $data && (ref ($data) eq "HASH")) {
+ %user = %{$data};
+ }
+ return "";
+}
+
+# was root password written in 1st stage?
+BEGIN { $TYPEINFO{RootPasswordWritten} = ["function", "boolean"];}
+sub RootPasswordWritten {
+ return bool ($root_password_written);
+}
+
+##------------------------------------
+# save the root password into variable
+BEGIN { $TYPEINFO{SetRootPassword} = ["function", "void", "string"];}
+sub SetRootPassword {
+
+ my $self = shift;
+ $root_password = $_[0];
+}
+
+##------------------------------------
+# crypt given password
+BEGIN { $TYPEINFO{CryptPassword} = ["function",
+ "string", "string"];
+}
+sub CryptPassword {
+
+ my $self = shift;
+ my $pw = shift;
+
+ return $pw if (!defined $pw);
+ return UsersUI->HashPassword (lc ($encryption_method), $pw);
+}
+
+##------------------------------------
+# Writes password of superuser
+# This is called during install
+# @return true on success
+BEGIN { $TYPEINFO{WriteRootPassword} = ["function", "boolean"];}
+sub WriteRootPassword {
+
+ my $self = shift;
+ my $crypted = $self->CryptPassword ($root_password, "system");
+ return SCR->Write (".target.passwd.root", $crypted);
+}
+
+# "-" means range! -> at the begining or at the end!
+# now CHARACTER_CLASS from /etc/login.defs is used
+my $valid_logname_chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-";
+
+my $valid_password_chars = "[-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#\$%^&*() ,;:._+/|?{}=\['\"`~<>]|]";# the ']' is or-ed...
+
+# error popup
+my $valid_password_message = __("The password may only contain the following characters:
+0-9, a-z, A-Z, and any of \"`~!\@#\$%^&* ,.;:._-+/|\?='{[(<>)]}\\\".
+Try again.");
+
+my $valid_home_chars = "[0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/_.-]";
+
+##------------------------------------
+BEGIN { $TYPEINFO{ValidLognameChars} = ["function", "string"]; }
+sub ValidLognameChars {
+ return $valid_logname_chars;
+}
+
+##------------------------------------
+BEGIN { $TYPEINFO{ValidPasswordChars} = ["function", "string"]; }
+sub ValidPasswordChars {
+ return $valid_password_chars;
+}
+
+##------------------------------------
+BEGIN { $TYPEINFO{ValidHomeChars} = ["function", "string"]; }
+sub ValidHomeChars {
+ return $valid_home_chars;
+}
+
+##------------------------------------
+BEGIN { $TYPEINFO{ValidPasswordMessage} = ["function", "string"]; }
+sub ValidPasswordMessage {
+ return $valid_password_message;
+}
+
+##------------------------------------
+# Return the part of help text about valid password characters
+BEGIN { $TYPEINFO{ValidPasswordHelptext} = ["function", "string"]; }
+sub ValidPasswordHelptext {
+ # help text (default part shown in more places)
+ return __("<p>
+For the password, use only characters that can be found on an English keyboard
+layout. In cases of system error, it may be necessary to log in without a
+localized keyboard layout.
+</p>");
+}
+
+##------------------------------------
+BEGIN { $TYPEINFO{GetMinPasswordLength} = ["function", "integer", "string"]; }
+sub GetMinPasswordLength {
+
+ my $self = shift;
+ if (defined ($min_pass_length{$_[0]})) {
+ return $min_pass_length{$_[0]};
+ }
+ else { return 5;}
+}
+
+##------------------------------------
+BEGIN { $TYPEINFO{GetMaxPasswordLength} = ["function", "integer", "string"]; }
+sub GetMaxPasswordLength {
+ my $self = shift;
+ if (defined ($max_pass_length{$_[0]})) {
+ return $max_pass_length{$_[0]};
+ }
+ else { return 8; }
+}
+
+# Writes the settings configured in 1st stage
+BEGIN { $TYPEINFO{Write} = ["function", "boolean"];}
+sub Write {
+
+ my $self = shift;
+ if (defined $user{"userpassword"}) {
+ $user{"userpassword"} = $self->CryptPassword ($user{"userpassword"});
+ $user{"encrypted"} = YaST::YCP::Integer (1);
+ }
+ my %data = (
+ "after_auth" => $after_auth,
+ "run_krb_config" => YaST::YCP::Integer ($run_krb_config),
+ "user" => \%user,
+ "encryption_method" => $encryption_method,
+ "root_alias" => $root_alias,
+ "autologin_user" => $autologin_user
+ );
+ if ($root_password) {
+ # indication to inst_root
+ $data{"root_password_written"} = YaST::YCP::Integer (1);
+ }
+ my $file = Directory->vardir()."/users_first_stage.ycp";
+ my $ret = SCR->Write (".target.ycp", $file, \%data);
+
+ y2milestone ("1st stage user information written: ", $ret);
+
+ # make the file root only readable
+ SCR->Execute (".target.bash", "chmod 600 $file") if ($ret);
+
+ # write root password now
+ $self->WriteRootPassword () if ($root_password);
+
+ return $ret;
+}
+
+# Read the settings configured in 1st stage
+BEGIN { $TYPEINFO{Read} = ["function", "boolean"];}
+sub Read {
+
+ my $self = shift;
+ my $file = Directory->vardir()."/users_first_stage.ycp";
+ my $ret = 0;
+
+ if (FileUtils->Exists ($file)) {
+ my $data = SCR->Read (".target.ycp", $file);
+ if (defined $data && ref ($data) eq "HASH") {
+
+ $autologin_user = $data->{"autologin_user"} || "";
+ $root_alias = $data->{"root_alias"} || "";
+ $after_auth = $data->{"after_auth"} || $after_auth;
+ $encryption_method =
+ $data->{"encryption_method"} || $encryption_method;
+ $run_krb_config = bool ($data->{"run_krb_config"});
+ if (ref ($data->{"user"}) eq "HASH") {
+ %user = %{$data->{"user"}};
+ }
+ $root_password_written = bool ($data->{"root_password_written"});
+ $ret = 1;
+ }
+# SCR->Execute (".target.remove", $file); TODO
+ }
+ return bool ($ret);
+}
+1
+# EOF
Modified: trunk/users/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/src/dialogs.ycp?rev=44075&r1=44074&r2=44075&view=diff
==============================================================================
--- trunk/users/src/dialogs.ycp (original)
+++ trunk/users/src/dialogs.ycp Thu Jan 31 16:31:16 2008
@@ -1644,15 +1644,15 @@
if (root_mail_checked)
{
if (username != org_username)
- Users::RemoveRootMail (org_username);
- Users::AddRootMail (username);
+ Users::RemoveRootAlias (org_username);
+ Users::AddRootAlias (username);
}
else if (root_mail) // not checked now, but checked before
{
if (username != org_username)
- Users::RemoveRootMail (org_username);
+ Users::RemoveRootAlias (org_username);
else
- Users::RemoveRootMail (username);
+ Users::RemoveRootAlias (username);
}
}
Modified: trunk/users/src/inst_auth.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/src/inst_auth.ycp?rev=44075&r1=44074&r2=44075&view=diff
==============================================================================
--- trunk/users/src/inst_auth.ycp (original)
+++ trunk/users/src/inst_auth.ycp Thu Jan 31 16:31:16 2008
@@ -14,6 +14,7 @@
import "Directory";
import "FileUtils";
+import "GetInstArgs";
import "Label";
import "Ldap";
import "NetworkInterfaces";
@@ -22,9 +23,8 @@
import "Popup";
import "Users";
import "UsersCache";
+import "UsersSimple";
import "Wizard";
-import "GetInstArgs";
-
/**
@@ -80,6 +80,17 @@
return ret == `ok ? selected : nil;
}
+//----------------------------------------- main body ----------------------
+
+// first check if some settings were written in first stage
+if (!GetInstArgs::going_back()) {
+
+ Users::SetKerberosConfiguration (UsersSimple::KerberosConfiguration ());
+ Users::SetAfterAuth (UsersSimple::AfterAuth ());
+ y2milestone ("skipping authentication dialog...");
+ return `next;
+ // TODO: actually, this could be all for this client...
+}
// Check if lan is configured
list<string> net_devices = NetworkInterfaces::ListDevicesExcept("dialup");
Modified: trunk/users/src/inst_root.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/src/inst_root.ycp?rev=44075&r1=44074&r2=44075&view=diff
==============================================================================
--- trunk/users/src/inst_root.ycp (original)
+++ trunk/users/src/inst_root.ycp Thu Jan 31 16:31:16 2008
@@ -30,10 +30,21 @@
import "Stage";
import "Users";
import "UsersCache";
+import "UsersSimple";
import "Wizard";
include "users/widgets.ycp"; // for EncryptionPopup()
+ UsersSimple::Read ();
+ if (!GetInstArgs::going_back() && UsersSimple::RootPasswordWritten ())
+ {
+ y2milestone ("root password was already written...");
+ // write encryption method (makes sense even if no local user is set)
+ Users::SetEncryptionMethod (UsersSimple::EncryptionMethod ());
+ Users::WriteSecurity ();
+ return `auto;
+ }
+
boolean check_CA_constraints =
ProductFeatures::GetBooleanFeature ("globals","root_password_ca_check");
Modified: trunk/users/src/inst_user.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/src/inst_user.ycp?rev=44075&r1=44074&r2=44075&view=diff
==============================================================================
--- trunk/users/src/inst_user.ycp (original)
+++ trunk/users/src/inst_user.ycp Thu Jan 31 16:31:16 2008
@@ -12,17 +12,49 @@
textdomain "users";
+ import "Autologin";
import "GetInstArgs";
import "Package";
import "Label";
import "Ldap";
+ import "Progress";
import "Users";
import "UsersCache";
+ import "UsersSimple";
import "Wizard";
include "users/wizards.ycp";
- any ret = `back;
+ symbol ret = `back;
+ if (!GetInstArgs::going_back() &&
+ UsersSimple::AfterAuth () == "users" &&
+ UsersSimple::GetUser () != $[])
+ {
+ map
participants (1)
-
jsuchome@svn.opensuse.org