diff --git a/.github/workflows/dbus.xml b/.github/workflows/dbus.xml new file mode 100644 index 0000000..9b25cd7 --- /dev/null +++ b/.github/workflows/dbus.xml @@ -0,0 +1,31 @@ + + + + + session + + + + + + + + + /lib/dbus-1/dbus-daemon-launch-helper + + + /var/run/dbus/pid + + + + + + EXTERNAL + + + unix:path=/tmp/test_system_bus_socket + diff --git a/.setupkeystore.sh b/.setupkeystore.sh index 35ec5ba..ef925e3 100755 --- a/.setupkeystore.sh +++ b/.setupkeystore.sh @@ -3,8 +3,8 @@ keyring="$1" set -x -if [ "$(expr substr $(uname -s) 1 5)" == "Linux" ] && [ "$keyring" == "gnome" ]; then - export $(dbus-launch) +if [ "$(expr substr $(uname -s) 1 5)" == "Linux" ] && [ "$keyring" == "gnome" ]; then + export $(dbus-launch --config-file=${$GITHUB_WORKSPACE}/.github/workflow/dbus.xml) eval "$(echo '\n' | gnome-keyring-daemon --unlock)" echo xxx@gmail.com | secret-tool store --label="main" email address PASS=$(secret-tool lookup email address) @@ -25,7 +25,7 @@ if [ "$(expr substr $(uname -s) 1 5)" == "Linux" ] && [ "$keyring" == "kde" ]; t cp $GITHUB_WORKSPACE/.setupkeystore/* ~/.local/share/kwalletd chmod 600 ~/.local/share/kwalletd/* dbus-uuidgen --ensure - export $(dbus-launch) + export $(dbus-launch --config-file=${$GITHUB_WORKSPACE}/.github/workflow/dbus.xml) password=$(kwalletcli -f . -e address) echo Checking the secret can be retrieved. if [ "$password" != "xxx@gmail.com" ]; then diff --git a/java-keyring/src/main/java/com/github/javakeyring/internal/kde/KWalletBackend.java b/java-keyring/src/main/java/com/github/javakeyring/internal/kde/KWalletBackend.java index c0ec770..31236a2 100644 --- a/java-keyring/src/main/java/com/github/javakeyring/internal/kde/KWalletBackend.java +++ b/java-keyring/src/main/java/com/github/javakeyring/internal/kde/KWalletBackend.java @@ -32,6 +32,7 @@ import org.freedesktop.dbus.annotations.DBusInterfaceName; import org.freedesktop.dbus.connections.impl.DBusConnection; +import org.freedesktop.dbus.connections.impl.DBusConnectionBuilder; import org.freedesktop.dbus.interfaces.DBusInterface; import java.io.IOException; @@ -45,7 +46,7 @@ public class KWalletBackend implements KeyringBackend { public KWalletBackend() throws BackendNotSupportedException { try { - connection = DBusConnection.getConnection(DBusConnection.DBusBusType.SESSION); + connection = DBusConnectionBuilder.forSessionBus().build(); wallet = connection.getRemoteObject("org.kde.kwalletd5", "/modules/kwalletd5", KWallet.class, true); wallet.localWallet(); //attempt connection to wallet } catch (Exception e) {