#include <config.h>
#endif
-#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <sys/stat.h>
-#include <sys/socket.h>
-
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/l2cap.h>
-#include <bluetooth/sdp.h>
-#include <bluetooth/sdp_lib.h>
-
#include <sys/un.h>
-#include <netinet/in.h>
#include <glib.h>
-#include "hcid.h"
+#include "lib/bluetooth.h"
+#include "lib/l2cap.h"
+#include "lib/sdp.h"
+#include "lib/sdp_lib.h"
+
#include "log.h"
#include "sdpd.h"
return -1;
}
- chmod(SDP_UNIX_PATH, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
+ chmod(SDP_UNIX_PATH, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
return 0;
}
}
len = recv(sk, &hdr, sizeof(sdp_pdu_hdr_t), MSG_PEEK);
- if (len <= 0) {
+ if (len != sizeof(sdp_pdu_hdr_t)) {
sdp_svcdb_collect_all(sk);
return FALSE;
}
return TRUE;
len = recv(sk, buf, size, 0);
+ /* Check here only that the received message is not empty.
+ * Incorrect length of message should be processed later
+ * inside handle_request() in order to produce ErrorResponse.
+ */
if (len <= 0) {
sdp_svcdb_collect_all(sk);
free(buf);
return -1;
}
- if (main_opts.did_source > 0)
- register_device_id();
-
io = g_io_channel_unix_new(l2cap_sock);
g_io_channel_set_close_on_unref(io, TRUE);