Source: sms4you
Version: 0.0.7-2
Severity: important
X-Debbugs-Cc: [email protected]
Working on Bookworm amd64 but with dbussy (python3-dbussy) from latest
upstream to fix async I/O bugs affecting Python > v3.10 (Bookworm has
v3.11).
I'm just finishing writing a new GatewayFile module that monitors a
spool directory using aionotify and sends (validly formatted) file
content as an SMS.
When the message is passed to the SMS gateway a DBus exception is
generated that prevents sending:
sms4you[149293]: File accepted test-message.sms to +44xxxxxxxx
sms4you[149293]: Task exception was never retrieved
sms4you[149293]: future: <Task finished name='Task-4'
coro=<GatewayFile._watch() done, defined at
/usr/lib/sms4you/sms4you-file/__init__.py:57>
exception=DBusError("org.freedesktop.ModemManager1.Error.Core.Unauthorized --
PolicyKit authorization failed: not authorized for
'org.freedesktop.ModemManager1.Messaging'")>
sms4you[149293]: Traceback (most recent call last):
sms4you[149293]: File "/usr/lib/sms4you/sms4you-file/__init__.py", line 67,
in _watch
sms4you[149293]: await self.gateway.dispatch(number, message)
sms4you[149293]: File "/usr/lib/sms4you/sms4you/core/gateway_sms.py", line
101, in dispatch
ms4you[149293]: created = reply.expect_return_objects("o")[0]
sms4you[149293]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sms4you[149293]: File "/usr/lib/python3/dist-packages/dbussy.py", line 4409,
in expect_return_objects
sms4you[149293]: raise DBusError(self.error_name,
self.expect_objects("s")[0])
sms4you[149293]: dbussy.DBusError:
org.freedesktop.ModemManager1.Error.Core.Unauthorized -- PolicyKit
authorization failed: not authorized for
'org.freedesktop.ModemManager1.Messaging'
I've worked around this exception for now by relaxing the polkit rule thus:
/usr/share/polkit-1/rules.d/sms4you.rules:
polkit.addRule(function(action, subject) {
if (action.id.startsWith("org.freedesktop.ModemManager1") &&
subject.isInGroup("_sms4you")) {
return polkit.Result.YES;
}
});
but sending still (silently) fails; notice how the exception states:
not authorized for 'org.freedesktop.ModemManager1.Messaging'
core/gateway_sms.py defines
MESSAGING_INTERFACE = MODEM_INTERFACE + ".Messaging"
and that is confirmed with an additional log message to be:
sms4you[149293]:
MESSAGING_INTERFACE=org.freedesktop.ModemManager1.Modem.Messaging
So somehow "Modem." is going missing!
It's unclear if that is a bug in ModemManager or just an incorrect message.
I'll do additional research on this and report a separate bug if that is
what it turns out to be.