summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoHyun Pyun <dh79.pyun@samsung.com>2016-05-11 18:57:16 +0900
committerDoHyun Pyun <dh79.pyun@samsung.com>2016-05-11 19:55:57 +0900
commit5ed0bdb94c9d76d2d40791e3adf784734000dad2 (patch)
treeda07df928552efc280edb27daea5e33b3c0a2b29
parentb87b1cf6dfb7a8ae093da3dc681e43543c79018a (diff)
downloadbluez-5ed0bdb94c9d76d2d40791e3adf784734000dad2.tar.gz
bluez-5ed0bdb94c9d76d2d40791e3adf784734000dad2.tar.bz2
bluez-5ed0bdb94c9d76d2d40791e3adf784734000dad2.zip
Fix the crash when SET_PATH command is recieved
This patchset is related with TC_MSE_MMB_BV_09_I PTS testcase. Change-Id: I96cbea2d315182bc934e9684e6be447c2bdaf351 Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
-rw-r--r--obexd/client/mns-tizen.c15
-rw-r--r--obexd/plugins/mas.c9
-rw-r--r--obexd/plugins/messages-tizen.c79
-rw-r--r--obexd/plugins/pbap.c18
-rw-r--r--[-rwxr-xr-x]obexd/src/obex.c4
5 files changed, 92 insertions, 33 deletions
diff --git a/obexd/client/mns-tizen.c b/obexd/client/mns-tizen.c
index 49522259..c6da1eb1 100644
--- a/obexd/client/mns-tizen.c
+++ b/obexd/client/mns-tizen.c
@@ -36,6 +36,7 @@
#include "driver.h"
#include "map_ap.h"
#include "mns-tizen.h"
+#include "gobex/gobex-apparam.h"
#define OBEX_MNS_UUID \
"\xBB\x58\x2B\x41\x42\x0C\x11\xDB\xB0\xDE\x08\x00\x20\x0C\x9A\x66"
@@ -58,12 +59,6 @@ enum msg_event_type {
EVENT_TYPE_UNKNOWN,
};
-struct sendevent_apparam {
- uint8_t masinstanceid_tag;
- uint8_t masinstanceid_len;
- uint8_t masinstanceid;
-} __attribute__ ((packed));
-
struct mns_data {
struct obc_session *session;
DBusMessage *msg;
@@ -135,7 +130,7 @@ static DBusMessage *send_event(DBusConnection *connection,
{
struct mns_data *mns = user_data;
struct obc_transfer *transfer;
- struct sendevent_apparam apparam;
+ GObexApparam *apparam;
gchar *event_type;
gchar *folder;
gchar *old_folder;
@@ -170,12 +165,10 @@ static DBusMessage *send_event(DBusConnection *connection,
if (transfer == NULL)
goto fail;
- apparam.masinstanceid_tag = MAP_AP_MASINSTANCEID;
- apparam.masinstanceid_len = 1;
/* Obexd currently supports single SDP for MAS */
- apparam.masinstanceid = 0;
+ apparam = g_obex_apparam_set_uint8(NULL, MAP_AP_MASINSTANCEID, 0);
- obc_transfer_set_apparam(transfer, &apparam);
+ obc_transfer_set_apparam(transfer, apparam);
if (obc_session_queue(mns->session, transfer, NULL, NULL, &err))
return dbus_message_new_method_return(message);
diff --git a/obexd/plugins/mas.c b/obexd/plugins/mas.c
index 8d0531a2..7036497f 100644
--- a/obexd/plugins/mas.c
+++ b/obexd/plugins/mas.c
@@ -178,14 +178,9 @@ static void mas_disconnect(struct obex_session *os, void *user_data)
DBG("");
manager_unregister_session(os);
-#ifdef __TIZEN_PATCH__
- if (mas)
-#endif
- {
- messages_disconnect(mas->backend_data);
+ messages_disconnect(mas->backend_data);
- mas_clean(mas);
- }
+ mas_clean(mas);
}
static int mas_get(struct obex_session *os, void *user_data)
diff --git a/obexd/plugins/messages-tizen.c b/obexd/plugins/messages-tizen.c
index 690237aa..7613484a 100644
--- a/obexd/plugins/messages-tizen.c
+++ b/obexd/plugins/messages-tizen.c
@@ -1,23 +1,22 @@
/*
*
- * OBEX Server
- *
- * Copyright (c) 2000-2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * OBEX Server
*
+ * Copyright (C) 2012 Samsung Electronics Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
@@ -1013,6 +1012,28 @@ int messages_get_folder_listing(void *s, const char *name,
return 0;
}
+
+static void append_variant(DBusMessageIter *iter, int type, void *val)
+{
+ DBusMessageIter value;
+ char sig[2] = { type, '\0' };
+
+ dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, sig, &value);
+ dbus_message_iter_append_basic(&value, type, val);
+ dbus_message_iter_close_container(iter, &value);
+}
+
+static void dict_append_entry(DBusMessageIter *dict, const char *key,
+ int type, void *val)
+{
+ DBusMessageIter entry;
+
+ dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
+ dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &key);
+ append_variant(&entry, type, val);
+ dbus_message_iter_close_container(dict, &entry);
+}
+
int messages_get_messages_listing(void *session, const char *name,
uint16_t max, uint16_t offset,
uint8_t subject_len,
@@ -1023,6 +1044,8 @@ int messages_get_messages_listing(void *session, const char *name,
DBusPendingCall *call;
DBusMessage *message;
struct session *s = session;
+ DBusMessageIter iter;
+ DBusMessageIter dict;
if (name != NULL && strlen(name))
s->name = g_strdup(name);
@@ -1058,8 +1081,44 @@ int messages_get_messages_listing(void *session, const char *name,
dbus_message_append_args(message, DBUS_TYPE_STRING, &s->name,
DBUS_TYPE_UINT16, &s->max,
+ DBUS_TYPE_UINT16, &s->offset,
+ DBUS_TYPE_BYTE, &subject_len,
DBUS_TYPE_INVALID);
+ dbus_message_iter_init_append(message, &iter);
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_STRING_AS_STRING
+ DBUS_TYPE_VARIANT_AS_STRING
+ DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
+
+ if (filter->parameter_mask)
+ dict_append_entry(&dict, "ParameterMask", DBUS_TYPE_UINT32,
+ &filter->parameter_mask);
+ if (filter->type)
+ dict_append_entry(&dict, "FilterMessageType", DBUS_TYPE_BYTE,
+ &filter->type);
+ if (filter->period_begin)
+ dict_append_entry(&dict, "FilterPeriodBegin", DBUS_TYPE_STRING,
+ &filter->period_begin);
+ if (filter->period_end)
+ dict_append_entry(&dict, "FilterPeriodEnd", DBUS_TYPE_STRING,
+ &filter->period_end);
+ if (filter->read_status)
+ dict_append_entry(&dict, "FilterReadStatus", DBUS_TYPE_BYTE,
+ &filter->read_status);
+ if (filter->recipient)
+ dict_append_entry(&dict, "FilterRecipient", DBUS_TYPE_STRING,
+ &filter->recipient);
+ if (filter->originator)
+ dict_append_entry(&dict, "FilterOriginator", DBUS_TYPE_STRING,
+ &filter->originator);
+ if (filter->priority)
+ dict_append_entry(&dict, "FilterPriority", DBUS_TYPE_BYTE,
+ &filter->priority);
+
+ dbus_message_iter_close_container(&iter, &dict);
+
if (dbus_connection_send_with_reply(g_conn, message, &call,
DBUS_TIMEOUT_INFINITE) == FALSE) {
error("Could not send dbus message");
diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
index e21231c3..68520b8a 100644
--- a/obexd/plugins/pbap.c
+++ b/obexd/plugins/pbap.c
@@ -969,8 +969,15 @@ static ssize_t vobject_pull_get_next_header(void *object, void *buf, size_t mtu,
if (obj->firstpacket) {
obj->firstpacket = FALSE;
-
+#ifdef __TIZEN_PATCH__
+ gsize count = 0;
+ count = g_obex_apparam_encode(obj->apparam, buf, mtu);
+ DBG("APPARAM Processed remove tags");
+ g_obex_apparam_remove_all(obj->apparam);
+ return count;
+#else
return g_obex_apparam_encode(obj->apparam, buf, mtu);
+#endif
}
return 0;
@@ -1025,8 +1032,13 @@ static ssize_t vobject_list_get_next_header(void *object, void *buf, size_t mtu,
return 0;
#else
- if (obj->apparam != NULL)
- return g_obex_apparam_encode(obj->apparam, buf, mtu);
+ if (obj->apparam != NULL) {
+ gsize count = 0;
+ count = g_obex_apparam_encode(obj->apparam, buf, mtu);
+ DBG("APPARAM Processed remove tags");
+ g_obex_apparam_remove_all(obj->apparam);
+ return count;
+ }
else
return 0;
#endif /* __TIZEN_PATCH__ */
diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index d62839f1..580b12ef 100755..100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
@@ -643,8 +643,8 @@ static void parse_name(struct obex_session *os, GObexPacket *req)
if (!g_obex_header_get_unicode(hdr, &name))
return;
#ifdef __TIZEN_PATCH__
- DBG("TYPE===>: %s", os->type);
- if (name && strcmp(os->type, "x-bt/phonebook")) {
+ DBG("Obex Session For: %s", os->service->name);
+ if (name && g_strcmp0(os->service->name, "Object Push server") == 0) {
char *new_name;
new_name = strrchr(name, '/');
if (new_name) {