From 15734b43c9dbca2d48c7ef1e0b7c46d920aa220d Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 16 Sep 2008 20:19:09 +0300 Subject: [PATCH] obexd: Only use a secure socket if specified --- obexd/src/bluetooth.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/obexd/src/bluetooth.c b/obexd/src/bluetooth.c index a7768aaa2..a4f038a77 100644 --- a/obexd/src/bluetooth.c +++ b/obexd/src/bluetooth.c @@ -200,7 +200,7 @@ static gint server_register(guint16 service, const gchar *name, guint8 channel, GIOChannel *io; struct server *server; uint32_t *handle; - gint err, sk, arg, lm = RFCOMM_LM_SECURE; + int err, sk, arg; sk = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); if (sk < 0) { @@ -221,9 +221,13 @@ static gint server_register(guint16 service, const gchar *name, guint8 channel, goto failed; } - if (setsockopt(sk, SOL_RFCOMM, RFCOMM_LM, &lm, sizeof(lm)) < 0) { - err = errno; - goto failed; + if (secure) { + int lm = RFCOMM_LM_SECURE; + + if (setsockopt(sk, SOL_RFCOMM, RFCOMM_LM, &lm, sizeof(lm)) < 0) { + err = errno; + goto failed; + } } memset(&laddr, 0, sizeof(laddr)); -- 2.47.3