linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] obexd: Refine error handling for agent authorization reply
@ 2025-08-29  6:33 fuleyi
  2025-08-29  7:54 ` bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: fuleyi @ 2025-08-29  6:33 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: fuleyi

Handle DBus error types in agent_reply() with specific errno values:
- Use -ETIMEDOUT for DBUS_ERROR_NO_REPLY (timeout)
- Use -EPERM for OBEX_ERROR_REJECT (permission denied)
- Use -EBADR for other errors

This improves the accuracy of error reporting and makes the authorization logic more robust.
---
 obexd/src/manager.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/obexd/src/manager.c b/obexd/src/manager.c
index 683dd4ca0..73273dff9 100644
--- a/obexd/src/manager.c
+++ b/obexd/src/manager.c
@@ -46,7 +46,7 @@ struct agent {
 	char *bus_name;
 	char *path;
 	gboolean auth_pending;
-	gboolean auth_reject;
+	int auth_reply;
 	char *new_name;
 	char *new_folder;
 	unsigned int watch_id;
@@ -632,11 +632,14 @@ static void agent_reply(DBusPendingCall *call, void *user_data)
 		error("Agent replied with an error: %s, %s",
 				derr.name, derr.message);
 
-		if (dbus_error_has_name(&derr, DBUS_ERROR_NO_REPLY))
-			agent_cancel();
+		if (dbus_error_has_name(&derr, DBUS_ERROR_NO_REPLY)) 
+			agent->auth_reply = -ETIMEDOUT;
 		else if (dbus_error_has_name(&derr, OBEX_ERROR_REJECT))
-			agent->auth_reject = TRUE;
-
+			agent->auth_reply = -EPERM;
+		else
+			agent->auth_reply = -EBADR;
+		
+		agent_cancel();	
 		dbus_error_free(&derr);
 		dbus_message_unref(reply);
 		return;
@@ -703,7 +706,7 @@ int manager_request_authorization(struct obex_transfer *transfer,
 	dbus_message_unref(msg);
 
 	agent->auth_pending = TRUE;
-	agent->auth_reject  = FALSE;
+	agent->auth_reply  = 0;
 	got_reply = FALSE;
 
 	/* Catches errors before authorization response comes */
@@ -726,8 +729,8 @@ int manager_request_authorization(struct obex_transfer *transfer,
 
 	dbus_pending_call_unref(call);
 
-	if (!agent || agent->auth_reject)
-		return -EPERM;
+	if (!agent || agent->auth_reply != 0)
+		return agent->auth_reply;
 
 	*new_folder = agent->new_folder;
 	*new_name = agent->new_name;
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: obexd: Refine error handling for agent authorization reply
  2025-08-29  6:33 [PATCH] obexd: Refine error handling for agent authorization reply fuleyi
@ 2025-08-29  7:54 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2025-08-29  7:54 UTC (permalink / raw)
  To: linux-bluetooth, fuleyi

[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]

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=996765

---Test result---

Test Summary:
CheckPatch                    PENDING   0.38 seconds
GitLint                       PENDING   0.38 seconds
BuildEll                      PASS      20.29 seconds
BluezMake                     PASS      2512.52 seconds
MakeCheck                     PASS      19.88 seconds
MakeDistcheck                 PASS      185.23 seconds
CheckValgrind                 PASS      234.97 seconds
CheckSmatch                   PASS      306.51 seconds
bluezmakeextell               PASS      127.45 seconds
IncrementalBuild              PENDING   0.24 seconds
ScanBuild                     PASS      912.87 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-29  7:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-29  6:33 [PATCH] obexd: Refine error handling for agent authorization reply fuleyi
2025-08-29  7:54 ` bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).