eXist-db / exist

eXist Native XML Database and Application Platform
https://exist-db.org
GNU Lesser General Public License v2.1
427 stars 179 forks source link

Regression in ant adduser task; creating users break the admin client #180

Open public-user opened 10 years ago

public-user commented 10 years ago

Invoking the following ant task against a clean eXist 2.1 server, as well as the 2.2RC1:

<exist:adduser name="myuser" secret="mypassword" primaryGroup="dba"
            failonerror="false" uri="${exist.url}/xmlrpc/db" user="admin" password=""/>

Seems to create the user successfully, but when running the admin client I receive the following error:

$ bin/client.sh -ouri=xmldb:exist://localhost:8080/xmlrpc -u admin -P password -s
...
XMLDBException while retrieving collection contents: Failed to invoke method getSubCollectionPermissions in class org.exist.xmlrpc.
org.apache.xmlrpc.XmlRpcException: Failed to invoke method getSubCollectionPermissions in class org.exist.xmlrpc.RpcConnection: nul
    at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:197)
    at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:156)
    at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143)
    at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)
    at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)
    at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)
    at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:158)
    at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:147)
    at org.exist.xmldb.RemoteCollection.getSubCollectionPermissions(RemoteCollection.java:342)
    at org.exist.xmldb.RemoteUserManagementService.getSubCollectionPermissions(RemoteUserManagementService.java:402)
    at org.exist.client.InteractiveClient.getResources(InteractiveClient.java:406)

Incidentally, since upgrading from eXist 2.0 I also see a change in behaviour when changing the password from the ant tasks, the target reports an error in making the change but the password change goes through.

dizzzz commented 10 years ago

Are you sure you use the 2.0 jars files to connect with a 2.0 server, and 2.1 jars with the 2.1 server?

public-user commented 10 years ago

Good clarification. Thank you for responding so promptly. I am using the correct jars.

I created a test case to confirm the issue and not an environment config error on my part. Save this very basic ant file https://gist.github.com/public-user/9844327 to your exist directory (note you may need to change the port, I'm using 8080).

Then from the directory that I've checked out exist (I tested both 2.1 and 2.2rc1), I run the following:

# clean out data from previous tests
rm -rf webapp/WEB-INF/data/* 
# Start the server, and put it to the background
bin/server.sh &
# Connect to the admin client without a password, this works with no errors
bin/client.sh -s -ouri=xmldb:exist://localhost:8080/xmlrpc -u admin
# Call ant to create/update users
# Here's the pertinent bits of the ant transcript:
#    [exist:adduser] Database driver registered.
#    [exist:adduser] Adding user new-user
#    [exist:password] Looking up user admin
#    [exist:password] Setting password for user admin
#    [exist:password] XMLDB exception caught: Failed to invoke method updateAccount in class org.exist.xmlrpc.RpcConnection:

ant -f test-ant.xml -lib tools/ant/lib 
# Use the admin client, note the admin password is now set
# The admin client checks the password then fails with the
# XMLDBException that I originally reported.
bin/client.sh -s -ouri=xmldb:exist://localhost:8080/xmlrpc -u admin -P 'admin'