1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-21 04:06:46 +00:00

net/phpldapadmin: update to 1.2.6.2 release

Set option pecl-mpcrypt for password hashes
Project moved to GitHub

PR:		245815
Approved by:	maintainer
This commit is contained in:
Dima Panov 2020-09-23 16:13:26 +00:00
parent fe9d06f460
commit 76d4c272f4
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=549746
9 changed files with 14 additions and 277 deletions

View File

@ -2,11 +2,8 @@
# $FreeBSD$
PORTNAME= phpldapadmin
PORTVERSION= 1.2.3
PORTREVISION= 11
PORTEPOCH= 1
PORTVERSION= 1.2.6.2
CATEGORIES= net www
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}-php5/${PORTVERSION}
PKGNAMESUFFIX= ${PHP_PKGNAMESUFFIX}
MAINTAINER= ports@bsdserwis.com
@ -17,11 +14,21 @@ LICENSE_FILE= ${WRKSRC}/LICENSE
USES= cpe php:web,flavors tar:tgz
USE_PHP= gettext ldap openssl pcre session xml iconv hash
USE_GITHUB= yes
GH_ACCOUNT= leenooks
GH_PROJECT= phpLDAPadmin
NO_ARCH= yes
NO_BUILD= yes
CPE_VENDOR= deon_george
OPTIONS_DEFINE= MCRYPT
MCRYPT_DESC= Use pecl-mcrypt for password hashing
MCRYPT_USE= PHP=mcrypt
.include <bsd.port.options.mk>
GROUPS?= ${WWWGRP}
CFGDIR= config
CFGFILE= config.php
@ -36,10 +43,6 @@ SUB_FILES+= pkg-message
.include <bsd.port.pre.mk>
.if (${PHP_VER} == 73)
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-lib__PageRender.php
.endif
post-patch:
cd ${WRKSRC} ; \
${FIND} . ! -type d ! -name ${CFGFILE}.example ! -name .cvsignore \

View File

@ -1,2 +1,3 @@
SHA256 (phpldapadmin-1.2.3.tgz) = aecaf8c3ce77ba3899dd31ee5ee183555b2f9349eb8e196dcd33d8a3c485ed58
SIZE (phpldapadmin-1.2.3.tgz) = 1115707
TIMESTAMP = 1600872367
SHA256 (leenooks-phpLDAPadmin-1.2.6.2_GH0.tar.gz) = 49b14019bf611267720b4e9de33f2502b44c526809f17225a4a76ee8296b8d64
SIZE (leenooks-phpLDAPadmin-1.2.6.2_GH0.tar.gz) = 1128212

View File

@ -1,42 +0,0 @@
--- lib/QueryRender.php.orig 2019-08-07 01:14:46.000000000 +0200
+++ lib/QueryRender.php 2019-09-02 10:45:44.632080000 +0200
@@ -284,10 +284,10 @@ class QueryRender extends PageRender {
# Ignore DN, we've already displayed it.
if ($attr == 'dn')
- continue;
+ continue 2;
if (! isset($dndetails[$attr]))
- continue;
+ continue 2;
# Set our object with our values
$afattrs[$attr]->clearValue();
@@ -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);
@@ -374,7 +374,7 @@ class QueryRender extends PageRender {
# If the entry is blank, we'll draw an empty box and continue.
if (! isset($dndetails[$attr])) {
echo '<td>&nbsp;</td>';
- continue;
+ continue 2;
}
# Special case for DNs
@@ -384,7 +384,7 @@ class QueryRender extends PageRender {
: htmlspecialchars($dndetails['dn']);
printf('<td><a href="cmd.php?%s">%s</a></td>',htmlspecialchars($href),$dn_display);
- continue;
+ continue 2;
}
# Set our object with our values

View File

@ -1,20 +0,0 @@
--- config/config.php.example.orig 2012-10-01 06:54:14 UTC
+++ config/config.php.example
@@ -379,7 +379,7 @@ $servers->setValue('server','name','My L
/* 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','password_hash_custom','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_rege
$servers->setValue('sasl','authz_id_replacement','$1');
$servers->setValue('sasl','props',null);
-$servers->setValue('appearance','password_hash','md5');
+$servers->setValue('appearance','password_hash_custom','md5');
$servers->setValue('login','attr','dn');
$servers->setValue('login','fallback_dn',false);
$servers->setValue('login','class',null);

View File

@ -1,29 +0,0 @@
--- lib/PageRender.php.orig 2012-10-01 06:54:14 UTC
+++ lib/PageRender.php
@@ -287,7 +287,7 @@ class PageRender extends Visitor {
break;
default:
- $vals[$i] = password_hash($passwordvalue,$enc);
+ $vals[$i] = password_hash_custom($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','password_hash_custom');
$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','password_hash_custom');
echo '<table cellspacing="0" cellpadding="0"><tr><td valign="top">';

View File

@ -1,11 +0,0 @@
--- lib/TemplateRender.php.orig 2012-10-01 06:54:14 UTC
+++ lib/TemplateRender.php
@@ -2466,7 +2466,7 @@ function deleteAttribute(attrName,friend
if ($val = $attribute->getValue($i))
$default = get_enc_type($val);
else
- $default = $this->getServer()->getValue('appearance','password_hash');
+ $default = $this->getServer()->getValue('appearance','password_hash_custom');
if (! $attribute->getPostValue())
printf('<input type="hidden" name="post_value[%s][]" value="%s" />',$attribute->getName(),$i);

View File

@ -1,30 +0,0 @@
--- lib/ds_ldap.php.orig 2012-10-01 06:54:14 UTC
+++ lib/ds_ldap.php
@@ -1116,13 +1116,24 @@ 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('\\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 ($m) {
+ return ''.chr(hexdec('\\1')).'';
+ },
+ $dn
+ );
}
public function getRootDSE($method=null) {

View File

@ -1,11 +0,0 @@
--- lib/ds_ldap_pla.php.orig 2012-10-01 06:54:14 UTC
+++ lib/ds_ldap_pla.php
@@ -16,7 +16,7 @@ class ldap_pla extends ldap {
function __construct($index) {
parent::__construct($index);
- $this->default->appearance['password_hash'] = array(
+ $this->default->appearance['password_hash_custom'] = array(
'desc'=>'Default HASH to use for passwords',
'default'=>'md5');

View File

@ -1,124 +0,0 @@
--- lib/functions.php.orig 2012-10-01 06:54:14 UTC
+++ lib/functions.php
@@ -51,7 +51,7 @@ if (file_exists(LIBDIR.'functions.custom
/**
* Loads class definition
*/
-function __autoload($className) {
+function pla_autoloader($className) {
if (file_exists(HOOKSDIR."classes/$className.php"))
require_once(HOOKSDIR."classes/$className.php");
elseif (file_exists(LIBDIR."$className.php"))
@@ -65,6 +65,7 @@ function __autoload($className) {
__METHOD__,_('Called to load a class that cant be found'),$className),
'type'=>'error'));
}
+spl_autoload_register('pla_autoloader');
/**
* Strips all slashes from the specified array in place (pass by ref).
@@ -745,6 +746,7 @@ function blowfish_encrypt($data,$secret=
if (! trim($secret))
return $data;
+/*
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);
@@ -754,6 +756,7 @@ function blowfish_encrypt($data,$secret=
return $encrypted_data;
}
+*/
if (file_exists(LIBDIR.'blowfish.php'))
require_once LIBDIR.'blowfish.php';
@@ -801,6 +804,7 @@ function blowfish_decrypt($encdata,$secr
if (! trim($secret))
return $encdata;
+/*
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);
@@ -810,6 +814,7 @@ function blowfish_decrypt($encdata,$secr
return $decrypted_data;
}
+*/
if (file_exists(LIBDIR.'blowfish.php'))
require_once LIBDIR.'blowfish.php';
@@ -1080,7 +1085,7 @@ function masort(&$data,$sortby,$rev=0) {
$code .= 'return $c;';
- $CACHE[$sortby] = create_function('$a, $b',$code);
+ $CACHE[$sortby] = function($a, $b) { global $code; return $code; };
}
uasort($data,$CACHE[$sortby]);
@@ -2127,7 +2132,7 @@ function password_types() {
* crypt, ext_des, md5crypt, blowfish, md5, sha, smd5, ssha, sha512, or clear.
* @return string The hashed password.
*/
-function password_hash($password_clear,$enc_type) {
+function password_hash_custom($password_clear,$enc_type) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
@@ -2318,7 +2323,7 @@ function password_check($cryptedpassword
# SHA crypted passwords
case 'sha':
- if (strcasecmp(password_hash($plainpassword,'sha'),'{SHA}'.$cryptedpassword) == 0)
+ if (strcasecmp(password_hash_custom($plainpassword,'sha'),'{SHA}'.$cryptedpassword) == 0)
return true;
else
return false;
@@ -2327,7 +2332,7 @@ function password_check($cryptedpassword
# MD5 crypted passwords
case 'md5':
- if( strcasecmp(password_hash($plainpassword,'md5'),'{MD5}'.$cryptedpassword) == 0)
+ if( strcasecmp(password_hash_custom($plainpassword,'md5'),'{MD5}'.$cryptedpassword) == 0)
return true;
else
return false;
@@ -2392,7 +2397,7 @@ function password_check($cryptedpassword
# SHA512 crypted passwords
case 'sha512':
- if (strcasecmp(password_hash($plainpassword,'sha512'),'{SHA512}'.$cryptedpassword) == 0)
+ if (strcasecmp(password_hash_custom($plainpassword,'sha512'),'{SHA512}'.$cryptedpassword) == 0)
return true;
else
return false;
@@ -2564,13 +2569,24 @@ function dn_unescape($dn) {
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('\\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 ($m) {
+ return ''.chr(hexdec('\\1')).'';
+ },
+ $dn
+ );
}
}