{"action":"created","comment":{"url":"https://api.github.com/repos/OpenXT/xctools/pulls/comments/28019765","id":28019765,"diff_hunk":"@@ -0,0 +1,382 @@\n+//\n+// Copyright (c) 2015 Assured Information Security, Inc\n+//\n+// Dates Modified:\n+//  - 4/8/2015: Initial commit\n+//    Rian Quinn <quinnr@ainfosec.com>\n+//\n+// This program is free software; you can redistribute it and/or modify\n+// it under the terms of the GNU General Public License as published by\n+// the Free Software Foundation; either version 2 of the License, or\n+// (at your option) any later version.\n+//\n+// This program is distributed in the hope that it will be useful,\n+// but WITHOUT ANY WARRANTY; without even the implied warranty of\n+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+// GNU General Public License for more details.\n+//\n+// You should have received a copy of the GNU General Public License\n+// along with this program; if not, write to the Free Software\n+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n+//\n+\n+#include \"openxtv4v.h\"\n+#include \"openxtdebug.h\"\n+\n+///\n+/// This is the main function to setup your V4V connection to another domain.\n+/// The following provides suggested arguments for this function:\n+///\n+/// Clients\n+/// - local port = V4V_PORT_NONE\n+/// - local domid = V4V_DOMID_ANY\n+/// - remote port = <port #>\n+/// - remote domid = <server domid, likely == 0>\n+///\n+/// Servers\n+/// - local port = <port #>\n+/// - local domid = V4V_DOMID_ANY\n+/// - remote port = V4V_PORT_NONE\n+/// - remote domid = <client domid>\n+///\n+/// @param lport local port\n+/// @param ldomid local domid\n+/// @param rport remote port\n+/// @param rdomid remote domid\n+///\n+/// @return NULL on failure, valid pointer on success\n+///\n+V4VConnection *openxt_v4v_open(int32_t lport, int32_t ldomid, int32_t rport, int32_t rdomid)\n+{\n+    // Create a new connection structure\n+    V4VConnection *conn = malloc(sizeof(V4VConnection));\n+\n+    // Initialize the connection for safety.\n+    conn->fd = 0;\n+    conn->connected = false;\n+    conn->local_addr.port = lport;\n+    conn->local_addr.domain = ldomid;\n+    conn->remote_addr.port = rport;\n+    conn->remote_addr.domain = rdomid;\n+\n+    // Attempt to open a V4V socket\n+    if((conn->fd = v4v_socket(SOCK_DGRAM)) <= 0)\n+        goto done;\n+\n+    // Bind to V4V\n+    if(v4v_bind(conn->fd, &conn->local_addr, conn->remote_addr.domain) != 0)\n+        goto done;\n+\n+    // We are now connected\n+    conn->connected = true;\n+\n+done:\n+\n+    // Success\n+    return conn;\n+}\n+\n+\n+///\n+/// The following is for internal use only.\n+///\n+int openxt_v4v_close_internal(V4VConnection *conn)\n+{\n+    int ret = 0;\n+\n+    // Sanity checks\n+    openxt_checkp(conn, -EINVAL);\n+\n+    // Close V4V\n+    if (conn->fd)","path":"audio_helper/src/openxtv4v.c","position":91,"original_position":91,"commit_id":"685d0273059d76cc50c77969297870b590acd735","original_commit_id":"685d0273059d76cc50c77969297870b590acd735","user":{"login":"cjp256","id":3318649,"avatar_url":"https://avatars.githubusercontent.com/u/3318649?v=3","gravatar_id":"","url":"https://api.github.com/users/cjp256","html_url":"https://github.com/cjp256","followers_url":"https://api.github.com/users/cjp256/followers","following_url":"https://api.github.com/users/cjp256/following{/other_user}","gists_url":"https://api.github.com/users/cjp256/gists{/gist_id}","starred_url":"https://api.github.com/users/cjp256/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjp256/subscriptions","organizations_url":"https://api.github.com/users/cjp256/orgs","repos_url":"https://api.github.com/users/cjp256/repos","events_url":"https://api.github.com/users/cjp256/events{/privacy}","received_events_url":"https://api.github.com/users/cjp256/received_events","type":"User","site_admin":false},"body":"fd should be checked if >= 0, 0 is a valid fd.","created_at":"2015-04-08T22:19:17Z","updated_at":"2015-04-08T22:19:17Z","html_url":"https://github.com/OpenXT/xctools/pull/3#discussion_r28019765","pull_request_url":"https://api.github.com/repos/OpenXT/xctools/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/OpenXT/xctools/pulls/comments/28019765"},"html":{"href":"https://github.com/OpenXT/xctools/pull/3#discussion_r28019765"},"pull_request":{"href":"https://api.github.com/repos/OpenXT/xctools/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/OpenXT/xctools/pulls/3","id":32902594,"html_url":"https://github.com/OpenXT/xctools/pull/3","diff_url":"https://github.com/OpenXT/xctools/pull/3.diff","patch_url":"https://github.com/OpenXT/xctools/pull/3.patch","issue_url":"https://api.github.com/repos/OpenXT/xctools/issues/3","number":3,"state":"open","locked":false,"title":"New audio code","user":{"login":"rianquinn","id":5932003,"avatar_url":"https://avatars.githubusercontent.com/u/5932003?v=3","gravatar_id":"","url":"https://api.github.com/users/rianquinn","html_url":"https://github.com/rianquinn","followers_url":"https://api.github.com/users/rianquinn/followers","following_url":"https://api.github.com/users/rianquinn/following{/other_user}","gists_url":"https://api.github.com/users/rianquinn/gists{/gist_id}","starred_url":"https://api.github.com/users/rianquinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rianquinn/subscriptions","organizations_url":"https://api.github.com/users/rianquinn/orgs","repos_url":"https://api.github.com/users/rianquinn/repos","events_url":"https://api.github.com/users/rianquinn/events{/privacy}","received_events_url":"https://api.github.com/users/rianquinn/received_events","type":"User","site_admin":false},"body":"New audio code\r\n\r\nLong description:\r\nThese changes bring in a bunch of audio fixes, including a new audio\r\nfront/back driver model for QEMU 1.4. The following was addressed:\r\n- General quest instability\r\n- Performance issues with capture and playback (there were a lot\r\n  of unneeded world switches due to v4v API)\r\n- Security cleanup (the old code had known buffer overflow attacks\r\n  and handle rewrite attack vulnerabilities)\r\n- Added error validation (the old code had little to no error checks)\r\n- Bugs with amixer patch. The patch was moved to the audio helper removing\r\n  the need to patch ALSA. This was a relatively easy thing to do as the\r\n  audio helper and amixer have to do the same kind of tasks\r\n- Changes to init script (the old init script over-wrote the ALSA state\r\n  on reboot, so settings in the UIVM would roll-back on each reboot)\r\n- Patch queue cleanup\r\n- Recipe cleanup\r\n- SELinux work to support init script\r\n\r\nBugs:\r\nOXT-133: Qemu 1.4 crash during tools install\r\nOXT-220: Qemu 1.4: sometimes the VM volume defaults to 0\r\nOXT-234: amixer patch\r\nOXT-189: Mic mute not working\r\nOXT-196: Audio on Dell Latitude E6540\r\nOXT-195: Audio on HP 2570p\r\nOXT-194: Audio Capture Setting not working\r\n\r\nSinged-off-by: Rian Quinn <quinnr@ainfosec.com>","created_at":"2015-04-08T21:12:13Z","updated_at":"2015-04-08T22:19:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b71ecde6c611f086fe18b45cf2f0c000f5e7b81b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OpenXT/xctools/pulls/3/commits","review_comments_url":"https://api.github.com/repos/OpenXT/xctools/pulls/3/comments","review_comment_url":"https://api.github.com/repos/OpenXT/xctools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenXT/xctools/issues/3/comments","statuses_url":"https://api.github.com/repos/OpenXT/xctools/statuses/685d0273059d76cc50c77969297870b590acd735","head":{"label":"rianquinn:audio-next","ref":"audio-next","sha":"685d0273059d76cc50c77969297870b590acd735","user":{"login":"rianquinn","id":5932003,"avatar_url":"https://avatars.githubusercontent.com/u/5932003?v=3","gravatar_id":"","url":"https://api.github.com/users/rianquinn","html_url":"https://github.com/rianquinn","followers_url":"https://api.github.com/users/rianquinn/followers","following_url":"https://api.github.com/users/rianquinn/following{/other_user}","gists_url":"https://api.github.com/users/rianquinn/gists{/gist_id}","starred_url":"https://api.github.com/users/rianquinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rianquinn/subscriptions","organizations_url":"https://api.github.com/users/rianquinn/orgs","repos_url":"https://api.github.com/users/rianquinn/repos","events_url":"https://api.github.com/users/rianquinn/events{/privacy}","received_events_url":"https://api.github.com/users/rianquinn/received_events","type":"User","site_admin":false},"repo":{"id":33632069,"name":"xctools","full_name":"rianquinn/xctools","owner":{"login":"rianquinn","id":5932003,"avatar_url":"https://avatars.githubusercontent.com/u/5932003?v=3","gravatar_id":"","url":"https://api.github.com/users/rianquinn","html_url":"https://github.com/rianquinn","followers_url":"https://api.github.com/users/rianquinn/followers","following_url":"https://api.github.com/users/rianquinn/following{/other_user}","gists_url":"https://api.github.com/users/rianquinn/gists{/gist_id}","starred_url":"https://api.github.com/users/rianquinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rianquinn/subscriptions","organizations_url":"https://api.github.com/users/rianquinn/orgs","repos_url":"https://api.github.com/users/rianquinn/repos","events_url":"https://api.github.com/users/rianquinn/events{/privacy}","received_events_url":"https://api.github.com/users/rianquinn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rianquinn/xctools","description":"","fork":true,"url":"https://api.github.com/repos/rianquinn/xctools","forks_url":"https://api.github.com/repos/rianquinn/xctools/forks","keys_url":"https://api.github.com/repos/rianquinn/xctools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rianquinn/xctools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rianquinn/xctools/teams","hooks_url":"https://api.github.com/repos/rianquinn/xctools/hooks","issue_events_url":"https://api.github.com/repos/rianquinn/xctools/issues/events{/number}","events_url":"https://api.github.com/repos/rianquinn/xctools/events","assignees_url":"https://api.github.com/repos/rianquinn/xctools/assignees{/user}","branches_url":"https://api.github.com/repos/rianquinn/xctools/branches{/branch}","tags_url":"https://api.github.com/repos/rianquinn/xctools/tags","blobs_url":"https://api.github.com/repos/rianquinn/xctools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rianquinn/xctools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rianquinn/xctools/git/refs{/sha}","trees_url":"https://api.github.com/repos/rianquinn/xctools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rianquinn/xctools/statuses/{sha}","languages_url":"https://api.github.com/repos/rianquinn/xctools/languages","stargazers_url":"https://api.github.com/repos/rianquinn/xctools/stargazers","contributors_url":"https://api.github.com/repos/rianquinn/xctools/contributors","subscribers_url":"https://api.github.com/repos/rianquinn/xctools/subscribers","subscription_url":"https://api.github.com/repos/rianquinn/xctools/subscription","commits_url":"https://api.github.com/repos/rianquinn/xctools/commits{/sha}","git_commits_url":"https://api.github.com/repos/rianquinn/xctools/git/commits{/sha}","comments_url":"https://api.github.com/repos/rianquinn/xctools/comments{/number}","issue_comment_url":"https://api.github.com/repos/rianquinn/xctools/issues/comments{/number}","contents_url":"https://api.github.com/repos/rianquinn/xctools/contents/{+path}","compare_url":"https://api.github.com/repos/rianquinn/xctools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rianquinn/xctools/merges","archive_url":"https://api.github.com/repos/rianquinn/xctools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rianquinn/xctools/downloads","issues_url":"https://api.github.com/repos/rianquinn/xctools/issues{/number}","pulls_url":"https://api.github.com/repos/rianquinn/xctools/pulls{/number}","milestones_url":"https://api.github.com/repos/rianquinn/xctools/milestones{/number}","notifications_url":"https://api.github.com/repos/rianquinn/xctools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rianquinn/xctools/labels{/name}","releases_url":"https://api.github.com/repos/rianquinn/xctools/releases{/id}","created_at":"2015-04-08T21:01:32Z","updated_at":"2015-04-08T21:01:33Z","pushed_at":"2015-04-08T21:10:32Z","git_url":"git://github.com/rianquinn/xctools.git","ssh_url":"git@github.com:rianquinn/xctools.git","clone_url":"https://github.com/rianquinn/xctools.git","svn_url":"https://github.com/rianquinn/xctools","homepage":null,"size":2586,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"OpenXT:master","ref":"master","sha":"619ed7b504a2a4aa393abe19bd4ca643b92c8696","user":{"login":"OpenXT","id":7283187,"avatar_url":"https://avatars.githubusercontent.com/u/7283187?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenXT","html_url":"https://github.com/OpenXT","followers_url":"https://api.github.com/users/OpenXT/followers","following_url":"https://api.github.com/users/OpenXT/following{/other_user}","gists_url":"https://api.github.com/users/OpenXT/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenXT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenXT/subscriptions","organizations_url":"https://api.github.com/users/OpenXT/orgs","repos_url":"https://api.github.com/users/OpenXT/repos","events_url":"https://api.github.com/users/OpenXT/events{/privacy}","received_events_url":"https://api.github.com/users/OpenXT/received_events","type":"Organization","site_admin":false},"repo":{"id":20779275,"name":"xctools","full_name":"OpenXT/xctools","owner":{"login":"OpenXT","id":7283187,"avatar_url":"https://avatars.githubusercontent.com/u/7283187?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenXT","html_url":"https://github.com/OpenXT","followers_url":"https://api.github.com/users/OpenXT/followers","following_url":"https://api.github.com/users/OpenXT/following{/other_user}","gists_url":"https://api.github.com/users/OpenXT/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenXT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenXT/subscriptions","organizations_url":"https://api.github.com/users/OpenXT/orgs","repos_url":"https://api.github.com/users/OpenXT/repos","events_url":"https://api.github.com/users/OpenXT/events{/privacy}","received_events_url":"https://api.github.com/users/OpenXT/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenXT/xctools","description":"","fork":false,"url":"https://api.github.com/repos/OpenXT/xctools","forks_url":"https://api.github.com/repos/OpenXT/xctools/forks","keys_url":"https://api.github.com/repos/OpenXT/xctools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenXT/xctools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenXT/xctools/teams","hooks_url":"https://api.github.com/repos/OpenXT/xctools/hooks","issue_events_url":"https://api.github.com/repos/OpenXT/xctools/issues/events{/number}","events_url":"https://api.github.com/repos/OpenXT/xctools/events","assignees_url":"https://api.github.com/repos/OpenXT/xctools/assignees{/user}","branches_url":"https://api.github.com/repos/OpenXT/xctools/branches{/branch}","tags_url":"https://api.github.com/repos/OpenXT/xctools/tags","blobs_url":"https://api.github.com/repos/OpenXT/xctools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenXT/xctools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenXT/xctools/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenXT/xctools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenXT/xctools/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenXT/xctools/languages","stargazers_url":"https://api.github.com/repos/OpenXT/xctools/stargazers","contributors_url":"https://api.github.com/repos/OpenXT/xctools/contributors","subscribers_url":"https://api.github.com/repos/OpenXT/xctools/subscribers","subscription_url":"https://api.github.com/repos/OpenXT/xctools/subscription","commits_url":"https://api.github.com/repos/OpenXT/xctools/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenXT/xctools/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenXT/xctools/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenXT/xctools/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenXT/xctools/contents/{+path}","compare_url":"https://api.github.com/repos/OpenXT/xctools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenXT/xctools/merges","archive_url":"https://api.github.com/repos/OpenXT/xctools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenXT/xctools/downloads","issues_url":"https://api.github.com/repos/OpenXT/xctools/issues{/number}","pulls_url":"https://api.github.com/repos/OpenXT/xctools/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenXT/xctools/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenXT/xctools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenXT/xctools/labels{/name}","releases_url":"https://api.github.com/repos/OpenXT/xctools/releases{/id}","created_at":"2014-06-12T18:57:34Z","updated_at":"2015-04-08T21:05:10Z","pushed_at":"2015-04-08T21:12:13Z","git_url":"git://github.com/OpenXT/xctools.git","ssh_url":"git@github.com:OpenXT/xctools.git","clone_url":"https://github.com/OpenXT/xctools.git","svn_url":"https://github.com/OpenXT/xctools","homepage":null,"size":2586,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":1,"forks":4,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenXT/xctools/pulls/3"},"html":{"href":"https://github.com/OpenXT/xctools/pull/3"},"issue":{"href":"https://api.github.com/repos/OpenXT/xctools/issues/3"},"comments":{"href":"https://api.github.com/repos/OpenXT/xctools/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenXT/xctools/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenXT/xctools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenXT/xctools/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/OpenXT/xctools/statuses/685d0273059d76cc50c77969297870b590acd735"}}}}