You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by km...@apache.org on 2009/01/26 18:29:42 UTC
svn commit: r737760 - in /db/derby/code/branches/10.4/java:
drda/org/apache/derby/impl/drda/
testing/org/apache/derbyTesting/functionTests/master/
testing/org/apache/derbyTesting/functionTests/master/ibm14/
testing/org/apache/derbyTesting/functionTests...
Author: kmarsden
Date: Mon Jan 26 17:29:40 2009
New Revision: 737760
URL: http://svn.apache.org/viewvc?rev=737760&view=rev
Log:
DERBY-4004 Remove required RDBNAM from ACCSEC. Use SECCHK RDBNAM if none is provided on ACCSEC
Backporting to 10.4 to avoid change in error message when connecting 10.5 client to 10.4 server with multibyte database name.
Added:
db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_accsecrd_nordb.inc
- copied unchanged from r734190, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_accsecrd_nordb.inc
db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_secchk_nordbonaccsec.inc
- copied unchanged from r734190, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_secchk_nordbonaccsec.inc
Modified:
db/derby/code/branches/10.4/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
db/derby/code/branches/10.4/java/drda/org/apache/derby/impl/drda/Database.java
db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/master/ibm14/testProtocol.out
db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/master/testProtocol.out
db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/protocol.tests
db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProtocol_app.properties
Modified: db/derby/code/branches/10.4/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java?rev=737760&r1=737759&r2=737760&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java (original)
+++ db/derby/code/branches/10.4/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java Mon Jan 26 17:29:40 2009
@@ -1912,7 +1912,7 @@
String dbname = parseRDBNAM();
Database d = session.getDatabase(dbname);
if (d == null)
- addDatabase(dbname);
+ initializeDatabase(dbname);
else
{
// reset database for connection re-use
@@ -1942,13 +1942,8 @@
missingCodePoint(CodePoint.SECMEC);
- // RESOLVE - when we look further into security we might want to
- // handle this part of the protocol at the session level without
- // requiring a database for when authentication is used but there
- // is no database level security
if (database == null)
- missingCodePoint(CodePoint.RDBNAM);
-
+ initializeDatabase(null);
database.securityMechanism = securityMechanism;
database.secTokenIn = secTokenIn;
@@ -3115,7 +3110,13 @@
String dbname = parseRDBNAM();
if (database != null)
{
- if (!database.dbName.equals(dbname))
+ if (database.dbName == null) {
+ // we didn't get the RDBNAM on ACCSEC. Set it here
+ database.setDatabaseName(dbname);
+ session.addDatabase(database);
+ session.database = database;
+ }
+ else if (!database.dbName.equals(dbname))
rdbnamMismatch(CodePoint.SECCHK);
}
else
@@ -3123,7 +3124,7 @@
// we should already have added the database in ACCSEC
// added code here in case we make the SECMEC session rather
// than database wide
- addDatabase(dbname);
+ initializeDatabase(dbname);
}
break;
default:
@@ -3136,6 +3137,10 @@
if (securityMechanism == 0)
missingCodePoint(CodePoint.SECMEC);
+ // Check that we have a database name.
+ if (database == null || database.dbName == null)
+ missingCodePoint(CodePoint.RDBNAM);
+
//check if we have a userid and password when we need it
if (securityCheckCode == 0 &&
(database.securityMechanism == CodePoint.SECMEC_USRIDPWD||
@@ -3329,7 +3334,7 @@
//first time we have seen a database name
Database d = session.getDatabase(dbname);
if (d == null)
- addDatabase(dbname);
+ initializeDatabase(dbname);
else
{
database = d;
@@ -8135,10 +8140,14 @@
return false; //to shut the compiler up
}
/**
- * Add a database to the current session
+ * Create a new database and intialize the
+ * DRDAConnThread database.
+ *
+ * @param dbname database name to initialize. If
+ * dbnam is non null, add database to the current session
*
*/
- private void addDatabase(String dbname)
+ private void initializeDatabase(String dbname)
{
Database db;
if (appRequester.isXARequester())
@@ -8147,8 +8156,10 @@
}
else
db = new Database(dbname);
- session.addDatabase(db);
- session.database = db;
+ if (dbname != null) {
+ session.addDatabase(db);
+ session.database = db;
+ }
database = db;
}
/**
Modified: db/derby/code/branches/10.4/java/drda/org/apache/derby/impl/drda/Database.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/drda/org/apache/derby/impl/drda/Database.java?rev=737760&r1=737759&r2=737760&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/drda/org/apache/derby/impl/drda/Database.java (original)
+++ db/derby/code/branches/10.4/java/drda/org/apache/derby/impl/drda/Database.java Mon Jan 26 17:29:40 2009
@@ -90,6 +90,18 @@
*/
Database (String dbName)
{
+ setDatabaseName(dbName);
+ this.stmtTable = new Hashtable();
+ initializeDefaultStatement();
+ }
+
+ /**
+ * Take database name including attributes and set
+ * attrString and shortDbName accordingly.
+ *
+ * @param dbName database name, including attributes.
+ */
+ public void setDatabaseName(String dbName) {
if (dbName != null)
{
int attrOffset = dbName.indexOf(';');
@@ -103,11 +115,9 @@
}
this.dbName = dbName;
- this.stmtTable = new Hashtable();
- initializeDefaultStatement();
- }
-
+ }
+
private void initializeDefaultStatement()
{
this.defaultStatement = new DRDAStatement(this);
Modified: db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/master/ibm14/testProtocol.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/master/ibm14/testProtocol.out?rev=737760&r1=737759&r2=737760&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/master/ibm14/testProtocol.out (original)
+++ db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/master/ibm14/testProtocol.out Mon Jan 26 17:29:40 2009
@@ -31,8 +31,6 @@
PASSED
Test non null SECMGRNM
PASSED
-Test missing RDBNAM on ACCSEC
-PASSED
Test specifying encrypted security mechanism without a security token
SECMEC=9 SECCHKCD=14
PASSED
@@ -63,6 +61,10 @@
PASSED
Test missing CRRTKN
PASSED
+Test no RDBNAM on ACCSEC. Sent with SECCHK
+PASSED
+Test missing RDBNAM on SECCHK
+PASSED
Test too small value for RDBACCCL
PASSED
Test too large value for RDBACCCL
Modified: db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/master/testProtocol.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/master/testProtocol.out?rev=737760&r1=737759&r2=737760&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/master/testProtocol.out (original)
+++ db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/master/testProtocol.out Mon Jan 26 17:29:40 2009
@@ -31,8 +31,6 @@
PASSED
Test non null SECMGRNM
PASSED
-Test missing RDBNAM on ACCSEC
-PASSED
Test specifying encrypted security mechanism without a security token
SECMEC=3 SECMEC=4 SECMEC=8 SECCHKCD=1
PASSED
@@ -63,6 +61,10 @@
PASSED
Test missing CRRTKN
PASSED
+Test no RDBNAM on ACCSEC. Sent with SECCHK
+PASSED
+Test missing RDBNAM on SECCHK
+PASSED
Test too small value for RDBACCCL
PASSED
Test too large value for RDBACCCL
Modified: db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/protocol.tests
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/protocol.tests?rev=737760&r1=737759&r2=737760&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/protocol.tests (original)
+++ db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/protocol.tests Mon Jan 26 17:29:40 2009
@@ -194,22 +194,6 @@
checkError SYNTAXRM 8 11 SECMGRNM
endTest
//
-DISPLAY "Test missing RDBNAM on ACCSEC"
-createDssRequest
-startDdm EXCSAT
-writeScalarString EXTNAM "test"
-endDdm
-endDss
-createDssRequest
-startDdm ACCSEC
-writeScalar2Bytes SECMEC 9 // Encrypted userid password
-endDdm
-endDss
-flush
-skipDss // don't care about the EXCSATRM so just skip
-checkerror SYNTAXRM 8 14 RDBNAM
-endTest
-//
DISPLAY "Test specifying encrypted security mechanism without a security token"
createDssRequest
startDdm EXCSAT
@@ -441,6 +425,36 @@
checkError SYNTAXRM 8 14 CRRTKN
endTest
//
+DISPLAY "Test no RDBNAM on ACCSEC. Sent with SECCHK"
+include "excsat_secchk_nordbonaccsec.inc"
+createDssRequest
+startDdm ACCRDB
+writeScalar2Bytes RDBACCCL SQLAM
+writeScalarBytes CRRTKN "0xd5c6f0f0f0f0f0f14bc7c3c2f600ec774aa60e"
+writeScalarString PRDID "TST01000"
+writeScalarString TYPDEFNAM QTDSQLJVM
+startDdm TYPDEFOVR
+writeScalar2Bytes CCSIDSBC 1208
+endDdm
+endDdm
+endDss
+flush
+skipDdm // don't care about SECCHKRM so just skip
+skipDss // don't care about ACCRDBRM
+endTest
+DISPLAY "Test missing RDBNAM on SECCHK"
+include "excsat_accsecrd_nordb.inc"
+createDssRequest
+startDdm SECCHK
+writeScalar2Bytes SECMEC 3 // userid password
+writeScalarString USRID test
+writeScalarString PASSWORD test
+endDdm
+endDss
+flush
+checkError SYNTAXRM 8 14 RDBNAM
+endTest
+//
DISPLAY "Test too small value for RDBACCCL"
include "excsat_secchk.inc"
createDssRequest
Modified: db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProtocol_app.properties
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProtocol_app.properties?rev=737760&r1=737759&r2=737760&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProtocol_app.properties (original)
+++ db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProtocol_app.properties Mon Jan 26 17:29:40 2009
@@ -35,5 +35,5 @@
database=jdbc:derby:wombat;create=true
derby.optimizer.noTimeout=true
-supportfiles=tests/derbynet/protocol.tests,tests/derbynet/excsat_accsecrd1.inc,tests/derbynet/excsat_accsecrd2.inc,tests/derbynet/excsat_secchk.inc,tests/derbynet/connect.inc,tests/derbynet/values1.inc,tests/derbynet/values64kblksz.inc
+supportfiles=tests/derbynet/protocol.tests,tests/derbynet/excsat_accsecrd1.inc,tests/derbynet/excsat_accsecrd2.inc,tests/derbynet/excsat_accsecrd_nordb.inc,tests/derbynet/excsat_secchk.inc,tests/derbynet/excsat_secchk_nordbonaccsec.inc,tests/derbynet/connect.inc,tests/derbynet/values1.inc,tests/derbynet/values64kblksz.inc