Drop tests related to fake passwords (#905)
This commit is contained in:
parent
5d2a653b90
commit
e30ebfabe8
|
@ -1,57 +0,0 @@
|
|||
--TEST--
|
||||
Test password with non alphanumeric characters
|
||||
--DESCRIPTION--
|
||||
The first three cases should have no problem connecting. Only the last case fails because the
|
||||
right curly brace should be escaped with another right brace.
|
||||
In Azure for this test to pass do not specify any particular database when connecting
|
||||
--SKIPIF--
|
||||
<?php require('skipif_mid-refactor.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("MsSetup.inc");
|
||||
require_once("MsCommon_mid-refactor.inc");
|
||||
|
||||
$dsn = getDSN($server, null, "ConnectionPooling=false;");
|
||||
try {
|
||||
// Test 1
|
||||
$conn = new PDO($dsn, "test_password", "! ;4triou");
|
||||
if (!$conn) {
|
||||
echo "Test 1: Should have connected.";
|
||||
}
|
||||
unset($conn);
|
||||
} catch (PDOException $e) {
|
||||
print_r($e->getMessage() . "\n");
|
||||
}
|
||||
try {
|
||||
// Test 2
|
||||
$conn = new PDO($dsn, "test_password2", "!}} ;4triou");
|
||||
if (!$conn) {
|
||||
echo "Test 2: Should have connected.";
|
||||
}
|
||||
unset($conn);
|
||||
} catch (PDOException $e) {
|
||||
print_r($e->getMessage() . "\n");
|
||||
}
|
||||
try {
|
||||
// Test 3
|
||||
$conn = new PDO($dsn, "test_password3", "! ;4triou}}");
|
||||
if (!$conn) {
|
||||
echo "Test 3: Should have connected.";
|
||||
}
|
||||
unset($conn);
|
||||
} catch (PDOException $e) {
|
||||
print_r($e->getMessage() . "\n");
|
||||
}
|
||||
// Test invalid password.
|
||||
try {
|
||||
// Test 4
|
||||
$conn = new PDO($dsn, "test_password3", "! ;4triou}");
|
||||
} catch (PDOException $e) {
|
||||
print_r($e->getMessage());
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
--EXPECTREGEX--
|
||||
SQLSTATE\[IMSSP\]: An unescaped right brace \(}\) was found in either the user name or password\. All right braces must be escaped with another right brace \(}}\)\.
|
|
@ -1,18 +0,0 @@
|
|||
--for this script to work in Azure, use sqlcmd to connect to master database
|
||||
IF NOT EXISTS (SELECT name FROM sys.sql_logins WHERE name = 'test_password')
|
||||
BEGIN
|
||||
CREATE LOGIN test_password WITH PASSWORD='! ;4triou';
|
||||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT name FROM sys.sql_logins WHERE name = 'test_password2')
|
||||
BEGIN
|
||||
CREATE LOGIN test_password2 WITH PASSWORD='!} ;4triou';
|
||||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT name FROM sys.sql_logins WHERE name = 'test_password3')
|
||||
BEGIN
|
||||
CREATE LOGIN test_password3 WITH PASSWORD='! ;4triou}';
|
||||
END
|
||||
GO
|
|
@ -1,21 +0,0 @@
|
|||
--for this script to work in Azure, create_logins_azure.sql must have been invoked beforehand
|
||||
--assuming these logins exist, use sqlcmd to connect to a test database
|
||||
--these users will be granted access to that database
|
||||
IF NOT EXISTS (SELECT name FROM sysusers WHERE name = 'test_password')
|
||||
BEGIN
|
||||
CREATE USER test_password FROM LOGIN test_password;
|
||||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT name FROM sysusers WHERE name = 'test_password2')
|
||||
BEGIN
|
||||
CREATE USER test_password2 FROM LOGIN test_password2;
|
||||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT name FROM sysusers WHERE name = 'test_password3')
|
||||
BEGIN
|
||||
CREATE USER test_password3 FROM LOGIN test_password3;
|
||||
END
|
||||
GO
|
||||
|
|
@ -10,19 +10,6 @@ import argparse
|
|||
from subprocess import Popen, PIPE
|
||||
from exec_sql_scripts import *
|
||||
|
||||
def createLoginUsers(conn_options, dbname, azure):
|
||||
if (azure.lower() == 'yes'):
|
||||
# can only create logins in the master database
|
||||
createLoginUsersAzure('create_logins_azure.sql', conn_options, 'master')
|
||||
# create users to use those logins to access the test database (dbname)
|
||||
createLoginUsersAzure('create_users_azure.sql', conn_options, dbname)
|
||||
else:
|
||||
executeSQLscript('test_password.sql', conn_options, dbname)
|
||||
|
||||
def createLoginUsersAzure(sqlfile, conn_options, dbname):
|
||||
inst_command = 'sqlcmd ' + conn_options + ' -i ' + sqlfile + ' -d ' + dbname
|
||||
executeCommmand(inst_command)
|
||||
|
||||
def setupTestDatabase(conn_options, dbname, azure):
|
||||
sqlFiles = ['test_types.sql', '168256.sql', 'cd_info.sql', 'tracks.sql']
|
||||
|
||||
|
@ -78,8 +65,6 @@ if __name__ == '__main__':
|
|||
if (args.AZURE.lower() == 'no'):
|
||||
executeSQLscript('create_db.sql', conn_options, args.DBNAME)
|
||||
|
||||
# create login users
|
||||
createLoginUsers(conn_options, args.DBNAME, args.AZURE)
|
||||
# create tables in the new database
|
||||
setupTestDatabase(conn_options, args.DBNAME, args.AZURE)
|
||||
# populate these tables
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
--first, create new logins (user id / password pair) if not yet created
|
||||
USE master;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT name FROM master..syslogins WHERE name = 'test_password')
|
||||
BEGIN
|
||||
CREATE LOGIN test_password WITH PASSWORD='! ;4triou';
|
||||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT name FROM master..syslogins WHERE name = 'test_password2')
|
||||
BEGIN
|
||||
CREATE LOGIN test_password2 WITH PASSWORD='!} ;4triou';
|
||||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT name FROM master..syslogins WHERE name = 'test_password3')
|
||||
BEGIN
|
||||
CREATE LOGIN test_password3 WITH PASSWORD='! ;4triou}';
|
||||
END
|
||||
GO
|
||||
|
||||
--the following users will be granted access to the test database
|
||||
USE $(dbname);
|
||||
GO
|
||||
|
||||
CREATE USER test_password FROM LOGIN test_password;
|
||||
CREATE USER test_password2 FROM LOGIN test_password2;
|
||||
CREATE USER test_password3 FROM LOGIN test_password3;
|
||||
GO
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
--TEST--
|
||||
password with non alphanumeric characters
|
||||
--DESCRIPTION--
|
||||
The first three cases should have no problem connecting. Only the last case fails because the
|
||||
right curly brace should be escaped with another right brace.
|
||||
In Azure for this test to pass do not specify any particular database when connecting
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
|
||||
require 'MsSetup.inc';
|
||||
function toConnect($options = array())
|
||||
{
|
||||
global $server;
|
||||
|
||||
// this function makes a connection to the server WITHOUT specifying the database
|
||||
return sqlsrv_connect($server, $options);
|
||||
}
|
||||
|
||||
$conn = toConnect(array( "UID" => "test_password", "pwd" => "! ;4triou" ));
|
||||
if (!$conn)
|
||||
{
|
||||
$errors = sqlsrv_errors();
|
||||
echo( $errors[0]["message"]);
|
||||
}
|
||||
sqlsrv_close( $conn );
|
||||
|
||||
$conn = toConnect(array( "UID" => "test_password2", "pwd" => "!}} ;4triou" ));
|
||||
if (!$conn)
|
||||
{
|
||||
$errors = sqlsrv_errors();
|
||||
echo( $errors[0]["message"]);
|
||||
}
|
||||
sqlsrv_close( $conn );
|
||||
|
||||
$conn = toConnect(array( "UID" => "test_password3", "pwd" => "! ;4triou}}" ));
|
||||
if (!$conn)
|
||||
{
|
||||
$errors = sqlsrv_errors();
|
||||
echo( $errors[0]["message"]);
|
||||
}
|
||||
sqlsrv_close( $conn );
|
||||
|
||||
$conn = toConnect(array( "UID" => "test_password3", "pwd" => "! ;4triou}" ));
|
||||
if ($conn)
|
||||
{
|
||||
echo( "Shouldn't have connected" );
|
||||
}
|
||||
$errors = sqlsrv_errors();
|
||||
echo $errors[0]["message"];
|
||||
sqlsrv_close( $conn );
|
||||
|
||||
print "Test successful";
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
An unescaped right brace \(}\) was found in either the user name or password. All right braces must be escaped with another right brace \(}}\)\.
|
||||
Warning: sqlsrv_close\(\) expects parameter 1 to be resource, bool(ean){0,1} given in .+(\/|\\)test_non_alpha_password\.php on line 45
|
||||
Test successful
|
Loading…
Reference in a new issue