summaryrefslogtreecommitdiff
path: root/lib/chef/win32/net.rb
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2015-07-29 12:15:34 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2015-07-29 13:03:12 -0700
commitce7268fd7f09e2f0ca30d664df541ca89e983258 (patch)
treeff0c900fd2cc5c0446be5066ca84a06241e1c151 /lib/chef/win32/net.rb
parent69a8fc2f30188e8947af304d7f804d51d05de00a (diff)
downloadchef-ce7268fd7f09e2f0ca30d664df541ca89e983258.tar.gz
Convert NetLocalGroupAdd to use FFI
Diffstat (limited to 'lib/chef/win32/net.rb')
-rw-r--r--lib/chef/win32/net.rb13
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