Compare commits

..

56 Commits
1.2.3 ... 1.2.4

Author SHA1 Message Date
Deon George
95411c05e1 Release 1.2.4 2019-05-14 15:01:32 +10:00
Deon George
7b1f6b5132 Fix for PHP 7.3 - deprecated continue in switch 2019-05-14 15:00:28 +10:00
Deon George
3c0ca27477 Remove SF branding 2019-04-21 23:37:10 +10:00
Deon George
511ead3ec6 Revert #63 - Add attribute not rendering correctly 2019-04-20 15:39:48 +10:00
Deon George
e37b498de1 PHP 7.2 compatibility fixes - closes #64 2019-04-19 22:48:22 +10:00
Deon George
29d7d4b2f7 Fixes #31 - Glue entries are not browsable through phpldapadmin 2019-04-19 21:01:02 +10:00
Deon George
c494078550 Closes pull request #22 and fixes #18 - preg_replace_callback changes 2019-04-19 20:08:53 +10:00
Deon George
73b7795bc0 Fixes #21 - Undefined variable: _SESSION 2019-04-18 23:17:24 +10:00
Deon George
c1af05f403 Merge pull request #63 from dago/renderfix
Fixes for translation of "Add new attribute"
2019-04-18 12:34:00 +10:00
Deon George
49ef60f26b Merge pull request #62 from spagu/patch-1
Fix php7.2 errors for function __autoload and create_function as they were deprecated.
2019-04-18 12:31:49 +10:00
Deon George
aa11e318ec Merge pull request #60 from NHellFire/php7.1
Use OpenSSL for blowfish when available (fixes #58)
2019-04-18 12:16:08 +10:00
Deon George
f3aad72b57 Merge pull request #66 from MichaelIT/master
Incompatable with openLDAP >=2.1.2
2019-04-18 11:58:12 +10:00
Deon George
6a55d808a2 Merge pull request #69 from RoyChaudhuri/master
Fix for bug #68, long redirect response
2019-04-18 11:56:25 +10:00
Deon George
aec5053f55 Merge pull request #71 from anarcat/CVE-2017-11107
Fix multiple XSS in file htdocs/entry_chooser.php (CVE-2017-11107)
2019-04-18 11:54:45 +10:00
Antoine Beaupré
4484129a41 Fix multiple XSS in file htdocs/entry_chooser.php (CVE-2017-11107)
Closes: #50

From: Ismail Belkacim <xd4rker@gmail.com>
2018-10-31 14:04:44 -04:00
Roy Chaudhuri
2e43cf95b9 Fix for bug #68, exit after redirect response when URI parameter is received by index.php 2018-09-17 15:45:42 +01:00
Michael
7569423f11 Update functions.php
Since openLDAP >=2.1.2,ldap_explode_dn turns unprintable chars (in the ASCII sense, UTF8 encoded) into \<hexcode>.
2018-07-17 19:59:11 +08:00
Dagobert Michelsen
5c0f787fbf Add URL for translation 2018-04-20 13:10:20 +02:00
Dagobert Michelsen
6c85d61525 Fix invocation of layout in TemplateRenderer 2018-04-20 12:33:58 +02:00
spagu
884cce1475 Update functions.php 2018-04-19 11:10:12 +01:00
NHellFire
53e005c1f4 Use OpenSSL for blowfish when available (fixes #58) 2018-02-11 07:22:36 +00:00
Deon George
733a10a1c5 Merge pull request #40 from PatrickBaus/master
Fixed detection of SSL encryption behind proxy server
2016-10-30 16:53:36 +08:00
Deon George
708bc5ed83 Merge pull request #37 from mr-GreyWolf/patch-1
Update functions.php
2016-10-30 16:53:05 +08:00
Deon George
e46579b34e Merge pull request #34 from gulikoza/master
Fix moving ldap entries and login error with 'fallback_dn'
2016-10-30 16:52:22 +08:00
Deon George
4fefe2aa8c Merge pull request #42 from ptomulik/crypt-sha
add support for SHA-256 and SHA-512 via crypt(3)
2016-10-30 16:47:44 +08:00
Paweł Tomulik
ee9034f24c add support for SHA-256 and SHA-512 via crypt(3) 2016-10-08 21:24:33 +02:00
Patrick Baus
61af45e872 Enabled HTTP_X_FORWARDED_PROTO header detection. It was disabled for testing. 2016-08-11 02:45:18 +02:00
Patrick Baus
dd6e9583a2 Fixed request smuggling vulnerability. See: https://www.owasp.org/index.php/OWASP_Periodic_Table_of_Vulnerabilities_-_HTTP_Request/Response_Smuggling
According to https://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method, the header should be ignored anyway if those properties were set.
2016-08-11 01:48:12 +02:00
Patrick Baus
665dbc2690 Fixed detection of SSL encryption, when a reverse proxy is used, that does the encryption.
If the server sets the HTTP_X_FORWARDED_PROTO header to 'https' or the
HTTP_X_FORWARDED_SSL header to 'on' SSL encryption is assumed
2016-08-11 01:32:41 +02:00
mr-GreyWolf
599d55700d Update functions.php 2016-03-30 23:07:02 +04:00
gulikoza
726190e5b8 Fix moving entries when confirm['copy'] is set.
If 'Delete after copy (move)' is selected and confirm['copy'] is set (which is default),
the entry will be copyied (created) not moved. This patch will skip confirm when entry
is being moved as there is no reason to confirm the move again.
2016-01-24 12:02:42 +01:00
gulikoza
0b8375fd2a Add additional check that full dn has been entered on login.
Fixes 'invalid dn syntax (34) for user' error when fallback_dn set and username was not found while trying to use it as dn.
2016-01-24 11:52:21 +01:00
Deon George
fa88250f0e Merge pull request #32 from jsdevel/fixing-sflogo-protocol-for-reverse-proxies
Changing the sourceforge logo to be protocol relative.
2015-12-07 16:56:41 +11:00
jsdevel
0491916d90 Changing the sourceforge logo to be protocol relative.
* This allows the browser to resolve the URL against the protocol the user used, not what a reverse proxy used.
2015-12-05 23:02:11 -07:00
Deon George
c004a291d7 Merge pull request #19 from scollin/master
Fix some monitor information problems
2015-02-23 12:40:32 -08:00
Sébastien Collin
54191d7ffb Fix some monitor information problems
Fix some monitor information problems as reported by @brendankearney
2015-01-30 13:56:29 +01:00
Deon George
9e283f369f Merge pull request #13 from DevoKun/master
Changed password_hash to pla_password_hash in a few places where it was still password_hash.
2014-10-08 12:30:58 +11:00
Devon Hubner
19114385fc Changed password_hash to pla_password_hash in a few places where it was still password_hash. 2014-10-07 14:25:32 -04:00
Deon George
7701e98bcc Merge pull request #11 from robgloess/patch-1
Fixed parse error in TemplateRender.php
2014-10-07 12:54:51 +11:00
robgloess
d4c2fb52ab Update TemplateRender.php
Fixed typo on 1682 - parse issue, non escaped " ' " causing error to be thrown
2014-09-30 22:28:09 +01:00
Deon George
7cbdd0c8db Merge pull request #9 from uda/master
Minor doc changes
2014-09-23 15:59:42 +10:00
Yehuda Deutsch
afec12d163 Rename INSTALL to INSTALL.md 2014-09-21 11:11:07 +03:00
Yehuda Deutsch
a4a602b6ec Created README.md 2014-09-21 11:10:30 +03:00
Deon George
e1952cddb6 Merge pull request #6 from marclaporte/patch-2
typos
2014-09-18 12:32:56 +10:00
Deon George
ee415fe8c6 Merge pull request #5 from marclaporte/patch-1
typo
2014-09-18 12:32:08 +10:00
Deon George
eca5c4ea9f Merge pull request #8 from pteague/master
Modified posixAccount Shell selection
2014-09-18 12:31:19 +10:00
Patrick Teague
a01752a68c * Fixed posixAccount Shell so that 'Bash' is actually bash and not shell. Also added Shell, Dash, False, and No Login 2014-09-16 14:53:52 -05:00
Marc Laporte
ba90f86e7b typos 2014-07-25 23:04:40 -04:00
Marc Laporte
6135f94a51 typo 2014-07-25 20:36:21 -04:00
Deon George
f7c4bd311a Merge pull request #4 from ivdmeer/master
Bugfix: fixed call to renamed function pla_password_hash.
2014-06-05 13:00:27 +10:00
Ivo van der Meer
c736ecd8c2 Bugfix: fixed call to renamed function pla_password_hash. 2014-06-04 10:48:06 +02:00
Deon George
d2a800878f Merge pull request #3 from bchavet/master
Use preg_replace_callback instead of /e in preg_replace
2014-06-04 13:43:52 +10:00
Ben Chavet
5a7edc892f Use preg_replace_callback instead of /e in preg_replace to fix E_DEPRECATED warnings 2014-05-29 18:57:44 +00:00
Deon George
d258398b68 Merge pull request #2 from archayl/php55fix
Php55fix
2014-05-14 09:05:39 +10:00
Mohamad Elrashidin Bin Sajeli
b082cf1742 Changed preg_replace to preg_replace callback 2014-05-08 20:40:57 +08:00
Mohamad Elrashidin Bin Sajeli
e673df3ba8 Changed password_hash to pla_password_hash 2014-05-08 20:22:30 +08:00
20 changed files with 181 additions and 65 deletions

View File

13
README.md Normal file
View File

@@ -0,0 +1,13 @@
phpLDAPadmin
============
phpLDAPadmin - Web based LDAP administration tool
## Installation
[INSTALL](INSTALL.md)
## License
[LICENSE](LICENSE)

View File

@@ -1 +1 @@
RELEASE-1.2.3
RELEASE-1.2.4

View File

@@ -379,7 +379,7 @@ $servers->setValue('server','name','My LDAP Server');
/* Default password hashing algorithm. One of md5, ssha, sha, md5crpyt, smd5,
blowfish, crypt or leave blank for now default algorithm. */
// $servers->setValue('appearance','password_hash','md5');
// $servers->setValue('appearance','pla_password_hash','md5');
/* If you specified 'cookie' or 'session' as the auth_type above, you can
optionally specify here an attribute to use when logging in. If you enter
@@ -546,7 +546,7 @@ $servers->setValue('sasl','authz_id_regex','/^uid=([^,]+)(.+)/i');
$servers->setValue('sasl','authz_id_replacement','$1');
$servers->setValue('sasl','props',null);
$servers->setValue('appearance','password_hash','md5');
$servers->setValue('appearance','pla_password_hash','md5');
$servers->setValue('login','attr','dn');
$servers->setValue('login','fallback_dn',false);
$servers->setValue('login','class',null);

View File

@@ -1,2 +1,2 @@
Please see http://phpldapadmin.sourceforge.net/Translate now for information on
Please see http://phpldapadmin.sourceforge.net/wiki/index.php/Translate now for information on
translating PLA.

View File

@@ -63,7 +63,7 @@ if ($request['recursive']) {
print '</small>';
} else {
if ($_SESSION[APPCONFIG]->getValue('confirm','copy')) {
if ($_SESSION[APPCONFIG]->getValue('confirm','copy') && !$request['remove']) {
$request['pageSRC'] = new TemplateRender($ldap['SRC']->getIndex(),get_request('template','REQUEST',false,null));
$request['pageSRC']->setDN($request['dnSRC']);
$request['pageSRC']->accept(true);

View File

@@ -15,9 +15,9 @@ $www['page'] = new page();
$request = array();
$request['container'] = get_request('container','GET');
$request['form'] = get_request('form','GET');
$request['element'] = get_request('element','GET');
$request['rdn'] = get_request('rdn','GET');
$request['form'] = htmlspecialchars(addslashes(get_request('form','GET')));
$request['element'] = htmlspecialchars(addslashes(get_request('element','GET')));
$request['rdn'] = htmlspecialchars(addslashes(get_request('rdn','GET')));
echo '<div class="popup">';
printf('<h3 class="subtitle">%s</h3>',_('Entry Chooser'));
@@ -33,7 +33,7 @@ echo '</script>';
echo '<table class="forminput" width="100%" border="0">';
if ($request['container']) {
printf('<tr><td class="heading" colspan="3">%s:</td><td>%s</td></tr>',_('Server'),$app['server']->getName());
printf('<tr><td class="heading" colspan="3">%s:</td><td>%s</td></tr>',_('Looking in'),$request['container']);
printf('<tr><td class="heading" colspan="3">%s:</td><td>%s</td></tr>',_('Looking in'),htmlspecialchars($request['container']));
echo '<tr><td class="blank" colspan="4">&nbsp;</td></tr>';
}

View File

@@ -81,7 +81,7 @@ printf('<tr><td>%s</td><td><input type="text" name="filter" style="width:300px"
_('Search Filter'),htmlspecialchars($request['filter']));
printf('<tr><td>%s</td><td><input type="text" name="attributes" style="width:300px" value="%s" /></td></tr>',
_('Show Attributtes'),htmlspecialchars($request['attr']));
_('Show Attributes'),htmlspecialchars($request['attr']));
printf('<tr><td>&nbsp;</td><td><input type="checkbox" name="sys_attr" id="sys_attr" %s/> <label for="sys_attr">%s</label></td></tr>',
$request['sys_attr'] ? 'checked="checked" ' : '',_('Include system attributes'));

View File

@@ -57,6 +57,11 @@ if (defined('CONFDIR'))
else
$app['config_file'] = 'config.php';
if (! is_readable($app['config_file'])) {
if (ob_get_level()) ob_end_clean();
die(sprintf("Missing configuration file <b>%s</b> - have you created it?",$app['config_file']));
}
# Make sure this PHP install has session support
if (! extension_loaded('session'))
error('<p>Your install of PHP appears to be missing php-session support.</p><p>Please install php-session support before using phpLDAPadmin.<br /><small>(Dont forget to restart your web server afterwards)</small></p>','error',null,true);
@@ -120,8 +125,10 @@ if (! $config = check_config($app['config_file'])) {
$_SESSION[APPCONFIG] = $config;
}
if ($uri = get_request('URI','GET'))
if ($uri = get_request('URI','GET')) {
header(sprintf('Location: cmd.php?%s',base64_decode($uri)));
exit;
}
if (! preg_match('/^([0-9]+\.?)+/',app_version())) {
system_message(array(

View File

@@ -202,8 +202,6 @@ function makeHttpRequest(url,parameters,meth,successCallbackFunctionName,errorCa
http_request.open(meth,url,true);
http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded');
http_request.setRequestHeader('Content-length',parameters.length);
http_request.setRequestHeader('Connection','close');
if (meth == 'GET') parameters = null;
http_request.send(parameters);

View File

@@ -16,7 +16,19 @@ printf('<h3 class="title">%s %s</h3>',_('Authenticate to server'),$app['server']
echo '<br />';
# Check for a secure connection
if (! isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on') {
$isHTTPS = false;
# Check if the current connection is encrypted
if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') {
$isHTTPS = true;
}
# Check if a proxy server downstream does encryption for us
elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && strtolower($_SERVER['HTTP_X_FORWARDED_SSL'])
== 'on') {
$isHTTPS = true;
}
if (!$isHTTPS) {
echo '<div style="text-align: center; color:red">';
printf('<acronym title="%s"><b>%s: %s.</b></acronym>',
_('You are not using \'https\'. Web browser will transmit login information in clear text.'),
@@ -25,6 +37,7 @@ if (! isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on') {
echo '<br />';
}
unset($isSecure);
# HTTP Basic Auth Form.
if ($app['server']->getAuthType() == 'http') {

View File

@@ -129,15 +129,15 @@ foreach (array(
}
# cn=Connections,cn=Monitor
printf('<tr class="list_item"><td class="heading" rowspan="2"><acronym title="%s">%s</acronym></td></tr>',$results['cn=Connections,cn=Monitor']['description'],_('LDAP Connections'));
printf('<tr class="list_item"><td class="heading" rowspan="2"><acronym title="%s">%s</acronym></td></tr>',$results['cn=Connections,cn=Monitor']['description'][0],_('LDAP Connections'));
printf('<tr class="list_item"><td class="value">');
echo '<table class="result"><tr><td>';
echo '<table class="result_table" border="0" width="100%">';
printf('<tr class="highlight"><td class="20%%">%s</td><td class="value" style="width: 80%%;">%s</td></tr>',
_('Total Connections'),$results['cn=Total,cn=Connections,cn=Monitor']['monitorcounter']);
_('Total Connections'),$results['cn=Total,cn=Connections,cn=Monitor']['monitorcounter'][0]);
printf('<tr class="highlight"><td class="20%%">%s</td><td class="value" style="width: 80%%;">%s</td></tr>',
_('Current Connections'),$results['cn=Current,cn=Connections,cn=Monitor']['monitorcounter']);
_('Current Connections'),$results['cn=Current,cn=Connections,cn=Monitor']['monitorcounter'][0]);
# Look for some connections
foreach ($results as $key => $value) {

View File

@@ -287,7 +287,7 @@ class PageRender extends Visitor {
break;
default:
$vals[$i] = password_hash($passwordvalue,$enc);
$vals[$i] = pla_password_hash($passwordvalue,$enc);
}
$vals = array_unique($vals);
@@ -957,7 +957,7 @@ class PageRender extends Visitor {
if (trim($val))
$enc_type = get_enc_type($val);
else
$enc_type = $server->getValue('appearance','password_hash');
$enc_type = $server->getValue('appearance','pla_password_hash');
$obfuscate_password = obfuscate_password_display($enc_type);
@@ -982,7 +982,7 @@ class PageRender extends Visitor {
if (trim($val))
$enc_type = get_enc_type($val);
else
$enc_type = $server->getValue('appearance','password_hash');
$enc_type = $server->getValue('appearance','pla_password_hash');
echo '<table cellspacing="0" cellpadding="0"><tr><td valign="top">';

View File

@@ -321,7 +321,7 @@ class QueryRender extends PageRender {
if (! $results) {
echo _('Search returned no results');
continue;
continue 2;
}
printf('<form action="cmd.php" method="post" id="massform_%s">',$counter);

View File

@@ -59,7 +59,7 @@ class TemplateRender extends PageRender {
$this->layout['action'] = '<td class="icon"><img src="%s/%s" alt="%s" /></td><td><a href="cmd.php?%s" title="%s">%s</a></td>';
$this->layout['actionajax'] = '<td class="icon"><img src="%s/%s" alt="%s" /></td><td><a href="cmd.php?%s" title="%s" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'%s\');">%s</a></td>';
# If we dont want to render this template automatically, we'll return here.
# If we don't want to render this template automatically, we'll return here.
if ($norender)
return;
@@ -273,7 +273,7 @@ class TemplateRender extends PageRender {
else
$container = $args[5];
# Process filter (arg 1), eventually replace %attr% by it's value set in a previous page.
# Process filter (arg 1), eventually replace %attr% by its value set in a previous page.
preg_match_all('/%(\w+)(\|.+)?(\/[lUC])?%/U',$args[1],$filtermatchall);
//print_r($matchall); // -1 = highlevel match, 1 = attr, 2 = subst, 3 = mod
@@ -1679,7 +1679,7 @@ function validateForm(silence) {
// Sometimes the alert gives us enough time!
if (typeof getAttributeComponents != "undefined")
alert("Dont bother, our JS is loaded now!");
alert("Don\'t bother, our JS is loaded now!");
}
validateForm(true);
@@ -2466,7 +2466,7 @@ function deleteAttribute(attrName,friendlyName,i)
if ($val = $attribute->getValue($i))
$default = get_enc_type($val);
else
$default = $this->getServer()->getValue('appearance','password_hash');
$default = $this->getServer()->getValue('appearance','pla_password_hash');
if (! $attribute->getPostValue())
printf('<input type="hidden" name="post_value[%s][]" value="%s" />',$attribute->getName(),$i);

View File

@@ -181,6 +181,14 @@ class ldap extends DS {
* specifies deref behavior for each ldap_search operation. */
ldap_set_option($resource,LDAP_OPT_REFERRALS,0);
/* Enabling manageDsaIt to be able to browse through glued entries
* 2.16.840.1.113730.3.4.2 : "ManageDsaIT Control" "RFC 3296" "The client may provide
* the ManageDsaIT control with an operation to indicate that the operation is intended
* to manage objects within the DSA (server) Information Tree. The control causes
* Directory-specific entries (DSEs), regardless of type, to be treated as normal entries
* allowing clients to interrogate and update these entries using LDAP operations." */
ldap_set_option($resource,LDAP_OPT_SERVER_CONTROLS,array(array('oid'=>'2.16.840.1.113730.3.4.2')));
# Try to fire up TLS is specified in the config
if ($this->isTLSEnabled())
$this->startTLS($resource);
@@ -251,7 +259,7 @@ class ldap extends DS {
else
$userDN = $this->getLoginID($user,'login');
if (! $userDN && $this->getValue('login','fallback_dn'))
if (! $userDN && $this->getValue('login','fallback_dn') && strpos($user, '='))
$userDN = $user;
if (! $userDN)
@@ -1116,13 +1124,14 @@ class ldap extends DS {
if (is_array($dn)) {
$a = array();
foreach ($dn as $key => $rdn)
$a[$key] = preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$rdn);
foreach ($dn as $key => $rdn) {
$a[$key] = preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', function($m) { return chr(hexdec('${m[1]}')); }, $rdn);
}
return $a;
} else
return preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$dn);
} else {
return preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', function($m) { return chr(hexdec('${m[1]}')); }, $dn);
}
}
public function getRootDSE($method=null) {

View File

@@ -16,7 +16,7 @@ class ldap_pla extends ldap {
function __construct($index) {
parent::__construct($index);
$this->default->appearance['password_hash'] = array(
$this->default->appearance['pla_password_hash'] = array(
'desc'=>'Default HASH to use for passwords',
'default'=>'md5');

View File

@@ -51,7 +51,7 @@ if (file_exists(LIBDIR.'functions.custom.php'))
/**
* Loads class definition
*/
function __autoload($className) {
function pla_autoload($className) {
if (file_exists(HOOKSDIR."classes/$className.php"))
require_once(HOOKSDIR."classes/$className.php");
elseif (file_exists(LIBDIR."$className.php"))
@@ -66,10 +66,16 @@ function __autoload($className) {
'type'=>'error'));
}
if (version_compare(phpversion(), '7.0', '>=')) {
spl_autoload_register('pla_autoload');
} else {
eval('function __autoload($className) {pla_autoload($className);}');
}
/**
* Strips all slashes from the specified array in place (pass by ref).
* @param Array The array to strip slashes from, typically one of
* $_GET, $_POST, or $_COOKIE.
* $_GET, $_POST, or $_COOKIE.
*/
function array_stripslashes(&$array) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@@ -362,7 +368,7 @@ function cmd_control_pane($type) {
'hide_debug_info'=>array(
'title'=>_('Show Cache'),
'enable'=>isset($_SESSION[APPCONFIG]) ? $_SESSION[APPCONFIG]->isCommandAvailable('script','show_cache') : false,
'enable'=>isset($_SESSION[APPCONFIG]) ? ($_SESSION[APPCONFIG]->isCommandAvailable('script','show_cache')) && (! $_SESSION[APPCONFIG]->getValue('appearance','hide_debug_info')) : false,
'link'=>sprintf('href="cmd.php?cmd=show_cache" onclick="return ajDISPLAY(\'BODY\',\'cmd=show_cache\',\'%s\');" title="%s"',
_('Loading'),_('Show Cache'),_('Show Cache')),
'image'=>sprintf('<img src="%s/debug-cache.png" alt="%s" />',IMGDIR,_('Show Cache'))),
@@ -745,6 +751,11 @@ function blowfish_encrypt($data,$secret=null) {
if (! trim($secret))
return $data;
if (! empty($data) && function_exists('openssl_encrypt') && in_array('bf-ecb', openssl_get_cipher_methods())) {
$keylen = openssl_cipher_iv_length('bf-ecb') * 2;
return openssl_encrypt($data, 'bf-ecb', substr($secret,0,$keylen));
}
if (function_exists('mcrypt_module_open') && ! empty($data)) {
$td = mcrypt_module_open(MCRYPT_BLOWFISH,'',MCRYPT_MODE_ECB,'');
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td),MCRYPT_DEV_URANDOM);
@@ -801,6 +812,11 @@ function blowfish_decrypt($encdata,$secret=null) {
if (! trim($secret))
return $encdata;
if (! empty($encdata) && function_exists('openssl_encrypt') && in_array('bf-ecb', openssl_get_cipher_methods())) {
$keylen = openssl_cipher_iv_length('bf-ecb') * 2;
return trim(openssl_decrypt($encdata, 'bf-ecb', substr($secret,0,$keylen)));
}
if (function_exists('mcrypt_module_open') && ! empty($encdata)) {
$td = mcrypt_module_open(MCRYPT_BLOWFISH,'',MCRYPT_MODE_ECB,'');
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td),MCRYPT_DEV_URANDOM);
@@ -993,6 +1009,23 @@ function get_custom_file($index,$filename,$path) {
return $return;
}
/**
* Replacement for create_function() which is deprecated as of php 7.2
*
* @param string The function arguments
* @param string The function code
*/
function pla_create_function($args, $code) {
if (version_compare(phpversion(),'7.0','>=')) {
# anonymous functions were introduced in PHP 5.3.0
return eval("return function(".$args."){".$code."};");
} else {
# create_function is deprecated in php 7.2
return create_function($args, $code);
}
}
/**
* Sort a multi dimensional array.
*
@@ -1080,7 +1113,7 @@ function masort(&$data,$sortby,$rev=0) {
$code .= 'return $c;';
$CACHE[$sortby] = create_function('$a, $b',$code);
$CACHE[$sortby] = pla_create_function('$a, $b',$code);
}
uasort($data,$CACHE[$sortby]);
@@ -2116,6 +2149,8 @@ function password_types() {
'smd5'=>'smd5',
'ssha'=>'ssha',
'sha512'=>'sha512',
'sha256crypt'=>'sha256crypt',
'sha512crypt'=>'sha512crypt',
);
}
@@ -2124,10 +2159,11 @@ function password_types() {
*
* @param string The password to hash in clear text.
* @param string Standard LDAP encryption type which must be one of
* crypt, ext_des, md5crypt, blowfish, md5, sha, smd5, ssha, sha512, or clear.
* crypt, ext_des, md5crypt, blowfish, md5, sha, smd5, ssha, sha512,
* sha256crypt, sha512crypt, or clear.
* @return string The hashed password.
*/
function password_hash($password_clear,$enc_type) {
function pla_password_hash($password_clear,$enc_type) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
@@ -2227,6 +2263,20 @@ function password_hash($password_clear,$enc_type) {
break;
case 'sha256crypt':
if (! defined('CRYPT_SHA256') || CRYPT_SHA256 == 0)
error(_('Your system crypt library does not support sha256crypt encryption.'),'error','index.php');
$new_value = sprintf('{CRYPT}%s',crypt($password_clear,'$5$'.random_salt(8)));
break;
case 'sha512crypt':
if (! defined('CRYPT_SHA512') || CRYPT_SHA512 == 0)
error(_('Your system crypt library does not support sha512crypt encryption.'),'error','index.php');
$new_value = sprintf('{CRYPT}%s',crypt($password_clear,'$6$'.random_salt(8)));
break;
case 'clear':
default:
$new_value = $password_clear;
@@ -2318,7 +2368,7 @@ function password_check($cryptedpassword,$plainpassword,$attribute='userpassword
# SHA crypted passwords
case 'sha':
if (strcasecmp(password_hash($plainpassword,'sha'),'{SHA}'.$cryptedpassword) == 0)
if (strcasecmp(pla_password_hash($plainpassword,'sha'),'{SHA}'.$cryptedpassword) == 0)
return true;
else
return false;
@@ -2327,7 +2377,7 @@ function password_check($cryptedpassword,$plainpassword,$attribute='userpassword
# MD5 crypted passwords
case 'md5':
if( strcasecmp(password_hash($plainpassword,'md5'),'{MD5}'.$cryptedpassword) == 0)
if( strcasecmp(pla_password_hash($plainpassword,'md5'),'{MD5}'.$cryptedpassword) == 0)
return true;
else
return false;
@@ -2392,7 +2442,7 @@ function password_check($cryptedpassword,$plainpassword,$attribute='userpassword
# SHA512 crypted passwords
case 'sha512':
if (strcasecmp(password_hash($plainpassword,'sha512'),'{SHA512}'.$cryptedpassword) == 0)
if (strcasecmp(pla_password_hash($plainpassword,'sha512'),'{SHA512}'.$cryptedpassword) == 0)
return true;
else
return false;
@@ -2470,6 +2520,32 @@ function draw_chooser_link($form,$element,$include_choose_text=true,$rdn='none')
printf('<span class="x-small"><a href="%s" title="%s">%s</a></span>',$href,$title,_('browse'));
}
/**
* http://php.net/manual/en/function.ldap-explode-dn.php#34724
* fixed for:
* Keep attention on UTF8 encoded DNs. Since openLDAP >=2.1.2
* ldap_explode_dn turns unprintable chars (in the ASCII sense, UTF8
* encoded) into \<hexcode>.
*/
function ldap_explode_dn_patch($dn,$with_attrib) {
$result = ldap_explode_dn($dn,$with_attrib);
if (! $result)
return null;
# translate hex code into ascii again
foreach ($result as $key => $value) {
$result[$key] = preg_replace_callback(
"/\\\([0-9A-Fa-f]{2})/",
function ($matches) {
return chr(hexdec($matches[1]));
},
$value
);
}
return $result;
}
/**
* Explode a DN into an array of its RDN parts.
*
@@ -2505,8 +2581,8 @@ function pla_explode_dn($dn,$with_attributes=0) {
$dn = addcslashes($dn,'<>+";');
# split the dn
$result[0] = ldap_explode_dn(dn_escape($dn),0);
$result[1] = ldap_explode_dn(dn_escape($dn),1);
$result[0] = ldap_explode_dn_patch(dn_escape($dn),0);
$result[1] = ldap_explode_dn_patch(dn_escape($dn),1);
if (! $result[$with_attributes]) {
if (DEBUG_ENABLED)
debug_log('Returning NULL - NO result.',1,0,__FILE__,__LINE__,__METHOD__);
@@ -2565,12 +2641,22 @@ function dn_unescape($dn) {
$a = array();
foreach ($dn as $key => $rdn)
$a[$key] = preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$rdn);
$a[$key] = preg_replace_callback('/\\\([0-9A-Fa-f]{2})/',
function ($r) {
return chr(hexdec($r[1]));
},
$rdn
);
return $a;
} else {
return preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$dn);
return preg_replace_callback('/\\\([0-9A-Fa-f]{2})/',
function ($r) {
return chr(hexdec($r[1]));
},
$dn
);
}
}
@@ -2583,35 +2669,21 @@ function dn_unescape($dn) {
* @return string The URL to the requested item.
*/
function get_href($type,$extra_info='') {
$sf = 'https://sourceforge.net';
$pla = 'http://phpldapadmin.sourceforge.net';
$group_id = '61828';
$bug_atid = '498546';
$rfe_atid = '498549';
$forum_id = 'phpldapadmin-users';
switch($type) {
case 'add_bug':
return sprintf('%s/tracker/?func=add&amp;group_id=%s&amp;atid=%s',$sf,$group_id,$bug_atid);
return 'https://github.com/leenooks/phpLDAPadmin/issues';
case 'add_rfe':
return sprintf('%s/tracker/?func=add&amp;group_id=%s&amp;atid=%s',$sf,$group_id,$rfe_atid);
return 'https://github.com/leenooks/phpLDAPadmin/issues';
case 'credits':
return sprintf('%s/Credits',$pla);
case 'documentation':
return sprintf('%s/Documentation',$pla);
case 'donate':
return sprintf('%s/donate/index.php?group_id=%s',$sf,$group_id);
return 'https://sourceforge.net/donate/index.php?group_id=61828';
case 'forum':
return sprintf('%s/mailarchive/forum.php?forum_name=%s',$sf,$forum_id);
case 'logo':
if (! isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on')
$proto = 'http';
else
$proto = 'https';
return isset($_SESSION) && ! $_SESSION[APPCONFIG]->getValue('appearance','remoteurls') ? '' : sprintf('%s://sflogo.sourceforge.net/sflogo.php?group_id=%s&amp;type=10',$proto,$group_id);
case 'sf':
return sprintf('%s/projects/phpldapadmin',$sf);
return 'https://stackoverflow.com/questions/tagged/phpldapadmin';
case 'web':
return sprintf('%s',$pla);
default:

View File

@@ -323,7 +323,7 @@ class page {
printf('<tr class="foot"><td><small>%s</small></td><td colspan="2"><div id="ajFOOT">%s</div>%s</td></tr>',
isCompress() ? '[C]' : '&nbsp;',
app_version(),
get_href('logo') ? sprintf('<a href="%s"><img src="%s" alt="SourceForge.net Logo" style="border: 0px;" /></a>',get_href('sf'),get_href('logo')) : '&nbsp;');
'&nbsp;');
}
/**

View File

@@ -72,9 +72,13 @@
<page>1</page>
<!-- <value><![CDATA[=php.PickList(/;(&(objectClass=posixAccount));loginShell;%loginShell%;;;;loginShell)]]></value> -->
<type>select</type>
<value id="/bin/sh">Bash</value>
<value id="/bin/bash">Bash</value>
<value id="/bin/csh">C Shell</value>
<value id="/bin/dash">Dash</value>
<value id="/bin/sh">Shell</value>
<value id="/bin/tsh">Turbo C Shell</value>
<value id="/bin/false">False</value>
<value id="/usr/sbin/nologin">No Login</value>
</attribute>
<attribute id="userPassword">
<display>Password</display>