2023-04-19 10:33:27

by Guiting Shen

[permalink] [raw]
Subject: [PATCH BlueZ v3] obexd: support to reply folder name to store file

From: Aaron_shen <[email protected]>

The obex agent usually reply the filename by getting the default filename
from the filename property of the transfer object which is not convenient.
The patch helps that the obex agent can reply folder name or new filename
or null which will use the default filename if new_name is NULL and the
default folder if the new_folder is NULL in opp_chkput().
---
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..322531009 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
+ folder name suffiexed 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.34.1


2023-04-19 11:55:44

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ,v3] obexd: support to reply folder name to store file

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=741292

---Test result---

Test Summary:
CheckPatch PASS 0.36 seconds
GitLint PASS 0.22 seconds
BuildEll PASS 29.01 seconds
BluezMake PASS 1118.82 seconds
MakeCheck PASS 12.56 seconds
MakeDistcheck PASS 169.21 seconds
CheckValgrind PASS 270.73 seconds
CheckSmatch PASS 384.56 seconds
bluezmakeextell PASS 116.09 seconds
IncrementalBuild PASS 945.71 seconds
ScanBuild PASS 1236.59 seconds



---
Regards,
Linux Bluetooth

2023-04-19 15:04:32

by Guiting Shen

[permalink] [raw]
Subject: Re: [PATCH BlueZ v3] obexd: support to reply folder name to store file

Dear Paul,

On 19.04.23 19:49 Paul Menzel wrote:
>Am 19.04.23 um 12:19 schrieb Guiting Shen:
>> From: Aaron_shen <[email protected]>

>The old name is still documented as the author for the commit. Did you
>execute the second command?

> git commit --amend --author="Aaron Shen <[email protected]>"

>Or with your real name:

> git commit --amend --author="Guiting Shen <[email protected]>"

>You can verify the success with `git show` and look at the meta data.

Sorry, I forgot to make new patch to send.

> The obex agent usually reply the filename by getting the default filename

>s/reply/replies/

>Do you mean *returns* instead of *replies*?

Yes, I mean to return the filename or folder name to reply the AuthorizePush
request from obexd manager.
Do I use 'returns' instead of 'replies' in v4 patch?

>> from the filename property of the transfer object which is not convenient.
>> The patch helps that the obex agent can reply folder name or new filename
>> or null which will use the default filename if new_name is NULL and the
>> default folder if the new_folder is NULL in opp_chkput().

Regards,
Guiting Shen

2023-04-19 15:06:27

by Paul Menzel

[permalink] [raw]
Subject: Re: [PATCH BlueZ v3] obexd: support to reply folder name to store file

Dear Guiting,


Am 19.04.23 um 16:50 schrieb Guiting Shen:

> On 19.04.23 19:49 Paul Menzel wrote:
>> Am 19.04.23 um 12:19 schrieb Guiting Shen:
>>> From: Aaron_shen <[email protected]>
>
>> The old name is still documented as the author for the commit. Did you
>> execute the second command?
>
>> git commit --amend --author="Aaron Shen <[email protected]>"
>
>> Or with your real name:
>
>> git commit --amend --author="Guiting Shen <[email protected]>"
>
>> You can verify the success with `git show` and look at the meta data.
>
> Sorry, I forgot to make new patch to send.

No problem.

>> The obex agent usually reply the filename by getting the default filename
>
>> s/reply/replies/
>
>> Do you mean *returns* instead of *replies*?
>
> Yes, I mean to return the filename or folder name to reply the AuthorizePush
> request from obexd manager.
> Do I use 'returns' instead of 'replies' in v4 patch?

At least for me that would be more correct.

>>> from the filename property of the transfer object which is not convenient.
>>> The patch helps that the obex agent can reply folder name or new filename
>>> or null which will use the default filename if new_name is NULL and the
>>> default folder if the new_folder is NULL in opp_chkput().


Kind regards,

Paul


PS: By the way, your replies are not correctly threaded. The message
header says you are using git-send-email to compose/send this message –
the one I am replying to right now with Message-Id:

[email protected]

2023-04-19 16:42:09

by Guiting Shen

[permalink] [raw]
Subject: Re: [PATCH BlueZ v3] obexd: support to reply folder name to store file

Dear Paul,

On 19.04.23 22:54 Paul Menzel wrote:
>Am 19.04.23 um 16:50 schrieb Guiting Shen:
>
>> On 19.04.23 19:49 Paul Menzel wrote:
>>> Am 19.04.23 um 12:19 schrieb Guiting Shen:
>>>> From: Aaron_shen <[email protected]>
>>
>>> The old name is still documented as the author for the commit. Did you
>>> execute the second command?
>>
>>> git commit --amend --author="Aaron Shen <[email protected]>"
>>
>>> Or with your real name:
>>
>>> git commit --amend --author="Guiting Shen <[email protected]>"
>>
>>> You can verify the success with `git show` and look at the meta data.
>>
>> Sorry, I forgot to make new patch to send.
>
>No problem.
>
>>> The obex agent usually reply the filename by getting the default filename
>>
>>> s/reply/replies/
>>
>>> Do you mean *returns* instead of *replies*?
>>
>> Yes, I mean to return the filename or folder name to reply the AuthorizePush
>> request from obexd manager.
>> Do I use 'returns' instead of 'replies' in v4 patch?
>
>At least for me that would be more correct.

Got it, thanks. I will send v4 patch tomorrow.

>>>> from the filename property of the transfer object which is not convenient.
>>>> The patch helps that the obex agent can reply folder name or new filename
>>>> or null which will use the default filename if new_name is NULL and the
>>>> default folder if the new_folder is NULL in opp_chkput().
>
>PS: By the way, your replies are not correctly threaded. The message
>header says you are using git-send-email to compose/send this message –
>the one I am replying to right now with Message-Id:
>
>[email protected]

Sorry, I found the Message-Id to reply finally.
Wish this reply will be right.

Regards,
Guiting Shen