From a4ca2c5965eb4a11ceab76eb62bf0308016c6f29 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 10 Jun 2010 16:57:22 -0700 Subject: [PATCH] Return an error for invalid transaction on immutable services --- src/service.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/service.c b/src/service.c index 1d4cde3..4ddf6c0 100644 --- a/src/service.c +++ b/src/service.c @@ -915,6 +915,9 @@ static DBusMessage *set_property(DBusConnection *conn, if (type != DBUS_TYPE_STRING) return __connman_error_invalid_arguments(msg); + if (service->immutable == TRUE) + return __connman_error_not_supported(msg); + if (__connman_security_check_privilege(msg, CONNMAN_SECURITY_PRIVILEGE_SECRET) < 0) return __connman_error_permission_denied(msg); @@ -937,6 +940,9 @@ static DBusMessage *set_property(DBusConnection *conn, if (type != DBUS_TYPE_STRING) return __connman_error_invalid_arguments(msg); + if (service->immutable == TRUE) + return __connman_error_not_supported(msg); + if (service->type != CONNMAN_SERVICE_TYPE_CELLULAR) return __connman_error_invalid_service(msg); @@ -958,6 +964,9 @@ static DBusMessage *set_property(DBusConnection *conn, if (type != DBUS_TYPE_STRING) return __connman_error_invalid_arguments(msg); + if (service->immutable == TRUE) + return __connman_error_not_supported(msg); + if (service->type != CONNMAN_SERVICE_TYPE_CELLULAR) return __connman_error_invalid_service(msg); @@ -977,6 +986,9 @@ static DBusMessage *set_property(DBusConnection *conn, if (type != DBUS_TYPE_STRING) return __connman_error_invalid_arguments(msg); + if (service->immutable == TRUE) + return __connman_error_not_supported(msg); + if (service->type != CONNMAN_SERVICE_TYPE_CELLULAR) return __connman_error_invalid_service(msg); @@ -1126,6 +1138,9 @@ static DBusMessage *clear_property(DBusConnection *conn, g_get_current_time(&service->modified); __connman_storage_save_service(service); } else if (g_str_equal(name, "Passphrase") == TRUE) { + if (service->immutable == TRUE) + return __connman_error_not_supported(msg); + g_free(service->passphrase); service->passphrase = NULL; @@ -1433,6 +1448,9 @@ static DBusMessage *remove_service(DBusConnection *conn, if (service->type == CONNMAN_SERVICE_TYPE_ETHERNET) return __connman_error_not_supported(msg); + if (service->immutable == TRUE) + return __connman_error_not_supported(msg); + if (service->favorite == FALSE && service->state != CONNMAN_SERVICE_STATE_FAILURE) return __connman_error_not_supported(msg); -- 2.7.4