diff --git a/test/JDBC/expected/test_windows_login-vu-prepare.out b/test/JDBC/expected/test_windows_login-vu-prepare.out index 6cb5a741ec..1edefb9eb2 100644 --- a/test/JDBC/expected/test_windows_login-vu-prepare.out +++ b/test/JDBC/expected/test_windows_login-vu-prepare.out @@ -1,5 +1,4 @@ -- psql --- TODO: BABEL-5349 do $$ begin if not exists (select * from pg_catalog.pg_roles where rolname = 'rds_ad') diff --git a/test/JDBC/expected/test_windows_login_before-16_6-vu-cleanup.out b/test/JDBC/expected/test_windows_login_before-16_6-vu-cleanup.out new file mode 100644 index 0000000000..870cf9753e --- /dev/null +++ b/test/JDBC/expected/test_windows_login_before-16_6-vu-cleanup.out @@ -0,0 +1,91 @@ +-- tsql +DROP LOGIN PassWordUser; +GO + +-- test for drop login with upn format +DROP LOGIN [aduser@AD]; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the login 'aduser@ad', because it does not exist or you do not have permission.)~~ + + +DROP LOGIN [ad\adUSer]; +GO + +DROP LOGIN [ad\aduserDB]; +GO + +DROP LOGIN [ad\Aduserlanguage]; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the login 'aduserlanguage@AD', because it does not exist or you do not have permission.)~~ + + +DROP LOGIN [ad\Aduserdblanguage]; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the login 'aduserdblanguage@AD', because it does not exist or you do not have permission.)~~ + + +DROP LOGIN [ad\AduserdbEnglish]; +GO + +DROP LOGIN [ad\Aduseroption]; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the login 'aduseroption@AD', because it does not exist or you do not have permission.)~~ + + +DROP LOGIN [babel\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the login 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@BABEL', because it does not exist or you do not have permission.)~~ + + +DROP LOGIN [ba.bel\username]; +GO + +-- test for non-existent login +DROP LOGIN [babel\non_existent_login] +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the login 'non_existent_login@BABEL', because it does not exist or you do not have permission.)~~ + + +-- drop login with different casing +DROP LOGIN UserPassword; +GO + +DROP LOGIN [BabeL\DupLicate]; +GO + +DROP LOGIN [Babel\DuplicateDefaultDB]; +GO + +-- test drop logins for logins with different language names +-- Arabic +DROP LOGIN [babel\كلب]; +GO + +-- Mongolian +DROP LOGIN [babel\өглөө]; +GO + +-- Greek +DROP LOGIN [babel\ελπίδα]; +GO + +-- Chinese +DROP LOGIN [babel\爱]; +GO + +DROP DATABASE ad_db; +GO + + diff --git a/test/JDBC/expected/test_windows_login_before-16_6-vu-prepare.out b/test/JDBC/expected/test_windows_login_before-16_6-vu-prepare.out new file mode 100644 index 0000000000..1edefb9eb2 --- /dev/null +++ b/test/JDBC/expected/test_windows_login_before-16_6-vu-prepare.out @@ -0,0 +1,498 @@ +-- psql +do +$$ begin + if not exists (select * from pg_catalog.pg_roles where rolname = 'rds_ad') + then create role rds_ad NOSUPERUSER NOLOGIN NOCREATEROLE INHERIT NOREPLICATION; + end if; +end $$; +GO +-- terminate-psql-conn + +-- tsql +CREATE DATABASE ad_db; +GO + +CREATE LOGIN PassWordUser with PASSWORD='123'; +GO + +-- positive test case +CREATE LOGIN [ad\Aduser] from windows; +GO + +-- test for default database +CREATE LOGIN [ad\Aduserdb] from windows with default_database=[ad_db]; +GO + +-- test for default language +CREATE LOGIN [ad\Aduserlanguage] from windows with default_language=[German]; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: '[German]' is not currently supported in Babelfish. please use babelfishpg_tsql.escape_hatch_language_non_english to ignore)~~ + + +-- test for default database and default language +CREATE LOGIN [ad\Aduserdblanguage] from windows with default_database=[ad_db], default_language=[German]; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: '[German]' is not currently supported in Babelfish. please use babelfishpg_tsql.escape_hatch_language_non_english to ignore)~~ + + +CREATE LOGIN [ad\AduserdbEnglish] from windows with default_database=[ad_db], default_language=[English]; +GO + +-- test for invalid options for windows +CREATE LOGIN [ad\Aduseroption] from windows with CHECK_POLICY = OFF, CHECK_EXPIRATION = OFF; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '=' at line 2 and character position 62)~~ + + + +-- test boundary conditions +-- test for when the login_name is greater than 21 characters +create login [babel\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The login name 'babel\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' has invalid length. Login name length should be between 1 and 20 for windows login.)~~ + + +-- test for when the login_name length is 0 +CREATE LOGIN [babel\] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The login name 'babel\' has invalid length. Login name length should be between 1 and 20 for windows login.)~~ + + +--test for when the total login name, i.e., domain+user is greater than 64 +CREATE LOGIN [babelforapg.individualad.testfornumberofcharactersintotalwhichisnotallowedinpostgres\user] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The login name 'user@BABELFORAPG.INDIVIDUALAD.TESTFORNUMBEROFCHARACTERSINTOTALWHICHISNOTALLOWEDINPOSTGRES' is too long. Maximum length is 63.)~~ + + +-- test for when the login_name contains invalid characters +CREATE LOGIN [babeluser] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babeluser' is not a valid Windows NT name. Give the complete name: .)~~ + +CREATE LOGIN [babel\user\] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\user\' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\us\er] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\us\er' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\user/] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\user/' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\us/er] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\us/er' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\user[] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\user[' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\u[ser] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\u[ser' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\use]r] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near 'r' at line 1 and character position 24)~~ + +CREATE LOGIN [babel\user;] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\user;' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\us;er] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\us;er' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\user:] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\user:' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\us:er] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\us:er' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\user|] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\user|' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\use|r] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\use|r' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\user=] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\user=' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\u=ser] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\u=ser' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\user,] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\user,' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\us,er] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\us,er' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\user+] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\user+' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\u+ser] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\u+ser' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\user*] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\user*' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\user*] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\user*' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\user?] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\user?' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\us?er] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\us?er' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\user>] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\user>' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\u>ser] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\u>ser' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\user<] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\user<' is not a valid name because it contains invalid characters.)~~ + +CREATE LOGIN [babel\user] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'babel\us<>er' is not a valid name because it contains invalid characters.)~~ + + +-- test to show UPN format is not allowed +CREATE LOGIN [user@BABEL] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'user@BABEL' is not a valid Windows NT name. Give the complete name: .)~~ + + +-- test for duplicate login +CREATE LOGIN usErpassWord with PASSWORD = '123'; +GO + +CREATE LOGIN UserPassword with PASSWORD = '098'; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The Server principal 'userpassword' already exists)~~ + + +CREATE LOGIN [babel\duplicate] from windows; +GO + +CREATE LOGIN [BabeL\DupLicate] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The Server principal 'duplicate@BABEL' already exists)~~ + + +CREATE LOGIN [babel\duplicatedefaultdb] from windows with default_database=[master]; +GO + +CREATE LOGIN [Babel\DuplicateDefaultDB] from windows with default_database=[ad_db]; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The Server principal 'duplicatedefaultdb@BABEL' already exists)~~ + + +-- test for empty domain name +CREATE LOGIN [\adnodomain] from windows; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The login name '\adnodomain' is invalid. The domain can not be empty.)~~ + + + +-- test for login names with different language +-- Arabic +CREATE LOGIN [babel\كلب] from windows; +GO + +-- Mongolian +CREATE LOGIN [babel\өглөө] from windows; +GO + +-- Greek +CREATE LOGIN [babel\ελπίδα] from windows; +GO + +-- Chinese +CREATE LOGIN [babel\爱] from windows; +GO + +-- test for windows login with password --> should throw error +CREATE LOGIN [babel\adbabel] from windows with password='1234'; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '=' at line 2 and character position 55)~~ + + +-- test for when the domain name contains invalid characters +CREATE LOGIN [