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 "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2014/01/21 17:09:21 UTC

[jira] [Updated] (DERBY-6457) NetworkServerControl API breaks when username or password contains non-ascii characters

     [ https://issues.apache.org/jira/browse/DERBY-6457?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-6457:
--------------------------------------

    Attachment: d6457-1a.diff

The attached patch fixes this bug and adds a regression test case to verify the fix. It makes the following changes:

*java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java:*

Make writeLDString() write the length in number of bytes instead of number of characters.

*java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetworkServerControlApiTest.java:*

Add a test case that shuts down the server using credentials that have non-ascii characters in them. The test case hangs indefinitely when run without the fix.

*java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java:*

Reorder how tearDown() restores the old state. Move the engine shutdown so that it's done before the system properties are reset. Since static properties are not re-read until the next time the engine is booted, it makes no difference for subsequent tests whether the properties were actually reset before or after the engine shutdown, as long as they are reset before the next test case boots the engine.

The current ordering caused problems because the new test case used a SystemPropertyTestSetup for enabling system-wide BUILTIN authentication. If the system properties are cleared before the engine shutdown in this configuration, there will be no user that's authenticated to do the engine shutdown because all the derby.user.* properties are gone. This made SystemPropertyTestSetup.tearDown() fail with an "invalid authentication" error.

All the regression tests ran cleanly with the patch.

> NetworkServerControl API breaks when username or password contains non-ascii characters
> ---------------------------------------------------------------------------------------
>
>                 Key: DERBY-6457
>                 URL: https://issues.apache.org/jira/browse/DERBY-6457
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server
>    Affects Versions: 10.10.1.1
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: d6457-1a.diff
>
>
> If you pass a non-ascii username/password combination to a NetworkServerControl API command, such as
>   java -jar derbynet.jar shutdown -user Bjørn -password Dæhlie
> it will hang forever.
> The reason is that NetworkServerControlImpl.writeLDString() writes the length of the string in characters, whereas NetworkServerControlImpl.readLDString() expects the length to be in number of bytes.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)