GitHub PullRequestReviewCommentEvent at 2014-03-07 18:33:59
Repository: riak-c-client
Actor: metadave
Payload: {"comment":{"url":"https://api.github.com/repos/basho/riak-c-client/pulls/comments/10393710","id":10393710,"diff_hunk":"@@ -82,9 +287,78 @@ void riak_connection_free(riak_connection** cxn_target) {\n \n     if (cxn->fd) {\n         close(cxn->fd);\n+    }\n \n+\n+    if(cxn->ssl) {\n+      SSL_free(cxn->ssl);\n     }\n+\n+    /*if(cxn->ssl_bio) {\n+      see the man page for SSL_free\n+      \"SSL_free() also calls the free()ing procedures for indirectly affected items,\n+      if applicable: the buffering BIO, the read and write BIOs, cipher lists specially\n+      created for this ssl, the SSL_SESSION. Do not explicitly free these indirectly freed\n+      up items before or after calling SSL_free(), as trying to free things twice may\n+      lead to program failure.\"\n+      BIO_free_all(cxn->ssl_bio);\n+    }*/\n+\n+    if(cxn->ssl_context) {\n+      SSL_CTX_free(cxn->ssl_context);\n+    }\n+\n     if (cxn->addrinfo != NULL) freeaddrinfo(cxn->addrinfo);\n     riak_free(cfg, cxn_target);\n }\n \n+\n+riak_error\n+riak_security_credentials_new(riak_config *cfg,\n+                              riak_security_credentials **creds_target,\n+                              char *username,\n+                              char *password,\n+                              char *cacertfile) {\n+    riak_security_credentials *creds= (riak_security_credentials*)(cfg->malloc_fn)(sizeof(riak_security_credentials));\n+    if (creds == NULL) {\n+        riak_log_critical_config(cfg, \"%s\", \"Could not allocate riak_security_credentials\");\n+        return ERIAK_OUT_OF_MEMORY;\n+    }\n+    memset((void*)creds, '\\0', sizeof(riak_security_credentials));\n+    *creds_target = creds;\n+    // TODO: should we allow this to be passed in with riak_security_creds?\n+    creds->ssl_method = SSLv23_client_method();","path":"src/riak_connection.c","position":277,"original_position":277,"commit_id":"b0a943770342567d737d0c8389c23a1dfcf3b9ff","original_commit_id":"e252908b7b10cff2159ca171743d51acb5df72af","user":{"login":"metadave","id":58244,"avatar_url":"https://gravatar.com/avatar/2a181b6e2658ad4106ea2bdd35e601f8?d=https%3A%2F%2Fidenticons.github.com%2F2596a5e119b63ccc73b675925f6aa228.png&r=x","gravatar_id":"2a181b6e2658ad4106ea2bdd35e601f8","url":"https://api.github.com/users/metadave","html_url":"https://github.com/metadave","followers_url":"https://api.github.com/users/metadave/followers","following_url":"https://api.github.com/users/metadave/following{/other_user}","gists_url":"https://api.github.com/users/metadave/gists{/gist_id}","starred_url":"https://api.github.com/users/metadave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metadave/subscriptions","organizations_url":"https://api.github.com/users/metadave/orgs","repos_url":"https://api.github.com/users/metadave/repos","events_url":"https://api.github.com/users/metadave/events{/privacy}","received_events_url":"https://api.github.com/users/metadave/received_events","type":"User","site_admin":false},"body":"the `SSLv23_method` symbol won't be available at compile time for older distros of OpenSSL, so \"probing\" for capabilities might be more difficult to do here. I'm thinking of making the SSL_METHOD a param here: \r\n```c\r\nriak_error\r\nriak_security_credentials_new(riak_config *cfg,\r\n                              riak_security_credentials **creds_target,\r\n                              char *username,\r\n                              char *password,\r\n                              char *cacertfile,\r\n                              const SSL_METHOD *ssl_method);\r\n```","created_at":"2014-03-07T18:33:59Z","updated_at":"2014-03-07T18:33:59Z","html_url":"https://github.com/basho/riak-c-client/pull/57#discussion_r10393710","pull_request_url":"https://api.github.com/repos/basho/riak-c-client/pulls/57","_links":{"self":{"href":"https://api.github.com/repos/basho/riak-c-client/pulls/comments/10393710"},"html":{"href":"https://github.com/basho/riak-c-client/pull/57#discussion_r10393710"},"pull_request":{"href":"https://api.github.com/repos/basho/riak-c-client/pulls/57"}}}}