- Fix sdp_copy_record(), so records are properly exported through D-Bus
This commit is contained in:
parent
8c7cfddfd2
commit
643330cb0d
74
bluez-fix-sdp-copy-for-strings-with-nulls.patch
Normal file
74
bluez-fix-sdp-copy-for-strings-with-nulls.patch
Normal file
@ -0,0 +1,74 @@
|
||||
diff --git a/lib/sdp.c b/lib/sdp.c
|
||||
index 896c5eb..66e65ca 100644
|
||||
--- a/lib/sdp.c
|
||||
+++ b/lib/sdp.c
|
||||
@@ -97,6 +97,7 @@ static uint128_t bluetooth_base_uuid = {
|
||||
#define SDP_MAX_ATTR_LEN 65535
|
||||
|
||||
static sdp_data_t *sdp_copy_seq(sdp_data_t *data);
|
||||
+static int sdp_attr_add_new_with_length(sdp_record_t *rec, uint16_t attr, uint8_t dtd, const void *value, uint32_t len);
|
||||
|
||||
/* Message structure. */
|
||||
struct tupla {
|
||||
@@ -1381,7 +1382,7 @@ static void sdp_copy_pattern(void *value, void *udata)
|
||||
sdp_pattern_add_uuid(rec, uuid);
|
||||
}
|
||||
|
||||
-static void *sdp_data_value(sdp_data_t *data)
|
||||
+static void *sdp_data_value(sdp_data_t *data, uint32_t *len)
|
||||
{
|
||||
void *val = NULL;
|
||||
|
||||
@@ -1435,6 +1436,8 @@ static void *sdp_data_value(sdp_data_t *data)
|
||||
case SDP_URL_STR32:
|
||||
case SDP_TEXT_STR32:
|
||||
val = data->val.str;
|
||||
+ if (len)
|
||||
+ *len = data->unitSize - 1;
|
||||
break;
|
||||
case SDP_ALT8:
|
||||
case SDP_ALT16:
|
||||
@@ -1457,7 +1460,7 @@ static sdp_data_t *sdp_copy_seq(sdp_data_t *data)
|
||||
sdp_data_t *datatmp;
|
||||
void *value;
|
||||
|
||||
- value = sdp_data_value(tmp);
|
||||
+ value = sdp_data_value(tmp, NULL);
|
||||
datatmp = sdp_data_alloc_with_length(tmp->dtd, value,
|
||||
tmp->unitSize);
|
||||
|
||||
@@ -1477,10 +1480,14 @@ static void sdp_copy_attrlist(void *value, void *udata)
|
||||
sdp_data_t *data = value;
|
||||
sdp_record_t *rec = udata;
|
||||
void *val;
|
||||
+ uint32_t len = 0;
|
||||
|
||||
- val = sdp_data_value(data);
|
||||
+ val = sdp_data_value(data, &len);
|
||||
|
||||
- sdp_attr_add_new(rec, data->attrId, data->dtd, val);
|
||||
+ if (!len)
|
||||
+ sdp_attr_add_new(rec, data->attrId, data->dtd, val);
|
||||
+ else
|
||||
+ sdp_attr_add_new_with_length(rec, data->attrId, data->dtd, val, len);
|
||||
}
|
||||
|
||||
sdp_record_t *sdp_copy_record(sdp_record_t *rec)
|
||||
@@ -2068,6 +2075,17 @@ int sdp_attr_add_new(sdp_record_t *rec, uint16_t attr, uint8_t dtd,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+static int sdp_attr_add_new_with_length(sdp_record_t *rec, uint16_t attr, uint8_t dtd,
|
||||
+ const void *value, uint32_t len)
|
||||
+{
|
||||
+ sdp_data_t *d = sdp_data_alloc_with_length(dtd, value, len);
|
||||
+ if (d) {
|
||||
+ sdp_attr_replace(rec, attr, d);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Set the information attributes of the service
|
||||
* pointed to by rec. The attributes are
|
@ -1,7 +1,7 @@
|
||||
Summary: Bluetooth utilities
|
||||
Name: bluez
|
||||
Version: 4.32
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
License: GPLv2+
|
||||
Group: Applications/System
|
||||
Source: http://www.kernel.org/pub/linux/bluetooth/%{name}-%{version}.tar.gz
|
||||
@ -14,6 +14,8 @@ Patch1: bluez-utils-oui-usage.patch
|
||||
Patch2: bluez-try-utf8-harder.patch
|
||||
# http://thread.gmane.org/gmane.linux.bluez.kernel/1688
|
||||
Patch3: bluez-sdp-xml-with-nulls.patch
|
||||
# http://thread.gmane.org/gmane.linux.bluez.kernel/1688/focus=1708
|
||||
Patch4: bluez-fix-sdp-copy-for-strings-with-nulls.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
||||
URL: http://www.bluez.org/
|
||||
@ -102,6 +104,7 @@ use in Bluetooth applications.
|
||||
%patch1 -p0 -b .oui
|
||||
%patch2 -p1 -b .non-utf8-name
|
||||
%patch3 -p1 -b .nulls-in-sdp-text
|
||||
%patch4 -p1 -b .more-nulls-in-sdp-text
|
||||
|
||||
%build
|
||||
%configure --enable-cups --enable-hid2hci --enable-dfutool --enable-tools --enable-bccmd --enable-gstreamer --enable-hidd --enable-pand --enable-dund
|
||||
@ -194,6 +197,9 @@ fi
|
||||
%{_libdir}/alsa-lib/*.so
|
||||
|
||||
%changelog
|
||||
* Mon Mar 09 2009 - Bastien Nocera <bnocera@redhat.com> - 4.32-6
|
||||
- Fix sdp_copy_record(), so records are properly exported through D-Bus
|
||||
|
||||
* Fri Mar 06 2009 - Bastien Nocera <bnocera@redhat.com> - 4.32-5
|
||||
- Fix SDP parsing to XML when it contains NULLs
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user