mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-26 05:34:23 +08:00
Require all incoming connections to be secure
This commit is contained in:
parent
714bf0e9cd
commit
60159d1c8e
@ -839,7 +839,7 @@ failed:
|
|||||||
|
|
||||||
static int server_socket(uint8_t *channel)
|
static int server_socket(uint8_t *channel)
|
||||||
{
|
{
|
||||||
int sock;
|
int sock, lm;
|
||||||
struct sockaddr_rc addr;
|
struct sockaddr_rc addr;
|
||||||
socklen_t sa_len;
|
socklen_t sa_len;
|
||||||
|
|
||||||
@ -849,6 +849,13 @@ static int server_socket(uint8_t *channel)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lm = RFCOMM_LM_SECURE;
|
||||||
|
if (setsockopt(sock, SOL_RFCOMM, RFCOMM_LM, &lm, sizeof(lm)) < 0) {
|
||||||
|
error("server setsockopt: %s", strerror(errno), errno);
|
||||||
|
close(sock);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
memset(&addr, 0, sizeof(addr));
|
memset(&addr, 0, sizeof(addr));
|
||||||
addr.rc_family = AF_BLUETOOTH;
|
addr.rc_family = AF_BLUETOOTH;
|
||||||
bacpy(&addr.rc_bdaddr, BDADDR_ANY);
|
bacpy(&addr.rc_bdaddr, BDADDR_ANY);
|
||||||
|
Loading…
Reference in New Issue
Block a user