Compare commits

...

14 Commits
1.2.5 ... 1.2.6

Author SHA1 Message Date
Deon George
9fac4b415a Release 1.2.6 2020-09-19 13:45:09 +10:00
Nic Bernstein
f4c8c3d31e SF Bug #1008 getContainerPath doesn't properly traverse to baseDN and back & #1009 - return_ldap_hash should not return container object in result set 2020-08-31 08:49:02 +10:00
Andy Beefeater
e45e71fd08 SF Feature #356 - HTMLTree icons formatting 2020-08-31 08:48:49 +10:00
Deon George
0011184a3f Documenting OID 1.3.6.1.1.22 - Thank you. Closes #102 2020-08-30 22:27:03 +10:00
Deon George
aa5be41b06 Add autocomplete=off - closes #122 2020-08-30 22:09:52 +10:00
Gurvinder Dadyala
bdfd68c3b6 Added Bcrypt support (#116)
* Set minimum PHP version to 5.5.0| Bcrypt Support
* Added Bcrypt hash support
* Update Install.md
2020-08-30 21:58:50 +10:00
Armin Leuprecht
fb437b037e Decode plainpassword before check (#115)
When the user's password contains HTML special chars
the password check would always fail if the
the given plainpassword is not decoded first.
2020-08-30 21:57:40 +10:00
Bennet Bleßmann
34d4f20222 Fixes usage of deprecated array/string access syntax. (#97)
PHP 7.4 Compatibility.
2020-08-30 21:56:25 +10:00
JamesCordell
0b65747110 Changes required so the sudoRole objectClass will present a link so members can be modified by default. (#101) 2020-02-20 09:17:37 +11:00
Jakub Filak
4661aa2114 Hooks fixes (#99)
* repace deprecated each with foreach

I tried to enable the example.php hooks and the use of the keyword each
was causing crashes in the docker image osixia/phpldapadmin:0.9.0

* check if DEBUG_ENABLED is defined

I enabled the hooks example.php and I started getting crashes caused by
undefined constant.

Tested with the docker image osixia/phpldapadmin:0.9.0
2020-02-20 09:17:01 +11:00
sshambar
0a57b2f80e Added appearance option show_authz (#94)
Enabling displays the authorization ID rather than the authentication ID,
similar to using ldapwhoami.  Requires PHP 7.2+
2020-02-20 09:14:18 +11:00
sshambar
0fe1758572 Add SASL PLAIN authentication support (#92)
Adds a new sasl mech 'plain' which converts all simple authentication
methods to SASL PLAIN.  NOTE: doesn't use auth_type 'sasl' as
credentials may come from login form, stored in cookies etc...
2020-02-20 09:12:39 +11:00
Noone404
4eb3737d31 Added option to use template string for bind DN (#90)
* Language update from launchpad

* Added login option 'bind_dn_template'
2020-02-20 09:11:17 +11:00
Genaro Contreras Gutierrez
cbdc0dacd6 Auth Form wiht Google reCAPTCHA (#87)
* reCaptcha config

* config reCaptcha

* check reCAPTCHA

* add reCAPTCHA to form login

* config attributes for reCAPTCHA

* Function to verify request with reCAPTCHA

* doc reCaptcha
2020-02-20 09:04:20 +11:00
17 changed files with 243 additions and 49 deletions

View File

@@ -5,7 +5,7 @@ For install instructions in non-English languages, see the wiki:
phpLDAPadmin requires the following:
a. A web server (Apache, IIS, etc).
b. PHP 5.0.0 or newer (with LDAP support)
b. PHP 5.5.0 or newer (with LDAP support)
* To install

View File

@@ -1 +1 @@
RELEASE-1.2.5
RELEASE-1.2.6

View File

@@ -173,6 +173,10 @@ $config->custom->commands['script'] = array(
// $config->custom->appearance['tree_width'] = null;
# $config->custom->appearance['tree_width'] = 250;
/* Number of tree command icons to show, 0 = show all icons on 1 row. */
// $config->custom->appearance['tree_icons'] = 0;
# $config->custom->appearance['tree_icons'] = 4;
/* Confirm create and update operations, allowing you to review the changes
and optionally skip attributes during the create/update operation. */
// $config->custom->confirm['create'] = true;
@@ -235,7 +239,7 @@ $config->custom->appearance['friendly_attrs'] = array(
*********************************************/
/* Add "modify group members" link to the attribute. */
// $config->custom->modify_member['groupattr'] = array('member','uniqueMember','memberUid');
// $config->custom->modify_member['groupattr'] = array('member','uniqueMember','memberUid','sudoUser');
/* Configure filter for member search. This only applies to "modify group members" feature */
// $config->custom->modify_member['filter'] = '(objectclass=Person)';
@@ -243,6 +247,7 @@ $config->custom->appearance['friendly_attrs'] = array(
/* Attribute that is added to the group member attribute. */
// $config->custom->modify_member['attr'] = 'dn';
/* For Posix attributes */
// $config->custom->modify_member['posixattr'] = 'uid';
// $config->custom->modify_member['posixfilter'] = '(uid=*)';
@@ -341,11 +346,16 @@ $servers->setValue('server','name','My LDAP Server');
/* Enable SASL authentication LDAP SASL authentication requires PHP 5.x
configured with --with-ldap-sasl=DIR. If this option is disabled (ie, set to
false), then all other sasl options are ignored. */
// $servers->setValue('login','auth_type','sasl');
# $servers->setValue('login','auth_type','sasl');
/* SASL auth mechanism */
/* SASL GSSAPI auth mechanism (requires auth_type of sasl) */
// $servers->setValue('sasl','mech','GSSAPI');
/* SASL PLAIN support... this mech converts simple binds to SASL
PLAIN binds using any auth_type (or other bind_id/pass) as credentials.
NOTE: auth_type must be simple auth compatible (ie not sasl) */
# $servers->setValue('sasl','mech','PLAIN');
/* SASL authentication realm name */
// $servers->setValue('sasl','realm','');
# $servers->setValue('sasl','realm','EXAMPLE.COM');
@@ -400,6 +410,12 @@ $servers->setValue('server','name','My LDAP Server');
setup. */
// $servers->setValue('login','class',array());
/* If login_attr was set to 'dn', it is possible to specify a template string to
build the DN from. Use '%s' where user input should be inserted. A user may
still enter the complete DN. In this case the template will not be used. */
// $servers->setValue('login','bind_dn_template',null);
# $servers->setValue('login','bind_dn_template','cn=%s,ou=people,dc=example,dc=com');
/* If you specified something different from 'dn', for example 'uid', as the
login_attr above, you can optionally specify here to fall back to
authentication with dn.
@@ -420,6 +436,9 @@ $servers->setValue('server','name','My LDAP Server');
/* Set to true if you would like to initially open the first level of each tree. */
// $servers->setValue('appearance','open_tree',false);
/* Set to true to display authorization ID in place of login dn (PHP 7.2+) */
// $servers->setValue('appearance','show_authz',false);
/* This feature allows phpLDAPadmin to automatically determine the next
available uidNumber for a new entry. */
// $servers->setValue('auto_number','enable',true);
@@ -573,4 +592,19 @@ $servers->setValue('server','custom_sys_attrs',array('passwordExpirationTime','p
$servers->setValue('server','custom_attrs',array('nsRoleDN','nsRole','nsAccountLock'));
$servers->setValue('server','force_may',array('uidNumber','gidNumber','sambaSID'));
*/
/***********************************************************************************
* If you want to configure Google reCAPTCHA on autentication form, do so below. *
* Remove the commented lines and use this section as a template for all *
* reCAPTCHA v2 Generate on https://www.google.com/recaptcha/ *
* *
* IMPORTANT: Select reCAPTCHA v2 on Type of reCAPTCHA *
***********************************************************************************/
$config->custom->session['reCAPTCHA-enable'] = false;
$config->custom->session['reCAPTCHA-key-site'] = '<put-here-key-site>';
$config->custom->session['reCAPTCHA-key-server'] = '<put-here-key-server>';
?>

View File

@@ -11,27 +11,44 @@
require './common.php';
$user = array();
$user['login'] = get_request('login');
$user['password'] = get_request('login_pass');
$pass = true;
if ($_SESSION[APPCONFIG]->getValue('session', 'reCAPTCHA-enable')) {
$pass = !IsRobot(get_request('g-recaptcha-response'));
}
if ($user['login'] && ! strlen($user['password']))
system_message(array(
'title'=>_('Authenticate to server'),
'body'=>_('You left the password blank.'),
'type'=>'warn'),
sprintf('cmd.php?cmd=login_form&server_id=%s',get_request('server_id','REQUEST')));
if ($pass) {
$user = array();
$user['login'] = get_request('login');
$user['password'] = get_request('login_pass');
if ($user['login'] && !strlen($user['password'])) {
system_message(array(
'title' => _('Authenticate to server'),
'body' => _('You left the password blank.'),
'type' => 'warn'),
sprintf('cmd.php?cmd=login_form&server_id=%s', get_request('server_id', 'REQUEST')));
}
if ($app['server']->login($user['login'], $user['password'], 'user')) {
system_message(array(
'title' => _('Authenticate to server'),
'body' => _('Successfully logged into server.'),
'type' => 'info'),
sprintf('cmd.php?server_id=%s', get_request('server_id', 'REQUEST')));
} else {
system_message(array(
'title' => _('Failed to Authenticate to server'),
'body' => _('Invalid Username or Password.'),
'type' => 'error'),
sprintf('cmd.php?cmd=login_form&server_id=%s', get_request('server_id', 'REQUEST')));
}
} else {
system_message(array(
'title' => _('Authenticate to server'),
'body' => _('Incorrect captcha.'),
'type' => 'warn'),
sprintf('cmd.php?cmd=login_form&server_id=%s', get_request('server_id', 'REQUEST')));
}
if ($app['server']->login($user['login'],$user['password'],'user'))
system_message(array(
'title'=>_('Authenticate to server'),
'body'=>_('Successfully logged into server.'),
'type'=>'info'),
sprintf('cmd.php?server_id=%s',get_request('server_id','REQUEST')));
else
system_message(array(
'title'=>_('Failed to Authenticate to server'),
'body'=>_('Invalid Username or Password.'),
'type'=>'error'),
sprintf('cmd.php?cmd=login_form&server_id=%s',get_request('server_id','REQUEST')));
?>

View File

@@ -65,7 +65,7 @@ if ($app['server']->getAuthType() == 'http') {
# HTML Login Form
} else {
echo '<form action="cmd.php" method="post">';
echo '<form action="cmd.php" method="post" autocomplete="off">';
echo '<div>';
echo '<input type="hidden" name="cmd" value="login" />';
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
@@ -80,7 +80,7 @@ if ($app['server']->getAuthType() == 'http') {
printf('<tr><td><b>%s:</b></td></tr>',
$app['server']->getValue('login','auth_text') ? $app['server']->getValue('login','auth_text') :
($app['server']->getValue('login','attr') == 'dn' ? _('Login DN') : $_SESSION[APPCONFIG]->getFriendlyName($app['server']->getValue('login','attr'))));
($app['server']->getValue('login','attr') == 'dn' ? ($app['server']->getValue('login', 'bind_dn_template') ? _('User Name') . ' / ' . _('Login DN') : _('Login DN')) : $_SESSION[APPCONFIG]->getFriendlyName($app['server']->getValue('login','attr'))));
printf('<tr><td><input type="text" id="login" name="login" size="40" value="%s" /></td></tr>',
$app['server']->getValue('login','attr',false) == 'dn' ? $app['server']->getValue('login','bind_id') : '');
@@ -90,6 +90,13 @@ if ($app['server']->getAuthType() == 'http') {
echo '<tr><td><input type="password" id="password" size="40" value="" name="login_pass" /></td></tr>';
echo '<tr><td colspan="2">&nbsp;</td></tr>';
#reCAPTCHA
if ($_SESSION[APPCONFIG]->getValue('session', 'reCAPTCHA-enable')) {
echo '<script src="https://www.google.com/recaptcha/api.js"></script>';
echo '<tr><td><div class="g-recaptcha" data-sitekey="'.$_SESSION[APPCONFIG]->getValue('session', 'reCAPTCHA-key-site').'"></div></td></tr>';
echo '<tr><td colspan="2">&nbsp;</td></tr>';
}
# If Anon bind allowed, then disable the form if the user choose to bind anonymously.
if ($app['server']->isAnonBindAllowed())
printf('<tr><td colspan="2"><small><b>%s</b></small> <input type="checkbox" name="anonymous_bind" onclick="form_field_toggle_enable(this,[\'login\',\'password\'],\'login\')" id="anonymous_bind_checkbox" /></td></tr>',

View File

@@ -65,7 +65,7 @@ for ($i=0;$i<count($possible_values);$i++) {
if (preg_match("/^".$request['attr']."$/i",$_SESSION[APPCONFIG]->getValue('modify_member','posixgroupattr')))
$possible_members[$i] = $possible_values[$i][$_SESSION[APPCONFIG]->getValue('modify_member','posixattr')][0];
else
$possible_members[$i] = $possible_values[$i][$_SESSION[APPCONFIG]->getValue('modify_member','attr')];
$possible_members[$i] = $possible_values[$i][$_SESSION[APPCONFIG]->getValue('modify_member','attr')][0];
}
# Show only user that are not already in group.

View File

@@ -45,7 +45,8 @@ class HTMLTree extends Tree {
if (! $onlytree) {
$this->draw_menu();
if ($server->getAuthType() != 'config')
if (($server->getAuthType() != 'config') ||
$server->getValue('appearance', 'show_authz'))
$this->draw_logged_in_user();
else
printf('<tr><td class="blank" colspan="%s">&nbsp;</td></tr>',$this->getDepth()+3);
@@ -183,10 +184,15 @@ class HTMLTree extends Tree {
$links = '';
$i = 0;
$icons = $_SESSION[APPCONFIG]->getValue('appearance','tree_icons');
if (is_array($_SESSION[APPCONFIG]->getValue('menu','session')))
foreach ($_SESSION[APPCONFIG]->getValue('menu','session') as $link => $title) {
if ($this->get_menu_item($link))
$links .= sprintf('<td class="server_links">%s</td>',$this->get_menu_item($link));
if ($icons && ++$i%$icons == 0)
$links .= '</tr><tr>';
}
# Finally add our logout link.
@@ -344,7 +350,7 @@ class HTMLTree extends Tree {
$server = $this->getServer();
$logged_in_dn = $server->getLogin(null);
$logged_in_dn = $server->displayLogin(null);
echo '<tr>';
echo '<td class="spacer"></td>';
printf('<td class="logged_in" colspan="%s">%s: ',$this->getDepth()+3-1,_('Logged in as'));

View File

@@ -200,7 +200,7 @@ class TemplateRender extends PageRender {
$next_number = $vals;
foreach ($mod as $calc) {
$operand = $calc{0};
$operand = $calc[0];
$operator = substr ($calc,1);
switch ($operand) {
@@ -264,6 +264,9 @@ class TemplateRender extends PageRender {
*
* * arg 8 (for MultiList)
* - size of displayed list (default: 10 lines)
*
* * arg 9
* - if whether to include parent in sub query TRUE|FALSE
*/
case 'MultiList':
case 'PickList':
@@ -322,6 +325,9 @@ class TemplateRender extends PageRender {
$vals = array();
foreach ($picklistvalues as $key => $values) {
if (! empty($args[9]) && $container == $key)
continue;
$display = $args[3];
foreach ($matchall[1] as $key => $arg) {

View File

@@ -8,7 +8,7 @@
*/
/** The minimum version of PHP required to run phpLDAPadmin. */
define('REQUIRED_PHP_VERSION','5.0.0');
define('REQUIRED_PHP_VERSION','5.5.0');
/**
* The config class contains all our configuration settings for a session.
@@ -261,6 +261,10 @@ class Config {
'desc'=>'LDAP search filter for the tree entries',
'default'=>'(objectClass=*)');
$this->default->appearance['tree_icons'] = array(
'desc'=>'Number of Tree Icons to display on a row',
'default'=>0);
# PLA will not display the header and footer parts in minimal mode.
$this->default->appearance['minimalMode'] = array(
'desc'=>'Minimal mode hides header and footer parts',
@@ -444,7 +448,7 @@ class Config {
*/
$this->default->modify_member['groupattr'] = array(
'desc'=>'Group member attributes',
'default'=>array('member','uniqueMember','memberUid'));
'default'=>array('member','uniqueMember','memberUid','uid'));
/**
* Attribute that is added to the group member attribute. For groupOfNames or groupOfUniqueNames this is dn,
@@ -574,6 +578,20 @@ class Config {
$this->default->search['time_limit'] = array(
'desc'=>'Maximum time to allow unlimited size_limit searches to the ldap server',
'default'=>120);
/* reCAPTCHA Login */
$this->default->session['reCAPTCHA-enable'] = array(
'desc'=>'Status reCAPTCHA (true | false)',
'default'=>false);
$this->default->session['reCAPTCHA-key-site'] = array(
'desc'=>'Site Key',
'default'=>"<put-here-key-site>");
$this->default->session['reCAPTCHA-key-server'] = array(
'desc'=>'Server key',
'default'=>"<put-here-key-server>");
}
/**

View File

@@ -574,6 +574,10 @@ class Datastore {
'desc'=>'User Login ID to bind to this DS',
'default'=>null);
$this->default->login['bind_dn_template'] = array(
'desc'=>'Template string for user login DN to bind to this DS. Use \'%s\' where user input should be inserted.',
'default'=>null);
$this->default->login['bind_pass'] = array(
'desc'=>'User Login Password to bind to this DS',
'default'=>null);

View File

@@ -195,7 +195,7 @@ class ldap extends DS {
# If SASL has been configured for binding, then start it now.
if ($this->isSASLEnabled())
$bind['result'] = $this->startSASL($resource,$method);
$bind['result'] = $this->startSASL($resource,$method,$bind['id'],$bind['pass']);
# Normal bind...
else
@@ -255,7 +255,7 @@ class ldap extends DS {
if (! is_null($user)) {
# If login,attr is set to DN, then user should be a DN
if (($this->getValue('login','attr') == 'dn') || $method != 'user')
$userDN = $user;
$userDN = $this->getValue('login', 'bind_dn_template') ? $this->fillDNTemplate($user) : $user;
else
$userDN = $this->getLoginID($user,'login');
@@ -512,6 +512,15 @@ class ldap extends DS {
return $this->getBaseDN();
}
private function fillDNTemplate($user) {
foreach($this->getLoginBaseDN() as $base)
if(substr_compare($user, $base, -strlen($base)) === 0)
return $user; // $user already passed as DN
// fill template
return sprintf($this->getValue('login', 'bind_dn_template'), preg_replace('/([,\\\\#+<>;"=])/', '\\\\$1', $user));
}
/**
* Return the login classes that a user must have to login
*/
@@ -579,6 +588,8 @@ class ldap extends DS {
* Users may configure phpLDAPadmin to use SASL in config,php thus:
* <code>
* $servers->setValue('login','auth_type','sasl');
* OR
* $servers->setValue('sasl','mech','PLAIN');
* </code>
*
* @return boolean
@@ -587,8 +598,11 @@ class ldap extends DS {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($this->getValue('login','auth_type') != 'sasl')
return false;
if (! in_array($this->getValue('login','auth_type'), array('sasl'))) {
// check if SASL mech uses login from other auth_types
if (! in_array(strtolower($this->getValue('sasl', 'mech')), array('plain')))
return false;
}
if (! function_exists('ldap_sasl_bind')) {
error(_('SASL has been enabled in your config, but your PHP install does not support SASL. SASL will be disabled.'),'warn');
@@ -606,7 +620,7 @@ class ldap extends DS {
*
* @todo This has not been tested, please let the developers know if this function works as expected.
*/
private function startSASL($resource,$method) {
private function startSASL($resource,$method,$login,$pass) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
@@ -616,8 +630,8 @@ class ldap extends DS {
if ($method == 'anon')
return false;
# At the moment, we have only implemented GSSAPI
if (! in_array(strtolower($this->getValue('sasl','mech')),array('gssapi'))) {
# At the moment, we have only implemented GSSAPI and PLAIN
if (! in_array(strtolower($this->getValue('sasl','mech')),array('gssapi','plain'))) {
system_message(array(
'title'=>_('SASL Method not implemented'),
'body'=>sprintf('<b>%s</b>: %s %s',_('Error'),$this->getValue('sasl','mech'),_('has not been implemented yet')),
@@ -626,8 +640,15 @@ class ldap extends DS {
return false;
}
if (strtolower($this->getValue('sasl','mech')) == 'plain') {
return @ldap_sasl_bind($resource,NULL,$pass,'PLAIN',
$this->getValue('sasl','realm'),
$login,
$this->getValue('sasl','props'));
}
if (! isset($CACHE['login_dn']))
$CACHE['login_dn'] = is_null($this->getLogin($method)) ? $this->getLogin('user') : $this->getLogin($method);
$CACHE['login_dn'] = $login;
$CACHE['authz_id'] = '';
@@ -918,7 +939,7 @@ class ldap extends DS {
$dn = $this->getContainer($dn);
if ($dn == $top)
break;
continue;
} elseif($value)
$dn = sprintf('%s,%s',$value,$dn);

View File

@@ -28,6 +28,10 @@ class ldap_pla extends ldap {
'desc'=>'Whether to initially open each tree',
'default'=>false);
$this->default->appearance['show_authz'] = array(
'desc'=>'Enable display of authorization ID as login',
'default'=>false);
$this->default->login['fallback_dn'] = array(
'desc'=>'If the attribute base login fails, see if a DN was entered',
'default'=>false);
@@ -655,5 +659,23 @@ class ldap_pla extends ldap {
$_SESSION['ACTIVITY'][$this->getIndex()] = $this->inactivityTime();
return true;
}
/**
* Return login, or authorization ID if show_authz enabled
*/
public function displayLogin($method=null) {
// check for whoami function, added in 7.2
if ($this->getValue('appearance', 'show_authz') && function_exists('ldap_exop_whoami')) {
$result = @ldap_exop_whoami($this->connect($method));
if ($result) // strip any dn: or u: prefix
$result = preg_replace('/^(u|dn):/i', '', $result);
else // fall back to login on error
$result = $this->getLogin($method);
return $result;
}
else {
return $this->getLogin($method);
}
}
}
?>

View File

@@ -223,7 +223,7 @@ abstract class Export {
*/
protected function isSafeAscii($str) {
for ($i=0;$i<strlen($str);$i++)
if (ord($str{$i}) < 32 || ord($str{$i}) > 127)
if (ord($str[$i]) < 32 || ord($str[$i]) > 127)
return false;
return true;

View File

@@ -1638,7 +1638,7 @@ function get_icon($server_id,$dn,$object_classes=array()) {
# Return icon filename based upon objectClass value
if (in_array('sambaaccount',$object_classes) &&
'$' == $rdn{ strlen($rdn) - 1 })
'$' == $rdn[ strlen($rdn) - 1 ])
return 'nt_machine.png';
if (in_array('sambaaccount',$object_classes))
@@ -2156,7 +2156,8 @@ function password_types() {
return array(
''=>'clear',
'blowfish'=>'blowfish',
'bcrypt'=>'bcrypt',
'blowfish'=>'blowfish',
'crypt'=>'crypt',
'ext_des'=>'ext_des',
'md5'=>'md5',
@@ -2258,6 +2259,19 @@ function pla_password_hash($password_clear,$enc_type) {
break;
case 'bcrypt':
$options = [
'cost' => 8,
];
#Checking if password_hash() function is available.
if (function_exists('password_hash'))
$new_value = sprintf('{BCRYPT}%s',base64_encode(password_hash($password_clear, PASSWORD_BCRYPT, $options)));
else
error(_('Your PHP install does not have the password_hash() function. Cannot do BCRYPT hashes.'),'error','index.php');
break;
case 'smd5':
if (function_exists('mhash') && function_exists('mhash_keygen_s2k')) {
mt_srand((double)microtime()*1000000);
@@ -2311,6 +2325,7 @@ function pla_password_hash($password_clear,$enc_type) {
* @return Boolean True if the clear password matches the hash, and false otherwise.
*/
function password_check($cryptedpassword,$plainpassword,$attribute='userpassword') {
$plainpassword = htmlspecialchars_decode($plainpassword);
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
@@ -2363,6 +2378,23 @@ function password_check($cryptedpassword,$plainpassword,$attribute='userpassword
}
break;
#BCRYPT hashed passwords
case 'bcrypt':
# Check php password_verify support before using it
if (function_exists('password_verify')) {
$hash = base64_decode($cryptedpassword);
if (password_verify($plainpassword, $hash)) {
return true;
} else {
return false;
}
} else {
error(_('Your PHP install does not have the password_verify() function. Cannot do Bcrypt hashes.'),'error','index.php');
}
break;
# Salted MD5
case 'smd5':
@@ -3217,4 +3249,30 @@ function isAjaxEnabled() {
else
return false;
}
/**
* Check if user is a robot with reCAPTCHA
**/
function IsRobot($gResponse){
$isRobot = true;
$url = 'https://www.google.com/recaptcha/api/siteverify';
$data = array(
'secret' => $_SESSION[APPCONFIG]->getValue('session','reCAPTCHA-key-server'),
'response' => $gResponse
);
$options = array(
'http' => array (
'method' => 'POST','header' =>
'Content-Type: application/x-www-form-urlencoded',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$verify = file_get_contents($url, false, $context);
$captcha_success = json_decode($verify);
if ($captcha_success->success) {
$isRobot = false;
}
return $isRobot;
}
?>

View File

@@ -32,7 +32,7 @@
* element priority. 1 otherwise.
*/
function sort_array_by_priority($a,$b) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',257,0,__FILE__,__LINE__,__METHOD__,$fargs);
return (($a['priority'] < $b['priority']) ? -1 : 1 );
@@ -68,7 +68,7 @@ function run_hook($hook_name,$args) {
/* Execution of procedures attached is done using a numeric order
* since all procedures have been attached to the hook with a
* numerical weight. */
while (list($key,$hook) = each($hooks[$hook_name])) {
foreach ($hooks[$hook_name] as $key=>$hook) {
if (DEBUG_ENABLED)
debug_log('Calling HOOK Function (%s)(%s)',257,0,__FILE__,__LINE__,__METHOD__,
$hook['hook_function'],$args);
@@ -159,7 +159,7 @@ function remove_hook($hook_name,$hook_function,$priority,$rollback_function) {
if (array_key_exists($hook_name,$_SESSION[APPCONFIG]->hooks)) {
reset($_SESSION[APPCONFIG]->hooks[$hook_name]);
while (list($key,$hook) = each($_SESSION[APPCONFIG]->hooks[$hook_name])) {
foreach ($_SESSION[APPCONFIG]->hooks[$hook_name] as $key=>$hook) {
if (($priority >= 0 && $priority == $hook['priority']) ||
($hook_function && $hook_function == $hook['hook_function']) ||
($rollback_function && $rollback_function == $hook['rollback_function'])) {

View File

@@ -48,6 +48,7 @@
1.3.6.1.1.13.1 "Pre-Read Controls" "" "The Pre-Read request control, indicates that a copy of the entry before application of update is to be returned."
1.3.6.1.1.13.2 "Post-Read Controls" "" "The Pre-Read request control, indicates that a copy of the entry before application of update is to be returned."
1.3.6.1.1.14 "Modify-Increment Extension" "RFC 4525" "An extension to the Lightweight Directory Access Protocol (LDAP) Modify operation to support an increment capability."
1.3.6.1.1.22 "Don't Use Copy Control" "RFC 9171" "When the control is attached to an LDAP request, the requested operation MUST NOT be performed on copied information. That is, the requested operation MUST be performed on original information."
1.3.6.1.4.1.42.2.27.8.5.1 "passwordPolicyRequest"
1.3.6.1.4.1.42.2.27.9.5.2 "GetEffectiveRights control" "" "May be used to determine what operations a given user may perform on a specified entry."
1.3.6.1.4.1.1466.101.119.1 "Dynamic Directory Services Refresh Request" "RFC 2589"

Binary file not shown.