From: Kruti Pendharkar Date: Mon, 1 Dec 2025 06:48:33 +0000 (-0800) Subject: Change to common source files not applicable to open-vm-tools. X-Git-Tag: stable-13.1.0~46 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=3b366a43e14b06e65166ff660b743bfa5eb6f83a;p=thirdparty%2Fopen-vm-tools.git Change to common source files not applicable to open-vm-tools. --- diff --git a/open-vm-tools/vgauth/lib/auth.c b/open-vm-tools/vgauth/lib/auth.c index 9895ae1c1..cc6d09ae2 100644 --- a/open-vm-tools/vgauth/lib/auth.c +++ b/open-vm-tools/vgauth/lib/auth.c @@ -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; diff --git a/open-vm-tools/vgauth/lib/errortext.c b/open-vm-tools/vgauth/lib/errortext.c index da22269dd..cd522ea99 100644 --- a/open-vm-tools/vgauth/lib/errortext.c +++ b/open-vm-tools/vgauth/lib/errortext.c @@ -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 #include #include @@ -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; +} diff --git a/open-vm-tools/vgauth/lib/l10n/en.vmsg b/open-vm-tools/vgauth/lib/l10n/en.vmsg index b4a12ce42..8bc511394 100644 --- a/open-vm-tools/vgauth/lib/l10n/en.vmsg +++ b/open-vm-tools/vgauth/lib/l10n/en.vmsg @@ -19,3 +19,26 @@ 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" diff --git a/open-vm-tools/vgauth/lib/l10n/es.vmsg b/open-vm-tools/vgauth/lib/l10n/es.vmsg index 1c0d52439..b8fca37bb 100644 --- a/open-vm-tools/vgauth/lib/l10n/es.vmsg +++ b/open-vm-tools/vgauth/lib/l10n/es.vmsg @@ -19,3 +19,26 @@ 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" diff --git a/open-vm-tools/vgauth/lib/l10n/fr.vmsg b/open-vm-tools/vgauth/lib/l10n/fr.vmsg index 6e534e5d9..cfdaca587 100644 --- a/open-vm-tools/vgauth/lib/l10n/fr.vmsg +++ b/open-vm-tools/vgauth/lib/l10n/fr.vmsg @@ -19,3 +19,26 @@ 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" diff --git a/open-vm-tools/vgauth/lib/l10n/ja.vmsg b/open-vm-tools/vgauth/lib/l10n/ja.vmsg index 0628a7f44..72dafbbdc 100644 --- a/open-vm-tools/vgauth/lib/l10n/ja.vmsg +++ b/open-vm-tools/vgauth/lib/l10n/ja.vmsg @@ -19,3 +19,26 @@ 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" diff --git a/open-vm-tools/vgauth/public/VGAuthCommon.h b/open-vm-tools/vgauth/public/VGAuthCommon.h index 12d243936..5012602a7 100644 --- a/open-vm-tools/vgauth/public/VGAuthCommon.h +++ b/open-vm-tools/vgauth/public/VGAuthCommon.h @@ -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); /** @} */