diff options
author | Tom Duffield <tom@chef.io> | 2016-10-31 12:30:17 -0500 |
---|---|---|
committer | Tom Duffield <tom@chef.io> | 2016-10-31 12:53:26 -0500 |
commit | a47b1840e6c7b356b79bd535033ba4cf50231bc3 (patch) | |
tree | c58ee90b784b98052bdd77a067fbb730139ca05d | |
parent | 1738bd548fe1227017f3fbd093fcf13f5c194bad (diff) | |
download | chef-COOL-413/getent-on-solaris-doesnt-work.tar.gz |
Solaris users are locked only if *LK*COOL-413/getent-on-solaris-doesnt-work
According to `man shadow` on Solaris 10 and 11, an account is only
locked if the first four characters in the password field are
`*LK*`. The same is true for SmartOS (the OS for which the initial code
was contributed).
Signed-off-by: Tom Duffield <tom@chef.io>
-rw-r--r-- | lib/chef/provider/user/solaris.rb | 2 | ||||
-rw-r--r-- | spec/unit/provider/user/solaris_spec.rb | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/chef/provider/user/solaris.rb b/lib/chef/provider/user/solaris.rb index 7bd944ed1c..7aa0ceb93a 100644 --- a/lib/chef/provider/user/solaris.rb +++ b/lib/chef/provider/user/solaris.rb @@ -53,7 +53,7 @@ class Chef raise Chef::Exceptions::User, "Cannot determine if #{@new_resource} is locked!" if user.nil? - @locked = !!(user[1] =~ /^\*?LK\*?/) + @locked = user[1].start_with?("*LK*") end def lock_user diff --git a/spec/unit/provider/user/solaris_spec.rb b/spec/unit/provider/user/solaris_spec.rb index ee2a744ea2..1935336308 100644 --- a/spec/unit/provider/user/solaris_spec.rb +++ b/spec/unit/provider/user/solaris_spec.rb @@ -123,11 +123,11 @@ describe Chef::Provider::User::Solaris do # locked shadow lines [ - "adam:LK:::::::", "adam:*LK*:::::::", "adam:*LK*foobar:::::::", "adam:*LK*bahamas10:::::::", "adam:*LK*goonawaLK:::::::", + "adam:*LK*LKgir:::::::", "adam:*LK*L....:::::::", ].each do |shadow| context "for user 'adam' with entry '#{shadow}'" do @@ -146,6 +146,7 @@ describe Chef::Provider::User::Solaris do "adam:foobar:::::::", "adam:bahamas10:::::::", "adam:goonawaLK:::::::", + "adam:LKgir:::::::", "adam:L...:::::::", ].each do |shadow| context "for user 'adam' with entry '#{shadow}'" do |