exist icon indicating copy to clipboard operation
exist copied to clipboard

sm:passwd#2 during autodeploy

Open mathias-goebel opened this issue 7 years ago • 7 comments

What is the problem

When deploying an app during autodeploy (first start of the db with *.xar at ./autodeploy) the usage of sm:passwd#2 in pre-install.xql or post-install.xql throws an error and stops execution of the script.

What did you expect

The usage of sm:passwd#2 should work as expected during autodeploy.

Describe how to reproduce or add a test

git clone [email protected]:eXist-db/exist.git /tmp/eXist-test
cd /tmp/eXist-test
git checkout eXist-3.5.0
# but it fails on recent as well, i guess
./build.sh
unzip autodeploy/dashboard-0.4.7.xar pre-install.xql
# will cancel the pre-install script and stop the deployment
echo ', sm:passwd("admin", "somepass")' >> pre-install.xql
zip autodeploy/dashboard-0.4.7.xar pre-install.xql
# just a little clean up here:
rm pre-install.xql
./bin/startup.sh

If you like to try it on a post-install script (the app will be deployed) you can modify the monex application like this:

# wipe the data at first
rm -rf webapp/WEB-INF/{data/*,logs/*.log}
unzip autodeploy/monex-0.9.10.xar post-install.xql
# insert on line 10, everything below will not be executed
sed -i '10i\let $test := sm:passwd("admin", "somepass")' post-install.xql
zip autodeploy/monex-0.9.10.xar post-install.xql
rm post-install.xql
./bin/startup.sh

So the trick is to set sm:passwd#2 as last function call in post-install.xql, so the app will be deployed, the password will be set, but the error is still reported in the logfile expath-repo.log:

	at org.exist.security.internal.SecurityManagerImpl.updateAccount(SecurityManagerImpl.java:239) ~[exist.jar:3.5.0]

Context information

  • eXist-db 3.5.0, but also the latest
  • openjdk version "1.8.0_144"
  • Ubuntu 17.10
  • 64 bit

mathias-goebel avatar Nov 07 '17 21:11 mathias-goebel