# rhbz#1313816: should abort, not crash, due to missing nss
west #
 ../../guestbin/swan-prep # no NSS DB init!
west #
 mkdir /tmp/rhbz1313816
west #
 ipsec pluto --rundir /tmp/rhbz1313816 --nofork --stderrlog --log-no-time
Starting Pluto (Libreswan Version ...) pid:PID
operating system: ...
core dump dir: /run/pluto
secrets file: /etc/ipsec.secrets
Initializing NSS using read-only database "sql:/var/lib/ipsec/nss"
FATAL ERROR: NSS: initialization using read-only database "sql:/var/lib/ipsec/nss" failed: SEC_ERROR_BAD_DATABASE: security library: bad database.
west #
 # rhbz#1041576 start pluto in dir not owned by root; should not fail
west #
 # with "pluto: unable to create lock dir:" not using /tmp or /var/tmp/
west #
 # due to specialness of parent dir in test
west #
 /testing/guestbin/swan-prep --nokeys
Creating empty NSS database
west #
 rm -rf /var/cache/otheruser
west #
 mkdir -p /var/cache/otheruser/var/run/pluto /var/cache/otheruser/etc
west #
 mv /etc/ipsec.conf /var/cache/otheruser/etc/
west #
 chown -R bin:bin /var/cache/otheruser/var/run/pluto /var/cache/otheruser/etc
west #
 chmod -R 755 /var/cache/otheruser
west #
 ipsec pluto --rundir /var/cache/otheruser/var/run/pluto --secretsfile /var/cache/otheruser/etc/ipsec.secrets
west #
 # give pluto time to start and create its socket and pid files
west #
 sleep 3
west #
 # show it is running
west #
 ipsec whack --rundir /var/cache/otheruser/var/run/pluto --briefstatus
State Information: DDoS cookies not required, Accepting new IKE connections
IKE SAs: total(0), half-open(0), open(0), authenticated(0), anonymous(0)
IPsec SAs: total(0), authenticated(0), anonymous(0)
west #
 # shut it down
west #
 ipsec whack --rundir /var/cache/otheruser/var/run/pluto  --shutdown
Pluto is shutting down
west #
 echo "initdone"
initdone
west #
