All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] modem: do not allow more than one client to lock down
@ 2011-01-26  7:33 =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
  2011-01-26  8:54 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont @ 2011-01-26  7:33 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1103 bytes --]

---
 src/modem.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/modem.c b/src/modem.c
index 553549e..a92107e 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -805,11 +805,14 @@ static DBusMessage *set_property_lockdown(struct ofono_modem *modem,
 	if (modem->pending != NULL)
 		return __ofono_error_busy(msg);
 
+	caller = dbus_message_get_sender(msg);
+
+	if (modem->lockdown && g_strcmp0(caller, modem->lock_owner))
+		return __ofono_error_access_denied(msg);
+
 	if (modem->lockdown == lockdown)
 		return dbus_message_new_method_return(msg);
 
-	caller = dbus_message_get_sender(msg);
-
 	if (lockdown) {
 		dbus_bool_t powered;
 
@@ -847,12 +850,8 @@ static DBusMessage *set_property_lockdown(struct ofono_modem *modem,
 					OFONO_MODEM_INTERFACE,
 					"Powered", DBUS_TYPE_BOOLEAN,
 					&powered);
-	} else {
-		if (g_strcmp0(caller, modem->lock_owner))
-			return __ofono_error_access_denied(msg);
-
+	} else
 		lockdown_remove(modem);
-	}
 
 done:
 	g_dbus_send_reply(conn, msg, DBUS_TYPE_INVALID);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] modem: do not allow more than one client to lock down
  2011-01-26  7:33 [PATCH] modem: do not allow more than one client to lock down =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
@ 2011-01-26  8:54 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2011-01-26  8:54 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 929 bytes --]

Hi Remi,

>  src/modem.c |   13 ++++++-------
>  1 files changed, 6 insertions(+), 7 deletions(-)

patch has been applied.

However I added some paranoia protection for lock_owner reset to NULL. I
know that in theory it is protected via lockdown == TRUE, but that is an
issue bound to break something eventually.

> @@ -847,12 +850,8 @@ static DBusMessage *set_property_lockdown(struct ofono_modem *modem,
>  					OFONO_MODEM_INTERFACE,
>  					"Powered", DBUS_TYPE_BOOLEAN,
>  					&powered);
> -	} else {
> -		if (g_strcmp0(caller, modem->lock_owner))
> -			return __ofono_error_access_denied(msg);
> -
> +	} else
>  		lockdown_remove(modem);
> -	}
>  
>  done:
>  	g_dbus_send_reply(conn, msg, DBUS_TYPE_INVALID);

And since this becomes a one line statement now and we already have a
goto label there, I changed this a bit around and removed the
unnecessary indentation.

Regards

Marcel



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-26  8:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-26  7:33 [PATCH] modem: do not allow more than one client to lock down =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2011-01-26  8:54 ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.