Skip to content

Commit 00b50a3

Browse files
authored
privilege, server: support LDAP authentication (#43582) (#43696)
close #43580
1 parent 463759e commit 00b50a3

File tree

73 files changed

+1606
-514
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1606
-514
lines changed

DEPS.bzl

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ def go_deps():
111111
sum = "h1:4QctJBgXEkbzeKz6PJy6bt3JSPNSN4I2mITYW+eKUoQ=",
112112
version = "v1.0.0",
113113
)
114+
go_repository(
115+
name = "com_github_alexbrainman_sspi",
116+
build_file_proto_mode = "disable",
117+
importpath = "github.com/alexbrainman/sspi",
118+
sum = "h1:Kk6a4nehpJ3UuJRqlA3JxYxBZEqCeOmATOvrbT4p9RA=",
119+
version = "v0.0.0-20210105120005-909beea2cc74",
120+
)
114121

115122
go_repository(
116123
name = "com_github_alexkohler_prealloc",
@@ -294,6 +301,14 @@ def go_deps():
294301
sum = "h1:Q2feRPMlcfVcqz3pF87PJzkm5lZrL+x6BDtzhODzNJM=",
295302
version = "v11.2.8+incompatible",
296303
)
304+
go_repository(
305+
name = "com_github_azure_go_ntlmssp",
306+
build_file_proto_mode = "disable",
307+
importpath = "github.com/Azure/go-ntlmssp",
308+
sum = "h1:mFRzDkZVAjdal+s7s0MwaRv9igoPqLRdzOLzw/8Xvq8=",
309+
version = "v0.0.0-20221128193559-754e69321358",
310+
)
311+
297312
go_repository(
298313
name = "com_github_bazelbuild_buildtools",
299314
build_file_proto_mode = "disable",
@@ -1217,6 +1232,14 @@ def go_deps():
12171232
sum = "h1:3tMoCCfM7ppqsR0ptz/wi1impNpT7/9wQtMZ8lr1mCQ=",
12181233
version = "v1.4.0",
12191234
)
1235+
go_repository(
1236+
name = "com_github_go_asn1_ber_asn1_ber",
1237+
build_file_proto_mode = "disable",
1238+
importpath = "github.com/go-asn1-ber/asn1-ber",
1239+
sum = "h1:vXT6d/FNDiELJnLb6hGNa309LMsrCoYFvpwHDF0+Y1A=",
1240+
version = "v1.5.4",
1241+
)
1242+
12201243
go_repository(
12211244
name = "com_github_go_check_check",
12221245
build_file_proto_mode = "disable_global",
@@ -1282,6 +1305,15 @@ def go_deps():
12821305
sum = "h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=",
12831306
version = "v0.2.1",
12841307
)
1308+
go_repository(
1309+
name = "com_github_go_ldap_ldap_v3",
1310+
build_file_proto_mode = "disable",
1311+
importpath = "github.com/go-ldap/ldap/v3",
1312+
replace = "github.com/YangKeao/ldap/v3",
1313+
sum = "h1:+OqGGFc2YHFd82aSHmjlILVt1t4JWJjrNIfV8cVEPow=",
1314+
version = "v3.4.5-0.20230421065457-369a3bab1117",
1315+
)
1316+
12851317
go_repository(
12861318
name = "com_github_go_logfmt_logfmt",
12871319
build_file_proto_mode = "disable_global",
@@ -1372,8 +1404,8 @@ def go_deps():
13721404
name = "com_github_go_sql_driver_mysql",
13731405
build_file_proto_mode = "disable_global",
13741406
importpath = "github.com/go-sql-driver/mysql",
1375-
sum = "h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=",
1376-
version = "v1.7.0",
1407+
sum = "h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=",
1408+
version = "v1.7.1",
13771409
)
13781410
go_repository(
13791411
name = "com_github_go_stack_stack",

bindinfo/bind_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,11 +762,11 @@ func TestPrivileges(t *testing.T) {
762762
tk.MustExec("drop table if exists t")
763763
tk.MustExec("create table t(a int, b int, index idx(a))")
764764
tk.MustExec("create global binding for select * from t using select * from t use index(idx)")
765-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
765+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
766766
rows := tk.MustQuery("show global bindings").Rows()
767767
require.Len(t, rows, 1)
768768
tk.MustExec("create user test@'%'")
769-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "test", Hostname: "%"}, nil, nil))
769+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "test", Hostname: "%"}, nil, nil, nil))
770770
rows = tk.MustQuery("show global bindings").Rows()
771771
require.Len(t, rows, 0)
772772
}

bindinfo/capture_test.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func TestDMLCapturePlanBaseline(t *testing.T) {
6464
rows := tk.MustQuery("show global bindings").Rows()
6565
require.Len(t, rows, 0)
6666

67-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
67+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
6868
tk.MustExec("delete from t where b = 1 and c > 1")
6969
tk.MustExec("delete from t where b = 1 and c > 1")
7070
tk.MustExec("update t set a = 1 where b = 1 and c > 1")
@@ -111,7 +111,7 @@ func TestCapturePlanBaseline(t *testing.T) {
111111
rows := tk.MustQuery("show global bindings").Rows()
112112
require.Len(t, rows, 0)
113113

114-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
114+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
115115
tk.MustExec("select * from t where a > 10")
116116
tk.MustExec("select * from t where a > 10")
117117
tk.MustExec("admin capture bindings")
@@ -143,7 +143,7 @@ func TestCapturePlanBaseline4DisabledStatus(t *testing.T) {
143143
rows := tk.MustQuery("show global bindings").Rows()
144144
require.Len(t, rows, 0)
145145

146-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
146+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
147147
tk.MustExec("select * from t where a > 10")
148148
tk.MustExec("select * from t where a > 10")
149149
tk.MustExec("admin capture bindings")
@@ -191,7 +191,7 @@ func TestCaptureDBCaseSensitivity(t *testing.T) {
191191
tk.MustExec("use SPM")
192192
tk.MustExec("create table t(a int, b int, key(b))")
193193
tk.MustExec("create global binding for select * from t using select /*+ use_index(t) */ * from t")
194-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
194+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
195195
tk.MustExec("select /*+ use_index(t,b) */ * from t")
196196
tk.MustExec("select /*+ use_index(t,b) */ * from t")
197197
tk.MustExec("admin capture bindings")
@@ -217,7 +217,7 @@ func TestCaptureBaselinesDefaultDB(t *testing.T) {
217217
tk.MustExec("drop database if exists spm")
218218
tk.MustExec("create database spm")
219219
tk.MustExec("create table spm.t(a int, index idx_a(a))")
220-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
220+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
221221
tk.MustExec("select * from spm.t ignore index(idx_a) where a > 10")
222222
tk.MustExec("select * from spm.t ignore index(idx_a) where a > 10")
223223
tk.MustExec("admin capture bindings")
@@ -244,7 +244,7 @@ func TestCapturePreparedStmt(t *testing.T) {
244244
tk := testkit.NewTestKit(t, store)
245245

246246
stmtsummary.StmtSummaryByDigestMap.Clear()
247-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
247+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
248248
tk.MustExec("use test")
249249
tk.MustExec("drop table if exists t")
250250
tk.MustExec("create table t(a int, b int, c int, key idx_b(b), key idx_c(c))")
@@ -279,7 +279,7 @@ func TestCapturePlanBaselineIgnoreTiFlash(t *testing.T) {
279279
tk.MustExec("use test")
280280
tk.MustExec("drop table if exists t")
281281
tk.MustExec("create table t(a int, b int, key(a), key(b))")
282-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
282+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
283283
tk.MustExec("select * from t")
284284
tk.MustExec("select * from t")
285285
// Create virtual tiflash replica info.
@@ -354,7 +354,7 @@ func TestBindingSource(t *testing.T) {
354354
tk.MustExec("SET GLOBAL tidb_capture_plan_baselines = off")
355355
}()
356356
tk.MustExec("use test")
357-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
357+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
358358
tk.MustExec("select * from t ignore index(idx_a) where a < 10")
359359
tk.MustExec("select * from t ignore index(idx_a) where a < 10")
360360
tk.MustExec("admin capture bindings")
@@ -374,7 +374,7 @@ func TestCapturedBindingCharset(t *testing.T) {
374374
tk := testkit.NewTestKit(t, store)
375375

376376
stmtsummary.StmtSummaryByDigestMap.Clear()
377-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
377+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
378378
tk.MustExec("use test")
379379
tk.MustExec("create table t(name varchar(25), index idx(name))")
380380

@@ -407,7 +407,7 @@ func TestConcurrentCapture(t *testing.T) {
407407
tk.MustExec("use test")
408408
tk.MustExec("drop table if exists t")
409409
tk.MustExec("create table t(a int, b int)")
410-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
410+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
411411
tk.MustExec("select * from t")
412412
tk.MustExec("select * from t")
413413
tk.MustExec("admin capture bindings")
@@ -427,7 +427,7 @@ func TestUpdateSubqueryCapture(t *testing.T) {
427427
tk.MustExec("create table t1(a int, b int, c int, key idx_b(b))")
428428
tk.MustExec("create table t2(a int, b int)")
429429
stmtsummary.StmtSummaryByDigestMap.Clear()
430-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
430+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
431431
tk.MustExec("update t1 set b = 1 where b = 2 and (a in (select a from t2 where b = 1) or c in (select a from t2 where b = 1))")
432432
tk.MustExec("update t1 set b = 1 where b = 2 and (a in (select a from t2 where b = 1) or c in (select a from t2 where b = 1))")
433433
tk.MustExec("admin capture bindings")
@@ -481,7 +481,7 @@ func TestIssue20417(t *testing.T) {
481481
stmtsummary.StmtSummaryByDigestMap.Clear()
482482
tk.MustExec("SET GLOBAL tidb_capture_plan_baselines = on")
483483
dom.BindHandle().CaptureBaselines()
484-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
484+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
485485
tk.MustExec("select * from t where b=2 and c=213124")
486486
tk.MustExec("select * from t where b=2 and c=213124")
487487
tk.MustExec("admin capture bindings")
@@ -526,7 +526,7 @@ func TestCaptureWithZeroSlowLogThreshold(t *testing.T) {
526526
tk.MustExec("drop table if exists t")
527527
tk.MustExec("create table t(a int)")
528528
stmtsummary.StmtSummaryByDigestMap.Clear()
529-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
529+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
530530
tk.MustExec("set tidb_slow_log_threshold = 0")
531531
tk.MustExec("select * from t")
532532
tk.MustExec("select * from t")
@@ -552,7 +552,7 @@ func TestIssue25505(t *testing.T) {
552552
tk.MustExec("create table t (a int(11) default null,b int(11) default null,key b (b),key ba (b))")
553553
tk.MustExec("create table t1 (a int(11) default null,b int(11) default null,key idx_ab (a,b),key idx_a (a),key idx_b (b))")
554554
tk.MustExec("create table t2 (a int(11) default null,b int(11) default null,key idx_ab (a,b),key idx_a (a),key idx_b (b))")
555-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
555+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
556556

557557
spmMap := map[string]string{}
558558
spmMap["with recursive `cte` ( `a` ) as ( select ? union select `a` + ? from `test` . `t1` where `a` < ? ) select * from `cte`"] =
@@ -619,7 +619,7 @@ func TestCaptureUserFilter(t *testing.T) {
619619
tk.MustExec("drop table if exists t")
620620
tk.MustExec("create table t(a int)")
621621

622-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
622+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
623623
tk.MustExec("select * from t where a > 10")
624624
tk.MustExec("select * from t where a > 10")
625625
tk.MustExec("admin capture bindings")
@@ -642,7 +642,7 @@ func TestCaptureUserFilter(t *testing.T) {
642642
tk.MustExec(`grant all on *.* to usr1 with grant option`)
643643
tk2 := testkit.NewTestKit(t, store)
644644
tk2.MustExec("use test")
645-
require.NoError(t, tk2.Session().Auth(&auth.UserIdentity{Username: "usr1", Hostname: "%"}, nil, nil))
645+
require.NoError(t, tk2.Session().Auth(&auth.UserIdentity{Username: "usr1", Hostname: "%"}, nil, nil, nil))
646646
tk2.MustExec("select * from t where a > 10")
647647
tk2.MustExec("select * from t where a > 10")
648648
tk2.MustExec("admin capture bindings")
@@ -707,7 +707,7 @@ func TestCaptureWildcardFilter(t *testing.T) {
707707
tk.MustExec("SET GLOBAL tidb_capture_plan_baselines = off")
708708
}()
709709

710-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
710+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
711711
dbs := []string{"db11", "db12", "db2"}
712712
tbls := []string{"t11", "t12", "t2"}
713713
for _, db := range dbs {
@@ -813,7 +813,7 @@ func TestCaptureFilter(t *testing.T) {
813813
tk.MustExec("drop table if exists t")
814814
tk.MustExec("create table t(a int)")
815815

816-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
816+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
817817
tk.MustExec("select * from t where a > 10")
818818
tk.MustExec("select * from t where a > 10")
819819
tk.MustExec("admin capture bindings")
@@ -965,7 +965,7 @@ func TestCaptureHints(t *testing.T) {
965965
tk.MustExec("use test")
966966
tk.MustExec("drop table if exists t")
967967
tk.MustExec("create table t(pk int primary key, a int, b int, key(a), key(b))")
968-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
968+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
969969

970970
captureCases := []struct {
971971
query string

bindinfo/session_handle_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func TestBaselineDBLowerCase(t *testing.T) {
179179
tk.MustExec("create database SPM")
180180
tk.MustExec("use SPM")
181181
tk.MustExec("create table t(a int, b int)")
182-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
182+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
183183
tk.MustExec("update t set a = a + 1")
184184
tk.MustExec("update t set a = a + 1")
185185
tk.MustExec("admin capture bindings")
@@ -269,7 +269,7 @@ func TestShowGlobalBindings(t *testing.T) {
269269
tk.MustExec("use SPM")
270270
tk.MustExec("create table t(a int, b int, key(a))")
271271
tk.MustExec("create table t0(a int, b int, key(a))")
272-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
272+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
273273
rows := tk.MustQuery("show global bindings").Rows()
274274
require.Len(t, rows, 0)
275275
// Simulate existing bindings in the mysql.bind_info.

br/pkg/lightning/config/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ func TestLoadConfig(t *testing.T) {
783783
err = taskCfg.Adjust(context.Background())
784784
require.NoError(t, err)
785785
equivalentDSN := taskCfg.Checkpoint.MySQLParam.ToDriverConfig().FormatDSN()
786-
expectedDSN := "guest:12345@tcp(172.16.30.11:4001)/?maxAllowedPacket=67108864&charset=utf8mb4&sql_mode=%27ONLY_FULL_GROUP_BY%2CSTRICT_TRANS_TABLES%2CNO_ZERO_IN_DATE%2CNO_ZERO_DATE%2CERROR_FOR_DIVISION_BY_ZERO%2CNO_AUTO_CREATE_USER%2CNO_ENGINE_SUBSTITUTION%27"
786+
expectedDSN := "guest:12345@tcp(172.16.30.11:4001)/?charset=utf8mb4&sql_mode=%27ONLY_FULL_GROUP_BY%2CSTRICT_TRANS_TABLES%2CNO_ZERO_IN_DATE%2CNO_ZERO_DATE%2CERROR_FOR_DIVISION_BY_ZERO%2CNO_AUTO_CREATE_USER%2CNO_ENGINE_SUBSTITUTION%27"
787787
require.Equal(t, expectedDSN, equivalentDSN)
788788

789789
result := taskCfg.String()

ddl/db_cache_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ func TestIssue34069(t *testing.T) {
264264
defer sem.Disable()
265265

266266
tk := testkit.NewTestKit(t, store)
267-
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil))
267+
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
268268
tk.MustExec("use test;")
269269
tk.MustExec("create table t_34069 (t int);")
270270
// No error when SEM is enabled.

ddl/db_integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3583,7 +3583,7 @@ func TestAvoidCreateViewOnLocalTemporaryTable(t *testing.T) {
35833583
tk := testkit.NewTestKit(t, store)
35843584
tk.MustExec("use test")
35853585

3586-
tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "localhost", CurrentUser: true, AuthUsername: "root", AuthHostname: "%"}, nil, []byte("012345678901234567890"))
3586+
tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "localhost", CurrentUser: true, AuthUsername: "root", AuthHostname: "%"}, nil, []byte("012345678901234567890"), nil)
35873587
tk.MustExec("drop table if exists tt0")
35883588
tk.MustExec("drop table if exists tt1")
35893589
tk.MustExec("drop table if exists tt2")

ddl/db_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ func TestForbidCacheTableForSystemTable(t *testing.T) {
804804
memOrSysDB := []string{"MySQL", "INFORMATION_SCHEMA", "PERFORMANCE_SCHEMA", "METRICS_SCHEMA"}
805805
for _, db := range memOrSysDB {
806806
tk.MustExec("use " + db)
807-
tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil)
807+
tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil)
808808
rows := tk.MustQuery("show tables").Rows()
809809
for i := 0; i < len(rows); i++ {
810810
sysTables = append(sysTables, rows[i][0].(string))

ddl/fktest/foreign_key_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ func TestCreateTableWithForeignKeyPrivilegeCheck(t *testing.T) {
305305

306306
tk2 := testkit.NewTestKit(t, store)
307307
tk2.MustExec("use test")
308-
tk2.Session().Auth(&auth.UserIdentity{Username: "u1", Hostname: "localhost", CurrentUser: true, AuthUsername: "u1", AuthHostname: "%"}, nil, []byte("012345678901234567890"))
308+
tk2.Session().Auth(&auth.UserIdentity{Username: "u1", Hostname: "localhost", CurrentUser: true, AuthUsername: "u1", AuthHostname: "%"}, nil, []byte("012345678901234567890"), nil)
309309
err := tk2.ExecToErr("create table t2 (a int, foreign key fk(a) references t1(id));")
310310
require.Error(t, err)
311311
require.Equal(t, "[planner:1142]REFERENCES command denied to user 'u1'@'%' for table 't1'", err.Error())
@@ -330,7 +330,7 @@ func TestAlterTableWithForeignKeyPrivilegeCheck(t *testing.T) {
330330
tk.MustExec("create table t1 (id int key);")
331331
tk2 := testkit.NewTestKit(t, store)
332332
tk2.MustExec("use test")
333-
tk2.Session().Auth(&auth.UserIdentity{Username: "u1", Hostname: "localhost", CurrentUser: true, AuthUsername: "u1", AuthHostname: "%"}, nil, []byte("012345678901234567890"))
333+
tk2.Session().Auth(&auth.UserIdentity{Username: "u1", Hostname: "localhost", CurrentUser: true, AuthUsername: "u1", AuthHostname: "%"}, nil, []byte("012345678901234567890"), nil)
334334
tk2.MustExec("create table t2 (a int)")
335335
err := tk2.ExecToErr("alter table t2 add foreign key (a) references t1 (id) on update cascade")
336336
require.Error(t, err)

0 commit comments

Comments
 (0)