]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Change to common source files not applicable to open-vm-tools.
authorKruti Pendharkar <kp025370@broadcom.com>
Mon, 1 Dec 2025 06:48:33 +0000 (22:48 -0800)
committerKruti Pendharkar <kp025370@broadcom.com>
Mon, 1 Dec 2025 06:48:33 +0000 (22:48 -0800)
open-vm-tools/vgauth/lib/auth.c
open-vm-tools/vgauth/lib/errortext.c
open-vm-tools/vgauth/lib/l10n/en.vmsg
open-vm-tools/vgauth/lib/l10n/es.vmsg
open-vm-tools/vgauth/lib/l10n/fr.vmsg
open-vm-tools/vgauth/lib/l10n/ja.vmsg
open-vm-tools/vgauth/public/VGAuthCommon.h

index 9895ae1c125a166625d6d6142dfeb50a7a127398..cc6d09ae20eb6e22ddb2d3fbcdcefc508c3c7e57 100644 (file)
@@ -610,7 +610,7 @@ VGAuth_ValidateUsernamePassword(VGAuthContext *ctx,
                         SU_(auth.password.invalid,
                             "Username and password validation failed for '%s': "
                             "%s"),
-                        userName, VGAuth_GetErrorText(err, NULL));
+                        userName, VGAuth_GetLocaleErrorText(err));
    }
 
    return err;
index da22269dddd6c6137935038ac3ee0d508e5f6ad0..cd522ea99d1a070953a2a4d278dffa77b29a612e 100644 (file)
@@ -1,5 +1,6 @@
 /*********************************************************
- * Copyright (C) 2011-2016 VMware, Inc. All rights reserved.
+ * Copyright (c) 2011-2025 Broadcom. All Rights Reserved.
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -22,7 +23,7 @@
  * Error descriptions.
  */
 
-#include "VGAuthCommon.h"
+#include "VGAuthInt.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -168,3 +169,100 @@ VGAuth_GetErrorName(VGAuthError errCode)
 {
    return VGAuthGetErrorInfo(errCode)->name;
 }
+
+#define ERRMSGID(id)   MSGID(id)
+
+
+/*
+ ******************************************************************************
+ * VGAuth_GetErrCodeToErrMsgId --                                          */ /**
+ *
+ * Returns error message id for an error code.  This returns a reference
+ * to a static global string, do not free it.
+ *
+ * @remark Can be called by any user.
+ *
+ * @param[in]  errCode    The VGAuthError code.
+ *
+ * @return An error message id with type const char *.
+ *
+ ******************************************************************************
+ */
+
+static const char *
+VGAuth_ErrCodeToErrMsgId(VGAuthError errCode)
+{
+   switch (errCode) {
+   case VGAUTH_E_OK:
+      return ERRMSGID(vgauth.errcode.ok) "The operation was successful";
+   case VGAUTH_E_INVALID_ARGUMENT:
+      return ERRMSGID(vgauth.errcode.invalid_argument) "One of the parameters was invalid";
+   case VGAUTH_E_INVALID_CERTIFICATE:
+      return ERRMSGID(vgauth.errcode.invalid_certificate) "The certificate is not a well-formed x509 document";
+   case VGAUTH_E_PERMISSION_DENIED:
+      return ERRMSGID(vgauth.errcode.permission_denied) "Insufficient permissions";
+   case VGAUTH_E_OUT_OF_MEMORY:
+      return ERRMSGID(vgauth.errcode.out_of_memory) "Out of memory";
+   case VGAUTH_E_COMM:
+      return ERRMSGID(vgauth.errcode.comm) "Internal communication error between library and service";
+   case VGAUTH_E_NOTIMPLEMENTED:
+      return ERRMSGID(vgauth.errcode.notimplemented) "Not implemented";
+   case VGAUTH_E_NOT_CONNECTED:
+      return ERRMSGID(vgauth.errcode.not_connected) "Not connected to the service";
+   case VGAUTH_E_VERSION_MISMATCH:
+      return ERRMSGID(vgauth.errcode.version_mismatch) "Service/library version mismatch";
+   case VGAUTH_E_SECURITY_VIOLATION:
+      return ERRMSGID(vgauth.errcode.security_violation) "Potential security violation detected";
+   case VGAUTH_E_CERT_ALREADY_EXISTS:
+      return ERRMSGID(vgauth.errcode.cert_already_exists) "The certificate already exists";
+   case VGAUTH_E_AUTHENTICATION_DENIED:
+      return ERRMSGID(vgauth.errcode.authentication_denied) "Authentication denied";
+   case VGAUTH_E_INVALID_TICKET:
+      return ERRMSGID(vgauth.errcode.invalid_ticket) "Invalid ticket";
+   case VGAUTH_E_MULTIPLE_MAPPINGS:
+      return ERRMSGID(vgauth.errcode.multiple_mappings)
+        "The certificate was found associated with more than one user, or a chain contained multiple matches against the mapping file";
+   case VGAUTH_E_ALREADY_IMPERSONATING:
+      return ERRMSGID(vgauth.errcode.already_impersonating) "The context is already impersonating";
+   case VGAUTH_E_NO_SUCH_USER:
+      return ERRMSGID(vgauth.errcode.no_such_user) "User cannot be found";
+   case VGAUTH_E_SERVICE_NOT_RUNNING:
+      return ERRMSGID(vgauth.errcode.service_not_running) "Service not running";
+   case VGAUTH_E_SYSTEM_ERRNO:
+      return ERRMSGID(vgauth.errcode.system_errno) "An OS-specific operation failed";
+   case VGAUTH_E_SYSTEM_WINDOWS:
+      return ERRMSGID(vgauth.errcode.system_windows) "An OS-specific operation failed";
+   case VGAUTH_E_TOO_MANY_CONNECTIONS:
+      return ERRMSGID(vgauth.errcode.too_many_connections) "The user exceeded its max number of connections";
+   case VGAUTH_E_UNSUPPORTED:
+      return ERRMSGID(vgauth.errcode.unsupported) "The operation is not supported";
+   }
+   return ERRMSGID(vgauth.errcode.fail) "Unknown error";
+}
+
+
+/*
+ ******************************************************************************
+ * VGAuth_GetLocaleErrorText --                                          */ /**
+ *
+ * Returns explanatory text for an error code.  This returns a reference
+ * to a string in hash table, do not free it.
+ *
+ * @remark Can be called by any user.
+ *
+ * @param[in]  errCode    The VGAuthError code.
+ *
+ * @return A description of @a errCode.
+ *
+ ******************************************************************************
+ */
+
+const char *
+VGAuth_GetLocaleErrorText(VGAuthError errCode)
+{
+   const char* msgid = VGAuth_ErrCodeToErrMsgId(errCode);
+   const char* errmsg = I18n_GetString(VMW_TEXT_DOMAIN, msgid);
+
+   g_debug("ErrCode %llu (ErrMsgId: %s) --- ErrMsg: %s", errCode, msgid, errmsg);
+   return errmsg;
+}
index b4a12ce4208d7dab5c73854ff8aaf0199e3681b4..8bc511394159b13f6aa4cc97cc232ca43800ebc1 100644 (file)
 auth.password.invalid = "Username and password validation failed for '%1$s': %2$s"
 auth.password.valid = "Username and password successfully validated for '%1$s'"
 auth.sspi.badid = "Attempt to authenticate using an invalid or expired SSPI challenge ID: %1$u"
+
+vgauth.errcode.ok = "The operation was successful"
+vgauth.errcode.invalid_argument = "One of the parameters was invalid"
+vgauth.errcode.invalid_certificate = "The certificate is not a well-formed x509 document"
+vgauth.errcode.permission_denied = "Insufficient permissions"
+vgauth.errcode.out_of_memory = "Out of memory"
+vgauth.errcode.comm = "Internal communication error between library and service"
+vgauth.errcode.notimplemented = "Not implemented"
+vgauth.errcode.not_connected = "Not connected to the service"
+vgauth.errcode.version_mismatch = "Service/library version mismatch"
+vgauth.errcode.security_violation = "Potential security violation detected"
+vgauth.errcode.cert_already_exists = "The certificate already exists"
+vgauth.errcode.authentication_denied = "Authentication denied"
+vgauth.errcode.invalid_ticket = "Invalid ticket"
+vgauth.errcode.multiple_mappings = "The certificate was found associated with more than one user, or a chain contained multiple matches against the mapping file"
+vgauth.errcode.already_impersonating = "The context is already impersonating"
+vgauth.errcode.no_such_user = "User cannot be found"
+vgauth.errcode.service_not_running = "Service not running"
+vgauth.errcode.system_errno = "An OS-specific operation failed"
+vgauth.errcode.system_windows = "An OS-specific operation failed"
+vgauth.errcode.too_many_connections = "The user exceeded its max number of connections"
+vgauth.errcode.unsupported = "The operation is not supported"
+vgauth.errcode.fail = "Unknown error"
index 1c0d52439d5561e4c45e7c0421182afa781230bf..b8fca37bbe802ff0338aeea4721b29d5e35ca432 100644 (file)
 auth.password.invalid = "Error en la validación del nombre de usuario y la contraseña para '%1$s': %2$s"
 auth.password.valid = "El nombre de usuario y la contraseña de '%1$s' se han validado correctamente"
 auth.sspi.badid = "Intento de autenticación utilizando un SSPI challenge ID no válido o caducado: %1$u"
+
+vgauth.errcode.ok = "The operation was successful"
+vgauth.errcode.invalid_argument = "One of the parameters was invalid"
+vgauth.errcode.invalid_certificate = "The certificate is not a well-formed x509 document"
+vgauth.errcode.permission_denied = "Insufficient permissions"
+vgauth.errcode.out_of_memory = "Out of memory"
+vgauth.errcode.comm = "Internal communication error between library and service"
+vgauth.errcode.notimplemented = "Not implemented"
+vgauth.errcode.not_connected = "Not connected to the service"
+vgauth.errcode.version_mismatch = "Service/library version mismatch"
+vgauth.errcode.security_violation = "Potential security violation detected"
+vgauth.errcode.cert_already_exists = "The certificate already exists"
+vgauth.errcode.authentication_denied = "Authentication denied"
+vgauth.errcode.invalid_ticket = "Invalid ticket"
+vgauth.errcode.multiple_mappings = "The certificate was found associated with more than one user, or a chain contained multiple matches against the mapping file"
+vgauth.errcode.already_impersonating = "The context is already impersonating"
+vgauth.errcode.no_such_user = "User cannot be found"
+vgauth.errcode.service_not_running = "Service not running"
+vgauth.errcode.system_errno = "An OS-specific operation failed"
+vgauth.errcode.system_windows = "An OS-specific operation failed"
+vgauth.errcode.too_many_connections = "The user exceeded its max number of connections"
+vgauth.errcode.unsupported = "The operation is not supported"
+vgauth.errcode.fail = "Unknown error"
index 6e534e5d91f8e504c4ce6e34b93802a772db78f5..cfdaca587c9776d6c0f1f82d9353d511e1b24f35 100644 (file)
 auth.password.invalid = "Échec de la validation du nom d'utilisateur et du mot de passe pour « %1$s » : %2$s"
 auth.password.valid = "Validation réussie du nom d'utilisateur et du mot de passe pour '%1$s'"
 auth.sspi.badid = "Tentative d'authentification à l'aide d'un ID de demande SSPI non valide ou expiré : %1$u"
+
+vgauth.errcode.ok = "The operation was successful"
+vgauth.errcode.invalid_argument = "One of the parameters was invalid"
+vgauth.errcode.invalid_certificate = "The certificate is not a well-formed x509 document"
+vgauth.errcode.permission_denied = "Insufficient permissions"
+vgauth.errcode.out_of_memory = "Out of memory"
+vgauth.errcode.comm = "Internal communication error between library and service"
+vgauth.errcode.notimplemented = "Not implemented"
+vgauth.errcode.not_connected = "Not connected to the service"
+vgauth.errcode.version_mismatch = "Service/library version mismatch"
+vgauth.errcode.security_violation = "Potential security violation detected"
+vgauth.errcode.cert_already_exists = "The certificate already exists"
+vgauth.errcode.authentication_denied = "Authentication denied"
+vgauth.errcode.invalid_ticket = "Invalid ticket"
+vgauth.errcode.multiple_mappings = "The certificate was found associated with more than one user, or a chain contained multiple matches against the mapping file"
+vgauth.errcode.already_impersonating = "The context is already impersonating"
+vgauth.errcode.no_such_user = "User cannot be found"
+vgauth.errcode.service_not_running = "Service not running"
+vgauth.errcode.system_errno = "An OS-specific operation failed"
+vgauth.errcode.system_windows = "An OS-specific operation failed"
+vgauth.errcode.too_many_connections = "The user exceeded its max number of connections"
+vgauth.errcode.unsupported = "The operation is not supported"
+vgauth.errcode.fail = "Unknown error"
index 0628a7f446e923adefcc71abeea055f4aac2369a..72dafbbdc914dd22c3f356bc329ae8841155ff4e 100644 (file)
 auth.password.invalid = "'%1$s' のユーザー名とパスワードの検証に失敗しました: %2$s"
 auth.password.valid = "'%1$s' のユーザー名とパスワードが正しく検証されました"
 auth.sspi.badid = "無効または期限切れの SSPI チャレンジ ID を使用して認証を試みます: %1$u"
+
+vgauth.errcode.ok = "The operation was successful"
+vgauth.errcode.invalid_argument = "One of the parameters was invalid"
+vgauth.errcode.invalid_certificate = "The certificate is not a well-formed x509 document"
+vgauth.errcode.permission_denied = "Insufficient permissions"
+vgauth.errcode.out_of_memory = "Out of memory"
+vgauth.errcode.comm = "Internal communication error between library and service"
+vgauth.errcode.notimplemented = "Not implemented"
+vgauth.errcode.not_connected = "Not connected to the service"
+vgauth.errcode.version_mismatch = "Service/library version mismatch"
+vgauth.errcode.security_violation = "Potential security violation detected"
+vgauth.errcode.cert_already_exists = "The certificate already exists"
+vgauth.errcode.authentication_denied = "Authentication denied"
+vgauth.errcode.invalid_ticket = "Invalid ticket"
+vgauth.errcode.multiple_mappings = "The certificate was found associated with more than one user, or a chain contained multiple matches against the mapping file"
+vgauth.errcode.already_impersonating = "The context is already impersonating"
+vgauth.errcode.no_such_user = "User cannot be found"
+vgauth.errcode.service_not_running = "Service not running"
+vgauth.errcode.system_errno = "An OS-specific operation failed"
+vgauth.errcode.system_windows = "An OS-specific operation failed"
+vgauth.errcode.too_many_connections = "The user exceeded its max number of connections"
+vgauth.errcode.unsupported = "The operation is not supported"
+vgauth.errcode.fail = "Unknown error"
index 12d243936994f35b10c9d6c207a7ca4024fb153d..5012602a75218aa1b84ba89a966fb9a1589c43bc 100644 (file)
@@ -1,5 +1,6 @@
 /*********************************************************
- * Copyright (C) 2011-2016 VMware, Inc. All rights reserved.
+ * Copyright (c) 2011-2025 Broadcom. All Rights Reserved.
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -119,6 +120,7 @@ void VGAuth_FreeBuffer(void *buffer);
 const char *VGAuth_GetErrorName(VGAuthError err);
 const char *VGAuth_GetErrorText(VGAuthError err,
                                 const char *language);
+const char *VGAuth_GetLocaleErrorText(VGAuthError err);
 
 /** @} */