{"action":"created","comment":{"url":"https://api.github.com/repos/tmds/Tmds.DBus/pulls/comments/219373798","pull_request_review_id":157533847,"id":219373798,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxOTM3Mzc5OA==","diff_hunk":"@@ -711,9 +711,13 @@ private async void HandleMethodCall(Message methodCall, IMessageStream peer)\n             if (_methodHandlers.TryGetValue(methodCall.Header.Path.Value, out methodHandler))\n             {\n                 var reply = await methodHandler(methodCall);\n-                reply.Header.ReplySerial = methodCall.Header.Serial;\n-                reply.Header.Destination = methodCall.Header.Sender;\n-                SendMessage(reply, peer);\n+                // Only reply if the caller expected it. Otherwise DBus will reject with org.freedesktop.DBus.Error.AccessDenied","path":"src/Tmds.DBus/DBusConnection.cs","position":7,"original_position":7,"commit_id":"8fff16ba40d285432e16fc3b31701e872d3cfe1b","original_commit_id":"8fff16ba40d285432e16fc3b31701e872d3cfe1b","user":{"login":"tmds","id":1025424,"node_id":"MDQ6VXNlcjEwMjU0MjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1025424?v=4","gravatar_id":"","url":"https://api.github.com/users/tmds","html_url":"https://github.com/tmds","followers_url":"https://api.github.com/users/tmds/followers","following_url":"https://api.github.com/users/tmds/following{/other_user}","gists_url":"https://api.github.com/users/tmds/gists{/gist_id}","starred_url":"https://api.github.com/users/tmds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmds/subscriptions","organizations_url":"https://api.github.com/users/tmds/orgs","repos_url":"https://api.github.com/users/tmds/repos","events_url":"https://api.github.com/users/tmds/events{/privacy}","received_events_url":"https://api.github.com/users/tmds/received_events","type":"User","site_admin":false},"body":"You can leave out the comment. The code is clear on its own.","created_at":"2018-09-21T03:15:55Z","updated_at":"2018-09-21T03:15:55Z","html_url":"https://github.com/tmds/Tmds.DBus/pull/61#discussion_r219373798","pull_request_url":"https://api.github.com/repos/tmds/Tmds.DBus/pulls/61","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/tmds/Tmds.DBus/pulls/comments/219373798"},"html":{"href":"https://github.com/tmds/Tmds.DBus/pull/61#discussion_r219373798"},"pull_request":{"href":"https://api.github.com/repos/tmds/Tmds.DBus/pulls/61"}}},"pull_request":{"url":"https://api.github.com/repos/tmds/Tmds.DBus/pulls/61","id":216669500,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE2NjY5NTAw","html_url":"https://github.com/tmds/Tmds.DBus/pull/61","diff_url":"https://github.com/tmds/Tmds.DBus/pull/61.diff","patch_url":"https://github.com/tmds/Tmds.DBus/pull/61.patch","issue_url":"https://api.github.com/repos/tmds/Tmds.DBus/issues/61","number":61,"state":"open","locked":false,"title":"Fix AccessDenied error if replying to method call that don't expect reply","user":{"login":"dodgyrabbit","id":518187,"node_id":"MDQ6VXNlcjUxODE4Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/518187?v=4","gravatar_id":"","url":"https://api.github.com/users/dodgyrabbit","html_url":"https://github.com/dodgyrabbit","followers_url":"https://api.github.com/users/dodgyrabbit/followers","following_url":"https://api.github.com/users/dodgyrabbit/following{/other_user}","gists_url":"https://api.github.com/users/dodgyrabbit/gists{/gist_id}","starred_url":"https://api.github.com/users/dodgyrabbit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dodgyrabbit/subscriptions","organizations_url":"https://api.github.com/users/dodgyrabbit/orgs","repos_url":"https://api.github.com/users/dodgyrabbit/repos","events_url":"https://api.github.com/users/dodgyrabbit/events{/privacy}","received_events_url":"https://api.github.com/users/dodgyrabbit/received_events","type":"User","site_admin":false},"body":"When a DBus method call is made, the caller can set a flag that they don't expect a reply. If you don't honor this flag, an Exception will be thrown when you try send the reply.\r\n\r\nI've created this patch and it seems to work for me - but @tmds you'd be best to review it.\r\n\r\n**Example:**\r\nUsing the bluez [gatt API](https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/gatt-api.txt), there is a particular method I need to export, called StartNotify().\r\n\r\nI did this and every time I got called with StartNotify(), Tmds.DBus threw an exception. I traced it down to this:\r\n\r\n` Type=error  Endian=l  Flags=1  Version=1  Priority=0 Cookie=8  ReplyCookie=21\r\n  Sender=org.freedesktop.DBus  Destination=:1.597\r\n  ErrorName=org.freedesktop.DBus.Error.AccessDenied  ErrorMessage=\"Rejected send message, 1 matched rules; type=\"method_return\", sender=\":1.597\" (uid=1000 pid=26233 comm=\"python gatt_server_example.py \" label=\"unconfined\") interface=\"(unset)\" member=\"(unset)\" error name=\"(unset)\" requested_reply=\"0\" destination=\":1.534\" (uid=0 pid=5898 comm=\"/usr/lib/bluetooth/bluetoothd -d --experimental \" label=\"unconfined\")\"\r\n`\r\n\r\nThe important part is **requested_reply=\"0\"** \r\n\r\nThis is what led me to the implementation in [DBusConnection](https://github.com/tmds/Tmds.DBus/blob/master/src/Tmds.DBus/DBusConnection.cs#L713) where the response is sent but the Flags is not honored.\r\n\r\nFeel free to change this if there is a better way to fix this - but the unit tests ran, everything else in my program works fine.","created_at":"2018-09-19T14:52:54Z","updated_at":"2018-09-21T03:15:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5fcfc97f7932f43fe8e53e382a988ce53a8b0d19","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/tmds/Tmds.DBus/pulls/61/commits","review_comments_url":"https://api.github.com/repos/tmds/Tmds.DBus/pulls/61/comments","review_comment_url":"https://api.github.com/repos/tmds/Tmds.DBus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tmds/Tmds.DBus/issues/61/comments","statuses_url":"https://api.github.com/repos/tmds/Tmds.DBus/statuses/8fff16ba40d285432e16fc3b31701e872d3cfe1b","head":{"label":"dodgyrabbit:master","ref":"master","sha":"8fff16ba40d285432e16fc3b31701e872d3cfe1b","user":{"login":"dodgyrabbit","id":518187,"node_id":"MDQ6VXNlcjUxODE4Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/518187?v=4","gravatar_id":"","url":"https://api.github.com/users/dodgyrabbit","html_url":"https://github.com/dodgyrabbit","followers_url":"https://api.github.com/users/dodgyrabbit/followers","following_url":"https://api.github.com/users/dodgyrabbit/following{/other_user}","gists_url":"https://api.github.com/users/dodgyrabbit/gists{/gist_id}","starred_url":"https://api.github.com/users/dodgyrabbit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dodgyrabbit/subscriptions","organizations_url":"https://api.github.com/users/dodgyrabbit/orgs","repos_url":"https://api.github.com/users/dodgyrabbit/repos","events_url":"https://api.github.com/users/dodgyrabbit/events{/privacy}","received_events_url":"https://api.github.com/users/dodgyrabbit/received_events","type":"User","site_admin":false},"repo":{"id":149462310,"node_id":"MDEwOlJlcG9zaXRvcnkxNDk0NjIzMTA=","name":"Tmds.DBus","full_name":"dodgyrabbit/Tmds.DBus","private":false,"owner":{"login":"dodgyrabbit","id":518187,"node_id":"MDQ6VXNlcjUxODE4Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/518187?v=4","gravatar_id":"","url":"https://api.github.com/users/dodgyrabbit","html_url":"https://github.com/dodgyrabbit","followers_url":"https://api.github.com/users/dodgyrabbit/followers","following_url":"https://api.github.com/users/dodgyrabbit/following{/other_user}","gists_url":"https://api.github.com/users/dodgyrabbit/gists{/gist_id}","starred_url":"https://api.github.com/users/dodgyrabbit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dodgyrabbit/subscriptions","organizations_url":"https://api.github.com/users/dodgyrabbit/orgs","repos_url":"https://api.github.com/users/dodgyrabbit/repos","events_url":"https://api.github.com/users/dodgyrabbit/events{/privacy}","received_events_url":"https://api.github.com/users/dodgyrabbit/received_events","type":"User","site_admin":false},"html_url":"https://github.com/dodgyrabbit/Tmds.DBus","description":"D-Bus for .NET","fork":true,"url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus","forks_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/forks","keys_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/teams","hooks_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/hooks","issue_events_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/issues/events{/number}","events_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/events","assignees_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/assignees{/user}","branches_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/branches{/branch}","tags_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/tags","blobs_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/git/refs{/sha}","trees_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/statuses/{sha}","languages_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/languages","stargazers_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/stargazers","contributors_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/contributors","subscribers_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/subscribers","subscription_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/subscription","commits_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/commits{/sha}","git_commits_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/git/commits{/sha}","comments_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/comments{/number}","issue_comment_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/issues/comments{/number}","contents_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/contents/{+path}","compare_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/merges","archive_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/downloads","issues_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/issues{/number}","pulls_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/pulls{/number}","milestones_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/milestones{/number}","notifications_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/labels{/name}","releases_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/releases{/id}","deployments_url":"https://api.github.com/repos/dodgyrabbit/Tmds.DBus/deployments","created_at":"2018-09-19T14:19:03Z","updated_at":"2018-09-20T14:10:55Z","pushed_at":"2018-09-20T14:10:53Z","git_url":"git://github.com/dodgyrabbit/Tmds.DBus.git","ssh_url":"git@github.com:dodgyrabbit/Tmds.DBus.git","clone_url":"https://github.com/dodgyrabbit/Tmds.DBus.git","svn_url":"https://github.com/dodgyrabbit/Tmds.DBus","homepage":"","size":1719,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tmds:master","ref":"master","sha":"8f37dc9c00a470f99d8933c1d1e88dcf02f931d5","user":{"login":"tmds","id":1025424,"node_id":"MDQ6VXNlcjEwMjU0MjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1025424?v=4","gravatar_id":"","url":"https://api.github.com/users/tmds","html_url":"https://github.com/tmds","followers_url":"https://api.github.com/users/tmds/followers","following_url":"https://api.github.com/users/tmds/following{/other_user}","gists_url":"https://api.github.com/users/tmds/gists{/gist_id}","starred_url":"https://api.github.com/users/tmds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmds/subscriptions","organizations_url":"https://api.github.com/users/tmds/orgs","repos_url":"https://api.github.com/users/tmds/repos","events_url":"https://api.github.com/users/tmds/events{/privacy}","received_events_url":"https://api.github.com/users/tmds/received_events","type":"User","site_admin":false},"repo":{"id":60125254,"node_id":"MDEwOlJlcG9zaXRvcnk2MDEyNTI1NA==","name":"Tmds.DBus","full_name":"tmds/Tmds.DBus","private":false,"owner":{"login":"tmds","id":1025424,"node_id":"MDQ6VXNlcjEwMjU0MjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1025424?v=4","gravatar_id":"","url":"https://api.github.com/users/tmds","html_url":"https://github.com/tmds","followers_url":"https://api.github.com/users/tmds/followers","following_url":"https://api.github.com/users/tmds/following{/other_user}","gists_url":"https://api.github.com/users/tmds/gists{/gist_id}","starred_url":"https://api.github.com/users/tmds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmds/subscriptions","organizations_url":"https://api.github.com/users/tmds/orgs","repos_url":"https://api.github.com/users/tmds/repos","events_url":"https://api.github.com/users/tmds/events{/privacy}","received_events_url":"https://api.github.com/users/tmds/received_events","type":"User","site_admin":false},"html_url":"https://github.com/tmds/Tmds.DBus","description":"D-Bus for .NET","fork":false,"url":"https://api.github.com/repos/tmds/Tmds.DBus","forks_url":"https://api.github.com/repos/tmds/Tmds.DBus/forks","keys_url":"https://api.github.com/repos/tmds/Tmds.DBus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tmds/Tmds.DBus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tmds/Tmds.DBus/teams","hooks_url":"https://api.github.com/repos/tmds/Tmds.DBus/hooks","issue_events_url":"https://api.github.com/repos/tmds/Tmds.DBus/issues/events{/number}","events_url":"https://api.github.com/repos/tmds/Tmds.DBus/events","assignees_url":"https://api.github.com/repos/tmds/Tmds.DBus/assignees{/user}","branches_url":"https://api.github.com/repos/tmds/Tmds.DBus/branches{/branch}","tags_url":"https://api.github.com/repos/tmds/Tmds.DBus/tags","blobs_url":"https://api.github.com/repos/tmds/Tmds.DBus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tmds/Tmds.DBus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tmds/Tmds.DBus/git/refs{/sha}","trees_url":"https://api.github.com/repos/tmds/Tmds.DBus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tmds/Tmds.DBus/statuses/{sha}","languages_url":"https://api.github.com/repos/tmds/Tmds.DBus/languages","stargazers_url":"https://api.github.com/repos/tmds/Tmds.DBus/stargazers","contributors_url":"https://api.github.com/repos/tmds/Tmds.DBus/contributors","subscribers_url":"https://api.github.com/repos/tmds/Tmds.DBus/subscribers","subscription_url":"https://api.github.com/repos/tmds/Tmds.DBus/subscription","commits_url":"https://api.github.com/repos/tmds/Tmds.DBus/commits{/sha}","git_commits_url":"https://api.github.com/repos/tmds/Tmds.DBus/git/commits{/sha}","comments_url":"https://api.github.com/repos/tmds/Tmds.DBus/comments{/number}","issue_comment_url":"https://api.github.com/repos/tmds/Tmds.DBus/issues/comments{/number}","contents_url":"https://api.github.com/repos/tmds/Tmds.DBus/contents/{+path}","compare_url":"https://api.github.com/repos/tmds/Tmds.DBus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tmds/Tmds.DBus/merges","archive_url":"https://api.github.com/repos/tmds/Tmds.DBus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tmds/Tmds.DBus/downloads","issues_url":"https://api.github.com/repos/tmds/Tmds.DBus/issues{/number}","pulls_url":"https://api.github.com/repos/tmds/Tmds.DBus/pulls{/number}","milestones_url":"https://api.github.com/repos/tmds/Tmds.DBus/milestones{/number}","notifications_url":"https://api.github.com/repos/tmds/Tmds.DBus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tmds/Tmds.DBus/labels{/name}","releases_url":"https://api.github.com/repos/tmds/Tmds.DBus/releases{/id}","deployments_url":"https://api.github.com/repos/tmds/Tmds.DBus/deployments","created_at":"2016-05-31T21:36:52Z","updated_at":"2018-09-09T21:40:13Z","pushed_at":"2018-09-20T14:10:54Z","git_url":"git://github.com/tmds/Tmds.DBus.git","ssh_url":"git@github.com:tmds/Tmds.DBus.git","clone_url":"https://github.com/tmds/Tmds.DBus.git","svn_url":"https://github.com/tmds/Tmds.DBus","homepage":"","size":1743,"stargazers_count":35,"watchers_count":35,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":9,"open_issues":5,"watchers":35,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tmds/Tmds.DBus/pulls/61"},"html":{"href":"https://github.com/tmds/Tmds.DBus/pull/61"},"issue":{"href":"https://api.github.com/repos/tmds/Tmds.DBus/issues/61"},"comments":{"href":"https://api.github.com/repos/tmds/Tmds.DBus/issues/61/comments"},"review_comments":{"href":"https://api.github.com/repos/tmds/Tmds.DBus/pulls/61/comments"},"review_comment":{"href":"https://api.github.com/repos/tmds/Tmds.DBus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tmds/Tmds.DBus/pulls/61/commits"},"statuses":{"href":"https://api.github.com/repos/tmds/Tmds.DBus/statuses/8fff16ba40d285432e16fc3b31701e872d3cfe1b"}},"author_association":"NONE"}}
{"actor":{"display_login":"tmds"}}