Skip to content

Commit

Permalink
Stop using (except for LDAP) and exporting useradd_defaults.skel
Browse files Browse the repository at this point in the history
  • Loading branch information
ancorgs committed Oct 7, 2021
1 parent 73dbe39 commit ad03ec2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/lib/y2users/autoinst_profile/user_defaults_section.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def self.attributes
# @return [String,nil] Default shell
#
# @!attribute skel
# @return [String,nil] Location of the files to be used as skeleton
# @return [String,nil] Location of the files to be used as skeleton. Currently used only for
# LDAP users, for which the home directory is still created directly by YaST.
#
# @!attribute umask
# @return [String,nil] File creation mode mask for the home directory
Expand Down
1 change: 0 additions & 1 deletion src/modules/Users.pm
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ my %useradd_defaults = (
"inactive" => "",
"expire" => "",
"shell" => "",
"skel" => "",
"groups" => "",
"umask" => "022"
);
Expand Down
9 changes: 7 additions & 2 deletions src/modules/UsersLDAP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ my $filters_read = 0;
# default shadow settings for LDAP users
my %shadow = ();

# other default settings (home, shell, etc.) for LDAP users
# (has the same structure as Users::useradd_defaults)
# other default settings (home, shell, etc.) for LDAP users.
# This has the same basic structure as Users::useradd_defaults, but it can contain extra keys that
# have been dropped from the former (eg. "groups" or "skel")
my %useradd_defaults = ();

# some default values for LDAP users
Expand Down Expand Up @@ -167,6 +168,7 @@ YaST::YCP::Import ("UsersCache");
YaST::YCP::Import ("UsersPlugins");
YaST::YCP::Import ("UsersRoutines");
YaST::YCP::Import ("UsersUI");
YaST::YCP::Import ("Y2UsersLinux");

##------------------------------------

Expand Down Expand Up @@ -444,7 +446,10 @@ exists on the LDAP server. Create it now?"), $dn)))
}
if (defined $user_config{"suseSkelDir"}[0]) {
$useradd_defaults{"skel"} = $user_config{"suseSkelDir"}[0];
} else {
$useradd_defaults{"skel"} = ${Y2UsersLinux->read_useradd_config()}{"skel"};
}

# set default secondary groups
# Warning: there are DN's, but we want (?) only names...
if (defined ($user_template{"suseSecondaryGroup"})) {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Y2UsersLinux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Y2UsersLinuxClass < Module
include Yast::Logger

EXPORTED_USERADD_ATTRS =
["group", "home", "inactivity_period", "expiration", "shell", "umask"].freeze
["group", "home", "inactivity_period", "expiration", "shell", "skel", "umask"].freeze
private_constant :EXPORTED_USERADD_ATTRS

# Reads the defaults for useradd
Expand Down

0 comments on commit ad03ec2

Please sign in to comment.