Fix the bug for the OPP server progress callback's file name
[platform/core/connectivity/bluetooth-frwk.git] / bt-service-adaptation / services / obex / bt-service-obex-server.c
index 56c6eab..baa9690 100644 (file)
@@ -1186,6 +1186,7 @@ int _bt_obex_server_accept_authorize(const char *filename, gboolean is_native)
 {
        char file_path[BT_FILE_PATH_MAX] = { 0 };
        bt_server_info_t *server_info;
+       bt_auth_info_t *new_auth_info;
 
        BT_CHECK_PARAMETER(filename, return);
 
@@ -1209,10 +1210,20 @@ int _bt_obex_server_accept_authorize(const char *filename, gboolean is_native)
 
        g_dbus_method_invocation_return_value(agent_info.auth_info->reply_context,
                g_variant_new("(s)", &file_path));
-       agent_info.auth_info->reply_context = NULL;
-       agent_info.auth_info->file_path = g_strdup(file_path);
-       g_free(agent_info.auth_info->filename);
-       agent_info.auth_info->filename = g_strdup(filename);
+
+       new_auth_info = g_malloc0(sizeof(bt_auth_info_t));
+
+       new_auth_info->file_size = agent_info.auth_info->file_size;
+       new_auth_info->file_path = g_strdup(file_path);
+       new_auth_info->filename = g_strdup(filename);
+       new_auth_info->device_name = g_strdup(agent_info.auth_info->device_name);
+       new_auth_info->transfer_path = g_strdup(agent_info.auth_info->transfer_path);
+       new_auth_info->address = g_strdup(agent_info.auth_info->address);
+       memcpy(new_auth_info->contact_auth_info, agent_info.auth_info->contact_auth_info, 5);
+
+       __bt_free_auth_info(agent_info.auth_info);
+
+       agent_info.auth_info = new_auth_info;
 
        return BLUETOOTH_ERROR_NONE;
 }