Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7036224rwl; Wed, 22 Mar 2023 20:50:43 -0700 (PDT) X-Google-Smtp-Source: AK7set8y36iOAeW0YLdG5MNoInA3jq3Ia2Hr38WKdznHpqNIwEflpBAX55obmEm6JqCR7J/iCwJv X-Received: by 2002:a17:906:d8c:b0:92f:fbac:69c4 with SMTP id m12-20020a1709060d8c00b0092ffbac69c4mr9260263eji.56.1679543443189; Wed, 22 Mar 2023 20:50:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679543443; cv=none; d=google.com; s=arc-20160816; b=kL7cKv4afxRPdqYAJnnmuiigq5PBN6WNrPdww3ZOfaLCl1N8shufOJ7lkIaKFwnUBS PPPtNg7ZX3xRBGesDTc+V6ATyc8OktW/w41UbS0Ni7Bb014M8m6vu/Wlg0zoC82Q8KRO D8F+/2ZmrImYaejcF4vtIMC1jhMhymTxOwLps+QWdFk5/NrC6sspXkPQftSwStdoOWT1 9zkQJSdd76oevvjOTQQdcu4wLH3YTR6A22xCh5NFo8r8q2OMA/eOdVJAAJpU6g2uMrJo ndPz8KMqIcaMH6owAgb6DXNWqMQsX0cx4V63rTs0NudMJ/vpc/2X8jp223KSmuvGmS+d QNCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=nxljwHdP8xNkwqo0WFmvF4AplStNr8O7CMgY8EWnZMQ=; b=Oi7ZkqArlhpY4QJtGcvsAvXVHxZY8BV5f3IlhYW4jscECfiDvIxR2qI6ZqT6xgItSA NNSZFXdVnovCPldPXtJ+3H0LgtfcPpE4TLVsCvmWQe16wDBJvdp5ykZj16yu580GFu88 jMps6sVDeipH7FQFu5cSeHzirBW9ifHQOmpGU8orNidq3gSFchCQNbgPcTpXVp6dADVP r9jjgyV3Jusl7Jn/imTAE+yPN7yAyE+DDrewTpfI66HbBUhuVvOLEE1rVUIl9XrudfrI 9dvxodl3pkw1fcIVt7CPdwh+fUTCYpYUJkItqUv0n+wxA0Dl48PzEUNFv35ihoWS+5EX x5dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VLLybmDz; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n8-20020a170906700800b0093161749da7si10154480ejj.369.2023.03.22.20.50.10; Wed, 22 Mar 2023 20:50:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VLLybmDz; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229891AbjCWDsO (ORCPT + 99 others); Wed, 22 Mar 2023 23:48:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229729AbjCWDsO (ORCPT ); Wed, 22 Mar 2023 23:48:14 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91B4E3586 for ; Wed, 22 Mar 2023 20:48:12 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id c18so21131730ple.11 for ; Wed, 22 Mar 2023 20:48:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679543292; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nxljwHdP8xNkwqo0WFmvF4AplStNr8O7CMgY8EWnZMQ=; b=VLLybmDzdhtbM8GF35t33434o/bv9vHI1cEohaDzNuA/2i0dhFP3S84/3pyKqeq+cj CTG2Hx8BLlpNegc1JqCi9Nz7Gz6sheH51nZGkh1RFki+VGuIS3SZENMhK6vnObfnHMO2 31kmwjawtqVUElTNaqiyUYJvOoWggg48YhJJza7l+XnhmYvdE2RP3wHLdIwMr7AQWk0s WTQwtUYVR4PYBW3JJvEOxMtXTx6jCXJFTsL+Zn/3ds/GEJTzRyirBPNIgNtsWe1D4pWD uAfVv1TTd6XCZdiAgibwuQ0qF7zvrWV72hNSMLBgDWM6PRA1unrZ2XBzSClCjlDSKAvT aqng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679543292; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nxljwHdP8xNkwqo0WFmvF4AplStNr8O7CMgY8EWnZMQ=; b=ql1xPJylCNcw+49rsHJ0qGuoIdskvU0n4SbQ5ah7OpjUBVCLik9u/6LUDHATgzt7rX nnojEjhb1icxUHKbvCcByCE6SmyXJQgJ1XbNsSQAjgfnYjudccptTjjneDXcvKfIjNBf KpaHgBqMsmgtkvc/R2rhPv53nWkYXNKW8rLQ3dAL6UBhxLlayj1l7WxiwVjTAn96iNPW gCQNNd6CA51SVeo3XQprk+cAKaILVlBgUKJqtyLHJCo6NSGqtRU6DJ+0Yo5HgK51LNVU qbulr1F6VwkU3lKDCvNyiMjZ+8DqGtskbLjMcc5I1DFzoiqOMvzRRYoyywzQtLVBsfYS PrlQ== X-Gm-Message-State: AO0yUKV/3DtNev2Vbjj/fWrusBI82kIJR/niBQydQYi5VNwE2MnhlZMb FOwM+kzC1U9UacrT1TeqgfLCcQWQTRFZ0Q== X-Received: by 2002:a17:90b:38c4:b0:233:feb4:895f with SMTP id nn4-20020a17090b38c400b00233feb4895fmr6025755pjb.44.1679543291725; Wed, 22 Mar 2023 20:48:11 -0700 (PDT) Received: from AndroidSev.unication.com.cn ([183.63.252.58]) by smtp.gmail.com with ESMTPSA id 5-20020a630205000000b0050fa6546a45sm4191358pgc.6.2023.03.22.20.48.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2023 20:48:11 -0700 (PDT) From: Aaron_shen To: linux-bluetooth@vger.kernel.org Cc: Aaron_shen Subject: [PATCH BlueZ] obexd: support to reply folder name to store file Date: Thu, 23 Mar 2023 11:48:05 +0800 Message-Id: <20230323034805.18946-1-aarongt.shen@gmail.com> X-Mailer: git-send-email 2.11.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org It is more convenient that agent reply the message with folder name instead of the full new filename to be store. Because the opp_chkput() will use the remote device filename if the new filename is NULL. --- doc/obex-agent-api.txt | 9 +++++---- obexd/src/manager.c | 10 ++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/doc/obex-agent-api.txt b/doc/obex-agent-api.txt index 3923da6df..9d399e3d2 100644 --- a/doc/obex-agent-api.txt +++ b/doc/obex-agent-api.txt @@ -46,10 +46,11 @@ Methods void Release() This method gets called when the service daemon needs to accept/reject a Bluetooth object push request. - Returns the full path (including the filename) where - the object shall be stored. The tranfer object will - contain a Filename property that contains the default - location and name that can be returned. + Returns the full path (including the filename) or + directory name suffixed with '/' where the object + shall be stored. The transfer object will contain a + Filename property that contains the default location + and name that can be returned. Possible errors: org.bluez.obex.Error.Rejected org.bluez.obex.Error.Canceled diff --git a/obexd/src/manager.c b/obexd/src/manager.c index 849928603..73fd6b9af 100644 --- a/obexd/src/manager.c +++ b/obexd/src/manager.c @@ -632,8 +632,7 @@ static void agent_reply(DBusPendingCall *call, void *user_data) if (dbus_error_has_name(&derr, DBUS_ERROR_NO_REPLY)) agent_cancel(); - - if (dbus_error_has_name(&derr, OBEX_ERROR_REJECT)) + else if (dbus_error_has_name(&derr, OBEX_ERROR_REJECT)) agent->auth_reject = TRUE; dbus_error_free(&derr); @@ -651,7 +650,10 @@ static void agent_reply(DBusPendingCall *call, void *user_data) agent->new_name = g_strdup(name); agent->new_folder = NULL; } else { - agent->new_name = g_strdup(slash + 1); + if (strlen(slash) == 1) + agent->new_name = NULL; + else + agent->new_name = g_strdup(slash + 1); agent->new_folder = g_strndup(name, slash - name); } } @@ -722,7 +724,7 @@ int manager_request_authorization(struct obex_transfer *transfer, dbus_pending_call_unref(call); - if (!agent || !agent->new_name || agent->auth_reject) + if (!agent || agent->auth_reject) return -EPERM; *new_folder = agent->new_folder; -- 2.11.0