From 65f14ca791ac6636ad7d8a3d59941e52a5e3188c Mon Sep 17 00:00:00 2001
From: Cathy Avery <cavery@redhat.com>
Date: Thu, 25 Jul 2019 12:32:24 +0200
Subject: [PATCH 01/16] End VGAuth impersonation in the case of error.
RH-Author: Cathy Avery <cavery@redhat.com>
Message-id: <20190725123239.18274-2-cavery@redhat.com>
Patchwork-id: 89711
O-Subject: [RHEL8.1 open-vm-tools PATCH 01/16] End VGAuth impersonation in the case of error.
Bugzilla: 1602648
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
commit 1535eb36e8293d753c29f1eaf6cd6d2165efb1ca
Author: Oliver Kurth <okurth@vmware.com>
Date: Tue Sep 4 15:40:58 2018 -0700
End VGAuth impersonation in the case of error.
* In GuestAuthPasswordAuthenticateImpersonate():
When VGAuth_UserHandleAccessToken fails, unimpersonation is not
being done. This can cause issues. Fixed it.
* In GuestAuthSAMLAuthenticateAndImpersonate(), fixed the following issues:
The 'newHandle' is not being freed which causes a memory leak.
When VGAuth_UserHandleAccessToken fails, unimpersonation is not
being done.
Signed-off-by: Cathy Avery <cavery@redhat.com>
Partial port: Only the parts of the patch that addesses the coverity defects were backported.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
open-vm-tools/services/plugins/vix/vixTools.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/services/plugins/vix/vixTools.c b/services/plugins/vix/vixTools.c
index 55b1f0a..2355beb 100644
--- a/services/plugins/vix/vixTools.c
+++ b/services/plugins/vix/vixTools.c
@@ -11630,8 +11630,8 @@ GuestAuthSAMLAuthenticateAndImpersonate(
{
#if SUPPORT_VGAUTH
VixError err;
- char *token;
- char *username;
+ char *token = NULL;
+ char *username = NULL;
VGAuthContext *ctx = NULL;
VGAuthError vgErr;
VGAuthUserHandle *newHandle = NULL;
@@ -11742,6 +11742,8 @@ impersonate:
err = VIX_OK;
done:
+ Util_ZeroFreeString(token);
+ Util_ZeroFreeString(username);
return err;
#else
--
1.8.3.1