From 73940aec5ee15b46393daad7be8418c0c587da78 Mon Sep 17 00:00:00 2001 From: Lawrence LCI Date: Tue, 19 Oct 2021 10:53:28 -0700 Subject: [PATCH 1/6] Remove Asynchronous default variable and unreferenced Asynchronous property in SqlConnection --- .../netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs | 9 --------- .../Microsoft/Data/Common/DbConnectionStringCommon.cs | 1 - .../src/Microsoft/Data/SqlClient/SqlConnectionString.cs | 1 - 3 files changed, 11 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs index b651022ded..b6c2b5d930 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs @@ -2267,15 +2267,6 @@ internal TdsParser Parser } } - internal bool Asynchronous - { - get - { - SqlConnectionString constr = (SqlConnectionString)ConnectionOptions; - return ((null != constr) ? constr.Asynchronous : SqlConnectionString.DEFAULT.Asynchronous); - } - } - // // INTERNAL METHODS // diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/DbConnectionStringCommon.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/DbConnectionStringCommon.cs index 047293a05a..aad002c116 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/DbConnectionStringCommon.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/DbConnectionStringCommon.cs @@ -952,7 +952,6 @@ internal static class DbConnectionStringDefaults internal const bool ContextConnection = false; internal static readonly bool TransparentNetworkIPResolution = !LocalAppContextSwitches.DisableTNIRByDefault; internal const string NetworkLibrary = ""; - internal const bool Asynchronous = false; #if ADONET_CERT_AUTH internal const string Certificate = ""; #endif diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionString.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionString.cs index 41b81dbc66..7d2640cb57 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionString.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionString.cs @@ -61,7 +61,6 @@ internal static class DEFAULT internal static readonly SqlConnectionIPAddressPreference IpAddressPreference = DbConnectionStringDefaults.IPAddressPreference; #if NETFRAMEWORK internal static readonly bool TransparentNetworkIPResolution = DbConnectionStringDefaults.TransparentNetworkIPResolution; - internal const bool Asynchronous = DbConnectionStringDefaults.Asynchronous; internal const bool Connection_Reset = DbConnectionStringDefaults.ConnectionReset; internal const bool Context_Connection = DbConnectionStringDefaults.ContextConnection; internal const string Network_Library = DbConnectionStringDefaults.NetworkLibrary; From a5d3e12456405ba435e6e4d7c38e86e60ef734fa Mon Sep 17 00:00:00 2001 From: Lawrence LCI Date: Tue, 19 Oct 2021 11:38:14 -0700 Subject: [PATCH 2/6] Replaced IntegratedWithPassword with IntegratedWithUserIDAndPassword to unify behaviour between netcore and netfx --- .../netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs | 4 ++-- .../netcore/src/Resources/Strings.Designer.cs | 6 +++--- .../netcore/src/Resources/Strings.resx | 6 +++--- .../src/Microsoft/Data/SqlClient/SqlConnectionString.cs | 7 ------- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs index 522092b988..369c477bd9 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs @@ -290,9 +290,9 @@ internal static Exception AuthenticationAndIntegratedSecurity() { return ADP.Argument(StringsHelper.GetString(Strings.SQL_AuthenticationAndIntegratedSecurity)); } - internal static Exception IntegratedWithPassword() + static internal Exception IntegratedWithUserIDAndPassword() { - return ADP.Argument(StringsHelper.GetString(Strings.SQL_IntegratedWithPassword)); + return ADP.Argument(StringsHelper.GetString(Strings.SQL_IntegratedWithUserIDAndPassword)); } internal static Exception InteractiveWithPassword() { diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.Designer.cs b/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.Designer.cs index f33751fb08..efa434fe04 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.Designer.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.Designer.cs @@ -2635,11 +2635,11 @@ internal static string SQL_InstanceFailure { } /// - /// Looks up a localized string similar to Cannot use 'Authentication=Active Directory Integrated' with 'Password' or 'PWD' connection string keywords.. + /// Looks up a localized string similar to Cannot use 'Authentication=Active Directory Integrated' with 'User ID', 'UID', 'Password' or 'PWD' connection string keywords.. /// - internal static string SQL_IntegratedWithPassword { + internal static string SQL_IntegratedWithUserIDAndPassword { get { - return ResourceManager.GetString("SQL_IntegratedWithPassword", resourceCulture); + return ResourceManager.GetString("SQL_IntegratedWithUserIDAndPassword", resourceCulture); } } diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx b/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx index bfe5559389..0b352f8148 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx +++ b/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx @@ -402,8 +402,8 @@ Cannot use 'Authentication' with 'Integrated Security'. - - Cannot use 'Authentication=Active Directory Integrated' with 'Password' or 'PWD' connection string keywords. + + Cannot use 'Authentication=Active Directory Integrated' with 'User ID', 'UID', 'Password' or 'PWD' connection string keywords. Cannot use 'Authentication=Active Directory Interactive' with 'Password' or 'PWD' connection string keywords. @@ -1932,4 +1932,4 @@ Parameter '{0}' cannot have Direction Output or InputOutput when EnableOptimizedParameterBinding is enabled on the parent command. - \ No newline at end of file + diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionString.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionString.cs index 7d2640cb57..fdcf0e81e2 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionString.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionString.cs @@ -571,17 +571,10 @@ internal SqlConnectionString(string connectionString) : base(connectionString, G throw SQL.AuthenticationAndIntegratedSecurity(); } -#if NETFRAMEWORK if (Authentication == SqlAuthenticationMethod.ActiveDirectoryIntegrated && (_hasUserIdKeyword || _hasPasswordKeyword)) { throw SQL.IntegratedWithUserIDAndPassword(); } -#else - if (Authentication == SqlAuthenticationMethod.ActiveDirectoryIntegrated && _hasPasswordKeyword) - { - throw SQL.IntegratedWithPassword(); - } -#endif if (Authentication == SqlAuthenticationMethod.ActiveDirectoryInteractive && _hasPasswordKeyword) { From 6d304356f59961d4973db306ab0920cdc8a34a23 Mon Sep 17 00:00:00 2001 From: Lawrence LCI Date: Tue, 19 Oct 2021 11:43:14 -0700 Subject: [PATCH 3/6] Reverse the order of the `static` and `internal` keyword for the method IntegratedWithUserIDAndPassword --- .../netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs index 369c477bd9..fa825dd791 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs @@ -290,7 +290,7 @@ internal static Exception AuthenticationAndIntegratedSecurity() { return ADP.Argument(StringsHelper.GetString(Strings.SQL_AuthenticationAndIntegratedSecurity)); } - static internal Exception IntegratedWithUserIDAndPassword() + internal static Exception IntegratedWithUserIDAndPassword() { return ADP.Argument(StringsHelper.GetString(Strings.SQL_IntegratedWithUserIDAndPassword)); } From 79af725d609f3b097a095567b1dd22edaa5cd8a4 Mon Sep 17 00:00:00 2001 From: Lawrence LCI Date: Tue, 19 Oct 2021 13:52:05 -0700 Subject: [PATCH 4/6] Revert changes to the IntegratedWithPassword on netcore --- .../netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs | 4 ++-- .../netcore/src/Resources/Strings.Designer.cs | 6 +++--- .../netcore/src/Resources/Strings.resx | 6 +++--- .../src/Microsoft/Data/SqlClient/SqlConnectionString.cs | 7 +++++++ 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs index fa825dd791..522092b988 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs @@ -290,9 +290,9 @@ internal static Exception AuthenticationAndIntegratedSecurity() { return ADP.Argument(StringsHelper.GetString(Strings.SQL_AuthenticationAndIntegratedSecurity)); } - internal static Exception IntegratedWithUserIDAndPassword() + internal static Exception IntegratedWithPassword() { - return ADP.Argument(StringsHelper.GetString(Strings.SQL_IntegratedWithUserIDAndPassword)); + return ADP.Argument(StringsHelper.GetString(Strings.SQL_IntegratedWithPassword)); } internal static Exception InteractiveWithPassword() { diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.Designer.cs b/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.Designer.cs index efa434fe04..f33751fb08 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.Designer.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.Designer.cs @@ -2635,11 +2635,11 @@ internal static string SQL_InstanceFailure { } /// - /// Looks up a localized string similar to Cannot use 'Authentication=Active Directory Integrated' with 'User ID', 'UID', 'Password' or 'PWD' connection string keywords.. + /// Looks up a localized string similar to Cannot use 'Authentication=Active Directory Integrated' with 'Password' or 'PWD' connection string keywords.. /// - internal static string SQL_IntegratedWithUserIDAndPassword { + internal static string SQL_IntegratedWithPassword { get { - return ResourceManager.GetString("SQL_IntegratedWithUserIDAndPassword", resourceCulture); + return ResourceManager.GetString("SQL_IntegratedWithPassword", resourceCulture); } } diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx b/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx index 0b352f8148..bfe5559389 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx +++ b/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx @@ -402,8 +402,8 @@ Cannot use 'Authentication' with 'Integrated Security'. - - Cannot use 'Authentication=Active Directory Integrated' with 'User ID', 'UID', 'Password' or 'PWD' connection string keywords. + + Cannot use 'Authentication=Active Directory Integrated' with 'Password' or 'PWD' connection string keywords. Cannot use 'Authentication=Active Directory Interactive' with 'Password' or 'PWD' connection string keywords. @@ -1932,4 +1932,4 @@ Parameter '{0}' cannot have Direction Output or InputOutput when EnableOptimizedParameterBinding is enabled on the parent command. - + \ No newline at end of file diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionString.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionString.cs index fdcf0e81e2..7d2640cb57 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionString.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionString.cs @@ -571,10 +571,17 @@ internal SqlConnectionString(string connectionString) : base(connectionString, G throw SQL.AuthenticationAndIntegratedSecurity(); } +#if NETFRAMEWORK if (Authentication == SqlAuthenticationMethod.ActiveDirectoryIntegrated && (_hasUserIdKeyword || _hasPasswordKeyword)) { throw SQL.IntegratedWithUserIDAndPassword(); } +#else + if (Authentication == SqlAuthenticationMethod.ActiveDirectoryIntegrated && _hasPasswordKeyword) + { + throw SQL.IntegratedWithPassword(); + } +#endif if (Authentication == SqlAuthenticationMethod.ActiveDirectoryInteractive && _hasPasswordKeyword) { From 4d3dc7f22f0ed4f6f2342a1699dc17d9cc7a12dd Mon Sep 17 00:00:00 2001 From: Lawrence LCI Date: Tue, 19 Oct 2021 14:25:34 -0700 Subject: [PATCH 5/6] Replace IntegratedWithUserIDAndPassword with IntegratedWithPassword and update the string resources --- .../netfx/src/Microsoft.Data.SqlClient.csproj | 4 ++-- .../netfx/src/Microsoft/Data/SqlClient/SqlUtil.cs | 4 ++-- .../netfx/src/Resources/Strings.Designer.cs | 6 +++--- .../netfx/src/Resources/Strings.de.resx | 6 +++--- .../netfx/src/Resources/Strings.es.resx | 6 +++--- .../netfx/src/Resources/Strings.fr.resx | 6 +++--- .../netfx/src/Resources/Strings.it.resx | 6 +++--- .../netfx/src/Resources/Strings.ja.resx | 6 +++--- .../netfx/src/Resources/Strings.ko.resx | 6 +++--- .../netfx/src/Resources/Strings.pt-BR.resx | 6 +++--- .../netfx/src/Resources/Strings.resx | 6 +++--- .../netfx/src/Resources/Strings.ru.resx | 6 +++--- .../netfx/src/Resources/Strings.zh-Hans.resx | 6 +++--- .../netfx/src/Resources/Strings.zh-Hant.resx | 6 +++--- .../src/Microsoft/Data/SqlClient/SqlConnectionString.cs | 7 ------- 15 files changed, 40 insertions(+), 47 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index fba0bf7f9a..70ff266501 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -632,10 +632,10 @@ - + True True - $(ResxFileName).resx + Strings.resx Resources\StringsHelper.cs diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlUtil.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlUtil.cs index e8884d1b81..3bc5591b3e 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlUtil.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlUtil.cs @@ -461,9 +461,9 @@ static internal Exception AuthenticationAndIntegratedSecurity() { return ADP.Argument(StringsHelper.GetString(Strings.SQL_AuthenticationAndIntegratedSecurity)); } - static internal Exception IntegratedWithUserIDAndPassword() + static internal Exception IntegratedWithPassword() { - return ADP.Argument(StringsHelper.GetString(Strings.SQL_IntegratedWithUserIDAndPassword)); + return ADP.Argument(StringsHelper.GetString(Strings.SQL_IntegratedWithPassword)); } static internal Exception InteractiveWithPassword() { diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.Designer.cs b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.Designer.cs index 1a35932194..bfaf7407be 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.Designer.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.Designer.cs @@ -9451,11 +9451,11 @@ internal static string SQL_InstanceFailure { } /// - /// Looks up a localized string similar to Cannot use 'Authentication=Active Directory Integrated' with 'User ID', 'UID', 'Password' or 'PWD' connection string keywords.. + /// Looks up a localized string similar to Cannot use 'Authentication=Active Directory Integrated' with 'Password' or 'PWD' connection string keywords.. /// - internal static string SQL_IntegratedWithUserIDAndPassword { + internal static string SQL_IntegratedWithPassword { get { - return ResourceManager.GetString("SQL_IntegratedWithUserIDAndPassword", resourceCulture); + return ResourceManager.GetString("SQL_IntegratedWithPassword", resourceCulture); } } diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.de.resx b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.de.resx index 242a25c266..ce32f9f611 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.de.resx +++ b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.de.resx @@ -2493,8 +2493,8 @@ "Authentication" kann nicht mit "Integrated Security" verwendet werden. - - "Authentication=Active Directory Integrated" kann nicht mit den Schlüsselwörtern "User ID", "UID", "Password" oder "PWD" für die Verbindungszeichenfolge verwendet werden. + + "Authentication=Active Directory Integrated" kann nicht mit den Schlüsselwörtern "Password" oder "PWD" für die Verbindungszeichenfolge verwendet werden. "Authentication=Active Directory Interactive" kann nicht mit den Schlüsselwörtern "Password" oder "PWD" für die Verbindungszeichenfolge verwendet werden. @@ -4617,4 +4617,4 @@ Der Parameter "{0}" kann keine Ausgaberichtung oder InputOutput aufweisen, wenn EnableOptimizedParameterBinding für den übergeordneten Befehl aktiviert ist. - \ No newline at end of file + diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.es.resx b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.es.resx index d5fe229cc6..02bc341574 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.es.resx +++ b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.es.resx @@ -2493,8 +2493,8 @@ No se puede usar 'Authentication' con 'Integrated Security'. - - No se puede usar "Authentication=Active Directory Integrated" con las palabras clave de cadena de conexión "User ID", "UID", "Password" ni "PWD". + + No se puede usar "Authentication=Active Directory Integrated" con las palabras clave de cadena de conexión "Password" ni "PWD". No se puede usar "Authentication=Active Directory Interactive" con las palabras clave de cadena de conexión "Password" ni "PWD". @@ -4617,4 +4617,4 @@ El parámetro “{0}” no puede tener la Dirección de salida ni InputOutput cuando EnableOptimizedParameterBinding está habilitado en el comando primario. - \ No newline at end of file + diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.fr.resx b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.fr.resx index 64fd1e7ca4..e530cea45b 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.fr.resx +++ b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.fr.resx @@ -2493,8 +2493,8 @@ Impossible d'utiliser 'Authentication avec 'Integrated Security'. - - Impossible d'utiliser 'Authentication=Active Directory Integrated' avec les mots clés de la chaîne de connexion 'User ID", "UID", "Password" ou "PWD". + + Impossible d'utiliser 'Authentication=Active Directory Integrated' avec les mots clés de la chaîne de connexion "Password" ou "PWD". Impossible d'utiliser « Authentication=Active Directory Interactive » avec les mots clés de chaîne de connexion « Password » ou « PWD ». @@ -4617,4 +4617,4 @@ Le paramètre « {0} » ne peut pas avoir Direction Output ou InputOutput lorsque EnableOptimizedParameterBinding est activé sur la commande parente. - \ No newline at end of file + diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.it.resx b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.it.resx index 7f003a4ef0..2fa8cff15f 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.it.resx +++ b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.it.resx @@ -2493,8 +2493,8 @@ Non è possibile usare 'Authentication' con 'Integrated Security'. - - Non è possibile usare 'Authentication=Active Directory Integrated' con le parole chiave della stringa di connessione 'User ID', 'UID', 'Password' o 'PWD'. + + Non è possibile usare 'Authentication=Active Directory Integrated' con le parole chiave della stringa di connessione 'Password' o 'PWD'. Non è possibile usare 'Authentication=Active Directory Interactive' con le parole chiave della stringa di connessione 'Password' o 'PWD'. @@ -4617,4 +4617,4 @@ Il parametro '{0}' non può includere Output o InputOutput come valore di Direction quando nel comando padre è abilitato EnableOptimizedParameterBinding. - \ No newline at end of file + diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.ja.resx b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.ja.resx index bd578d0274..1c9ac3fa9a 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.ja.resx +++ b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.ja.resx @@ -2493,8 +2493,8 @@ 'Authentication' と 'Integrated Security' を一緒に使用することはできません。 - - 'Authentication=Active Directory Integrated' と接続文字列キーワード 'User ID'、'UID'、'Password'、'PWD' を一緒に使用することはできません。 + + 'Authentication=Active Directory Integrated' と接続文字列キーワード 'Password'、'PWD' を一緒に使用することはできません。 'Authentication=Active Directory Interactive' と接続文字列キーワード 'Password'、'PWD' を一緒に使用することはできません。 @@ -4617,4 +4617,4 @@ 親コマンドで EnableOptimizedParameterBinding が有効になっている場合、パラメーター '{0}' に Direction 出力または InputOutput は指定できません。 - \ No newline at end of file + diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.ko.resx b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.ko.resx index 85b53aeb93..10b0651532 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.ko.resx +++ b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.ko.resx @@ -2493,8 +2493,8 @@ 'Authentication'을 'Integrated Security'와 함께 사용할 수 없습니다. - - 'Authentication=Active Directory Integrated'를 'User ID', 'UID', 'Password' 또는 'PWD' 연결 문자열 키워드와 함께 사용할 수 없습니다. + + 'Authentication=Active Directory Integrated'를 'Password' 또는 'PWD' 연결 문자열 키워드와 함께 사용할 수 없습니다. 'Authentication=Active Directory Interactive'를 'Password' 또는 'PWD' 연결 문자열 키워드와 함께 사용할 수 없습니다. @@ -4617,4 +4617,4 @@ 부모 명령에서 EnableOptimizedParameterBinding을 사용하는 경우 매개 변수 '{0}'에는 Direction Output 또는 InputOutput을 사용할 수 없습니다. - \ No newline at end of file + diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.pt-BR.resx b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.pt-BR.resx index 4f1a14df1d..e47c428360 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.pt-BR.resx +++ b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.pt-BR.resx @@ -2493,8 +2493,8 @@ Não é possível usar "Authentication" com "Integrated Security". - - Não é possível usar 'Authentication=Active Directory Integrated' com as palavras-chave de cadeia de conexão 'User ID', 'UID', 'Password' ou 'PWD'. + + Não é possível usar 'Authentication=Active Directory Integrated' com as palavras-chave de cadeia de conexão 'Password' ou 'PWD'. Não é possível usar 'Authentication=Active Directory Interactive' com as palavras-chave de cadeia de conexão 'Password' ou 'PWD'. @@ -4617,4 +4617,4 @@ O parâmetro '{0}' não pode ter a saída de direção ou InputOutput quando EnableOptimizedParameterBinding está habilitado no comando pai. - \ No newline at end of file + diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.resx b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.resx index 0d9e331900..acf6a6beff 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.resx +++ b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.resx @@ -2493,8 +2493,8 @@ Cannot use 'Authentication' with 'Integrated Security'. - - Cannot use 'Authentication=Active Directory Integrated' with 'User ID', 'UID', 'Password' or 'PWD' connection string keywords. + + Cannot use 'Authentication=Active Directory Integrated' with 'Password' or 'PWD' connection string keywords. Cannot use 'Authentication=Active Directory Interactive' with 'Password' or 'PWD' connection string keywords. @@ -4617,4 +4617,4 @@ Parameter '{0}' cannot have Direction Output or InputOutput when EnableOptimizedParameterBinding is enabled on the parent command. - \ No newline at end of file + diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.ru.resx b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.ru.resx index af69c6db42..cbcc1c6fa3 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.ru.resx +++ b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.ru.resx @@ -2493,8 +2493,8 @@ Нельзя использовать 'Authentication' с 'Integrated Security'. - - Невозможно использовать "Authentication=Active Directory Integrated" с ключевыми словами строки подключения "User ID", "UID", "Password" или "PWD". + + Невозможно использовать "Authentication=Active Directory Integrated" с ключевыми словами строки подключения "Password" или "PWD". Невозможно использовать "Authentication=Active Directory Interactive" с ключевыми словами "Password" или "PWD" в строке подключения. @@ -4617,4 +4617,4 @@ У параметра "{0}" не может быть направления вывода или InputOutput, если EnableOptimizedParameterBinding включен в родительской команде. - \ No newline at end of file + diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.zh-Hans.resx b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.zh-Hans.resx index 50a59826b7..f285238f4d 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.zh-Hans.resx +++ b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.zh-Hans.resx @@ -2493,8 +2493,8 @@ 无法对“Integrated Security”使用“Authentication”。 - - 无法对“User ID”、“UID”、“Password”或“PWD”连接字符串关键字使用“Authentication=Active Directory Integrated”。 + + 无法对“Password”或“PWD”连接字符串关键字使用“Authentication=Active Directory Integrated”。 无法对 "Password" 或 "PWD" 连接字符串关键字使用 "Authentication=Active Directory Interactive"。 @@ -4617,4 +4617,4 @@ 当在父命令上启用 EnableOptimizedParameterBinding 时,参数“{0}”不能具有 Direction Output 或 InputOutput。 - \ No newline at end of file + diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.zh-Hant.resx b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.zh-Hant.resx index 2deb6a88a4..cc4fdbffc3 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.zh-Hant.resx +++ b/src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.zh-Hant.resx @@ -2493,8 +2493,8 @@ 無法搭配 'Integrated Security' 使用 'Authentication'。 - - 無法搭配 'User ID'、'UID'、'Password' 或 'PWD' 等連接字串關鍵字使用 'Authentication=Active Directory Integrated'。 + + 無法搭配 'Password' 或 'PWD' 等連接字串關鍵字使用 'Authentication=Active Directory Integrated'。 使用 'Authentication=Active Directory Interactive' 時,無法搭配 'Password' 或 'PWD' 連接字串關鍵字一起使用。 @@ -4617,4 +4617,4 @@ 在父命令上啟用 EnableOptimizedParameterBinding 時,參數 '{0}' 不能具有方向輸出或 InputOutput。 - \ No newline at end of file + diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionString.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionString.cs index 7d2640cb57..f1a488c4b6 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionString.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionString.cs @@ -571,17 +571,10 @@ internal SqlConnectionString(string connectionString) : base(connectionString, G throw SQL.AuthenticationAndIntegratedSecurity(); } -#if NETFRAMEWORK - if (Authentication == SqlAuthenticationMethod.ActiveDirectoryIntegrated && (_hasUserIdKeyword || _hasPasswordKeyword)) - { - throw SQL.IntegratedWithUserIDAndPassword(); - } -#else if (Authentication == SqlAuthenticationMethod.ActiveDirectoryIntegrated && _hasPasswordKeyword) { throw SQL.IntegratedWithPassword(); } -#endif if (Authentication == SqlAuthenticationMethod.ActiveDirectoryInteractive && _hasPasswordKeyword) { From b6df8b9ea6f0a19c8f4c64834ec50e94375a18e4 Mon Sep 17 00:00:00 2001 From: Lawrence LCI Date: Tue, 19 Oct 2021 14:55:44 -0700 Subject: [PATCH 6/6] Add unit tests to verify the exception when ActiveDirectoryIntegrated is set, and pwd and uid are specficied --- .../FunctionalTests/SqlConnectionTest.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.cs index 1ca22db548..888abca555 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.cs @@ -353,6 +353,25 @@ public void GetSchema_Connection_Closed() Assert.NotNull(ex.Message); } + [Theory] + [InlineData("Authentication = ActiveDirectoryIntegrated;Password = ''")] + [InlineData("Authentication = ActiveDirectoryIntegrated;PWD = ''")] + [InlineData("Authentication = ActiveDirectoryIntegrated;User Id='';PWD = ''")] + [InlineData("Authentication = ActiveDirectoryIntegrated;User Id='';Password = ''")] + [InlineData("Authentication = ActiveDirectoryIntegrated;UID='';PWD = ''")] + [InlineData("Authentication = ActiveDirectoryIntegrated;UID='';Password = ''")] + public void ConnectionString_ActiveDirectoryIntegrated_Password(string connectionString) + { + SqlConnection cn = new SqlConnection(); + + ArgumentException ex = Assert.Throws(() => cn.ConnectionString = connectionString); + // Invalid value for key 'user instance' + Assert.Null(ex.InnerException); + Assert.NotNull(ex.Message); + Assert.True(ex.Message.IndexOf("'pwd'", StringComparison.OrdinalIgnoreCase) != -1); + Assert.Null(ex.ParamName); + } + [Theory] [InlineData(@"AttachDbFileName=C:\test\attach.mdf", @"AttachDbFileName=C:\test\attach.mdf")] [InlineData(@"AttachDbFileName=C:\test\attach.mdf;", @"AttachDbFileName=C:\test\attach.mdf;")]