summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan McLellan <btm@loftninjas.org>2017-11-20 13:24:54 -0500
committerBryan McLellan <btm@loftninjas.org>2017-11-20 15:56:15 -0500
commitc85f17331162f1eca18d33f5591460edbe787c66 (patch)
treeda5625607ffe377151a4328c71f27b509cda3e40
parent25d1ec70d26e999a9998e6b8df6078f0df01aa5a (diff)
downloadchef-btm/test_user_context.tar.gz
DO NOT MERGE: bunch of debuggingbtm/test_user_context
Signed-off-by: Bryan McLellan <btm@loftninjas.org>
-rw-r--r--appveyor.yml2
-rw-r--r--lib/chef/mixin/user_context.rb3
-rw-r--r--lib/chef/util/windows/logon_session.rb5
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