diff options
author | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-12-01 18:11:38 -0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-12-01 18:11:38 -0300 |
commit | 4a073b1a5a3a4742a67485c71298944bb66cc50b (patch) | |
tree | 54bcf673881ce82a44ac467a0d03975f2247a8d9 /serial | |
parent | 1a092fcbf4bf5ac7b59c8de58d2d3b890987596b (diff) |
Disallow Serial.Disconnect from unauthorized senders.
Diffstat (limited to 'serial')
-rw-r--r-- | serial/port.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/serial/port.c b/serial/port.c index c83c84b6..9b58f212 100644 --- a/serial/port.c +++ b/serial/port.c @@ -386,7 +386,7 @@ static DBusMessage *port_disconnect(DBusConnection *conn, { struct serial_device *device = user_data; struct serial_port *port; - const char *dev; + const char *dev, *owner, *caller; if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &dev, DBUS_TYPE_INVALID) == FALSE) @@ -399,6 +399,11 @@ static DBusMessage *port_disconnect(DBusConnection *conn, if (!port->listener_id) return failed(msg, "Not connected"); + owner = dbus_message_get_sender(port->msg); + caller = dbus_message_get_sender(msg); + if (!g_str_equal(owner, caller)) + return failed(msg, "Operation not permited"); + if (port->id >= 0) port_release(port); |