Add error checking for service methods
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 5 Apr 2009 17:19:07 +0000 (19:19 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Sun, 5 Apr 2009 17:19:07 +0000 (19:19 +0200)
src/profile.c

index ce26c7a..86b78f1 100644 (file)
@@ -146,12 +146,22 @@ static DBusMessage *get_properties(DBusConnection *conn,
 static DBusMessage *connect_service(DBusConnection *conn,
                                        DBusMessage *msg, void *data)
 {
+       struct connman_group *group = data;
+
+       if (group->type == CONNMAN_SERVICE_TYPE_ETHERNET)
+               return __connman_error_not_supported(msg);
+
        return __connman_error_not_implemented(msg);
 }
 
 static DBusMessage *disconnect_service(DBusConnection *conn,
                                        DBusMessage *msg, void *data)
 {
+       struct connman_group *group = data;
+
+       if (group->type == CONNMAN_SERVICE_TYPE_ETHERNET)
+               return __connman_error_not_supported(msg);
+
        return __connman_error_not_implemented(msg);
 }
 
@@ -160,6 +170,9 @@ static DBusMessage *remove_service(DBusConnection *conn,
 {
        struct connman_group *group = data;
 
+       if (group->type == CONNMAN_SERVICE_TYPE_ETHERNET)
+               return __connman_error_not_supported(msg);
+
        group->favorite = FALSE;
 
        return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
@@ -168,12 +181,22 @@ static DBusMessage *remove_service(DBusConnection *conn,
 static DBusMessage *move_before(DBusConnection *conn,
                                        DBusMessage *msg, void *data)
 {
+       struct connman_group *group = data;
+
+       if (group->favorite == FALSE)
+               return __connman_error_not_supported(msg);
+
        return __connman_error_not_implemented(msg);
 }
 
 static DBusMessage *move_after(DBusConnection *conn,
                                        DBusMessage *msg, void *data)
 {
+       struct connman_group *group = data;
+
+       if (group->favorite == FALSE)
+               return __connman_error_not_supported(msg);
+
        return __connman_error_not_implemented(msg);
 }