diff --git a/internal/authorizer/authorizer.go b/internal/authorizer/authorizer.go index 19ddb27ac..28e3a5774 100644 --- a/internal/authorizer/authorizer.go +++ b/internal/authorizer/authorizer.go @@ -176,10 +176,16 @@ func (a Authorizer) isAllowed(ctx context.Context, action Action, pid int32, uid return err } + // polkit requests an uint32 on dbus + var upid uint32 + if pid > 0 { + upid = uint32(pid) + } + subject := authSubject{ Kind: "unix-process", Details: map[string]dbus.Variant{ - "pid": dbus.MakeVariant(uint32(pid)), // polkit requests an uint32 on dbus + "pid": dbus.MakeVariant(upid), "start-time": dbus.MakeVariant(startTime), "uid": dbus.MakeVariant(uid), }, diff --git a/internal/smbsafe/smbsafe_test.go b/internal/smbsafe/smbsafe_test.go index 81194b11f..40b209949 100644 --- a/internal/smbsafe/smbsafe_test.go +++ b/internal/smbsafe/smbsafe_test.go @@ -126,11 +126,11 @@ func TestMultipleSmbLocksOnlyReleaseOnLast(t *testing.T) { func shouldHaveWaited(t *testing.T, startpoint time.Time) { t.Helper() - require.Less(t, uint64(waitTime-time.Millisecond), uint64(time.Since(startpoint)), "Should have waited") + require.Less(t, int64(waitTime-time.Millisecond), int64(time.Since(startpoint)), "Should have waited") } func shouldNotHaveWaited(t *testing.T, startpoint time.Time) { t.Helper() - require.Less(t, uint64(time.Since(startpoint)), uint64(waitTime+time.Millisecond), "Shouldn’t have waited") + require.WithinDuration(t, time.Now(), startpoint, waitTime, "Shouldn’t have waited") }