diff --git a/pam/go-exec/module.c b/pam/go-exec/module.c
index fb48addba..f295a6f86 100644
--- a/pam/go-exec/module.c
+++ b/pam/go-exec/module.c
@@ -133,6 +133,9 @@ const char *UBUNTU_AUTHD_PAM_OBJECT_NODE =
" "
" "
" "
+#ifdef AUTHD_TEST_EXEC_MODULE
+ " "
+#endif
" "
"";
diff --git a/pam/integration-tests/cmd/exec-client/modulewrapper.go b/pam/integration-tests/cmd/exec-client/modulewrapper.go
index 64977a16a..5c229cb29 100644
--- a/pam/integration-tests/cmd/exec-client/modulewrapper.go
+++ b/pam/integration-tests/cmd/exec-client/modulewrapper.go
@@ -1,4 +1,4 @@
-//go:build pam_tests_exec_client
+//-go:build pam_tests_exec_client
package main
@@ -9,6 +9,7 @@ import (
"syscall"
"time"
+ "github.com/godbus/dbus/v5"
"github.com/msteinert/pam/v2"
"github.com/ubuntu/authd/log"
"github.com/ubuntu/authd/pam/internal/dbusmodule"
@@ -23,6 +24,13 @@ func newModuleWrapper(serverAddress string) (pam.ModuleTransaction, func(), erro
return &moduleWrapper{mTx}, closeFunc, err
}
+// SimulateClientPanic forces the client to panic with the provided text.
+func (m *moduleWrapper) CallInvalidMethod() error {
+ method := "com.ubuntu.authd.pam.InvalidMethod"
+ tx, _ := m.ModuleTransaction.(*dbusmodule.Transaction)
+ return tx.BusObject().Call(method, dbus.FlagNoAutoStart).Err
+}
+
// SimulateClientPanic forces the client to panic with the provided text.
func (m *moduleWrapper) SimulateClientPanic(text string) {
panic(text)
diff --git a/pam/integration-tests/exec_test.go b/pam/integration-tests/exec_test.go
index 68e7288ee..e3db376df 100644
--- a/pam/integration-tests/exec_test.go
+++ b/pam/integration-tests/exec_test.go
@@ -202,6 +202,10 @@ func TestExecModule(t *testing.T) {
methodCalls: []cliMethodCall{{m: "ThisMethodDoesNotExist"}},
wantError: pam_test.ErrInvalidMethod,
},
+ "Error_when_calling_unknown_dbus_method": {
+ methodCalls: []cliMethodCall{{m: "CallInvalidMethod"}},
+ wantError: pam.ErrSystem,
+ },
"Error_when_argument_types_do_not_match_arguments": {
methodCalls: []cliMethodCall{{m: "SetItem", args: []any{"an-item", "value"}}},
wantError: pam_test.ErrArgumentTypeMismatch,
diff --git a/pam/internal/dbusmodule/transaction.go b/pam/internal/dbusmodule/transaction.go
index d6796bdba..baabab6ce 100644
--- a/pam/internal/dbusmodule/transaction.go
+++ b/pam/internal/dbusmodule/transaction.go
@@ -67,6 +67,11 @@ func NewTransaction(ctx context.Context, address string, o ...TransactionOptions
return &Transaction{obj: obj}, cleanup, nil
}
+// Bus gets the DBus object.
+func (tx *Transaction) BusObject() dbus.BusObject {
+ return tx.obj
+}
+
// SetData allows to save any value in the module data that is preserved
// during the whole time the module is loaded.
func (tx *Transaction) SetData(key string, data any) error {