+ if (c->n_matches >= MATCHES_MAX) {
+ r = sd_bus_error_setf(error, SD_BUS_ERROR_LIMITS_EXCEEDED, "Reached limit of %u matches per client", MATCHES_MAX);
+ goto fail;
+ }
+
+ r = bus_match_parse(arg0, &components, &n_components);
+ if (r < 0) {
+ r = sd_bus_error_setf(error, SD_BUS_ERROR_MATCH_RULE_INVALID, "Match rule \"%s\" is not valid", arg0);
+ goto fail;
+ }
+
+ r = match_new(c, components, n_components, &m);
+ if (r < 0)
+ goto fail;
+
+ r = bus_add_match_internal_kernel(bus, id, components, n_components, m->cookie);
+ if (r < 0)
+ goto fail;
+
+ bus_match_parse_free(components, n_components);
+
+ return sd_bus_reply_method_return(message, NULL);
+
+fail:
+ bus_match_parse_free(components, n_components);
+
+ match_free(m);
+
+ if (c->n_matches <= 0)
+ client_free(c);
+
+ return r;
+}
+
+static int driver_remove_match(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+
+ struct bus_match_component *components = NULL;
+ _cleanup_free_ char *normalized = NULL;
+ Context *context = userdata;
+ unsigned n_components = 0;
+ Client *c = NULL;
+ Match *m = NULL;
+ char *arg0;
+ uint64_t id;
+ int r;
+
+ assert(bus);
+ assert(message);
+ assert(context);
+
+ r = sd_bus_message_read(message, "s", &arg0);