diff --git a/obexd/plugins/bluetooth.c b/obexd/plugins/bluetooth.c
index fe508f4..b126717 100644
--- a/obexd/plugins/bluetooth.c
+++ b/obexd/plugins/bluetooth.c
}
static struct bluetooth_service *find_service(
- struct obex_service_driver *driver,
- uint8_t channel)
+ struct obex_service_driver *driver)
{
GSList *l;
for (l = any->services; l; l = l->next) {
struct bluetooth_service *service = l->data;
- if (driver != NULL && service->driver != driver)
- continue;
-
- if (channel != 0 && service->driver->channel != channel)
- continue;
-
- return service;
+ if (service->driver == driver)
+ return service;
}
return NULL;
struct bluetooth_service *service;
char *xml;
- service = find_service(driver, 0);
+ service = find_service(driver);
if (service == NULL) {
service = g_new0(struct bluetooth_service, 1);
service->driver = driver;
static void confirm_event(GIOChannel *io, void *user_data)
{
- struct bluetooth_service *service = user_data;
+ struct bluetooth_service *service;
GError *err = NULL;
char address[18];
uint8_t channel;
+ struct obex_service_driver *driver = user_data;
bt_io_get(io, BT_IO_RFCOMM, &err,
BT_IO_OPT_DEST, address,
info("bluetooth: New connection from: %s, channel %u", address,
channel);
- if (service->driver->service != OBEX_OPP) {
+ service = find_service(driver);
+ if (service == NULL) {
+ error("bluetooth: Unable to find service");
+ goto drop;
+ }
+
+ if (driver->service != OBEX_OPP) {
if (request_service_authorization(service, io, address) < 0)
goto drop;