Blame SOURCES/ovt-End-VGAuth-impersonation-in-the-case-of-error.patch

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