db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r734190 - in /db/derby/code/trunk/java: drda/org/apache/derby/impl/drda/ testing/org/apache/derby/impl/drda/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/master/ibm14/ testing/org/apach...
Date Tue, 13 Jan 2009 17:22:35 GMT
Author: kmarsden
Date: Tue Jan 13 09:21:57 2009
New Revision: 734190

URL: http://svn.apache.org/viewvc?rev=734190&view=rev
Log:
DERBY-4004  Remove required RDBNAM from ACCSEC. Use SECCHK RDBNAM if none is provided on ACCSEC


Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_accsecrd_nordb.inc
  (with props)
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_secchk_nordbonaccsec.inc
  (with props)
Modified:
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/Database.java
    db/derby/code/trunk/java/testing/org/apache/derby/impl/drda/ProtocolTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ibm14/testProtocol.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/testProtocol.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/protocol.tests
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProtocol_app.properties

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java?rev=734190&r1=734189&r2=734190&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java Tue Jan 13
09:21:57 2009
@@ -1910,7 +1910,7 @@
 					String dbname = parseRDBNAM();
 					Database d = session.getDatabase(dbname);
 					if (d == null)
-						addDatabase(dbname);
+						initializeDatabase(dbname);
 					else
                     {
                         // reset database for connection re-use 
@@ -1940,13 +1940,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;
 
@@ -3113,7 +3108,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
@@ -3121,7 +3122,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:
@@ -3134,6 +3135,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||
@@ -3327,7 +3332,7 @@
 						//first time we have seen a database name
 						Database d = session.getDatabase(dbname);
 						if (d == null)
-							addDatabase(dbname);
+							initializeDatabase(dbname);
 						else
 						{
 							database = d;
@@ -8148,10 +8153,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())
@@ -8160,8 +8169,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/trunk/java/drda/org/apache/derby/impl/drda/Database.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/Database.java?rev=734190&r1=734189&r2=734190&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/Database.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/Database.java Tue Jan 13 09:21:57
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/trunk/java/testing/org/apache/derby/impl/drda/ProtocolTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derby/impl/drda/ProtocolTest.java?rev=734190&r1=734189&r2=734190&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derby/impl/drda/ProtocolTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derby/impl/drda/ProtocolTest.java Tue Jan
13 09:21:57 2009
@@ -902,6 +902,8 @@
                         resourcePath + "/connect.inc",
                         resourcePath + "/excsat_accsecrd1.inc",
                         resourcePath + "/excsat_accsecrd2.inc",
+                        resourcePath + "/excsat_accsecrd_nordb.inc",
+                        resourcePath + "/excsat_secchk_nordbonaccsec.inc",
                         resourcePath + "/excsat_secchk.inc",
                         resourcePath + "/values1.inc",
                         resourcePath + "/values64kblksz.inc",

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ibm14/testProtocol.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ibm14/testProtocol.out?rev=734190&r1=734189&r2=734190&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ibm14/testProtocol.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ibm14/testProtocol.out
Tue Jan 13 09:21:57 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/trunk/java/testing/org/apache/derbyTesting/functionTests/master/testProtocol.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/testProtocol.out?rev=734190&r1=734189&r2=734190&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/testProtocol.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/testProtocol.out
Tue Jan 13 09:21:57 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

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_accsecrd_nordb.inc
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_accsecrd_nordb.inc?rev=734190&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_accsecrd_nordb.inc
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_accsecrd_nordb.inc
Tue Jan 13 09:21:57 2009
@@ -0,0 +1,13 @@
+createDssRequest
+startDdm EXCSAT
+writeScalarString EXTNAM "test"
+endDdm
+endDss
+createDssRequest
+startDdm ACCSEC
+writeScalar2Bytes SECMEC 3 // userid password
+endDdm
+endDss
+flush
+skipDss		// don't care about the EXCSATRM so just skip
+skipDss		// don't care about the ACCSECRD so just skip

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_accsecrd_nordb.inc
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_secchk_nordbonaccsec.inc
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_secchk_nordbonaccsec.inc?rev=734190&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_secchk_nordbonaccsec.inc
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_secchk_nordbonaccsec.inc
Tue Jan 13 09:21:57 2009
@@ -0,0 +1,23 @@
+
+createDssRequest
+startDdm EXCSAT
+writeScalarString EXTNAM "test"
+endDdm
+endDss
+flush
+createDssRequest
+startDdm ACCSEC
+writeScalar2Bytes SECMEC 3 //  userid password
+endDdm
+endDss
+flush
+skipDss		// don't care about the EXCSATRM so just skip
+skipDss		// don't care about the ACCSECRD so just skip
+createDssRequest
+startDdm  SECCHK
+writeScalar2Bytes SECMEC 3 // userid password
+writeScalarString RDBNAM "wombat;create=true            " 
+writeScalarString USRID test
+writeScalarString PASSWORD test
+endDdm
+endDss

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/excsat_secchk_nordbonaccsec.inc
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/protocol.tests
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/protocol.tests?rev=734190&r1=734189&r2=734190&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/protocol.tests
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/protocol.tests
Tue Jan 13 09:21:57 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/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProtocol_app.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProtocol_app.properties?rev=734190&r1=734189&r2=734190&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProtocol_app.properties
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProtocol_app.properties
Tue Jan 13 09:21:57 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
 



Mime
View raw message