From 5c0ff1860cc360ee5f5b702772b4dc9b5005cae7 Mon Sep 17 00:00:00 2001 From: Victor Luna Date: Tue, 17 Nov 2026 18:31:28 -0500 Subject: [PATCH] feat: use Kerberos for integrated authentication on Linux and macOS --- README.md | 13 ++ go.mod | 3 + go.sum | 10 ++ internal/translations/catalog.go | 95 +++++++----- .../locales/de-DE/out.gotext.json | 58 +++++++ .../locales/en-US/out.gotext.json | 66 ++++++++ .../locales/es-ES/out.gotext.json | 58 +++++++ .../locales/fr-FR/out.gotext.json | 58 +++++++ .../locales/it-IT/out.gotext.json | 58 +++++++ .../locales/ja-JP/out.gotext.json | 58 +++++++ .../locales/ko-KR/out.gotext.json | 58 +++++++ .../locales/pt-BR/out.gotext.json | 58 +++++++ .../locales/ru-RU/out.gotext.json | 58 +++++++ .../locales/zh-CN/out.gotext.json | 58 +++++++ .../locales/zh-TW/out.gotext.json | 58 +++++++ pkg/sqlcmd/kerberos.go | 63 ++++++++ pkg/sqlcmd/kerberos_test.go | 142 ++++++++++++++++++ pkg/sqlcmd/sqlcmd.go | 8 + 18 files changed, 943 insertions(+), 37 deletions(-) create mode 100644 pkg/sqlcmd/kerberos.go create mode 100644 pkg/sqlcmd/kerberos_test.go diff --git a/README.md b/README.md index 4a4e436c..5603011b 100644 --- a/README.md +++ b/README.md @@ -256,6 +256,19 @@ These environment variables can be set to configure some aspects of AAD auth and `SQLCMDCLIENTID` - set this to the identifier of an application registered in your AAD which is authorized to authenticate to Azure SQL Database. Applies to `ActiveDirectoryInteractive` and `ActiveDirectoryPassword` methods. +### Kerberos Authentication on Linux and macOS + +On Linux and macOS, `-E` authenticates with Kerberos using the ticket from `kinit`. This also applies when no user name is given, such as `sqlcmd query` with a context that has no user, or the flag CLI without `-U`. + +``` +kinit alice@EXAMPLE.COM +sqlcmd -S sqlhost.example.com,1433 -E +``` + +`KRB5_CONFIG` sets the location of `krb5.conf` (default `/etc/krb5.conf`) and `KRB5CCNAME` sets the credential cache (default `/tmp/krb5cc_`). Only `FILE:` caches are supported, so on Linux distributions that default to `KCM:` or `KEYRING:` (Fedora, RHEL), run `kinit -c FILE:...` and set `KRB5CCNAME`. + +macOS has no `krb5.conf` by default and keeps tickets in an `API:` cache that `sqlcmd` can't read. Create a `krb5.conf` and add `default_cc_name = FILE:/tmp/krb5cc_%{uid}` to its `[libdefaults]` section so `kinit` writes a file cache (this is the Heimdal setting name used on macOS; MIT Kerberos calls it `default_ccache_name`). Alternatively, point `KRB5CCNAME` to a `FILE:` cache. + ### Console colors Sqlcmd now supports syntax coloring the output of `:list` and the results of TSQL queries when output to the terminal. diff --git a/go.mod b/go.mod index cda8432e..54bfbf16 100644 --- a/go.mod +++ b/go.mod @@ -47,6 +47,9 @@ require ( github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect + github.com/go-crypt/x v0.4.12 // indirect + github.com/go-krb5/krb5 v0.1.0 // indirect + github.com/go-krb5/x v0.3.2 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-viper/mapstructure/v2 v2.5.0 // indirect diff --git a/go.sum b/go.sum index 66cb55bf..a3790fb5 100644 --- a/go.sum +++ b/go.sum @@ -60,7 +60,13 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/go-crypt/x v0.4.12 h1:84mFpT7cdVxQUY8pTnBhAGvqrGxY/q8M+757zrMiXPM= +github.com/go-crypt/x v0.4.12/go.mod h1:edbLOsFD4LEWC9wVvNb3k560JIMIhEJ7awb8NeTPHs8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-krb5/krb5 v0.1.0 h1:eckVEox/2y/0OlQiAPKWrRF2cVvLsu4a1JaEnF0EGaE= +github.com/go-krb5/krb5 v0.1.0/go.mod h1:pjottanZMR4s9ITIh/cHBYoNMtqkK4IzXuplsihoncI= +github.com/go-krb5/x v0.3.2 h1:uIjmgkxEbIXoVwgKT1Xi+efVmtqiXcpQlCVuJ/hq2Z0= +github.com/go-krb5/x v0.3.2/go.mod h1:h44nn9OxeR34A9Tu0UZfRmgwWizETfWwWy97K3RlxuI= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -89,6 +95,10 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= +github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA= +github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo= +github.com/gorilla/sessions v1.4.0 h1:kpIYOp/oi6MG/p5PgxApU8srsSw9tuFbt46Lt7auzqQ= +github.com/gorilla/sessions v1.4.0/go.mod h1:FLWm50oby91+hl7p/wRxDth9bWSuk0qVL2emc7lT5ik= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= diff --git a/internal/translations/catalog.go b/internal/translations/catalog.go index adcbf40e..e50f9335 100644 --- a/internal/translations/catalog.go +++ b/internal/translations/catalog.go @@ -152,6 +152,7 @@ var messageKeyToIndex = map[string]int{ "Display one or many users from the sqlconfig file": 142, "Display raw byte data": 159, "Display the current-context": 106, + "Do not strip the \"mssql: \" prefix from error messages": 307, "Don't download image. Use already downloaded image": 169, "Download (into container) and attach database (.bak) from URL": 176, "Downloading %s": 196, @@ -193,6 +194,7 @@ var messageKeyToIndex = map[string]int{ "Invalid variable value %s": 302, "Is a container runtime installed on this machine (e.g. Podman or Docker)?": 199, "Is a container runtime running? (Try `%s` or `%s` (list containers), does it return without error?)": 202, + "Kerberos credential cache type %s is not supported. Use a FILE: cache in KRB5CCNAME.": 308, "Legal docs and information: aka.ms/SqlcmdLegal": 223, "Level of mssql driver messages to print": 253, "Line in errorlog to wait for before connecting": 170, @@ -216,14 +218,15 @@ var messageKeyToIndex = map[string]int{ "Name of user to delete": 122, "New password": 271, "New password and exit": 272, - "No context exists with the name: \"%v\"": 155, - "No current context": 20, - "No endpoints to uninstall": 50, - "Now ready for client connections on port %#v": 189, - "Open in Azure Data Studio": 64, - "Open tools (e.g Azure Data Studio) for current context": 10, - "Or, set the environment variable i.e. %s %s=YES ": 178, - "Pass in the %s %s": 89, + "No Kerberos credentials found in %s. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.": 309, + "No context exists with the name: \"%v\"": 155, + "No current context": 20, + "No endpoints to uninstall": 50, + "Now ready for client connections on port %#v": 189, + "Open in Azure Data Studio": 64, + "Open tools (e.g Azure Data Studio) for current context": 10, + "Or, set the environment variable i.e. %s %s=YES ": 178, + "Pass in the %s %s": 89, "Pass in the flag %s to override this safety check for user (non-system) databases": 48, "Password": 261, "Password encryption method (%s) in sqlconfig file": 85, @@ -231,7 +234,8 @@ var messageKeyToIndex = map[string]int{ "Port (next available port from 1433 upwards used by default)": 175, "Press Ctrl+C to exit this process...": 216, "Print version information and exit": 231, - "Prints the output in vertical format. This option sets the sqlcmd scripting variable %s to '%s'. The default is false": 251, + "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable %s to '%s'. The default is false": 306, + "Prints the output in vertical format. This option sets the sqlcmd scripting variable %s to '%s'. The default is false": 251, "Provide a username with the %s flag": 95, "Provide a valid encryption method (%s) with the %s flag": 97, "Provide password in the %s (or %s) environment variable": 93, @@ -250,7 +254,7 @@ var messageKeyToIndex = map[string]int{ "Run a query using [%s] database": 13, "See all release tags for SQL Server, install previous version": 207, "See connection strings": 187, - "Server name override is not supported with the current authentication method": 306, + "Server name override is not supported with the current authentication method": 310, "Servers:": 222, "Set new default database": 14, "Set the current context": 149, @@ -357,7 +361,7 @@ var messageKeyToIndex = map[string]int{ "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools": 285, } -var de_DEIndex = []uint32{ // 308 elements +var de_DEIndex = []uint32{ // 312 elements // Entry 0 - 1F 0x00000000, 0x0000003c, 0x0000007e, 0x00000096, 0x000000d1, 0x000000e9, 0x000000fd, 0x00000148, @@ -445,7 +449,8 @@ var de_DEIndex = []uint32{ // 308 elements 0x00004cbf, 0x00004d1a, 0x00004d65, 0x00004d6f, 0x00004d83, 0x00004d9c, 0x00004dc2, 0x00004de2, 0x00004de2, 0x00004de2, 0x00004de2, 0x00004de2, -} // Size: 1256 bytes + 0x00004de2, 0x00004de2, 0x00004de2, 0x00004de2, +} // Size: 1272 bytes const de_DEData string = "" + // Size: 19938 bytes "\x02SQL Server installieren/erstellen, abfragen, deinstallieren\x02Konfi" + @@ -738,7 +743,7 @@ const de_DEData string = "" + // Size: 19938 bytes ":\x02(1 Zeile betroffen)\x02(%[1]d Zeilen betroffen)\x02Ungültiger Varia" + "blenbezeichner %[1]s\x02Ungültiger Variablenwert %[1]s" -var en_USIndex = []uint32{ // 308 elements +var en_USIndex = []uint32{ // 312 elements // Entry 0 - 1F 0x00000000, 0x0000002c, 0x00000062, 0x0000007a, 0x000000b3, 0x000000cb, 0x000000de, 0x00000113, @@ -825,10 +830,11 @@ var en_USIndex = []uint32{ // 308 elements 0x00003bf5, 0x00003c26, 0x00003c75, 0x00003c95, 0x00003ca5, 0x00003cfb, 0x00003d40, 0x00003d4a, 0x00003d5b, 0x00003d71, 0x00003d93, 0x00003db0, - 0x00003e0a, 0x00003eba, 0x00003fb5, 0x00004002, -} // Size: 1256 bytes + 0x00003e0a, 0x00003eba, 0x00003fb5, 0x00004034, + 0x0000406a, 0x000040c2, 0x00004130, 0x0000417d, +} // Size: 1272 bytes -const en_USData string = "" + // Size: 16386 bytes +const en_USData string = "" + // Size: 16765 bytes "\x02Install/Create, Query, Uninstall SQL Server\x02View configuration in" + "formation and connection strings\x04\x02\x0a\x0a\x00\x12\x02Feedback:" + "\x0a %[1]s\x02help for backwards compatibility flags (-S, -U, -E etc.)" + @@ -1070,10 +1076,16 @@ const en_USData string = "" + // Size: 16386 bytes "r name sent to SQL Server.\x02Specifies the path to a server certificate" + " file (PEM, DER, or CER) to match against the server's TLS certificate. " + "Use when encryption is enabled (-N true, -N mandatory, or -N strict) for" + - " certificate pinning instead of standard certificate validation.\x02Serv" + - "er name override is not supported with the current authentication method" + " certificate pinning instead of standard certificate validation.\x02Prin" + + "ts the output in ASCII table format. This option sets the sqlcmd scripti" + + "ng variable %[1]s to '%[2]s'. The default is false\x02Do not strip the " + + "\x22mssql: \x22 prefix from error messages\x02Kerberos credential cache " + + "type %[1]s is not supported. Use a FILE: cache in KRB5CCNAME.\x02No Kerb" + + "eros credentials found in %[1]s. Run kinit to get a ticket in a FILE: ca" + + "che, or set KRB5CCNAME to one.\x02Server name override is not supported " + + "with the current authentication method" -var es_ESIndex = []uint32{ // 308 elements +var es_ESIndex = []uint32{ // 312 elements // Entry 0 - 1F 0x00000000, 0x00000032, 0x00000081, 0x0000009c, 0x000000ec, 0x0000010d, 0x00000127, 0x0000017f, @@ -1161,7 +1173,8 @@ var es_ESIndex = []uint32{ // 308 elements 0x00004c6c, 0x00004ccf, 0x00004d1d, 0x00004d2a, 0x00004d3c, 0x00004d54, 0x00004d7f, 0x00004da2, 0x00004da2, 0x00004da2, 0x00004da2, 0x00004da2, -} // Size: 1256 bytes + 0x00004da2, 0x00004da2, 0x00004da2, 0x00004da2, +} // Size: 1272 bytes const es_ESData string = "" + // Size: 19874 bytes "\x02Instalar/Crear, Consultar, Desinstalar SQL Server\x02Visualización d" + @@ -1455,7 +1468,7 @@ const es_ESData string = "" + // Size: 19874 bytes " afectadas)\x02Identificador de variable %[1]s no válido\x02Valor de var" + "iable %[1]s no válido" -var fr_FRIndex = []uint32{ // 308 elements +var fr_FRIndex = []uint32{ // 312 elements // Entry 0 - 1F 0x00000000, 0x00000037, 0x0000007f, 0x0000009d, 0x000000e1, 0x000000fe, 0x00000117, 0x00000169, @@ -1543,7 +1556,8 @@ var fr_FRIndex = []uint32{ // 308 elements 0x00004fbe, 0x00005014, 0x00005059, 0x00005069, 0x0000507e, 0x00005098, 0x000050bf, 0x000050e1, 0x000050e1, 0x000050e1, 0x000050e1, 0x000050e1, -} // Size: 1256 bytes + 0x000050e1, 0x000050e1, 0x000050e1, 0x000050e1, +} // Size: 1272 bytes const fr_FRData string = "" + // Size: 20705 bytes "\x02Installer/créer, interroger, désinstaller SQL Server\x02Afficher les" + @@ -1847,7 +1861,7 @@ const fr_FRData string = "" + // Size: 20705 bytes "\x02Identifiant de variable invalide %[1]s\x02Valeur de variable invalid" + "e %[1]s" -var it_ITIndex = []uint32{ // 308 elements +var it_ITIndex = []uint32{ // 312 elements // Entry 0 - 1F 0x00000000, 0x0000003c, 0x00000088, 0x000000a0, 0x000000f7, 0x00000114, 0x0000012b, 0x0000016a, @@ -1935,7 +1949,8 @@ var it_ITIndex = []uint32{ // 308 elements 0x00004a16, 0x00004a74, 0x00004ac1, 0x00004acb, 0x00004ae0, 0x00004afa, 0x00004b2a, 0x00004b52, 0x00004b52, 0x00004b52, 0x00004b52, 0x00004b52, -} // Size: 1256 bytes + 0x00004b52, 0x00004b52, 0x00004b52, 0x00004b52, +} // Size: 1272 bytes const it_ITData string = "" + // Size: 19282 bytes "\x02Installare/creare, eseguire query, disinstallare SQL Server\x02Visua" + @@ -2221,7 +2236,7 @@ const it_ITData string = "" + // Size: 19282 bytes "riga interessata)\x02(%[1]d righe interessate)\x02Identificatore della v" + "ariabile %[1]s non valido\x02Valore della variabile %[1]s non valido" -var ja_JPIndex = []uint32{ // 308 elements +var ja_JPIndex = []uint32{ // 312 elements // Entry 0 - 1F 0x00000000, 0x0000004f, 0x00000077, 0x0000009d, 0x000000d8, 0x000000f8, 0x0000010b, 0x0000014c, @@ -2309,7 +2324,8 @@ var ja_JPIndex = []uint32{ // 308 elements 0x00005d02, 0x00005d7c, 0x00005ddb, 0x00005dec, 0x00005e0c, 0x00005e30, 0x00005e56, 0x00005e79, 0x00005e79, 0x00005e79, 0x00005e79, 0x00005e79, -} // Size: 1256 bytes + 0x00005e79, 0x00005e79, 0x00005e79, 0x00005e79, +} // Size: 1272 bytes const ja_JPData string = "" + // Size: 24185 bytes "\x02インストール/作成、クエリ、SQL Server のアンインストール\x02構成情報と接続文字列の表示\x04\x02\x0a\x0a" + @@ -2474,7 +2490,7 @@ const ja_JPData string = "" + // Size: 24185 bytes "\x02パスワード:\x02(1 行が影響を受けます)\x02(%[1]d 行が影響を受けます)\x02変数識別子 %[1]s が無効です" + "\x02変数値の %[1]s が無効です" -var ko_KRIndex = []uint32{ // 308 elements +var ko_KRIndex = []uint32{ // 312 elements // Entry 0 - 1F 0x00000000, 0x00000029, 0x00000053, 0x0000006c, 0x000000b8, 0x000000d0, 0x000000de, 0x00000121, @@ -2562,7 +2578,8 @@ var ko_KRIndex = []uint32{ // 308 elements 0x00004cc5, 0x00004d25, 0x00004d71, 0x00004d79, 0x00004d8e, 0x00004dae, 0x00004dcf, 0x00004dea, 0x00004dea, 0x00004dea, 0x00004dea, 0x00004dea, -} // Size: 1256 bytes + 0x00004dea, 0x00004dea, 0x00004dea, 0x00004dea, +} // Size: 1272 bytes const ko_KRData string = "" + // Size: 19946 bytes "\x02SQL Server 설치/생성, 쿼리, 제거\x02구성 정보 및 연결 문자열 보기\x04\x02\x0a\x0a\x00" + @@ -2719,7 +2736,7 @@ const ko_KRData string = "" + // Size: 19946 bytes "%[6]s\x02암호:\x02(1개 행 적용됨)\x02(영향을 받은 행 %[1]d개)\x02잘못된 변수 식별자 %[1]s\x02잘" + "못된 변수 값 %[1]s" -var pt_BRIndex = []uint32{ // 308 elements +var pt_BRIndex = []uint32{ // 312 elements // Entry 0 - 1F 0x00000000, 0x00000034, 0x00000071, 0x0000008d, 0x000000e3, 0x00000103, 0x0000011e, 0x0000016d, @@ -2807,7 +2824,8 @@ var pt_BRIndex = []uint32{ // 308 elements 0x00004920, 0x0000497e, 0x000049c8, 0x000049cf, 0x000049e1, 0x000049f9, 0x00004a24, 0x00004a47, 0x00004a47, 0x00004a47, 0x00004a47, 0x00004a47, -} // Size: 1256 bytes + 0x00004a47, 0x00004a47, 0x00004a47, 0x00004a47, +} // Size: 1272 bytes const pt_BRData string = "" + // Size: 19015 bytes "\x02Instalar/Criar, Consultar, Desinstalar o SQL Server\x02Exibir inform" + @@ -3087,7 +3105,7 @@ const pt_BRData string = "" + // Size: 19015 bytes "fetada)\x02(%[1]d linhas afetadas)\x02Identificador de variável %[1]s in" + "válido\x02Valor de variável inválido %[1]s" -var ru_RUIndex = []uint32{ // 308 elements +var ru_RUIndex = []uint32{ // 312 elements // Entry 0 - 1F 0x00000000, 0x00000056, 0x000000c1, 0x000000ec, 0x00000151, 0x00000172, 0x00000195, 0x0000023b, @@ -3175,7 +3193,8 @@ var ru_RUIndex = []uint32{ // 308 elements 0x00007e41, 0x00007ed3, 0x00007f4b, 0x00007f59, 0x00007f7d, 0x00007fa4, 0x00007ff3, 0x00008038, 0x00008038, 0x00008038, 0x00008038, 0x00008038, -} // Size: 1256 bytes + 0x00008038, 0x00008038, 0x00008038, 0x00008038, +} // Size: 1272 bytes const ru_RUData string = "" + // Size: 32824 bytes "\x02Установка или создание, запрос, удаление SQL Server\x02Просмотреть с" + @@ -3464,7 +3483,7 @@ const ru_RUData string = "" + // Size: 32824 bytes "идентификатор переменной %[1]s\x02Недопустимое значение переменной %[1]" + "s" -var zh_CNIndex = []uint32{ // 308 elements +var zh_CNIndex = []uint32{ // 312 elements // Entry 0 - 1F 0x00000000, 0x0000002b, 0x00000050, 0x00000065, 0x00000096, 0x000000ab, 0x000000b8, 0x000000fc, @@ -3552,7 +3571,8 @@ var zh_CNIndex = []uint32{ // 308 elements 0x00003805, 0x00003861, 0x000038ae, 0x000038b6, 0x000038c7, 0x000038dc, 0x000038f9, 0x00003910, 0x00003910, 0x00003910, 0x00003910, 0x00003910, -} // Size: 1256 bytes + 0x00003910, 0x00003910, 0x00003910, 0x00003910, +} // Size: 1272 bytes const zh_CNData string = "" + // Size: 14608 bytes "\x02安装/创建、查询、卸载 SQL Server\x02查看配置信息和连接字符串\x04\x02\x0a\x0a\x00\x0f\x02反馈" + @@ -3673,7 +3693,7 @@ const zh_CNData string = "" + // Size: 14608 bytes "[5]s,行 %#[6]v%[7]s\x02Msg %#[1]v,级别 %[2]d,状态 %[3]d,服务器 %[4]s,行 %#[5]v%[6" + "]s\x02密码:\x02(1 行受影响)\x02(%[1]d 行受影响)\x02变量标识符 %[1]s 无效\x02变量值 %[1]s 无效" -var zh_TWIndex = []uint32{ // 308 elements +var zh_TWIndex = []uint32{ // 312 elements // Entry 0 - 1F 0x00000000, 0x00000031, 0x00000053, 0x0000006e, 0x000000a1, 0x000000b8, 0x000000c2, 0x00000106, @@ -3761,7 +3781,8 @@ var zh_TWIndex = []uint32{ // 308 elements 0x00003853, 0x000038b2, 0x00003902, 0x0000390a, 0x00003924, 0x00003942, 0x00003961, 0x00003978, 0x00003978, 0x00003978, 0x00003978, 0x00003978, -} // Size: 1256 bytes + 0x00003978, 0x00003978, 0x00003978, 0x00003978, +} // Size: 1272 bytes const zh_TWData string = "" + // Size: 14712 bytes "\x02安裝/建立、查詢、解除安裝 SQL Server\x02檢視組態資訊和連接字串\x04\x02\x0a\x0a\x00\x15\x02意" + @@ -3880,4 +3901,4 @@ const zh_TWData string = "" + // Size: 14712 bytes "#[5]v%[6]s\x02密碼:\x02(1 個資料列受影響)\x02(%[1]d 個資料列受影響)\x02無效的變數識別碼 %[1]s" + "\x02變數值 %[1]s 無效" - // Total table size 235291 bytes (229KiB); checksum: AA9B2EAD + // Total table size 235846 bytes (230KiB); checksum: 422808F2 diff --git a/internal/translations/locales/de-DE/out.gotext.json b/internal/translations/locales/de-DE/out.gotext.json index 5e74cf30..014f2b89 100644 --- a/internal/translations/locales/de-DE/out.gotext.json +++ b/internal/translations/locales/de-DE/out.gotext.json @@ -2841,6 +2841,29 @@ ], "fuzzy": true }, + { + "id": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "message": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "translation": "", + "placeholders": [ + { + "id": "SQLCMDFORMAT", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "sqlcmd.SQLCMDFORMAT" + }, + { + "id": "Ascii", + "string": "%[2]s", + "type": "string", + "underlyingType": "string", + "argNum": 2, + "expr": "\"ascii\"" + } + ] + }, { "id": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", "message": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", @@ -2899,6 +2922,11 @@ ], "fuzzy": true }, + { + "id": "Do not strip the \"mssql: \" prefix from error messages", + "message": "Do not strip the \"mssql: \" prefix from error messages", + "translation": "" + }, { "id": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", "message": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", @@ -3655,6 +3683,36 @@ ], "fuzzy": true }, + { + "id": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "message": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "translation": "", + "placeholders": [ + { + "id": "CacheType", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "cacheType" + } + ] + }, + { + "id": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "message": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "translation": "", + "placeholders": [ + { + "id": "Path", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "path" + } + ] + }, { "id": "Server name override is not supported with the current authentication method", "message": "Server name override is not supported with the current authentication method", diff --git a/internal/translations/locales/en-US/out.gotext.json b/internal/translations/locales/en-US/out.gotext.json index 21772c8d..01a63a85 100644 --- a/internal/translations/locales/en-US/out.gotext.json +++ b/internal/translations/locales/en-US/out.gotext.json @@ -2847,6 +2847,31 @@ ], "fuzzy": true }, + { + "id": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "message": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "translation": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "translatorComment": "Copied from source.", + "placeholders": [ + { + "id": "SQLCMDFORMAT", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "sqlcmd.SQLCMDFORMAT" + }, + { + "id": "Ascii", + "string": "%[2]s", + "type": "string", + "underlyingType": "string", + "argNum": 2, + "expr": "\"ascii\"" + } + ], + "fuzzy": true + }, { "id": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", "message": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", @@ -2905,6 +2930,13 @@ ], "fuzzy": true }, + { + "id": "Do not strip the \"mssql: \" prefix from error messages", + "message": "Do not strip the \"mssql: \" prefix from error messages", + "translation": "Do not strip the \"mssql: \" prefix from error messages", + "translatorComment": "Copied from source.", + "fuzzy": true + }, { "id": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", "message": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", @@ -3661,6 +3693,40 @@ ], "fuzzy": true }, + { + "id": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "message": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "translation": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "translatorComment": "Copied from source.", + "placeholders": [ + { + "id": "CacheType", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "cacheType" + } + ], + "fuzzy": true + }, + { + "id": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "message": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "translation": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "translatorComment": "Copied from source.", + "placeholders": [ + { + "id": "Path", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "path" + } + ], + "fuzzy": true + }, { "id": "Server name override is not supported with the current authentication method", "message": "Server name override is not supported with the current authentication method", diff --git a/internal/translations/locales/es-ES/out.gotext.json b/internal/translations/locales/es-ES/out.gotext.json index 66b51962..3605e811 100644 --- a/internal/translations/locales/es-ES/out.gotext.json +++ b/internal/translations/locales/es-ES/out.gotext.json @@ -2841,6 +2841,29 @@ ], "fuzzy": true }, + { + "id": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "message": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "translation": "", + "placeholders": [ + { + "id": "SQLCMDFORMAT", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "sqlcmd.SQLCMDFORMAT" + }, + { + "id": "Ascii", + "string": "%[2]s", + "type": "string", + "underlyingType": "string", + "argNum": 2, + "expr": "\"ascii\"" + } + ] + }, { "id": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", "message": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", @@ -2899,6 +2922,11 @@ ], "fuzzy": true }, + { + "id": "Do not strip the \"mssql: \" prefix from error messages", + "message": "Do not strip the \"mssql: \" prefix from error messages", + "translation": "" + }, { "id": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", "message": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", @@ -3655,6 +3683,36 @@ ], "fuzzy": true }, + { + "id": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "message": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "translation": "", + "placeholders": [ + { + "id": "CacheType", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "cacheType" + } + ] + }, + { + "id": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "message": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "translation": "", + "placeholders": [ + { + "id": "Path", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "path" + } + ] + }, { "id": "Server name override is not supported with the current authentication method", "message": "Server name override is not supported with the current authentication method", diff --git a/internal/translations/locales/fr-FR/out.gotext.json b/internal/translations/locales/fr-FR/out.gotext.json index d09d0a6d..1c571c9b 100644 --- a/internal/translations/locales/fr-FR/out.gotext.json +++ b/internal/translations/locales/fr-FR/out.gotext.json @@ -2841,6 +2841,29 @@ ], "fuzzy": true }, + { + "id": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "message": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "translation": "", + "placeholders": [ + { + "id": "SQLCMDFORMAT", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "sqlcmd.SQLCMDFORMAT" + }, + { + "id": "Ascii", + "string": "%[2]s", + "type": "string", + "underlyingType": "string", + "argNum": 2, + "expr": "\"ascii\"" + } + ] + }, { "id": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", "message": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", @@ -2899,6 +2922,11 @@ ], "fuzzy": true }, + { + "id": "Do not strip the \"mssql: \" prefix from error messages", + "message": "Do not strip the \"mssql: \" prefix from error messages", + "translation": "" + }, { "id": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", "message": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", @@ -3655,6 +3683,36 @@ ], "fuzzy": true }, + { + "id": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "message": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "translation": "", + "placeholders": [ + { + "id": "CacheType", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "cacheType" + } + ] + }, + { + "id": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "message": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "translation": "", + "placeholders": [ + { + "id": "Path", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "path" + } + ] + }, { "id": "Server name override is not supported with the current authentication method", "message": "Server name override is not supported with the current authentication method", diff --git a/internal/translations/locales/it-IT/out.gotext.json b/internal/translations/locales/it-IT/out.gotext.json index b320dd5c..8c53c739 100644 --- a/internal/translations/locales/it-IT/out.gotext.json +++ b/internal/translations/locales/it-IT/out.gotext.json @@ -2841,6 +2841,29 @@ ], "fuzzy": true }, + { + "id": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "message": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "translation": "", + "placeholders": [ + { + "id": "SQLCMDFORMAT", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "sqlcmd.SQLCMDFORMAT" + }, + { + "id": "Ascii", + "string": "%[2]s", + "type": "string", + "underlyingType": "string", + "argNum": 2, + "expr": "\"ascii\"" + } + ] + }, { "id": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", "message": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", @@ -2899,6 +2922,11 @@ ], "fuzzy": true }, + { + "id": "Do not strip the \"mssql: \" prefix from error messages", + "message": "Do not strip the \"mssql: \" prefix from error messages", + "translation": "" + }, { "id": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", "message": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", @@ -3655,6 +3683,36 @@ ], "fuzzy": true }, + { + "id": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "message": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "translation": "", + "placeholders": [ + { + "id": "CacheType", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "cacheType" + } + ] + }, + { + "id": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "message": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "translation": "", + "placeholders": [ + { + "id": "Path", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "path" + } + ] + }, { "id": "Server name override is not supported with the current authentication method", "message": "Server name override is not supported with the current authentication method", diff --git a/internal/translations/locales/ja-JP/out.gotext.json b/internal/translations/locales/ja-JP/out.gotext.json index 55cd0a6c..81570ef1 100644 --- a/internal/translations/locales/ja-JP/out.gotext.json +++ b/internal/translations/locales/ja-JP/out.gotext.json @@ -2841,6 +2841,29 @@ ], "fuzzy": true }, + { + "id": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "message": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "translation": "", + "placeholders": [ + { + "id": "SQLCMDFORMAT", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "sqlcmd.SQLCMDFORMAT" + }, + { + "id": "Ascii", + "string": "%[2]s", + "type": "string", + "underlyingType": "string", + "argNum": 2, + "expr": "\"ascii\"" + } + ] + }, { "id": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", "message": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", @@ -2899,6 +2922,11 @@ ], "fuzzy": true }, + { + "id": "Do not strip the \"mssql: \" prefix from error messages", + "message": "Do not strip the \"mssql: \" prefix from error messages", + "translation": "" + }, { "id": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", "message": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", @@ -3655,6 +3683,36 @@ ], "fuzzy": true }, + { + "id": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "message": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "translation": "", + "placeholders": [ + { + "id": "CacheType", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "cacheType" + } + ] + }, + { + "id": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "message": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "translation": "", + "placeholders": [ + { + "id": "Path", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "path" + } + ] + }, { "id": "Server name override is not supported with the current authentication method", "message": "Server name override is not supported with the current authentication method", diff --git a/internal/translations/locales/ko-KR/out.gotext.json b/internal/translations/locales/ko-KR/out.gotext.json index c7bfe94a..bd40ea47 100644 --- a/internal/translations/locales/ko-KR/out.gotext.json +++ b/internal/translations/locales/ko-KR/out.gotext.json @@ -2841,6 +2841,29 @@ ], "fuzzy": true }, + { + "id": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "message": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "translation": "", + "placeholders": [ + { + "id": "SQLCMDFORMAT", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "sqlcmd.SQLCMDFORMAT" + }, + { + "id": "Ascii", + "string": "%[2]s", + "type": "string", + "underlyingType": "string", + "argNum": 2, + "expr": "\"ascii\"" + } + ] + }, { "id": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", "message": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", @@ -2899,6 +2922,11 @@ ], "fuzzy": true }, + { + "id": "Do not strip the \"mssql: \" prefix from error messages", + "message": "Do not strip the \"mssql: \" prefix from error messages", + "translation": "" + }, { "id": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", "message": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", @@ -3655,6 +3683,36 @@ ], "fuzzy": true }, + { + "id": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "message": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "translation": "", + "placeholders": [ + { + "id": "CacheType", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "cacheType" + } + ] + }, + { + "id": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "message": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "translation": "", + "placeholders": [ + { + "id": "Path", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "path" + } + ] + }, { "id": "Server name override is not supported with the current authentication method", "message": "Server name override is not supported with the current authentication method", diff --git a/internal/translations/locales/pt-BR/out.gotext.json b/internal/translations/locales/pt-BR/out.gotext.json index 6ca60db9..3af8fb07 100644 --- a/internal/translations/locales/pt-BR/out.gotext.json +++ b/internal/translations/locales/pt-BR/out.gotext.json @@ -2841,6 +2841,29 @@ ], "fuzzy": true }, + { + "id": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "message": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "translation": "", + "placeholders": [ + { + "id": "SQLCMDFORMAT", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "sqlcmd.SQLCMDFORMAT" + }, + { + "id": "Ascii", + "string": "%[2]s", + "type": "string", + "underlyingType": "string", + "argNum": 2, + "expr": "\"ascii\"" + } + ] + }, { "id": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", "message": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", @@ -2899,6 +2922,11 @@ ], "fuzzy": true }, + { + "id": "Do not strip the \"mssql: \" prefix from error messages", + "message": "Do not strip the \"mssql: \" prefix from error messages", + "translation": "" + }, { "id": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", "message": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", @@ -3655,6 +3683,36 @@ ], "fuzzy": true }, + { + "id": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "message": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "translation": "", + "placeholders": [ + { + "id": "CacheType", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "cacheType" + } + ] + }, + { + "id": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "message": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "translation": "", + "placeholders": [ + { + "id": "Path", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "path" + } + ] + }, { "id": "Server name override is not supported with the current authentication method", "message": "Server name override is not supported with the current authentication method", diff --git a/internal/translations/locales/ru-RU/out.gotext.json b/internal/translations/locales/ru-RU/out.gotext.json index e57c1ca7..3948ac18 100644 --- a/internal/translations/locales/ru-RU/out.gotext.json +++ b/internal/translations/locales/ru-RU/out.gotext.json @@ -2841,6 +2841,29 @@ ], "fuzzy": true }, + { + "id": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "message": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "translation": "", + "placeholders": [ + { + "id": "SQLCMDFORMAT", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "sqlcmd.SQLCMDFORMAT" + }, + { + "id": "Ascii", + "string": "%[2]s", + "type": "string", + "underlyingType": "string", + "argNum": 2, + "expr": "\"ascii\"" + } + ] + }, { "id": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", "message": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", @@ -2899,6 +2922,11 @@ ], "fuzzy": true }, + { + "id": "Do not strip the \"mssql: \" prefix from error messages", + "message": "Do not strip the \"mssql: \" prefix from error messages", + "translation": "" + }, { "id": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", "message": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", @@ -3655,6 +3683,36 @@ ], "fuzzy": true }, + { + "id": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "message": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "translation": "", + "placeholders": [ + { + "id": "CacheType", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "cacheType" + } + ] + }, + { + "id": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "message": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "translation": "", + "placeholders": [ + { + "id": "Path", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "path" + } + ] + }, { "id": "Server name override is not supported with the current authentication method", "message": "Server name override is not supported with the current authentication method", diff --git a/internal/translations/locales/zh-CN/out.gotext.json b/internal/translations/locales/zh-CN/out.gotext.json index 145eb3ac..d72d3046 100644 --- a/internal/translations/locales/zh-CN/out.gotext.json +++ b/internal/translations/locales/zh-CN/out.gotext.json @@ -2841,6 +2841,29 @@ ], "fuzzy": true }, + { + "id": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "message": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "translation": "", + "placeholders": [ + { + "id": "SQLCMDFORMAT", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "sqlcmd.SQLCMDFORMAT" + }, + { + "id": "Ascii", + "string": "%[2]s", + "type": "string", + "underlyingType": "string", + "argNum": 2, + "expr": "\"ascii\"" + } + ] + }, { "id": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", "message": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", @@ -2899,6 +2922,11 @@ ], "fuzzy": true }, + { + "id": "Do not strip the \"mssql: \" prefix from error messages", + "message": "Do not strip the \"mssql: \" prefix from error messages", + "translation": "" + }, { "id": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", "message": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", @@ -3655,6 +3683,36 @@ ], "fuzzy": true }, + { + "id": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "message": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "translation": "", + "placeholders": [ + { + "id": "CacheType", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "cacheType" + } + ] + }, + { + "id": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "message": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "translation": "", + "placeholders": [ + { + "id": "Path", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "path" + } + ] + }, { "id": "Server name override is not supported with the current authentication method", "message": "Server name override is not supported with the current authentication method", diff --git a/internal/translations/locales/zh-TW/out.gotext.json b/internal/translations/locales/zh-TW/out.gotext.json index ee4e808c..98d3ded1 100644 --- a/internal/translations/locales/zh-TW/out.gotext.json +++ b/internal/translations/locales/zh-TW/out.gotext.json @@ -2841,6 +2841,29 @@ ], "fuzzy": true }, + { + "id": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "message": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false", + "translation": "", + "placeholders": [ + { + "id": "SQLCMDFORMAT", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "sqlcmd.SQLCMDFORMAT" + }, + { + "id": "Ascii", + "string": "%[2]s", + "type": "string", + "underlyingType": "string", + "argNum": 2, + "expr": "\"ascii\"" + } + ] + }, { "id": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", "message": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.", @@ -2899,6 +2922,11 @@ ], "fuzzy": true }, + { + "id": "Do not strip the \"mssql: \" prefix from error messages", + "message": "Do not strip the \"mssql: \" prefix from error messages", + "translation": "" + }, { "id": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", "message": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed", @@ -3655,6 +3683,36 @@ ], "fuzzy": true }, + { + "id": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "message": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.", + "translation": "", + "placeholders": [ + { + "id": "CacheType", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "cacheType" + } + ] + }, + { + "id": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "message": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", + "translation": "", + "placeholders": [ + { + "id": "Path", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "path" + } + ] + }, { "id": "Server name override is not supported with the current authentication method", "message": "Server name override is not supported with the current authentication method", diff --git a/pkg/sqlcmd/kerberos.go b/pkg/sqlcmd/kerberos.go new file mode 100644 index 00000000..ae9d197c --- /dev/null +++ b/pkg/sqlcmd/kerberos.go @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package sqlcmd + +import ( + "fmt" + "net/url" + "os" + "runtime" + "strings" + + "github.com/microsoft/go-sqlcmd/internal/localizer" + + // Registers the "krb5" authenticator that integrated authentication uses outside Windows + _ "github.com/microsoft/go-mssqldb/integratedauth/krb5" +) + +// kerberosConnectionString adds the krb5 authenticator parameters for integrated authentication outside Windows, +// where the driver would otherwise default to NTLM, which needs a user name and password. +func kerberosConnectionString(connectionString string) (string, error) { + if runtime.GOOS == "windows" { + return connectionString, nil + } + credCache, err := credentialCachePath(os.Getenv("KRB5CCNAME")) + if err != nil { + return "", err + } + u, err := url.Parse(connectionString) + if err != nil { + return "", err + } + query := u.Query() + query.Set("authenticator", "krb5") + // The driver uses KRB5CCNAME as a literal path, so pass the cache without its FILE: prefix + query.Set("krb5-credcachefile", credCache) + u.RawQuery = query.Encode() + return u.String(), nil +} + +// credentialCachePath returns the file of a FILE: credential cache name, defaulting to /tmp/krb5cc_ +func credentialCachePath(name string) (string, error) { + if name == "" { + return existingCacheFile(fmt.Sprintf("/tmp/krb5cc_%d", os.Getuid())) + } + cacheType, path, found := strings.Cut(name, ":") + if !found || strings.Contains(cacheType, "/") { + return existingCacheFile(name) + } + // The pure Go Kerberos client can't read API: (macOS default), KCM:, KEYRING: or DIR: caches + if !strings.EqualFold(cacheType, "FILE") { + return "", localizer.Errorf("Kerberos credential cache type %s is not supported. Use a FILE: cache in KRB5CCNAME.", cacheType) + } + return existingCacheFile(path) +} + +// existingCacheFile fails early when kinit hasn't written the cache file, instead of the driver's file-not-found error +func existingCacheFile(path string) (string, error) { + if _, err := os.Stat(path); err != nil { + return "", localizer.Errorf("No Kerberos credentials found in %s. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.", path) + } + return path, nil +} diff --git a/pkg/sqlcmd/kerberos_test.go b/pkg/sqlcmd/kerberos_test.go new file mode 100644 index 00000000..bffe39aa --- /dev/null +++ b/pkg/sqlcmd/kerberos_test.go @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package sqlcmd + +import ( + "bytes" + "fmt" + "os" + "path/filepath" + "runtime" + "strings" + "testing" + + "github.com/microsoft/go-mssqldb/integratedauth" + "github.com/microsoft/go-mssqldb/msdsn" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestCredentialCachePath(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("-E uses SSPI on Windows") + } + dir := t.TempDir() + cache := filepath.Join(dir, "cc") + colonCache := filepath.Join(dir, "a:b") + for _, path := range []string{cache, colonCache} { + require.NoError(t, os.WriteFile(path, nil, 0o600)) + } + tests := []struct { + name, ccname, path, errText string + }{ + {"FILE prefix", "FILE:" + cache, cache, ""}, + {"lowercase prefix", "file:" + cache, cache, ""}, + {"no prefix", cache, cache, ""}, + {"colon in path", colonCache, colonCache, ""}, + {"missing file", "FILE:" + filepath.Join(dir, "missing"), "", "No Kerberos credentials found in"}, + {"empty FILE path", "FILE:", "", "No Kerberos credentials found in"}, + {"API", "API:1234", "", "is not supported"}, + {"KCM", "KCM:1000", "", "is not supported"}, + {"KEYRING", "KEYRING:persistent:1000", "", "is not supported"}, + {"DIR", "DIR:" + dir, "", "is not supported"}, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + path, err := credentialCachePath(test.ccname) + if test.errText != "" { + assert.ErrorContains(t, err, test.errText) + return + } + assert.NoError(t, err) + assert.Equal(t, test.path, path) + }) + } +} + +func TestKerberosAuthenticator(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("-E uses SSPI on Windows") + } + dir := t.TempDir() + configFile := filepath.Join(dir, "krb5.conf") + cache := filepath.Join(dir, "krb5cc_test") + require.NoError(t, os.WriteFile(configFile, []byte("[libdefaults]\n default_realm = EXAMPLE.COM\n"), 0o600)) + require.NoError(t, os.WriteFile(cache, nil, 0o600)) + defaultCache := fmt.Sprintf("/tmp/krb5cc_%d", os.Getuid()) + _, statErr := os.Stat(defaultCache) + defaultExists := statErr == nil + defaultErr := "No Kerberos credentials found in " + defaultCache + if defaultExists { + defaultErr = "" + } + tests := []struct { + name, ccname, wantCache, errText string + }{ + {"FILE cache", "FILE:" + cache, cache, ""}, + {"plain path", cache, cache, ""}, + {"missing cache", "FILE:" + filepath.Join(dir, "missing"), "", "No Kerberos credentials found in"}, + {"unsupported type", "API:x", "", "is not supported"}, + {"default cache", "", defaultCache, defaultErr}, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + t.Setenv("KRB5_CONFIG", configFile) + t.Setenv("KRB5CCNAME", test.ccname) + base, err := ConnectSettings{UseTrustedConnection: true, ServerName: "sqlhost"}.ConnectionString() + require.NoError(t, err) + connstr, err := kerberosConnectionString(base) + if test.errText != "" { + require.ErrorContains(t, err, test.errText) + return + } + require.NoError(t, err) + config, err := msdsn.Parse(connstr) + require.NoError(t, err) + assert.Equal(t, "krb5", config.Parameters["authenticator"]) + assert.Equal(t, test.wantCache, config.Parameters["krb5-credcachefile"]) + auth, err := integratedauth.GetIntegratedAuthenticator(config) + require.NoError(t, err) + assert.NotNil(t, auth) + }) + } +} + +func TestConnectDbKerberos(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("-E uses SSPI on Windows") + } + t.Setenv("KRB5CCNAME", "API:x") + const unsupported = "is not supported" + tests := []struct { + name string + settings ConnectSettings + useCurrent bool + kerberos bool + printed bool + }{ + {"-E alone", ConnectSettings{UseTrustedConnection: true}, false, true, true}, + {"no -E and no user", ConnectSettings{}, false, true, true}, + {"-E on current connection", ConnectSettings{UseTrustedConnection: true}, true, true, false}, + {"-E with SqlPassword", ConnectSettings{UseTrustedConnection: true, AuthenticationMethod: SqlPassword, UserName: "u", Password: "p"}, false, false, false}, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + test.settings.ServerName = "127.0.0.1:1" + s := New(nil, "", InitializeVariables(false)) + buf := &memoryBuffer{buf: new(bytes.Buffer)} + s.SetOutput(buf) + var err error + if test.useCurrent { + s.Connect = &test.settings + err = s.ConnectDb(nil, true) + } else { + err = s.ConnectDb(&test.settings, true) + } + require.Error(t, err) + assert.Equal(t, test.kerberos, strings.Contains(err.Error(), unsupported), "error: %v", err) + assert.Equal(t, test.printed, strings.Contains(buf.buf.String(), unsupported), "output: %q", buf.buf.String()) + }) + } +} diff --git a/pkg/sqlcmd/sqlcmd.go b/pkg/sqlcmd/sqlcmd.go index 93637a02..aa45825b 100644 --- a/pkg/sqlcmd/sqlcmd.go +++ b/pkg/sqlcmd/sqlcmd.go @@ -271,6 +271,14 @@ func (s *Sqlcmd) ConnectDb(connect *ConnectSettings, nopw bool) error { if err != nil { return err } + if connect.integratedAuthentication() && !connect.sqlAuthentication() { + if connstr, err = kerberosConnectionString(connstr); err != nil { + if newConnection { + _, _ = fmt.Fprintln(s.GetOutput(), err) + } + return err + } + } if !useAad { var c *mssql.Connector