{"action":"created","comment":{"url":"https://api.github.com/repos/docker/distribution/pulls/comments/75912887","id":75912887,"diff_hunk":"@@ -60,7 +53,32 @@ func (ac *accessController) Authorized(ctx context.Context, accessRecords ...aut\n \t\t}\n \t}\n \n-\tif err := ac.AuthenticateUser(username, password); err != nil {\n+\t// Dynamically parsing the latest account list\n+\tfstat, err := os.Stat(ac.path)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\tlastModified := fstat.ModTime().String()\n+\tac.mtx.Lock()\n+\tif ac.modtime != lastModified {\n+\t\tac.modtime = lastModified\n+\n+\t\tf, err := os.Open(ac.path)\n+\t\tif err != nil {\n+\t\t\treturn nil, err\n+\t\t}\n+\t\tdefer f.Close()\n+\n+\t\th, err := newHTPasswd(f)\n+\t\tif err != nil {\n+\t\t\treturn nil, err\n+\t\t}\n+\t\tac.htpasswd = h\n+\t}\n+\tac.mtx.Unlock()\n+\n+\tif err := ac.htpasswd.authenticateUser(username, password); err != nil {","path":"registry/auth/htpasswd/access.go","position":68,"original_position":68,"commit_id":"235daeba076c320f1aa0ced5ffcb435f161d1cd0","original_commit_id":"235daeba076c320f1aa0ced5ffcb435f161d1cd0","user":{"login":"aaronlehmann","id":10601430,"avatar_url":"https://avatars.githubusercontent.com/u/10601430?v=3","gravatar_id":"","url":"https://api.github.com/users/aaronlehmann","html_url":"https://github.com/aaronlehmann","followers_url":"https://api.github.com/users/aaronlehmann/followers","following_url":"https://api.github.com/users/aaronlehmann/following{/other_user}","gists_url":"https://api.github.com/users/aaronlehmann/gists{/gist_id}","starred_url":"https://api.github.com/users/aaronlehmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaronlehmann/subscriptions","organizations_url":"https://api.github.com/users/aaronlehmann/orgs","repos_url":"https://api.github.com/users/aaronlehmann/repos","events_url":"https://api.github.com/users/aaronlehmann/events{/privacy}","received_events_url":"https://api.github.com/users/aaronlehmann/received_events","type":"User","site_admin":false},"body":"You also need to hold the lock when you access `ac.htpasswd`.\r\n\r\nMaybe set a local variable to the value of `ac.htpasswd` before releasing the lock above.","created_at":"2016-08-23T17:28:00Z","updated_at":"2016-08-23T17:28:00Z","html_url":"https://github.com/docker/distribution/pull/1885#discussion_r75912887","pull_request_url":"https://api.github.com/repos/docker/distribution/pulls/1885","_links":{"self":{"href":"https://api.github.com/repos/docker/distribution/pulls/comments/75912887"},"html":{"href":"https://github.com/docker/distribution/pull/1885#discussion_r75912887"},"pull_request":{"href":"https://api.github.com/repos/docker/distribution/pulls/1885"}}},"pull_request":{"url":"https://api.github.com/repos/docker/distribution/pulls/1885","id":80290267,"html_url":"https://github.com/docker/distribution/pull/1885","diff_url":"https://github.com/docker/distribution/pull/1885.diff","patch_url":"https://github.com/docker/distribution/pull/1885.patch","issue_url":"https://api.github.com/repos/docker/distribution/issues/1885","number":1885,"state":"open","locked":false,"title":"Dynamically Parsing the Latest Account List","user":{"login":"ghostplant","id":12099308,"avatar_url":"https://avatars.githubusercontent.com/u/12099308?v=3","gravatar_id":"","url":"https://api.github.com/users/ghostplant","html_url":"https://github.com/ghostplant","followers_url":"https://api.github.com/users/ghostplant/followers","following_url":"https://api.github.com/users/ghostplant/following{/other_user}","gists_url":"https://api.github.com/users/ghostplant/gists{/gist_id}","starred_url":"https://api.github.com/users/ghostplant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghostplant/subscriptions","organizations_url":"https://api.github.com/users/ghostplant/orgs","repos_url":"https://api.github.com/users/ghostplant/repos","events_url":"https://api.github.com/users/ghostplant/events{/privacy}","received_events_url":"https://api.github.com/users/ghostplant/received_events","type":"User","site_admin":false},"body":"To parse the latest account list dynamically,\r\n\r\nthus, maintainers could manage the accounts by maintaining the htpasswd file without restarting docker-registry frequently,\r\n\r\nwhich is required by small organizations to build a secure docker-registry service using a simple AUTH option to manage.\r\n\r\nSigned-off-by: CUI Wei <ghostplant@qq.com>","created_at":"2016-08-05T18:54:57Z","updated_at":"2016-08-23T17:28:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bee29b5934332fc57b8ba2df5538dfb1d3f74bf8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/docker/distribution/pulls/1885/commits","review_comments_url":"https://api.github.com/repos/docker/distribution/pulls/1885/comments","review_comment_url":"https://api.github.com/repos/docker/distribution/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/distribution/issues/1885/comments","statuses_url":"https://api.github.com/repos/docker/distribution/statuses/235daeba076c320f1aa0ced5ffcb435f161d1cd0","head":{"label":"ghostplant:master","ref":"master","sha":"235daeba076c320f1aa0ced5ffcb435f161d1cd0","user":{"login":"ghostplant","id":12099308,"avatar_url":"https://avatars.githubusercontent.com/u/12099308?v=3","gravatar_id":"","url":"https://api.github.com/users/ghostplant","html_url":"https://github.com/ghostplant","followers_url":"https://api.github.com/users/ghostplant/followers","following_url":"https://api.github.com/users/ghostplant/following{/other_user}","gists_url":"https://api.github.com/users/ghostplant/gists{/gist_id}","starred_url":"https://api.github.com/users/ghostplant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghostplant/subscriptions","organizations_url":"https://api.github.com/users/ghostplant/orgs","repos_url":"https://api.github.com/users/ghostplant/repos","events_url":"https://api.github.com/users/ghostplant/events{/privacy}","received_events_url":"https://api.github.com/users/ghostplant/received_events","type":"User","site_admin":false},"repo":{"id":65041913,"name":"distribution","full_name":"ghostplant/distribution","owner":{"login":"ghostplant","id":12099308,"avatar_url":"https://avatars.githubusercontent.com/u/12099308?v=3","gravatar_id":"","url":"https://api.github.com/users/ghostplant","html_url":"https://github.com/ghostplant","followers_url":"https://api.github.com/users/ghostplant/followers","following_url":"https://api.github.com/users/ghostplant/following{/other_user}","gists_url":"https://api.github.com/users/ghostplant/gists{/gist_id}","starred_url":"https://api.github.com/users/ghostplant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghostplant/subscriptions","organizations_url":"https://api.github.com/users/ghostplant/orgs","repos_url":"https://api.github.com/users/ghostplant/repos","events_url":"https://api.github.com/users/ghostplant/events{/privacy}","received_events_url":"https://api.github.com/users/ghostplant/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ghostplant/distribution","description":"The Docker toolset to pack, ship, store, and deliver content","fork":true,"url":"https://api.github.com/repos/ghostplant/distribution","forks_url":"https://api.github.com/repos/ghostplant/distribution/forks","keys_url":"https://api.github.com/repos/ghostplant/distribution/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ghostplant/distribution/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ghostplant/distribution/teams","hooks_url":"https://api.github.com/repos/ghostplant/distribution/hooks","issue_events_url":"https://api.github.com/repos/ghostplant/distribution/issues/events{/number}","events_url":"https://api.github.com/repos/ghostplant/distribution/events","assignees_url":"https://api.github.com/repos/ghostplant/distribution/assignees{/user}","branches_url":"https://api.github.com/repos/ghostplant/distribution/branches{/branch}","tags_url":"https://api.github.com/repos/ghostplant/distribution/tags","blobs_url":"https://api.github.com/repos/ghostplant/distribution/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ghostplant/distribution/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ghostplant/distribution/git/refs{/sha}","trees_url":"https://api.github.com/repos/ghostplant/distribution/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ghostplant/distribution/statuses/{sha}","languages_url":"https://api.github.com/repos/ghostplant/distribution/languages","stargazers_url":"https://api.github.com/repos/ghostplant/distribution/stargazers","contributors_url":"https://api.github.com/repos/ghostplant/distribution/contributors","subscribers_url":"https://api.github.com/repos/ghostplant/distribution/subscribers","subscription_url":"https://api.github.com/repos/ghostplant/distribution/subscription","commits_url":"https://api.github.com/repos/ghostplant/distribution/commits{/sha}","git_commits_url":"https://api.github.com/repos/ghostplant/distribution/git/commits{/sha}","comments_url":"https://api.github.com/repos/ghostplant/distribution/comments{/number}","issue_comment_url":"https://api.github.com/repos/ghostplant/distribution/issues/comments{/number}","contents_url":"https://api.github.com/repos/ghostplant/distribution/contents/{+path}","compare_url":"https://api.github.com/repos/ghostplant/distribution/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ghostplant/distribution/merges","archive_url":"https://api.github.com/repos/ghostplant/distribution/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ghostplant/distribution/downloads","issues_url":"https://api.github.com/repos/ghostplant/distribution/issues{/number}","pulls_url":"https://api.github.com/repos/ghostplant/distribution/pulls{/number}","milestones_url":"https://api.github.com/repos/ghostplant/distribution/milestones{/number}","notifications_url":"https://api.github.com/repos/ghostplant/distribution/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ghostplant/distribution/labels{/name}","releases_url":"https://api.github.com/repos/ghostplant/distribution/releases{/id}","deployments_url":"https://api.github.com/repos/ghostplant/distribution/deployments","created_at":"2016-08-05T18:53:08Z","updated_at":"2016-08-05T18:53:11Z","pushed_at":"2016-08-23T04:45:30Z","git_url":"git://github.com/ghostplant/distribution.git","ssh_url":"git@github.com:ghostplant/distribution.git","clone_url":"https://github.com/ghostplant/distribution.git","svn_url":"https://github.com/ghostplant/distribution","homepage":null,"size":10451,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"docker:master","ref":"master","sha":"bfa0a9c0973b5026d2e942dec29115c120e7f731","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":28366058,"name":"distribution","full_name":"docker/distribution","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/distribution","description":"The Docker toolset to pack, ship, store, and deliver content","fork":false,"url":"https://api.github.com/repos/docker/distribution","forks_url":"https://api.github.com/repos/docker/distribution/forks","keys_url":"https://api.github.com/repos/docker/distribution/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/distribution/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/distribution/teams","hooks_url":"https://api.github.com/repos/docker/distribution/hooks","issue_events_url":"https://api.github.com/repos/docker/distribution/issues/events{/number}","events_url":"https://api.github.com/repos/docker/distribution/events","assignees_url":"https://api.github.com/repos/docker/distribution/assignees{/user}","branches_url":"https://api.github.com/repos/docker/distribution/branches{/branch}","tags_url":"https://api.github.com/repos/docker/distribution/tags","blobs_url":"https://api.github.com/repos/docker/distribution/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/distribution/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/distribution/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/distribution/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/distribution/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/distribution/languages","stargazers_url":"https://api.github.com/repos/docker/distribution/stargazers","contributors_url":"https://api.github.com/repos/docker/distribution/contributors","subscribers_url":"https://api.github.com/repos/docker/distribution/subscribers","subscription_url":"https://api.github.com/repos/docker/distribution/subscription","commits_url":"https://api.github.com/repos/docker/distribution/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/distribution/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/distribution/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/distribution/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/distribution/contents/{+path}","compare_url":"https://api.github.com/repos/docker/distribution/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/distribution/merges","archive_url":"https://api.github.com/repos/docker/distribution/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/distribution/downloads","issues_url":"https://api.github.com/repos/docker/distribution/issues{/number}","pulls_url":"https://api.github.com/repos/docker/distribution/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/distribution/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/distribution/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/distribution/labels{/name}","releases_url":"https://api.github.com/repos/docker/distribution/releases{/id}","deployments_url":"https://api.github.com/repos/docker/distribution/deployments","created_at":"2014-12-22T23:49:26Z","updated_at":"2016-08-23T08:13:09Z","pushed_at":"2016-08-23T17:07:57Z","git_url":"git://github.com/docker/distribution.git","ssh_url":"git@github.com:docker/distribution.git","clone_url":"https://github.com/docker/distribution.git","svn_url":"https://github.com/docker/distribution","homepage":null,"size":14118,"stargazers_count":2433,"watchers_count":2433,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":899,"mirror_url":null,"open_issues_count":236,"forks":899,"open_issues":236,"watchers":2433,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/distribution/pulls/1885"},"html":{"href":"https://github.com/docker/distribution/pull/1885"},"issue":{"href":"https://api.github.com/repos/docker/distribution/issues/1885"},"comments":{"href":"https://api.github.com/repos/docker/distribution/issues/1885/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/distribution/pulls/1885/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/distribution/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/distribution/pulls/1885/commits"},"statuses":{"href":"https://api.github.com/repos/docker/distribution/statuses/235daeba076c320f1aa0ced5ffcb435f161d1cd0"}}}}
{"actor":{"display_login":"aaronlehmann"}}