{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/comments/39446372","id":39446372,"diff_hunk":"@@ -0,0 +1,1219 @@\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+using System.Diagnostics;\n+using Microsoft.Win32.SafeHandles;\n+using System.Runtime.InteropServices;\n+using System.Security.Authentication.ExtendedProtection;\n+\n+namespace System.Net.Security\n+{\n+    //\n+    // Used when working with SSPI APIs, like SafeSspiAuthDataHandle(). Holds the pointer to the auth data blob.\n+    //\n+#if DEBUG\n+    internal sealed class SafeSspiAuthDataHandle : DebugSafeHandle\n+    {\n+#else\n+    internal sealed class SafeSspiAuthDataHandle : SafeHandleZeroOrMinusOneIsInvalid\n+    {\n+#endif\n+        public SafeSspiAuthDataHandle() : base(true)\n+        {\n+        }\n+\n+        protected override bool ReleaseHandle()\n+        {\n+            return Interop.Secur32.SspiFreeAuthIdentity(handle) == Interop.SecurityStatus.OK;\n+        }\n+    }\n+\n+    //\n+    //  A set of Safe Handles that depend on native FreeContextBuffer finalizer\n+    //\n+#if DEBUG\n+    internal abstract class SafeFreeContextBuffer : DebugSafeHandle\n+    {\n+#else\n+    internal abstract class SafeFreeContextBuffer : SafeHandleZeroOrMinusOneIsInvalid\n+    {\n+#endif\n+        protected SafeFreeContextBuffer() : base(true) { }\n+\n+        // This must be ONLY called from this file and in the context of a CER\n+        internal unsafe void Set(IntPtr value)\n+        {\n+            this.handle = value;\n+        }\n+\n+        internal static int EnumeratePackages(out int pkgnum, out SafeFreeContextBuffer pkgArray)\n+        {\n+            int res = -1;\n+            SafeFreeContextBuffer_SECURITY pkgArray_SECURITY = null;","path":"src/System.Net.Security/src/System/Net/SecureProtocols/_SecuritySafeHandles.Windows.cs","position":52,"original_position":52,"commit_id":"7261d4b1ab0e6fee20585d58b2b9cc1b82db72c1","original_commit_id":"7261d4b1ab0e6fee20585d58b2b9cc1b82db72c1","user":{"login":"CIPop","id":8635911,"avatar_url":"https://avatars.githubusercontent.com/u/8635911?v=3","gravatar_id":"","url":"https://api.github.com/users/CIPop","html_url":"https://github.com/CIPop","followers_url":"https://api.github.com/users/CIPop/followers","following_url":"https://api.github.com/users/CIPop/following{/other_user}","gists_url":"https://api.github.com/users/CIPop/gists{/gist_id}","starred_url":"https://api.github.com/users/CIPop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CIPop/subscriptions","organizations_url":"https://api.github.com/users/CIPop/orgs","repos_url":"https://api.github.com/users/CIPop/repos","events_url":"https://api.github.com/users/CIPop/events{/privacy}","received_events_url":"https://api.github.com/users/CIPop/received_events","type":"User","site_admin":false},"body":"Not sure I understand the comment. EnumeratePackages looks like a factory method: it creates a `SafeFreeContextBuffer`. The handle returned can be invalid:\r\n```C#\r\n            SafeFreeContextBuffer_SECURITY pkgArray_SECURITY = null;\r\n            res = Interop.SafeNetHandles_SECURITY.EnumerateSecurityPackagesW(out pkgnum, out pkgArray_SECURITY);\r\n            pkgArray = pkgArray_SECURITY;\r\n\r\n            if (res != 0 && pkgArray != null)\r\n            {\r\n                pkgArray.SetHandleAsInvalid();\r\n            }\r\n```","created_at":"2015-09-14T20:59:53Z","updated_at":"2015-09-14T20:59:53Z","html_url":"https://github.com/dotnet/corefx/pull/3113#discussion_r39446372","pull_request_url":"https://api.github.com/repos/dotnet/corefx/pulls/3113","_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments/39446372"},"html":{"href":"https://github.com/dotnet/corefx/pull/3113#discussion_r39446372"},"pull_request":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/3113"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/3113","id":44380670,"html_url":"https://github.com/dotnet/corefx/pull/3113","diff_url":"https://github.com/dotnet/corefx/pull/3113.diff","patch_url":"https://github.com/dotnet/corefx/pull/3113.patch","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/3113","number":3113,"state":"open","locked":false,"title":"Porting System.Net.Security","user":{"login":"CIPop","id":8635911,"avatar_url":"https://avatars.githubusercontent.com/u/8635911?v=3","gravatar_id":"","url":"https://api.github.com/users/CIPop","html_url":"https://github.com/CIPop","followers_url":"https://api.github.com/users/CIPop/followers","following_url":"https://api.github.com/users/CIPop/following{/other_user}","gists_url":"https://api.github.com/users/CIPop/gists{/gist_id}","starred_url":"https://api.github.com/users/CIPop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CIPop/subscriptions","organizations_url":"https://api.github.com/users/CIPop/orgs","repos_url":"https://api.github.com/users/CIPop/repos","events_url":"https://api.github.com/users/CIPop/events{/privacy}","received_events_url":"https://api.github.com/users/CIPop/received_events","type":"User","site_admin":false},"body":"Missing issues for TODO comments. Will create the tracking issue and update the code, author (dotnetbot) and reference the tracking issue.\r\n\r\n@davidsh @bartonjs @pgavlin @stephentoub @SidharthNabar  PTAL.\r\n","created_at":"2015-09-07T21:59:42Z","updated_at":"2015-09-14T20:59:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf8776f3f97d8e49fc16c42cafe784515edcd90a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/corefx/pulls/3113/commits","review_comments_url":"https://api.github.com/repos/dotnet/corefx/pulls/3113/comments","review_comment_url":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/3113/comments","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/7261d4b1ab0e6fee20585d58b2b9cc1b82db72c1","head":{"label":"CIPop:SNSecurityPR","ref":"SNSecurityPR","sha":"7261d4b1ab0e6fee20585d58b2b9cc1b82db72c1","user":{"login":"CIPop","id":8635911,"avatar_url":"https://avatars.githubusercontent.com/u/8635911?v=3","gravatar_id":"","url":"https://api.github.com/users/CIPop","html_url":"https://github.com/CIPop","followers_url":"https://api.github.com/users/CIPop/followers","following_url":"https://api.github.com/users/CIPop/following{/other_user}","gists_url":"https://api.github.com/users/CIPop/gists{/gist_id}","starred_url":"https://api.github.com/users/CIPop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CIPop/subscriptions","organizations_url":"https://api.github.com/users/CIPop/orgs","repos_url":"https://api.github.com/users/CIPop/repos","events_url":"https://api.github.com/users/CIPop/events{/privacy}","received_events_url":"https://api.github.com/users/CIPop/received_events","type":"User","site_admin":false},"repo":{"id":37789108,"name":"corefx","full_name":"CIPop/corefx","owner":{"login":"CIPop","id":8635911,"avatar_url":"https://avatars.githubusercontent.com/u/8635911?v=3","gravatar_id":"","url":"https://api.github.com/users/CIPop","html_url":"https://github.com/CIPop","followers_url":"https://api.github.com/users/CIPop/followers","following_url":"https://api.github.com/users/CIPop/following{/other_user}","gists_url":"https://api.github.com/users/CIPop/gists{/gist_id}","starred_url":"https://api.github.com/users/CIPop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CIPop/subscriptions","organizations_url":"https://api.github.com/users/CIPop/orgs","repos_url":"https://api.github.com/users/CIPop/repos","events_url":"https://api.github.com/users/CIPop/events{/privacy}","received_events_url":"https://api.github.com/users/CIPop/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/CIPop/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/CIPop/corefx","forks_url":"https://api.github.com/repos/CIPop/corefx/forks","keys_url":"https://api.github.com/repos/CIPop/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CIPop/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CIPop/corefx/teams","hooks_url":"https://api.github.com/repos/CIPop/corefx/hooks","issue_events_url":"https://api.github.com/repos/CIPop/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/CIPop/corefx/events","assignees_url":"https://api.github.com/repos/CIPop/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/CIPop/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/CIPop/corefx/tags","blobs_url":"https://api.github.com/repos/CIPop/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CIPop/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CIPop/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/CIPop/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CIPop/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/CIPop/corefx/languages","stargazers_url":"https://api.github.com/repos/CIPop/corefx/stargazers","contributors_url":"https://api.github.com/repos/CIPop/corefx/contributors","subscribers_url":"https://api.github.com/repos/CIPop/corefx/subscribers","subscription_url":"https://api.github.com/repos/CIPop/corefx/subscription","commits_url":"https://api.github.com/repos/CIPop/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/CIPop/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/CIPop/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/CIPop/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/CIPop/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/CIPop/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CIPop/corefx/merges","archive_url":"https://api.github.com/repos/CIPop/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CIPop/corefx/downloads","issues_url":"https://api.github.com/repos/CIPop/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/CIPop/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/CIPop/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/CIPop/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CIPop/corefx/labels{/name}","releases_url":"https://api.github.com/repos/CIPop/corefx/releases{/id}","created_at":"2015-06-20T23:04:57Z","updated_at":"2015-09-09T08:20:51Z","pushed_at":"2015-09-14T18:02:48Z","git_url":"git://github.com/CIPop/corefx.git","ssh_url":"git@github.com:CIPop/corefx.git","clone_url":"https://github.com/CIPop/corefx.git","svn_url":"https://github.com/CIPop/corefx","homepage":"http://dotnet.github.io/core/","size":32331,"stargazers_count":1,"watchers_count":1,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"f41c09dbb93723d62787e5b3973cd3fc8666fec8","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}","created_at":"2014-11-06T23:42:48Z","updated_at":"2015-09-14T17:39:01Z","pushed_at":"2015-09-14T20:38:49Z","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/core/","size":67369,"stargazers_count":8335,"watchers_count":8335,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1783,"mirror_url":null,"open_issues_count":616,"forks":1783,"open_issues":616,"watchers":8335,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/3113"},"html":{"href":"https://github.com/dotnet/corefx/pull/3113"},"issue":{"href":"https://api.github.com/repos/dotnet/corefx/issues/3113"},"comments":{"href":"https://api.github.com/repos/dotnet/corefx/issues/3113/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/3113/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/3113/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/corefx/statuses/7261d4b1ab0e6fee20585d58b2b9cc1b82db72c1"}}}}