summaryrefslogtreecommitdiff
path: root/lib/chef/util/windows
diff options
context:
space:
mode:
authorAmeya Varade <ameya.varade@clogeny.com>2013-06-24 21:01:39 +0530
committeradamedx <adamed@opscode.com>2013-06-25 07:24:05 -0700
commit8a63098cf318f8dd29ed54242df600a80c124da5 (patch)
tree477d26c74eb2be046474ec228e06f9b4c67e6819 /lib/chef/util/windows
parent9678ccfae66c3c984b0f177dad39b9abbe6264d5 (diff)
downloadchef-8a63098cf318f8dd29ed54242df600a80c124da5.tar.gz
comments are always good.
It's tough to understand this fix, thus putting some descriptive comments.
Diffstat (limited to 'lib/chef/util/windows')
-rw-r--r--lib/chef/util/windows/net_user.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/chef/util/windows/net_user.rb b/lib/chef/util/windows/net_user.rb
index 69f18d8dc6..256fdc5f24 100644
--- a/lib/chef/util/windows/net_user.rb
+++ b/lib/chef/util/windows/net_user.rb
@@ -37,6 +37,11 @@ class Chef::Util::Windows::NetUser < Chef::Util::Windows
#[:symbol_name, default_val]
#default_val duals as field type
#array index duals as structure offset
+
+ #OC-8391
+ #Changing [:password, nil], to [:password, ""],
+ #if :password is set to nil, windows user creation api ignores the password policy applied
+ #thus initializing it with empty string value.
USER_INFO_3 = [
[:name, nil],
[:password, ""],
@@ -183,6 +188,8 @@ class Chef::Util::Windows::NetUser < Chef::Util::Windows
def disable_account
user_modify do |user|
user[:flags] |= UF_ACCOUNTDISABLE
+ #This does not set the password to nil. It (for some reason) means to ignore updating the field.
+ #please refer to https://github.com/jmccann/chef/commit/ff732aab4f7e79f215567bcc3dc4e4f7295207ee#commitcomment-3413715
user[:password] = nil
end
end
@@ -190,6 +197,8 @@ class Chef::Util::Windows::NetUser < Chef::Util::Windows
def enable_account
user_modify do |user|
user[:flags] &= ~UF_ACCOUNTDISABLE
+ #This does not set the password to nil. It (for some reason) means to ignore updating the field.
+ #please refer to https://github.com/jmccann/chef/commit/ff732aab4f7e79f215567bcc3dc4e4f7295207ee#commitcomment-3413715
user[:password] = nil
end
end