Blame SOURCES/ovt-Remove-some-dead-code.patch

79b9e8
From 626402d0e29e816e46fea97797c02c6264997a6f Mon Sep 17 00:00:00 2001
79b9e8
From: John Wolfe <jwolfe@vmware.com>
79b9e8
Date: Mon, 8 May 2023 20:15:01 -0700
79b9e8
Subject: [PATCH] Remove some dead code.
79b9e8
79b9e8
RH-Author: Ani Sinha <None>
79b9e8
RH-MergeRequest: 22: Remove some dead code.
79b9e8
RH-Bugzilla: 2215562
79b9e8
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
79b9e8
RH-Acked-by: Cathy Avery <cavery@redhat.com>
79b9e8
RH-Commit: [1/1] f1963d6d390d5f10d827fb3f1057123bb32dda53
79b9e8
79b9e8
Address CVE-2023-20867.
79b9e8
Remove some authentication types which were deprecated long
79b9e8
ago and are no longer in use. These are dead code.
79b9e8
79b9e8
cherry-picked from
79b9e8
https://github.com/vmware/open-vm-tools/blob/CVE-2023-20867.patch/2023-20867-Remove-some-dead-code-1100-1105.patch
79b9e8
79b9e8
Signed-off-by: Ani Sinha <anisinha@redhat.com>
79b9e8
---
79b9e8
 open-vm-tools/services/plugins/vix/vixTools.c | 102 ------------------
79b9e8
 1 file changed, 102 deletions(-)
79b9e8
79b9e8
diff --git a/open-vm-tools/services/plugins/vix/vixTools.c b/open-vm-tools/services/plugins/vix/vixTools.c
79b9e8
index c40ad15a..d9b947f6 100644
79b9e8
--- a/open-vm-tools/services/plugins/vix/vixTools.c
79b9e8
+++ b/open-vm-tools/services/plugins/vix/vixTools.c
79b9e8
@@ -228,8 +228,6 @@ char *gImpersonatedUsername = NULL;
79b9e8
 #define  VIX_TOOLS_CONFIG_API_AUTHENTICATION          "Authentication"
79b9e8
 #define  VIX_TOOLS_CONFIG_AUTHTYPE_AGENTS             "InfrastructureAgents"
79b9e8
 
79b9e8
-#define VIX_TOOLS_CONFIG_INFRA_AGENT_DISABLED_DEFAULT  TRUE
79b9e8
-
79b9e8
 /*
79b9e8
  * The switch that controls all APIs
79b9e8
  */
79b9e8
@@ -704,9 +702,6 @@ VixError GuestAuthSAMLAuthenticateAndImpersonate(
79b9e8
 
79b9e8
 void GuestAuthUnimpersonate();
79b9e8
 
79b9e8
-static Bool VixToolsCheckIfAuthenticationTypeEnabled(GKeyFile *confDictRef,
79b9e8
-                                                     const char *typeName);
79b9e8
-
79b9e8
 #if SUPPORT_VGAUTH
79b9e8
 
79b9e8
 VGAuthError TheVGAuthContext(VGAuthContext **ctx);
79b9e8
@@ -7845,29 +7840,6 @@ VixToolsImpersonateUser(VixCommandRequestHeader *requestMsg,   // IN
79b9e8
                                           userToken);
79b9e8
       break;
79b9e8
    }
79b9e8
-   case VIX_USER_CREDENTIAL_ROOT:
79b9e8
-   {
79b9e8
-      if ((requestMsg->requestFlags & VIX_REQUESTMSG_HAS_HASHED_SHARED_SECRET) &&
79b9e8
-          !VixToolsCheckIfAuthenticationTypeEnabled(gConfDictRef,
79b9e8
-                                            VIX_TOOLS_CONFIG_AUTHTYPE_AGENTS)) {
79b9e8
-          /*
79b9e8
-           * Don't accept hashed shared secret if disabled.
79b9e8
-           */
79b9e8
-          g_message("%s: Requested authentication type has been disabled.\n",
79b9e8
-                    __FUNCTION__);
79b9e8
-          err = VIX_E_GUEST_AUTHTYPE_DISABLED;
79b9e8
-          goto done;
79b9e8
-      }
79b9e8
-   }
79b9e8
-   // fall through
79b9e8
-
79b9e8
-   case VIX_USER_CREDENTIAL_CONSOLE_USER:
79b9e8
-      err = VixToolsImpersonateUserImplEx(NULL,
79b9e8
-                                          credentialType,
79b9e8
-                                          NULL,
79b9e8
-                                          loadUserProfile,
79b9e8
-                                          userToken);
79b9e8
-      break;
79b9e8
    case VIX_USER_CREDENTIAL_NAME_PASSWORD:
79b9e8
    case VIX_USER_CREDENTIAL_NAME_PASSWORD_OBFUSCATED:
79b9e8
    case VIX_USER_CREDENTIAL_NAMED_INTERACTIVE_USER:
79b9e8
@@ -8036,36 +8008,6 @@ VixToolsImpersonateUserImplEx(char const *credentialTypeStr,         // IN
79b9e8
          }
79b9e8
       }
79b9e8
 
79b9e8
-      /*
79b9e8
-       * If the VMX asks to be root, then we allow them.
79b9e8
-       * The VMX will make sure that only it will pass this value in,
79b9e8
-       * and only when the VM and host are configured to allow this.
79b9e8
-       */
79b9e8
-      if ((VIX_USER_CREDENTIAL_ROOT == credentialType)
79b9e8
-            && (thisProcessRunsAsRoot)) {
79b9e8
-         *userToken = PROCESS_CREATOR_USER_TOKEN;
79b9e8
-
79b9e8
-         gImpersonatedUsername = Util_SafeStrdup("_ROOT_");
79b9e8
-         err = VIX_OK;
79b9e8
-         goto abort;
79b9e8
-      }
79b9e8
-
79b9e8
-      /*
79b9e8
-       * If the VMX asks to be root, then we allow them.
79b9e8
-       * The VMX will make sure that only it will pass this value in,
79b9e8
-       * and only when the VM and host are configured to allow this.
79b9e8
-       *
79b9e8
-       * XXX This has been deprecated XXX
79b9e8
-       */
79b9e8
-      if ((VIX_USER_CREDENTIAL_CONSOLE_USER == credentialType)
79b9e8
-            && ((allowConsoleUserOps) || !(thisProcessRunsAsRoot))) {
79b9e8
-         *userToken = PROCESS_CREATOR_USER_TOKEN;
79b9e8
-
79b9e8
-         gImpersonatedUsername = Util_SafeStrdup("_CONSOLE_USER_NAME_");
79b9e8
-         err = VIX_OK;
79b9e8
-         goto abort;
79b9e8
-      }
79b9e8
-
79b9e8
       /*
79b9e8
        * If the VMX asks us to run commands in the context of the current
79b9e8
        * user, make sure that the user who requested the command is the
79b9e8
@@ -10755,50 +10697,6 @@ VixToolsCheckIfVixCommandEnabled(int opcode,                          // IN
79b9e8
 }
79b9e8
 
79b9e8
 
79b9e8
-/*
79b9e8
- *-----------------------------------------------------------------------------
79b9e8
- *
79b9e8
- * VixToolsCheckIfAuthenticationTypeEnabled --
79b9e8
- *
79b9e8
- *    Checks to see if a given authentication type has been
79b9e8
- *    disabled via the tools configuration.
79b9e8
- *
79b9e8
- * Return value:
79b9e8
- *    TRUE if enabled, FALSE otherwise.
79b9e8
- *
79b9e8
- * Side effects:
79b9e8
- *    None
79b9e8
- *
79b9e8
- *-----------------------------------------------------------------------------
79b9e8
- */
79b9e8
-
79b9e8
-static Bool
79b9e8
-VixToolsCheckIfAuthenticationTypeEnabled(GKeyFile *confDictRef,     // IN
79b9e8
-                                         const char *typeName)      // IN
79b9e8
-{
79b9e8
-   char authnDisabledName[64]; // Authentication.<AuthenticationType>.disabled
79b9e8
-   gboolean disabled;
79b9e8
-
79b9e8
-   Str_Snprintf(authnDisabledName, sizeof(authnDisabledName),
79b9e8
-                VIX_TOOLS_CONFIG_API_AUTHENTICATION ".%s.disabled",
79b9e8
-                typeName);
79b9e8
-
79b9e8
-   ASSERT(confDictRef != NULL);
79b9e8
-
79b9e8
-   /*
79b9e8
-    * XXX Skip doing the strcmp() to verify the auth type since we only
79b9e8
-    * have the one typeName (VIX_TOOLS_CONFIG_AUTHTYPE_AGENTS), and default
79b9e8
-    * it to VIX_TOOLS_CONFIG_INFRA_AGENT_DISABLED_DEFAULT.
79b9e8
-    */
79b9e8
-   disabled = VixTools_ConfigGetBoolean(confDictRef,
79b9e8
-                                        VIX_TOOLS_CONFIG_API_GROUPNAME,
79b9e8
-                                        authnDisabledName,
79b9e8
-                                        VIX_TOOLS_CONFIG_INFRA_AGENT_DISABLED_DEFAULT);
79b9e8
-
79b9e8
-   return !disabled;
79b9e8
-}
79b9e8
-
79b9e8
-
79b9e8
 /*
79b9e8
  *-----------------------------------------------------------------------------
79b9e8
  *
79b9e8
-- 
79b9e8
2.37.3
79b9e8