You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Jørgen Løland (JIRA)" <ji...@apache.org> on 2007/09/06 11:52:31 UTC

[jira] Created: (DERBY-3060) DRDA incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.

DRDA incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.
--------------------------------------------------------------------------------------------------------------

                 Key: DERBY-3060
                 URL: https://issues.apache.org/jira/browse/DERBY-3060
             Project: Derby
          Issue Type: Bug
          Components: Network Server
    Affects Versions: 10.3.1.4, 10.4.0.0
            Reporter: Jørgen Løland


DRDAConnThread#getConnFromDatabaseName incorrectly assumes that all SQLExceptions with error code 08004 thrown when trying to connect to a database are caused by an authentication failure.

DRDAConnThread lines 1295-1296:
------8<------ 
if (sqlState.regionMatches(0,SQLState.LOGIN_FAILED,0,5)) 
    return CodePoint.SECCHKCD_USERIDINVALID;
------>8------


I have added an exception to BasicDatabase#setupConnection with error code 08004.C.7. The exception is thrown if the connection is refused because the database has been booted in slave replication mode. This exception is, however, translated into an authentication exception by DRDAConnThread:


When the NetworkServer has already booted a database 'test' in slave replication mode, I get the following output from ij:

ij> connect 'jdbc:derby://localhost/test';
ERROR 08004: Connection authentication failure occurred.  Reason: userid or password invalid.

If I change the SQL code of the exception to XRE02.C and repeat, I get:

ij> connect 'jdbc:derby://localhost/test';
ERROR XRE02: DERBY SQL error: SQLCODE: -1, SQLSTATE: XRE02, SQLERRMC: Connect refused to database 'test' because it is in replication slave mode.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3060) DRDA incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12525385 ] 

Jørgen Løland commented on DERBY-3060:
--------------------------------------

The network server was started with -noSecurityManager

> DRDA incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3060
>                 URL: https://issues.apache.org/jira/browse/DERBY-3060
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Jørgen Løland
>
> DRDAConnThread#getConnFromDatabaseName incorrectly assumes that all SQLExceptions with error code 08004 thrown when trying to connect to a database are caused by an authentication failure.
> DRDAConnThread lines 1295-1296:
> ------8<------ 
> if (sqlState.regionMatches(0,SQLState.LOGIN_FAILED,0,5)) 
>     return CodePoint.SECCHKCD_USERIDINVALID;
> ------>8------
> I have added an exception to BasicDatabase#setupConnection with error code 08004.C.7. The exception is thrown if the connection is refused because the database has been booted in slave replication mode. This exception is, however, translated into an authentication exception by DRDAConnThread:
> When the NetworkServer has already booted a database 'test' in slave replication mode, I get the following output from ij:
> ij> connect 'jdbc:derby://localhost/test';
> ERROR 08004: Connection authentication failure occurred.  Reason: userid or password invalid.
> If I change the SQL code of the exception to XRE02.C and repeat, I get:
> ij> connect 'jdbc:derby://localhost/test';
> ERROR XRE02: DERBY SQL error: SQLCODE: -1, SQLSTATE: XRE02, SQLERRMC: Connect refused to database 'test' because it is in replication slave mode.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3060) Network Server incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel John Debrunner updated DERBY-3060:
-----------------------------------------

    Summary: Network Server incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.  (was: DRDA incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.)

I assume this is an issue with the Network Server and not the standard DRDA protocol

> Network Server incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3060
>                 URL: https://issues.apache.org/jira/browse/DERBY-3060
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>
> DRDAConnThread#getConnFromDatabaseName incorrectly assumes that all SQLExceptions with error code 08004 thrown when trying to connect to a database are caused by an authentication failure.
> DRDAConnThread lines 1295-1296:
> ------8<------ 
> if (sqlState.regionMatches(0,SQLState.LOGIN_FAILED,0,5)) 
>     return CodePoint.SECCHKCD_USERIDINVALID;
> ------>8------
> I have added an exception to BasicDatabase#setupConnection with error code 08004.C.7. The exception is thrown if the connection is refused because the database has been booted in slave replication mode. This exception is, however, translated into an authentication exception by DRDAConnThread:
> When the NetworkServer has already booted a database 'test' in slave replication mode, I get the following output from ij:
> ij> connect 'jdbc:derby://localhost/test';
> ERROR 08004: Connection authentication failure occurred.  Reason: userid or password invalid.
> If I change the SQL code of the exception to XRE02.C and repeat, I get:
> ij> connect 'jdbc:derby://localhost/test';
> ERROR XRE02: DERBY SQL error: SQLCODE: -1, SQLSTATE: XRE02, SQLERRMC: Connect refused to database 'test' because it is in replication slave mode.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3060) Network Server incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland updated DERBY-3060:
---------------------------------

    Attachment: derby-3060-1.stat
                derby-3060-1.diff

Attaching a patch, v1, that does the following:

M      java/drda/org/apache/derby/impl/drda/DRDAConnThread.java

Added a method, isAuthenticationException, that checks if the EmbedSQLException.getMessageId field is equal to the authentication error code in SQLState.java. getMessageId returns the whole 9-character error code (e.g. 08004.C.1) instead of only the first five chars returned by getSqlState, allowing us to check if the exception is, in fact, authentication related. 

If the exception turns out to not be an EmbedSQLException, the pre-patch strategy of assuming the cause is an authentication failure is used.

The described method is used in two cases that previously only checked if the SQL state was 08004 and concluded on an authentication failure.

M      java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
M      java/engine/org/apache/derby/jdbc/InternalDriver.java

Changed two uses of SQLState.LOGIN_FAILED where the causes of the exceptions were failed authentication. Changed these to use the more explicit SQLState for authentication error: NET_CONNECT_AUTH_FAILED 


I have started the tests and will revert back with results once these have completed. I attached the patch now in case someone wants to comment on the solution.

> Network Server incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3060
>                 URL: https://issues.apache.org/jira/browse/DERBY-3060
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-3060-1.diff, derby-3060-1.stat
>
>
> DRDAConnThread#getConnFromDatabaseName incorrectly assumes that all SQLExceptions with error code 08004 thrown when trying to connect to a database are caused by an authentication failure.
> DRDAConnThread lines 1295-1296:
> ------8<------ 
> if (sqlState.regionMatches(0,SQLState.LOGIN_FAILED,0,5)) 
>     return CodePoint.SECCHKCD_USERIDINVALID;
> ------>8------
> I have added an exception to BasicDatabase#setupConnection with error code 08004.C.7. The exception is thrown if the connection is refused because the database has been booted in slave replication mode. This exception is, however, translated into an authentication exception by DRDAConnThread:
> When the NetworkServer has already booted a database 'test' in slave replication mode, I get the following output from ij:
> ij> connect 'jdbc:derby://localhost/test';
> ERROR 08004: Connection authentication failure occurred.  Reason: userid or password invalid.
> If I change the SQL code of the exception to XRE02.C and repeat, I get:
> ij> connect 'jdbc:derby://localhost/test';
> ERROR XRE02: DERBY SQL error: SQLCODE: -1, SQLSTATE: XRE02, SQLERRMC: Connect refused to database 'test' because it is in replication slave mode.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3060) Network Server incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12526394 ] 

Øystein Grøvlen commented on DERBY-3060:
----------------------------------------

Jørgen, thank you for the patch.  It looks very good, and is very well commented.  I am running tests, and will commit the patch if nothing new shows up.  While at it, I will take the liberty to fix a mistaken bit-wise or in getRdbAccessErrorCodePoint, and also add some curly braces to make it more readable.  (None of this was introduced by this patch.)

> Network Server incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3060
>                 URL: https://issues.apache.org/jira/browse/DERBY-3060
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-3060-1.diff, derby-3060-1.stat
>
>
> DRDAConnThread#getConnFromDatabaseName incorrectly assumes that all SQLExceptions with error code 08004 thrown when trying to connect to a database are caused by an authentication failure.
> DRDAConnThread lines 1295-1296:
> ------8<------ 
> if (sqlState.regionMatches(0,SQLState.LOGIN_FAILED,0,5)) 
>     return CodePoint.SECCHKCD_USERIDINVALID;
> ------>8------
> I have added an exception to BasicDatabase#setupConnection with error code 08004.C.7. The exception is thrown if the connection is refused because the database has been booted in slave replication mode. This exception is, however, translated into an authentication exception by DRDAConnThread:
> When the NetworkServer has already booted a database 'test' in slave replication mode, I get the following output from ij:
> ij> connect 'jdbc:derby://localhost/test';
> ERROR 08004: Connection authentication failure occurred.  Reason: userid or password invalid.
> If I change the SQL code of the exception to XRE02.C and repeat, I get:
> ij> connect 'jdbc:derby://localhost/test';
> ERROR XRE02: DERBY SQL error: SQLCODE: -1, SQLSTATE: XRE02, SQLERRMC: Connect refused to database 'test' because it is in replication slave mode.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DERBY-3060) Network Server incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.

Posted by "Øystein Grøvlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Øystein Grøvlen resolved DERBY-3060.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 10.4.0.0
       Derby Info:   (was: [Patch Available])

Patch derby-3060-1.diff committed in version 574870.

> Network Server incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3060
>                 URL: https://issues.apache.org/jira/browse/DERBY-3060
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>             Fix For: 10.4.0.0
>
>         Attachments: derby-3060-1.diff, derby-3060-1.stat
>
>
> DRDAConnThread#getConnFromDatabaseName incorrectly assumes that all SQLExceptions with error code 08004 thrown when trying to connect to a database are caused by an authentication failure.
> DRDAConnThread lines 1295-1296:
> ------8<------ 
> if (sqlState.regionMatches(0,SQLState.LOGIN_FAILED,0,5)) 
>     return CodePoint.SECCHKCD_USERIDINVALID;
> ------>8------
> I have added an exception to BasicDatabase#setupConnection with error code 08004.C.7. The exception is thrown if the connection is refused because the database has been booted in slave replication mode. This exception is, however, translated into an authentication exception by DRDAConnThread:
> When the NetworkServer has already booted a database 'test' in slave replication mode, I get the following output from ij:
> ij> connect 'jdbc:derby://localhost/test';
> ERROR 08004: Connection authentication failure occurred.  Reason: userid or password invalid.
> If I change the SQL code of the exception to XRE02.C and repeat, I get:
> ij> connect 'jdbc:derby://localhost/test';
> ERROR XRE02: DERBY SQL error: SQLCODE: -1, SQLSTATE: XRE02, SQLERRMC: Connect refused to database 'test' because it is in replication slave mode.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DERBY-3060) Network Server incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland closed DERBY-3060.
--------------------------------


> Network Server incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3060
>                 URL: https://issues.apache.org/jira/browse/DERBY-3060
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>             Fix For: 10.4.0.0
>
>         Attachments: derby-3060-1.diff, derby-3060-1.stat
>
>
> DRDAConnThread#getConnFromDatabaseName incorrectly assumes that all SQLExceptions with error code 08004 thrown when trying to connect to a database are caused by an authentication failure.
> DRDAConnThread lines 1295-1296:
> ------8<------ 
> if (sqlState.regionMatches(0,SQLState.LOGIN_FAILED,0,5)) 
>     return CodePoint.SECCHKCD_USERIDINVALID;
> ------>8------
> I have added an exception to BasicDatabase#setupConnection with error code 08004.C.7. The exception is thrown if the connection is refused because the database has been booted in slave replication mode. This exception is, however, translated into an authentication exception by DRDAConnThread:
> When the NetworkServer has already booted a database 'test' in slave replication mode, I get the following output from ij:
> ij> connect 'jdbc:derby://localhost/test';
> ERROR 08004: Connection authentication failure occurred.  Reason: userid or password invalid.
> If I change the SQL code of the exception to XRE02.C and repeat, I get:
> ij> connect 'jdbc:derby://localhost/test';
> ERROR XRE02: DERBY SQL error: SQLCODE: -1, SQLSTATE: XRE02, SQLERRMC: Connect refused to database 'test' because it is in replication slave mode.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3060) Network Server incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland updated DERBY-3060:
---------------------------------

    Derby Info: [Patch Available]

derbyall and allsuites completed without error

> Network Server incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3060
>                 URL: https://issues.apache.org/jira/browse/DERBY-3060
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-3060-1.diff, derby-3060-1.stat
>
>
> DRDAConnThread#getConnFromDatabaseName incorrectly assumes that all SQLExceptions with error code 08004 thrown when trying to connect to a database are caused by an authentication failure.
> DRDAConnThread lines 1295-1296:
> ------8<------ 
> if (sqlState.regionMatches(0,SQLState.LOGIN_FAILED,0,5)) 
>     return CodePoint.SECCHKCD_USERIDINVALID;
> ------>8------
> I have added an exception to BasicDatabase#setupConnection with error code 08004.C.7. The exception is thrown if the connection is refused because the database has been booted in slave replication mode. This exception is, however, translated into an authentication exception by DRDAConnThread:
> When the NetworkServer has already booted a database 'test' in slave replication mode, I get the following output from ij:
> ij> connect 'jdbc:derby://localhost/test';
> ERROR 08004: Connection authentication failure occurred.  Reason: userid or password invalid.
> If I change the SQL code of the exception to XRE02.C and repeat, I get:
> ij> connect 'jdbc:derby://localhost/test';
> ERROR XRE02: DERBY SQL error: SQLCODE: -1, SQLSTATE: XRE02, SQLERRMC: Connect refused to database 'test' because it is in replication slave mode.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DERBY-3060) DRDA incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.

Posted by "Jørgen Løland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jørgen Løland reassigned DERBY-3060:
------------------------------------

    Assignee: Jørgen Løland

> DRDA incorrectly assumes that all SQLExceptions with error code 08004 are caused by an authentication failure.
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3060
>                 URL: https://issues.apache.org/jira/browse/DERBY-3060
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>
> DRDAConnThread#getConnFromDatabaseName incorrectly assumes that all SQLExceptions with error code 08004 thrown when trying to connect to a database are caused by an authentication failure.
> DRDAConnThread lines 1295-1296:
> ------8<------ 
> if (sqlState.regionMatches(0,SQLState.LOGIN_FAILED,0,5)) 
>     return CodePoint.SECCHKCD_USERIDINVALID;
> ------>8------
> I have added an exception to BasicDatabase#setupConnection with error code 08004.C.7. The exception is thrown if the connection is refused because the database has been booted in slave replication mode. This exception is, however, translated into an authentication exception by DRDAConnThread:
> When the NetworkServer has already booted a database 'test' in slave replication mode, I get the following output from ij:
> ij> connect 'jdbc:derby://localhost/test';
> ERROR 08004: Connection authentication failure occurred.  Reason: userid or password invalid.
> If I change the SQL code of the exception to XRE02.C and repeat, I get:
> ij> connect 'jdbc:derby://localhost/test';
> ERROR XRE02: DERBY SQL error: SQLCODE: -1, SQLSTATE: XRE02, SQLERRMC: Connect refused to database 'test' because it is in replication slave mode.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.