From c85f17331162f1eca18d33f5591460edbe787c66 Mon Sep 17 00:00:00 2001 From: Bryan McLellan Date: Mon, 20 Nov 2017 13:24:54 -0500 Subject: DO NOT MERGE: bunch of debugging Signed-off-by: Bryan McLellan --- appveyor.yml | 2 -- lib/chef/mixin/user_context.rb | 3 +++ lib/chef/util/windows/logon_session.rb | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index de947203c1..fa361939e0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,9 +29,7 @@ install: - ruby --version - gem --version - bundler --version - - gem uninstall bundler -a -x - gem update --system %OMNIBUS_RUBYGEMS% || gem update --system %OMNIBUS_RUBYGEMS% || gem update --system %OMNIBUS_RUBYGEMS% - - gem install bundler -v %OMNIBUS_BUNDLER% --quiet --no-ri --no-rdoc || gem install bundler -v %OMNIBUS_BUNDLER% --quiet --no-ri --no-rdoc || gem install bundler -v %OMNIBUS_BUNDLER% --quiet --no-ri --no-rdoc - gem --version - bundler --version - SET BUNDLE_WITHOUT=server:docgen:maintenance:pry:travis:integration:ci diff --git a/lib/chef/mixin/user_context.rb b/lib/chef/mixin/user_context.rb index 526d6b0f3f..f89acb3c99 100644 --- a/lib/chef/mixin/user_context.rb +++ b/lib/chef/mixin/user_context.rb @@ -34,6 +34,7 @@ class Chef login_session = nil begin + puts "UserContext DEBUG: creating new logon session with user: '#{user}'" if user logon_session = Chef::Util::Windows::LogonSession.new(user, password, domain) logon_session.open @@ -41,7 +42,9 @@ class Chef end yield ensure + puts "UserContext DEBUG: about to call logon_session.close, logon_session is: '#{logon_session}'" logon_session.close if logon_session + puts "UserContext DEBUG: after logon_session.close" end end diff --git a/lib/chef/util/windows/logon_session.rb b/lib/chef/util/windows/logon_session.rb index ef80b113b1..3d1f858825 100644 --- a/lib/chef/util/windows/logon_session.rb +++ b/lib/chef/util/windows/logon_session.rb @@ -58,9 +58,11 @@ class Chef end def close + puts "UserContext DEBUG: in close" validate_session_open! if impersonating + puts "UserContext DEBUG: impersonating, calling restore_user_context" restore_user_context end @@ -91,10 +93,13 @@ class Chef end def restore_user_context + puts "UserContext DEBUG: calling restore_user_context" validate_session_open! if impersonating + puts "UserContext DEBUG: impersonating, calling RevertToSelf" status = Chef::ReservedNames::Win32::API::Security.RevertToSelf + puts "UserContext DEBUG: RevertToSelf return: '#{status}'" if !status last_error = FFI::LastError.error -- cgit v1.2.1