{"action":"created","comment":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/comments/53837145","id":53837145,"diff_hunk":"@@ -621,6 +621,430 @@ void linux_tcp_conn_t::on_event(int /* events */) {\n     event_watcher->stop_watching_for_errors();\n }\n \n+/* tls_conn_wrapper_t wraps a TLS connection and safely releases it in\n+exceptional cases if it is not reclaimed before execution leaves its scope. */\n+class tls_conn_wrapper_t {\n+public:\n+    tls_conn_wrapper_t(SSL *_conn) {\n+        conn = _conn;\n+    }\n+\n+    ~tls_conn_wrapper_t() {\n+        SSL_free(conn);\n+    }\n+\n+    // Transfer ownership of the connection to the caller.\n+    void reclaim() {","path":"src/arch/io/network.cc","position":17,"original_position":17,"commit_id":"c4f7adbbb278891091e23c0af8bff4490d482025","original_commit_id":"c4f7adbbb278891091e23c0af8bff4490d482025","user":{"login":"danielmewes","id":505365,"avatar_url":"https://avatars.githubusercontent.com/u/505365?v=3","gravatar_id":"","url":"https://api.github.com/users/danielmewes","html_url":"https://github.com/danielmewes","followers_url":"https://api.github.com/users/danielmewes/followers","following_url":"https://api.github.com/users/danielmewes/following{/other_user}","gists_url":"https://api.github.com/users/danielmewes/gists{/gist_id}","starred_url":"https://api.github.com/users/danielmewes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielmewes/subscriptions","organizations_url":"https://api.github.com/users/danielmewes/orgs","repos_url":"https://api.github.com/users/danielmewes/repos","events_url":"https://api.github.com/users/danielmewes/events{/privacy}","received_events_url":"https://api.github.com/users/danielmewes/received_events","type":"User","site_admin":false},"body":"For consistency with other similar structures in our code and in the standard libraries, I suggest changing this function into the following:\r\n```C++\r\n// Transfer ownership of the connection to the caller.\r\nSSL *release() {\r\n    rassert(conn != nullptr);\r\n    SSL *res = conn;\r\n    conn = nullptr;\r\n    return res;\r\n}\r\n```\r\n\r\nThis also fixes two other minor things:\r\n1. Use `nullptr` instead of `NULL` (this is mostly a stylistic change)\r\n2. Adds an assertion that the connection hasn't been released before. `rasserts` are enabled when compiling with `make DEBUG=1`.","created_at":"2016-02-23T19:41:15Z","updated_at":"2016-02-23T19:41:15Z","html_url":"https://github.com/rethinkdb/rethinkdb/pull/5381#discussion_r53837145","pull_request_url":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/5381","_links":{"self":{"href":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/comments/53837145"},"html":{"href":"https://github.com/rethinkdb/rethinkdb/pull/5381#discussion_r53837145"},"pull_request":{"href":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/5381"}}},"pull_request":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/5381","id":58837658,"html_url":"https://github.com/rethinkdb/rethinkdb/pull/5381","diff_url":"https://github.com/rethinkdb/rethinkdb/pull/5381.diff","patch_url":"https://github.com/rethinkdb/rethinkdb/pull/5381.patch","issue_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/5381","number":5381,"state":"open","locked":false,"title":"TLS for all connections","user":{"login":"jlhawn","id":1441929,"avatar_url":"https://avatars.githubusercontent.com/u/1441929?v=3","gravatar_id":"","url":"https://api.github.com/users/jlhawn","html_url":"https://github.com/jlhawn","followers_url":"https://api.github.com/users/jlhawn/followers","following_url":"https://api.github.com/users/jlhawn/following{/other_user}","gists_url":"https://api.github.com/users/jlhawn/gists{/gist_id}","starred_url":"https://api.github.com/users/jlhawn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlhawn/subscriptions","organizations_url":"https://api.github.com/users/jlhawn/orgs","repos_url":"https://api.github.com/users/jlhawn/repos","events_url":"https://api.github.com/users/jlhawn/events{/privacy}","received_events_url":"https://api.github.com/users/jlhawn/received_events","type":"User","site_admin":false},"body":"This set of commits adds the ability to wrap any of the web, driver, or cluster connections with TLS. The `--help` output has been accompanied with the following section:\r\n\r\n```\r\nTLS options:\r\n  --web-tls                                   secure the web administration console\r\n                                              with TLS\r\n  --web-tls-key key_filename                  private key to use for web\r\n                                              administration console TLS\r\n  --web-tls-cert cert_filename                certificate to use for web\r\n                                              administration console TLS\r\n  --driver-tls                                secure client driver connections with\r\n                                              TLS\r\n  --driver-tls-key key_filename               private key to use for client driver\r\n                                              connection TLS\r\n  --driver-tls-cert cert_filename             certificate to use for client driver\r\n                                              connection TLS\r\n  --driver-tls-ca ca_filename                 CA certificate bundle used to verify\r\n                                              client certificates; TLS client\r\n                                              authentication disabled if omitted\r\n  --cluster-tls                               secure intra-cluster connections with\r\n                                              TLS\r\n  --cluster-tls-key key_filename              private key to use for intra-cluster\r\n                                              connection TLS\r\n  --cluster-tls-cert cert_filename            certificate to use for intra-cluster\r\n                                              connection TLS\r\n  --cluster-tls-ca ca_filename                CA certificate bundle used to verify\r\n                                              cluster peer certificates\r\n  --tls-ciphers cipher_list                   specify a list of TLS ciphers to use;\r\n                                              default is 'ECDHE+AESGCM'\r\n  --tls-ec-curves curve_list                  specify a list of elliptic curves to\r\n                                              use for ECDHE; default is\r\n                                              'secp521r1:secp384r1:prime256v1'\r\n  --tls-dhparams dhparams_filename            provide parameters for DHE key\r\n                                              agreement; REQUIRED if using DHE\r\n                                              cipher suites; at least 2048-bit\r\n                                              recommended\r\n```\r\n\r\nTODO: rebase onto the `next` branch?\r\n\r\nfixes #3151\r\nfixes #3158","created_at":"2016-02-10T01:42:31Z","updated_at":"2016-02-23T19:41:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e041c20194c0fc8de69fc3861b62ff9ed4e52207","assignee":{"login":"danielmewes","id":505365,"avatar_url":"https://avatars.githubusercontent.com/u/505365?v=3","gravatar_id":"","url":"https://api.github.com/users/danielmewes","html_url":"https://github.com/danielmewes","followers_url":"https://api.github.com/users/danielmewes/followers","following_url":"https://api.github.com/users/danielmewes/following{/other_user}","gists_url":"https://api.github.com/users/danielmewes/gists{/gist_id}","starred_url":"https://api.github.com/users/danielmewes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielmewes/subscriptions","organizations_url":"https://api.github.com/users/danielmewes/orgs","repos_url":"https://api.github.com/users/danielmewes/repos","events_url":"https://api.github.com/users/danielmewes/events{/privacy}","received_events_url":"https://api.github.com/users/danielmewes/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/milestones/110","html_url":"https://github.com/rethinkdb/rethinkdb/milestones/2.3","labels_url":"https://api.github.com/repos/rethinkdb/rethinkdb/milestones/110/labels","id":1339083,"number":110,"title":"2.3","description":"","creator":{"login":"danielmewes","id":505365,"avatar_url":"https://avatars.githubusercontent.com/u/505365?v=3","gravatar_id":"","url":"https://api.github.com/users/danielmewes","html_url":"https://github.com/danielmewes","followers_url":"https://api.github.com/users/danielmewes/followers","following_url":"https://api.github.com/users/danielmewes/following{/other_user}","gists_url":"https://api.github.com/users/danielmewes/gists{/gist_id}","starred_url":"https://api.github.com/users/danielmewes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielmewes/subscriptions","organizations_url":"https://api.github.com/users/danielmewes/orgs","repos_url":"https://api.github.com/users/danielmewes/repos","events_url":"https://api.github.com/users/danielmewes/events{/privacy}","received_events_url":"https://api.github.com/users/danielmewes/received_events","type":"User","site_admin":false},"open_issues":32,"closed_issues":42,"state":"open","created_at":"2015-10-05T20:52:53Z","updated_at":"2016-02-23T02:02:25Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/5381/commits","review_comments_url":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/5381/comments","review_comment_url":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/5381/comments","statuses_url":"https://api.github.com/repos/rethinkdb/rethinkdb/statuses/c4f7adbbb278891091e23c0af8bff4490d482025","head":{"label":"jlhawn:tls","ref":"tls","sha":"c4f7adbbb278891091e23c0af8bff4490d482025","user":{"login":"jlhawn","id":1441929,"avatar_url":"https://avatars.githubusercontent.com/u/1441929?v=3","gravatar_id":"","url":"https://api.github.com/users/jlhawn","html_url":"https://github.com/jlhawn","followers_url":"https://api.github.com/users/jlhawn/followers","following_url":"https://api.github.com/users/jlhawn/following{/other_user}","gists_url":"https://api.github.com/users/jlhawn/gists{/gist_id}","starred_url":"https://api.github.com/users/jlhawn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlhawn/subscriptions","organizations_url":"https://api.github.com/users/jlhawn/orgs","repos_url":"https://api.github.com/users/jlhawn/repos","events_url":"https://api.github.com/users/jlhawn/events{/privacy}","received_events_url":"https://api.github.com/users/jlhawn/received_events","type":"User","site_admin":false},"repo":{"id":50877326,"name":"rethinkdb","full_name":"jlhawn/rethinkdb","owner":{"login":"jlhawn","id":1441929,"avatar_url":"https://avatars.githubusercontent.com/u/1441929?v=3","gravatar_id":"","url":"https://api.github.com/users/jlhawn","html_url":"https://github.com/jlhawn","followers_url":"https://api.github.com/users/jlhawn/followers","following_url":"https://api.github.com/users/jlhawn/following{/other_user}","gists_url":"https://api.github.com/users/jlhawn/gists{/gist_id}","starred_url":"https://api.github.com/users/jlhawn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlhawn/subscriptions","organizations_url":"https://api.github.com/users/jlhawn/orgs","repos_url":"https://api.github.com/users/jlhawn/repos","events_url":"https://api.github.com/users/jlhawn/events{/privacy}","received_events_url":"https://api.github.com/users/jlhawn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jlhawn/rethinkdb","description":"The open-source database for the realtime web.","fork":true,"url":"https://api.github.com/repos/jlhawn/rethinkdb","forks_url":"https://api.github.com/repos/jlhawn/rethinkdb/forks","keys_url":"https://api.github.com/repos/jlhawn/rethinkdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jlhawn/rethinkdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jlhawn/rethinkdb/teams","hooks_url":"https://api.github.com/repos/jlhawn/rethinkdb/hooks","issue_events_url":"https://api.github.com/repos/jlhawn/rethinkdb/issues/events{/number}","events_url":"https://api.github.com/repos/jlhawn/rethinkdb/events","assignees_url":"https://api.github.com/repos/jlhawn/rethinkdb/assignees{/user}","branches_url":"https://api.github.com/repos/jlhawn/rethinkdb/branches{/branch}","tags_url":"https://api.github.com/repos/jlhawn/rethinkdb/tags","blobs_url":"https://api.github.com/repos/jlhawn/rethinkdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jlhawn/rethinkdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jlhawn/rethinkdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/jlhawn/rethinkdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jlhawn/rethinkdb/statuses/{sha}","languages_url":"https://api.github.com/repos/jlhawn/rethinkdb/languages","stargazers_url":"https://api.github.com/repos/jlhawn/rethinkdb/stargazers","contributors_url":"https://api.github.com/repos/jlhawn/rethinkdb/contributors","subscribers_url":"https://api.github.com/repos/jlhawn/rethinkdb/subscribers","subscription_url":"https://api.github.com/repos/jlhawn/rethinkdb/subscription","commits_url":"https://api.github.com/repos/jlhawn/rethinkdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/jlhawn/rethinkdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/jlhawn/rethinkdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/jlhawn/rethinkdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/jlhawn/rethinkdb/contents/{+path}","compare_url":"https://api.github.com/repos/jlhawn/rethinkdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jlhawn/rethinkdb/merges","archive_url":"https://api.github.com/repos/jlhawn/rethinkdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jlhawn/rethinkdb/downloads","issues_url":"https://api.github.com/repos/jlhawn/rethinkdb/issues{/number}","pulls_url":"https://api.github.com/repos/jlhawn/rethinkdb/pulls{/number}","milestones_url":"https://api.github.com/repos/jlhawn/rethinkdb/milestones{/number}","notifications_url":"https://api.github.com/repos/jlhawn/rethinkdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jlhawn/rethinkdb/labels{/name}","releases_url":"https://api.github.com/repos/jlhawn/rethinkdb/releases{/id}","deployments_url":"https://api.github.com/repos/jlhawn/rethinkdb/deployments","created_at":"2016-02-01T22:50:48Z","updated_at":"2016-02-01T22:51:01Z","pushed_at":"2016-02-19T05:03:59Z","git_url":"git://github.com/jlhawn/rethinkdb.git","ssh_url":"git@github.com:jlhawn/rethinkdb.git","clone_url":"https://github.com/jlhawn/rethinkdb.git","svn_url":"https://github.com/jlhawn/rethinkdb","homepage":"http://rethinkdb.com","size":129809,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"next"}},"base":{"label":"rethinkdb:v2.2.x","ref":"v2.2.x","sha":"21430b5ee21df6635d46f661030d62049df18a0c","user":{"login":"rethinkdb","id":1229647,"avatar_url":"https://avatars.githubusercontent.com/u/1229647?v=3","gravatar_id":"","url":"https://api.github.com/users/rethinkdb","html_url":"https://github.com/rethinkdb","followers_url":"https://api.github.com/users/rethinkdb/followers","following_url":"https://api.github.com/users/rethinkdb/following{/other_user}","gists_url":"https://api.github.com/users/rethinkdb/gists{/gist_id}","starred_url":"https://api.github.com/users/rethinkdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rethinkdb/subscriptions","organizations_url":"https://api.github.com/users/rethinkdb/orgs","repos_url":"https://api.github.com/users/rethinkdb/repos","events_url":"https://api.github.com/users/rethinkdb/events{/privacy}","received_events_url":"https://api.github.com/users/rethinkdb/received_events","type":"Organization","site_admin":false},"repo":{"id":6452529,"name":"rethinkdb","full_name":"rethinkdb/rethinkdb","owner":{"login":"rethinkdb","id":1229647,"avatar_url":"https://avatars.githubusercontent.com/u/1229647?v=3","gravatar_id":"","url":"https://api.github.com/users/rethinkdb","html_url":"https://github.com/rethinkdb","followers_url":"https://api.github.com/users/rethinkdb/followers","following_url":"https://api.github.com/users/rethinkdb/following{/other_user}","gists_url":"https://api.github.com/users/rethinkdb/gists{/gist_id}","starred_url":"https://api.github.com/users/rethinkdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rethinkdb/subscriptions","organizations_url":"https://api.github.com/users/rethinkdb/orgs","repos_url":"https://api.github.com/users/rethinkdb/repos","events_url":"https://api.github.com/users/rethinkdb/events{/privacy}","received_events_url":"https://api.github.com/users/rethinkdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rethinkdb/rethinkdb","description":"The open-source database for the realtime web.","fork":false,"url":"https://api.github.com/repos/rethinkdb/rethinkdb","forks_url":"https://api.github.com/repos/rethinkdb/rethinkdb/forks","keys_url":"https://api.github.com/repos/rethinkdb/rethinkdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rethinkdb/rethinkdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rethinkdb/rethinkdb/teams","hooks_url":"https://api.github.com/repos/rethinkdb/rethinkdb/hooks","issue_events_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/events{/number}","events_url":"https://api.github.com/repos/rethinkdb/rethinkdb/events","assignees_url":"https://api.github.com/repos/rethinkdb/rethinkdb/assignees{/user}","branches_url":"https://api.github.com/repos/rethinkdb/rethinkdb/branches{/branch}","tags_url":"https://api.github.com/repos/rethinkdb/rethinkdb/tags","blobs_url":"https://api.github.com/repos/rethinkdb/rethinkdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rethinkdb/rethinkdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rethinkdb/rethinkdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/rethinkdb/rethinkdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rethinkdb/rethinkdb/statuses/{sha}","languages_url":"https://api.github.com/repos/rethinkdb/rethinkdb/languages","stargazers_url":"https://api.github.com/repos/rethinkdb/rethinkdb/stargazers","contributors_url":"https://api.github.com/repos/rethinkdb/rethinkdb/contributors","subscribers_url":"https://api.github.com/repos/rethinkdb/rethinkdb/subscribers","subscription_url":"https://api.github.com/repos/rethinkdb/rethinkdb/subscription","commits_url":"https://api.github.com/repos/rethinkdb/rethinkdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/rethinkdb/rethinkdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/rethinkdb/rethinkdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/rethinkdb/rethinkdb/contents/{+path}","compare_url":"https://api.github.com/repos/rethinkdb/rethinkdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rethinkdb/rethinkdb/merges","archive_url":"https://api.github.com/repos/rethinkdb/rethinkdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rethinkdb/rethinkdb/downloads","issues_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues{/number}","pulls_url":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls{/number}","milestones_url":"https://api.github.com/repos/rethinkdb/rethinkdb/milestones{/number}","notifications_url":"https://api.github.com/repos/rethinkdb/rethinkdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rethinkdb/rethinkdb/labels{/name}","releases_url":"https://api.github.com/repos/rethinkdb/rethinkdb/releases{/id}","deployments_url":"https://api.github.com/repos/rethinkdb/rethinkdb/deployments","created_at":"2012-10-30T05:37:47Z","updated_at":"2016-02-23T18:37:32Z","pushed_at":"2016-02-23T19:36:06Z","git_url":"git://github.com/rethinkdb/rethinkdb.git","ssh_url":"git@github.com:rethinkdb/rethinkdb.git","clone_url":"https://github.com/rethinkdb/rethinkdb.git","svn_url":"https://github.com/rethinkdb/rethinkdb","homepage":"http://rethinkdb.com","size":438215,"stargazers_count":12440,"watchers_count":12440,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1004,"mirror_url":null,"open_issues_count":1275,"forks":1004,"open_issues":1275,"watchers":12440,"default_branch":"next"}},"_links":{"self":{"href":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/5381"},"html":{"href":"https://github.com/rethinkdb/rethinkdb/pull/5381"},"issue":{"href":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/5381"},"comments":{"href":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/5381/comments"},"review_comments":{"href":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/5381/comments"},"review_comment":{"href":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rethinkdb/rethinkdb/pulls/5381/commits"},"statuses":{"href":"https://api.github.com/repos/rethinkdb/rethinkdb/statuses/c4f7adbbb278891091e23c0af8bff4490d482025"}}}}