Merge pull request #413 from Th3R3p0/master

Security + Bug Fix
This commit is contained in:
Claude 2017-03-22 08:17:56 +01:00 committed by GitHub
commit 8f1e516cb6
2 changed files with 8 additions and 1 deletions

View File

@ -26,6 +26,13 @@ class Api extends Main
{ {
die("The API has been disabled\n"); die("The API has been disabled\n");
} }
// if ldap is configured and no api token is configured, fail the request
if ((config_item('require_auth') == true) && (config_item('apikey') == ''))
{
die("API key not configured");
}
} }
function index() function index()

View File

@ -120,7 +120,7 @@ class Auth extends CI_Controller
public public
function alpha_dash_dot($str) function alpha_dash_dot($str)
{ {
return (!preg_match("/^([-a-z0-9_-\.])+$/i", $str)) ? FALSE : TRUE; return (!preg_match("/^([-a-z0-9_\-\.])+$/i", $str)) ? FALSE : TRUE;
} }
} }
?> ?>