{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/comments/50988535","id":50988535,"diff_hunk":"@@ -0,0 +1,257 @@\n+// Copyright (c) Microsoft. All rights reserved.\n+// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n+\n+#include \"pal_types.h\"\n+#include \"pal_utilities.h\"\n+#include \"pal_gssapi.h\"\n+\n+#if HAVE_GSSFW_HEADERS\n+#include <GSS/GSS.h>\n+#else\n+#include <gssapi/gssapi_ext.h>\n+#include <gssapi/gssapi_krb5.h>\n+#endif\n+\n+#include <assert.h>\n+#include <string.h>\n+\n+static_assert(PAL_GSS_C_DELEG_FLAG == GSS_C_DELEG_FLAG, \"\");\n+static_assert(PAL_GSS_C_MUTUAL_FLAG == GSS_C_MUTUAL_FLAG, \"\");\n+static_assert(PAL_GSS_C_REPLAY_FLAG == GSS_C_REPLAY_FLAG, \"\");\n+static_assert(PAL_GSS_C_SEQUENCE_FLAG == GSS_C_SEQUENCE_FLAG, \"\");\n+static_assert(PAL_GSS_C_CONF_FLAG == GSS_C_CONF_FLAG, \"\");\n+static_assert(PAL_GSS_C_INTEG_FLAG == GSS_C_INTEG_FLAG, \"\");\n+static_assert(PAL_GSS_C_ANON_FLAG == GSS_C_ANON_FLAG, \"\");\n+static_assert(PAL_GSS_C_PROT_READY_FLAG == GSS_C_PROT_READY_FLAG, \"\");\n+static_assert(PAL_GSS_C_TRANS_FLAG == GSS_C_TRANS_FLAG, \"\");\n+static_assert(PAL_GSS_C_DCE_STYLE == GSS_C_DCE_STYLE, \"\");\n+static_assert(PAL_GSS_C_IDENTIFY_FLAG == GSS_C_IDENTIFY_FLAG, \"\");\n+static_assert(PAL_GSS_C_EXTENDED_ERROR_FLAG == GSS_C_EXTENDED_ERROR_FLAG, \"\");\n+static_assert(PAL_GSS_C_DELEG_POLICY_FLAG == GSS_C_DELEG_POLICY_FLAG, \"\");\n+\n+static_assert(PAL_GSS_COMPLETE == GSS_S_COMPLETE, \"\");\n+static_assert(PAL_GSS_CONTINUE_NEEDED == GSS_S_CONTINUE_NEEDED, \"\");\n+\n+#if !(HAVE_GSS_SPNEGO_MECHANISM)\n+static char gss_mech_value[] = \"\\x2b\\x06\\x01\\x05\\x05\\x02\"; // Binary representation of SPNEGO Oid (RFC 4178)\n+#endif\n+static void NetSecurity_HandleError(uint32_t majorStatus, gss_buffer_t* outBufferHandle, uint32_t* outBufferLength)\n+{\n+    assert(outBufferHandle != nullptr);\n+    if (GSS_ERROR(majorStatus) || (*outBufferHandle)->length > UnsignedCast(std::numeric_limits<int>::max()))\n+    {\n+        uint32_t relBufferStatus;\n+        gss_release_buffer(&relBufferStatus, *outBufferHandle);\n+        *outBufferHandle = nullptr;\n+        *outBufferLength = 0;\n+    }\n+    else\n+    {\n+        *outBufferLength = static_cast<uint32_t>((*outBufferHandle)->length);\n+    }\n+}\n+\n+extern \"C\" uint32_t NetSecurity_AcquireCredSpNego(uint32_t* minorStatus,\n+                                                  gss_name_t desiredName,\n+                                                  int32_t isInitiate,\n+                                                  gss_cred_id_t* outputCredHandle)\n+{\n+    assert(outputCredHandle != nullptr);\n+    assert(isInitiate == 0 || isInitiate == 1);\n+#if HAVE_GSS_SPNEGO_MECHANISM\n+    gss_OID_set_desc gss_mech_spnego_OID_set_desc = {.count = 1, .elements = GSS_SPNEGO_MECHANISM};\n+#else\n+    gss_OID_desc gss_mech_spnego_OID_desc = {.length = 6, .value = static_cast<void*>(gss_mech_value)};\n+    gss_OID_set_desc gss_mech_spnego_OID_set_desc = {.count = 1, .elements = &gss_mech_spnego_OID_desc};\n+#endif\n+    gss_cred_usage_t credUsage = isInitiate ? GSS_C_INITIATE : GSS_C_ACCEPT;\n+    return gss_acquire_cred(\n+        minorStatus, desiredName, 0, &gss_mech_spnego_OID_set_desc, credUsage, outputCredHandle, nullptr, nullptr);\n+}\n+\n+extern \"C\" uint32_t NetSecurity_DeleteSecContext(uint32_t* minorStatus, gss_ctx_id_t* contextHandle)\n+{\n+    assert(contextHandle != nullptr);","path":"src/Native/System.Net.Security.Native/pal_gssapi.cpp","position":77,"original_position":74,"commit_id":"d1ce84dcd5fe5a1ea7355b633ab4883680f281d9","original_commit_id":"f7cfe62e31031bd7ec5a55267cbf75659202df35","user":{"login":"kapilash","id":113322,"avatar_url":"https://avatars.githubusercontent.com/u/113322?v=3","gravatar_id":"","url":"https://api.github.com/users/kapilash","html_url":"https://github.com/kapilash","followers_url":"https://api.github.com/users/kapilash/followers","following_url":"https://api.github.com/users/kapilash/following{/other_user}","gists_url":"https://api.github.com/users/kapilash/gists{/gist_id}","starred_url":"https://api.github.com/users/kapilash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kapilash/subscriptions","organizations_url":"https://api.github.com/users/kapilash/orgs","repos_url":"https://api.github.com/users/kapilash/repos","events_url":"https://api.github.com/users/kapilash/events{/privacy}","received_events_url":"https://api.github.com/users/kapilash/received_events","type":"User","site_admin":false},"body":"added it now. sorry about missing the minorStatus through out.","created_at":"2016-01-27T14:18:00Z","updated_at":"2016-01-27T14:18:00Z","html_url":"https://github.com/dotnet/corefx/pull/5500#discussion_r50988535","pull_request_url":"https://api.github.com/repos/dotnet/corefx/pulls/5500","_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments/50988535"},"html":{"href":"https://github.com/dotnet/corefx/pull/5500#discussion_r50988535"},"pull_request":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/5500"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/5500","id":56331189,"html_url":"https://github.com/dotnet/corefx/pull/5500","diff_url":"https://github.com/dotnet/corefx/pull/5500.diff","patch_url":"https://github.com/dotnet/corefx/pull/5500.patch","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/5500","number":5500,"state":"open","locked":false,"title":"Interop Layer for supporting xplat NegotiateStream","user":{"login":"kapilash","id":113322,"avatar_url":"https://avatars.githubusercontent.com/u/113322?v=3","gravatar_id":"","url":"https://api.github.com/users/kapilash","html_url":"https://github.com/kapilash","followers_url":"https://api.github.com/users/kapilash/followers","following_url":"https://api.github.com/users/kapilash/following{/other_user}","gists_url":"https://api.github.com/users/kapilash/gists{/gist_id}","starred_url":"https://api.github.com/users/kapilash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kapilash/subscriptions","organizations_url":"https://api.github.com/users/kapilash/orgs","repos_url":"https://api.github.com/users/kapilash/repos","events_url":"https://api.github.com/users/kapilash/events{/privacy}","received_events_url":"https://api.github.com/users/kapilash/received_events","type":"User","site_admin":false},"body":"Introducing native shims for libgssapi in order to support NegotiateStream","created_at":"2016-01-18T11:31:29Z","updated_at":"2016-01-27T14:18:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8ff4260f6bb010af55fa166659b6a407d9e7fe2b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/corefx/pulls/5500/commits","review_comments_url":"https://api.github.com/repos/dotnet/corefx/pulls/5500/comments","review_comment_url":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/5500/comments","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/d1ce84dcd5fe5a1ea7355b633ab4883680f281d9","head":{"label":"kapilash:spnego","ref":"spnego","sha":"d1ce84dcd5fe5a1ea7355b633ab4883680f281d9","user":{"login":"kapilash","id":113322,"avatar_url":"https://avatars.githubusercontent.com/u/113322?v=3","gravatar_id":"","url":"https://api.github.com/users/kapilash","html_url":"https://github.com/kapilash","followers_url":"https://api.github.com/users/kapilash/followers","following_url":"https://api.github.com/users/kapilash/following{/other_user}","gists_url":"https://api.github.com/users/kapilash/gists{/gist_id}","starred_url":"https://api.github.com/users/kapilash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kapilash/subscriptions","organizations_url":"https://api.github.com/users/kapilash/orgs","repos_url":"https://api.github.com/users/kapilash/repos","events_url":"https://api.github.com/users/kapilash/events{/privacy}","received_events_url":"https://api.github.com/users/kapilash/received_events","type":"User","site_admin":false},"repo":{"id":32931025,"name":"corefx","full_name":"kapilash/corefx","owner":{"login":"kapilash","id":113322,"avatar_url":"https://avatars.githubusercontent.com/u/113322?v=3","gravatar_id":"","url":"https://api.github.com/users/kapilash","html_url":"https://github.com/kapilash","followers_url":"https://api.github.com/users/kapilash/followers","following_url":"https://api.github.com/users/kapilash/following{/other_user}","gists_url":"https://api.github.com/users/kapilash/gists{/gist_id}","starred_url":"https://api.github.com/users/kapilash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kapilash/subscriptions","organizations_url":"https://api.github.com/users/kapilash/orgs","repos_url":"https://api.github.com/users/kapilash/repos","events_url":"https://api.github.com/users/kapilash/events{/privacy}","received_events_url":"https://api.github.com/users/kapilash/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kapilash/corefx","description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others.","fork":true,"url":"https://api.github.com/repos/kapilash/corefx","forks_url":"https://api.github.com/repos/kapilash/corefx/forks","keys_url":"https://api.github.com/repos/kapilash/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kapilash/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kapilash/corefx/teams","hooks_url":"https://api.github.com/repos/kapilash/corefx/hooks","issue_events_url":"https://api.github.com/repos/kapilash/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/kapilash/corefx/events","assignees_url":"https://api.github.com/repos/kapilash/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/kapilash/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/kapilash/corefx/tags","blobs_url":"https://api.github.com/repos/kapilash/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kapilash/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kapilash/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/kapilash/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kapilash/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/kapilash/corefx/languages","stargazers_url":"https://api.github.com/repos/kapilash/corefx/stargazers","contributors_url":"https://api.github.com/repos/kapilash/corefx/contributors","subscribers_url":"https://api.github.com/repos/kapilash/corefx/subscribers","subscription_url":"https://api.github.com/repos/kapilash/corefx/subscription","commits_url":"https://api.github.com/repos/kapilash/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/kapilash/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/kapilash/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/kapilash/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/kapilash/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/kapilash/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kapilash/corefx/merges","archive_url":"https://api.github.com/repos/kapilash/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kapilash/corefx/downloads","issues_url":"https://api.github.com/repos/kapilash/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/kapilash/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/kapilash/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/kapilash/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kapilash/corefx/labels{/name}","releases_url":"https://api.github.com/repos/kapilash/corefx/releases{/id}","deployments_url":"https://api.github.com/repos/kapilash/corefx/deployments","created_at":"2015-03-26T14:08:29Z","updated_at":"2016-01-11T04:01:08Z","pushed_at":"2016-01-27T14:09:41Z","git_url":"git://github.com/kapilash/corefx.git","ssh_url":"git@github.com:kapilash/corefx.git","clone_url":"https://github.com/kapilash/corefx.git","svn_url":"https://github.com/kapilash/corefx","homepage":"","size":46870,"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":"dotnet:master","ref":"master","sha":"9de289860651c00167aa5dafebabcf0d23668d1d","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":26295345,"name":"corefx","full_name":"dotnet/corefx","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/corefx","description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others.","fork":false,"url":"https://api.github.com/repos/dotnet/corefx","forks_url":"https://api.github.com/repos/dotnet/corefx/forks","keys_url":"https://api.github.com/repos/dotnet/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/corefx/teams","hooks_url":"https://api.github.com/repos/dotnet/corefx/hooks","issue_events_url":"https://api.github.com/repos/dotnet/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/corefx/events","assignees_url":"https://api.github.com/repos/dotnet/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/corefx/tags","blobs_url":"https://api.github.com/repos/dotnet/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/corefx/languages","stargazers_url":"https://api.github.com/repos/dotnet/corefx/stargazers","contributors_url":"https://api.github.com/repos/dotnet/corefx/contributors","subscribers_url":"https://api.github.com/repos/dotnet/corefx/subscribers","subscription_url":"https://api.github.com/repos/dotnet/corefx/subscription","commits_url":"https://api.github.com/repos/dotnet/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/corefx/merges","archive_url":"https://api.github.com/repos/dotnet/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/corefx/downloads","issues_url":"https://api.github.com/repos/dotnet/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/corefx/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/corefx/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/corefx/deployments","created_at":"2014-11-06T23:42:48Z","updated_at":"2016-01-27T13:59:52Z","pushed_at":"2016-01-27T14:09:46Z","git_url":"git://github.com/dotnet/corefx.git","ssh_url":"git@github.com:dotnet/corefx.git","clone_url":"https://github.com/dotnet/corefx.git","svn_url":"https://github.com/dotnet/corefx","homepage":"http://dotnet.github.io/","size":61010,"stargazers_count":9023,"watchers_count":9023,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2071,"mirror_url":null,"open_issues_count":795,"forks":2071,"open_issues":795,"watchers":9023,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/5500"},"html":{"href":"https://github.com/dotnet/corefx/pull/5500"},"issue":{"href":"https://api.github.com/repos/dotnet/corefx/issues/5500"},"comments":{"href":"https://api.github.com/repos/dotnet/corefx/issues/5500/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/5500/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/5500/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/corefx/statuses/d1ce84dcd5fe5a1ea7355b633ab4883680f281d9"}}}}