summaryrefslogtreecommitdiff
path: root/lib/chef/util
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2015-05-08 08:32:03 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2015-05-15 08:51:17 -0700
commit4f1c79cb4f6de820d2bb29ea1cb5e3adf914c1ec (patch)
tree70a1af64b62134a43d89d5ca1caedc8426775d73 /lib/chef/util
parentca93171b6d2ed8a5a36c1f10f09a26b47fea47bf (diff)
downloadchef-4f1c79cb4f6de820d2bb29ea1cb5e3adf914c1ec.tar.gz
NetUserSetInfo uses ffi
Diffstat (limited to 'lib/chef/util')
-rw-r--r--lib/chef/util/windows/net_user.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/chef/util/windows/net_user.rb b/lib/chef/util/windows/net_user.rb
index 1144645eef..5da0fc3835 100644
--- a/lib/chef/util/windows/net_user.rb
+++ b/lib/chef/util/windows/net_user.rb
@@ -126,7 +126,7 @@ class Chef::Util::Windows::NetUser < Chef::Util::Windows
def usri3_to_hash(usri3)
t = USER_INFO_3_TRANSFORM.invert
usri3.inject({}) do |memo, (k,v)|
- memo[USER_INFO_3_TRANSFORM[k]] = v
+ memo[t[k]] = v
memo
end
end
@@ -153,11 +153,10 @@ class Chef::Util::Windows::NetUser < Chef::Util::Windows
end
def set_info(args)
- user = user_info_3(args)
- buffer = user_info_3_pack(user)
- rc = NetUserSetInfo.call(nil, @name, 3, buffer, nil)
- if rc != NERR_Success
- raise ArgumentError, get_last_error(rc)
+ begin
+ rc = Chef::ReservedNames::Win32::NetUser::net_user_set_info_l3(nil, @username, transform_usri3(args))
+ rescue Chef::Exceptions::Win32APIError => e
+ raise ArgumentError, e
end
end