{"action":"created","comment":{"url":"https://api.github.com/repos/pfsense/pfsense/pulls/comments/199608151","pull_request_review_id":133751545,"id":199608151,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTYwODE1MQ==","diff_hunk":"@@ -2593,49 +2565,168 @@ function captiveportal_blocked_mac($mac) {\n \n }\n \n-function captiveportal_send_server_accounting($off = false) {\n-\tglobal $cpzone, $config;\n+/* Captiveportal Radius Accounting */\n \n-\tif (!isset($config['captiveportal'][$cpzone]['radacct_enable'])) {\n-\t\treturn;\n+PEAR::loadExtension('bcmath');\n+\n+\n+function gigawords($bytes) {\n+\n+\t$GIGAWORDS_RIGHT_OPERAND = '4294967296'; // 2^32\n+\t/*\n+\t * RFC2866 Specifies a 32bit unsigned integer, which is a max of 4294967295\n+\t * Currently there is a fault in the PECL radius_put_int function which can handle only 32bit signed integer.\n+\t */\n+\n+\t// We use BCMath functions since normal integers don't work with so large numbers\n+\t$gigawords = bcdiv( bcsub( $bytes, remainder($bytes) ) , $GIGAWORDS_RIGHT_OPERAND) ;\n+\n+\t// We need to manually set this to a zero instead of NULL for put_int() safety\n+\tif (is_null($gigawords)) {\n+\t\t$gigawords = 0;\n+\t}\n+\n+\treturn $gigawords;\n+}\n+\n+function remainder($bytes) {\n+\t$GIGAWORDS_RIGHT_OPERAND = '4294967296'; // 2^32\n+\t// Calculate the bytes we are going to send to the radius\n+\t$bytes = bcmod($bytes, $GIGAWORDS_RIGHT_OPERAND);\n+\t\n+\tif (is_null($bytes)) {\n+\t\t$bytes = 0;\n \t}\n-\tif ($off) {\n+\n+    return $bytes;\n+}\n+\n+function captiveportal_send_server_accounting($type = 'on', $ruleno = null, $username = null, $clientip = null, $clientmac = null, $sessionid = null, $start_time = null, $stop_time = null, $term_cause = null) {\n+\tglobal $cpzone, $config;\n+\t\n+\t$cpcfg = $config['captiveportal'][$cpzone];\n+\t$acctcfg = auth_get_authserver($cpcfg['radacct_server']);\n+\t\n+\tif (!isset($cpcfg['radacct_enable']) || empty($acctcfg)) {\n+\t\treturn null;\n+\t}\n+\t\n+\tif ($type === 'on') {\n+\t\t$racct = new Auth_RADIUS_Acct_On;\n+\t} else if($type === 'off') {\n \t\t$racct = new Auth_RADIUS_Acct_Off;\n+\t} else if($type === 'start' ) {","path":"src/etc/inc/captiveportal.inc","position":880,"original_position":880,"commit_id":"3ccd402cb96338743ab948680507dbfebec46065","original_commit_id":"3ccd402cb96338743ab948680507dbfebec46065","user":{"login":"jim-p","id":174434,"node_id":"MDQ6VXNlcjE3NDQzNA==","avatar_url":"https://avatars3.githubusercontent.com/u/174434?v=4","gravatar_id":"","url":"https://api.github.com/users/jim-p","html_url":"https://github.com/jim-p","followers_url":"https://api.github.com/users/jim-p/followers","following_url":"https://api.github.com/users/jim-p/following{/other_user}","gists_url":"https://api.github.com/users/jim-p/gists{/gist_id}","starred_url":"https://api.github.com/users/jim-p/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jim-p/subscriptions","organizations_url":"https://api.github.com/users/jim-p/orgs","repos_url":"https://api.github.com/users/jim-p/repos","events_url":"https://api.github.com/users/jim-p/events{/privacy}","received_events_url":"https://api.github.com/users/jim-p/received_events","type":"User","site_admin":false},"body":"Change to `elseif`, add space after `elseif`.","created_at":"2018-07-02T20:15:59Z","updated_at":"2018-07-02T20:37:08Z","html_url":"https://github.com/pfsense/pfsense/pull/3640#discussion_r199608151","pull_request_url":"https://api.github.com/repos/pfsense/pfsense/pulls/3640","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/pfsense/pfsense/pulls/comments/199608151"},"html":{"href":"https://github.com/pfsense/pfsense/pull/3640#discussion_r199608151"},"pull_request":{"href":"https://api.github.com/repos/pfsense/pfsense/pulls/3640"}}},"pull_request":{"url":"https://api.github.com/repos/pfsense/pfsense/pulls/3640","id":110232287,"node_id":"MDExOlB1bGxSZXF1ZXN0MTEwMjMyMjg3","html_url":"https://github.com/pfsense/pfsense/pull/3640","diff_url":"https://github.com/pfsense/pfsense/pull/3640.diff","patch_url":"https://github.com/pfsense/pfsense/pull/3640.patch","issue_url":"https://api.github.com/repos/pfsense/pfsense/issues/3640","number":3640,"state":"open","locked":false,"title":"Redmine # 5112: Captive Portal - Use User Manager as Authentication source","user":{"login":"Augustin-FL","id":9406403,"node_id":"MDQ6VXNlcjk0MDY0MDM=","avatar_url":"https://avatars0.githubusercontent.com/u/9406403?v=4","gravatar_id":"","url":"https://api.github.com/users/Augustin-FL","html_url":"https://github.com/Augustin-FL","followers_url":"https://api.github.com/users/Augustin-FL/followers","following_url":"https://api.github.com/users/Augustin-FL/following{/other_user}","gists_url":"https://api.github.com/users/Augustin-FL/gists{/gist_id}","starred_url":"https://api.github.com/users/Augustin-FL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Augustin-FL/subscriptions","organizations_url":"https://api.github.com/users/Augustin-FL/orgs","repos_url":"https://api.github.com/users/Augustin-FL/repos","events_url":"https://api.github.com/users/Augustin-FL/events{/privacy}","received_events_url":"https://api.github.com/users/Augustin-FL/received_events","type":"User","site_admin":false},"body":"The captive portal currently only supports local user database, RADIUS or voucher authentication.\r\n\r\nI added support for LDAP Authentication (using the User Manager, exactly like OpenVPN does). ","created_at":"2017-03-10T23:54:45Z","updated_at":"2018-07-02T20:37:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e57f45d19cdf078a551fd0a8db01cf6f812c6b5c","assignee":null,"assignees":[],"requested_reviewers":[{"login":"rbgarga","id":149872,"node_id":"MDQ6VXNlcjE0OTg3Mg==","avatar_url":"https://avatars1.githubusercontent.com/u/149872?v=4","gravatar_id":"","url":"https://api.github.com/users/rbgarga","html_url":"https://github.com/rbgarga","followers_url":"https://api.github.com/users/rbgarga/followers","following_url":"https://api.github.com/users/rbgarga/following{/other_user}","gists_url":"https://api.github.com/users/rbgarga/gists{/gist_id}","starred_url":"https://api.github.com/users/rbgarga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbgarga/subscriptions","organizations_url":"https://api.github.com/users/rbgarga/orgs","repos_url":"https://api.github.com/users/rbgarga/repos","events_url":"https://api.github.com/users/rbgarga/events{/privacy}","received_events_url":"https://api.github.com/users/rbgarga/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":469702389,"node_id":"MDU6TGFiZWw0Njk3MDIzODk=","url":"https://api.github.com/repos/pfsense/pfsense/labels/Changes%20requested","name":"Changes requested","color":"fbca04","default":false},{"id":343835390,"node_id":"MDU6TGFiZWwzNDM4MzUzOTA=","url":"https://api.github.com/repos/pfsense/pfsense/labels/Pending%20review/testing","name":"Pending review/testing","color":"207de5","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/pfsense/pfsense/pulls/3640/commits","review_comments_url":"https://api.github.com/repos/pfsense/pfsense/pulls/3640/comments","review_comment_url":"https://api.github.com/repos/pfsense/pfsense/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pfsense/pfsense/issues/3640/comments","statuses_url":"https://api.github.com/repos/pfsense/pfsense/statuses/3ccd402cb96338743ab948680507dbfebec46065","head":{"label":"Augustin-FL:master","ref":"master","sha":"3ccd402cb96338743ab948680507dbfebec46065","user":{"login":"Augustin-FL","id":9406403,"node_id":"MDQ6VXNlcjk0MDY0MDM=","avatar_url":"https://avatars0.githubusercontent.com/u/9406403?v=4","gravatar_id":"","url":"https://api.github.com/users/Augustin-FL","html_url":"https://github.com/Augustin-FL","followers_url":"https://api.github.com/users/Augustin-FL/followers","following_url":"https://api.github.com/users/Augustin-FL/following{/other_user}","gists_url":"https://api.github.com/users/Augustin-FL/gists{/gist_id}","starred_url":"https://api.github.com/users/Augustin-FL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Augustin-FL/subscriptions","organizations_url":"https://api.github.com/users/Augustin-FL/orgs","repos_url":"https://api.github.com/users/Augustin-FL/repos","events_url":"https://api.github.com/users/Augustin-FL/events{/privacy}","received_events_url":"https://api.github.com/users/Augustin-FL/received_events","type":"User","site_admin":false},"repo":{"id":84609676,"node_id":"MDEwOlJlcG9zaXRvcnk4NDYwOTY3Ng==","name":"pfsense","full_name":"Augustin-FL/pfsense","owner":{"login":"Augustin-FL","id":9406403,"node_id":"MDQ6VXNlcjk0MDY0MDM=","avatar_url":"https://avatars0.githubusercontent.com/u/9406403?v=4","gravatar_id":"","url":"https://api.github.com/users/Augustin-FL","html_url":"https://github.com/Augustin-FL","followers_url":"https://api.github.com/users/Augustin-FL/followers","following_url":"https://api.github.com/users/Augustin-FL/following{/other_user}","gists_url":"https://api.github.com/users/Augustin-FL/gists{/gist_id}","starred_url":"https://api.github.com/users/Augustin-FL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Augustin-FL/subscriptions","organizations_url":"https://api.github.com/users/Augustin-FL/orgs","repos_url":"https://api.github.com/users/Augustin-FL/repos","events_url":"https://api.github.com/users/Augustin-FL/events{/privacy}","received_events_url":"https://api.github.com/users/Augustin-FL/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Augustin-FL/pfsense","description":"Main repository for pfSense","fork":true,"url":"https://api.github.com/repos/Augustin-FL/pfsense","forks_url":"https://api.github.com/repos/Augustin-FL/pfsense/forks","keys_url":"https://api.github.com/repos/Augustin-FL/pfsense/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Augustin-FL/pfsense/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Augustin-FL/pfsense/teams","hooks_url":"https://api.github.com/repos/Augustin-FL/pfsense/hooks","issue_events_url":"https://api.github.com/repos/Augustin-FL/pfsense/issues/events{/number}","events_url":"https://api.github.com/repos/Augustin-FL/pfsense/events","assignees_url":"https://api.github.com/repos/Augustin-FL/pfsense/assignees{/user}","branches_url":"https://api.github.com/repos/Augustin-FL/pfsense/branches{/branch}","tags_url":"https://api.github.com/repos/Augustin-FL/pfsense/tags","blobs_url":"https://api.github.com/repos/Augustin-FL/pfsense/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Augustin-FL/pfsense/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Augustin-FL/pfsense/git/refs{/sha}","trees_url":"https://api.github.com/repos/Augustin-FL/pfsense/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Augustin-FL/pfsense/statuses/{sha}","languages_url":"https://api.github.com/repos/Augustin-FL/pfsense/languages","stargazers_url":"https://api.github.com/repos/Augustin-FL/pfsense/stargazers","contributors_url":"https://api.github.com/repos/Augustin-FL/pfsense/contributors","subscribers_url":"https://api.github.com/repos/Augustin-FL/pfsense/subscribers","subscription_url":"https://api.github.com/repos/Augustin-FL/pfsense/subscription","commits_url":"https://api.github.com/repos/Augustin-FL/pfsense/commits{/sha}","git_commits_url":"https://api.github.com/repos/Augustin-FL/pfsense/git/commits{/sha}","comments_url":"https://api.github.com/repos/Augustin-FL/pfsense/comments{/number}","issue_comment_url":"https://api.github.com/repos/Augustin-FL/pfsense/issues/comments{/number}","contents_url":"https://api.github.com/repos/Augustin-FL/pfsense/contents/{+path}","compare_url":"https://api.github.com/repos/Augustin-FL/pfsense/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Augustin-FL/pfsense/merges","archive_url":"https://api.github.com/repos/Augustin-FL/pfsense/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Augustin-FL/pfsense/downloads","issues_url":"https://api.github.com/repos/Augustin-FL/pfsense/issues{/number}","pulls_url":"https://api.github.com/repos/Augustin-FL/pfsense/pulls{/number}","milestones_url":"https://api.github.com/repos/Augustin-FL/pfsense/milestones{/number}","notifications_url":"https://api.github.com/repos/Augustin-FL/pfsense/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Augustin-FL/pfsense/labels{/name}","releases_url":"https://api.github.com/repos/Augustin-FL/pfsense/releases{/id}","deployments_url":"https://api.github.com/repos/Augustin-FL/pfsense/deployments","created_at":"2017-03-10T23:37:18Z","updated_at":"2018-07-02T16:59:34Z","pushed_at":"2018-07-02T16:59:25Z","git_url":"git://github.com/Augustin-FL/pfsense.git","ssh_url":"git@github.com:Augustin-FL/pfsense.git","clone_url":"https://github.com/Augustin-FL/pfsense.git","svn_url":"https://github.com/Augustin-FL/pfsense","homepage":"http://www.pfsense.org","size":253802,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pfsense:master","ref":"master","sha":"9fa8c7de7bca843a3157807c66fecd3159b701ac","user":{"login":"pfsense","id":3716965,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM3MTY5NjU=","avatar_url":"https://avatars1.githubusercontent.com/u/3716965?v=4","gravatar_id":"","url":"https://api.github.com/users/pfsense","html_url":"https://github.com/pfsense","followers_url":"https://api.github.com/users/pfsense/followers","following_url":"https://api.github.com/users/pfsense/following{/other_user}","gists_url":"https://api.github.com/users/pfsense/gists{/gist_id}","starred_url":"https://api.github.com/users/pfsense/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfsense/subscriptions","organizations_url":"https://api.github.com/users/pfsense/orgs","repos_url":"https://api.github.com/users/pfsense/repos","events_url":"https://api.github.com/users/pfsense/events{/privacy}","received_events_url":"https://api.github.com/users/pfsense/received_events","type":"Organization","site_admin":false},"repo":{"id":1740040,"node_id":"MDEwOlJlcG9zaXRvcnkxNzQwMDQw","name":"pfsense","full_name":"pfsense/pfsense","owner":{"login":"pfsense","id":3716965,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM3MTY5NjU=","avatar_url":"https://avatars1.githubusercontent.com/u/3716965?v=4","gravatar_id":"","url":"https://api.github.com/users/pfsense","html_url":"https://github.com/pfsense","followers_url":"https://api.github.com/users/pfsense/followers","following_url":"https://api.github.com/users/pfsense/following{/other_user}","gists_url":"https://api.github.com/users/pfsense/gists{/gist_id}","starred_url":"https://api.github.com/users/pfsense/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfsense/subscriptions","organizations_url":"https://api.github.com/users/pfsense/orgs","repos_url":"https://api.github.com/users/pfsense/repos","events_url":"https://api.github.com/users/pfsense/events{/privacy}","received_events_url":"https://api.github.com/users/pfsense/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pfsense/pfsense","description":"Main repository for pfSense","fork":false,"url":"https://api.github.com/repos/pfsense/pfsense","forks_url":"https://api.github.com/repos/pfsense/pfsense/forks","keys_url":"https://api.github.com/repos/pfsense/pfsense/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pfsense/pfsense/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pfsense/pfsense/teams","hooks_url":"https://api.github.com/repos/pfsense/pfsense/hooks","issue_events_url":"https://api.github.com/repos/pfsense/pfsense/issues/events{/number}","events_url":"https://api.github.com/repos/pfsense/pfsense/events","assignees_url":"https://api.github.com/repos/pfsense/pfsense/assignees{/user}","branches_url":"https://api.github.com/repos/pfsense/pfsense/branches{/branch}","tags_url":"https://api.github.com/repos/pfsense/pfsense/tags","blobs_url":"https://api.github.com/repos/pfsense/pfsense/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pfsense/pfsense/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pfsense/pfsense/git/refs{/sha}","trees_url":"https://api.github.com/repos/pfsense/pfsense/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pfsense/pfsense/statuses/{sha}","languages_url":"https://api.github.com/repos/pfsense/pfsense/languages","stargazers_url":"https://api.github.com/repos/pfsense/pfsense/stargazers","contributors_url":"https://api.github.com/repos/pfsense/pfsense/contributors","subscribers_url":"https://api.github.com/repos/pfsense/pfsense/subscribers","subscription_url":"https://api.github.com/repos/pfsense/pfsense/subscription","commits_url":"https://api.github.com/repos/pfsense/pfsense/commits{/sha}","git_commits_url":"https://api.github.com/repos/pfsense/pfsense/git/commits{/sha}","comments_url":"https://api.github.com/repos/pfsense/pfsense/comments{/number}","issue_comment_url":"https://api.github.com/repos/pfsense/pfsense/issues/comments{/number}","contents_url":"https://api.github.com/repos/pfsense/pfsense/contents/{+path}","compare_url":"https://api.github.com/repos/pfsense/pfsense/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pfsense/pfsense/merges","archive_url":"https://api.github.com/repos/pfsense/pfsense/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pfsense/pfsense/downloads","issues_url":"https://api.github.com/repos/pfsense/pfsense/issues{/number}","pulls_url":"https://api.github.com/repos/pfsense/pfsense/pulls{/number}","milestones_url":"https://api.github.com/repos/pfsense/pfsense/milestones{/number}","notifications_url":"https://api.github.com/repos/pfsense/pfsense/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pfsense/pfsense/labels{/name}","releases_url":"https://api.github.com/repos/pfsense/pfsense/releases{/id}","deployments_url":"https://api.github.com/repos/pfsense/pfsense/deployments","created_at":"2011-05-12T19:44:21Z","updated_at":"2018-07-02T19:20:23Z","pushed_at":"2018-07-02T19:29:43Z","git_url":"git://github.com/pfsense/pfsense.git","ssh_url":"git@github.com:pfsense/pfsense.git","clone_url":"https://github.com/pfsense/pfsense.git","svn_url":"https://github.com/pfsense/pfsense","homepage":"http://www.pfsense.org","size":255668,"stargazers_count":1789,"watchers_count":1789,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":798,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":798,"open_issues":9,"watchers":1789,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pfsense/pfsense/pulls/3640"},"html":{"href":"https://github.com/pfsense/pfsense/pull/3640"},"issue":{"href":"https://api.github.com/repos/pfsense/pfsense/issues/3640"},"comments":{"href":"https://api.github.com/repos/pfsense/pfsense/issues/3640/comments"},"review_comments":{"href":"https://api.github.com/repos/pfsense/pfsense/pulls/3640/comments"},"review_comment":{"href":"https://api.github.com/repos/pfsense/pfsense/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pfsense/pfsense/pulls/3640/commits"},"statuses":{"href":"https://api.github.com/repos/pfsense/pfsense/statuses/3ccd402cb96338743ab948680507dbfebec46065"}},"author_association":"NONE"}}
{"actor":{"display_login":"jim-p"}}