diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-07-29 12:15:34 -0700 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-07-29 13:03:12 -0700 |
commit | ce7268fd7f09e2f0ca30d664df541ca89e983258 (patch) | |
tree | ff0c900fd2cc5c0446be5066ca84a06241e1c151 /lib/chef/win32/net.rb | |
parent | 69a8fc2f30188e8947af304d7f804d51d05de00a (diff) | |
download | chef-ce7268fd7f09e2f0ca30d664df541ca89e983258.tar.gz |
Convert NetLocalGroupAdd to use FFI
Diffstat (limited to 'lib/chef/win32/net.rb')
-rw-r--r-- | lib/chef/win32/net.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/chef/win32/net.rb b/lib/chef/win32/net.rb index 1349091eb9..ce6b64e255 100644 --- a/lib/chef/win32/net.rb +++ b/lib/chef/win32/net.rb @@ -106,6 +106,19 @@ END raise Chef::Exceptions::Win32APIError, msg + "\n" + formatted_message end + def self.net_local_group_add(server_name, group_name) + server_name = wstring(server_name) + group_name = wstring(group_name) + + buf = LOCALGROUP_INFO_0.new + buf[:lgrpi0_name] = FFI::MemoryPointer.from_string(group_name) + + rc = NetLocalGroupAdd(server_name, 0, buf, nil) + if rc != NERR_Success + net_api_error!(rc) + end + end + def self.net_user_add_l3(server_name, args) buf = default_user_info_3 |