Commits

Zhang Huangbin committed b86ee6a

Update phpMyAdmin to 4.1.14.
Add patch for phpLDAPadmin-1.2.3 to work under PHP 5.5.x.

Comments (0)

Files changed (12)

iRedMail/ChangeLog

 
     * Updated packages:
         + Roundcube webmail -> 1.0.0
-        + phpMyAdmin -> 4.1.13
+        + phpMyAdmin -> 4.1.14
 
 iRedMail-0.8.6:
     * Works on new Linux/BSD distribution releases:

iRedMail/conf/apache_php

 
 export HTTPD_PORT='80'
 export HTTPD_RC_SCRIPT_NAME='apache2'
-export APACHE_VERSION='2.2'
 
 if [ X"${DISTRO}" == X"RHEL" ]; then
     export HTTPD_RC_SCRIPT_NAME='httpd'
         export HTTPD_SSL_CONF="${HTTPD_CONF_ROOT}/sites-available/default-ssl"
         export HTTPD_MOD_CONF_SECURITY="${HTTPD_CONF_DIR}/security"
     else
-        # For Ubuntu 14.04 and later
-        export APACHE_VERSION='2.4'
-
         export HTTPD_CONF_DIR="${HTTPD_CONF_ROOT}/conf-available"
         export HTTPD_SSL_CONF="${HTTPD_CONF_ROOT}/sites-available/default-ssl.conf"
         export HTTPD_MOD_CONF_SECURITY="${HTTPD_CONF_DIR}/security.conf"
 
 export HTTPD_CGIBIN_DIR="${HTTPD_SERVERROOT}/cgi-bin"
 
-if [ X"${APACHE_VERSION}" == X'2.4' ]; then
-    HTTPD_DIRECTIVE_REQUIRE='Require all granted'
-else
-    HTTPD_DIRECTIVE_REQUIRE='Require valid-user'
-fi
-
 # PHP
 export PHP_DISABLED_FUNCTIONS='show_source,system,shell_exec,passthru,exec,phpinfo,proc_open'
 

iRedMail/conf/phpldapadmin

 export PHPLDAPADMIN_USE_SOURCE='YES'
 
 if [ X"${DISTRO}" == X'DEBIAN' -o X"${DISTRO}" == X'UBUNTU' ]; then
-    # Install phpLDAPadmin via apt repo
-    export PHPLDAPADMIN_USE_SOURCE='NO'
+    if [ X"${DISTRO_CODENAME}" == X'wheezy' \
+        -o X"${DISTRO_CODENAME}" == X'precise' ]; then
+        # Install phpLDAPadmin via apt repo
+        export PHPLDAPADMIN_USE_SOURCE='NO'
 
-    export PLA_HTTPD_ROOT="/usr/share/phpldapadmin"
-    export PLA_HTTPD_ROOT_SYMBOL_LINK="${PLA_HTTPD_ROOT}"
-    export PLA_CONF_DIR="${PLA_HTTPD_ROOT}/config"
+        export PLA_HTTPD_ROOT="/usr/share/phpldapadmin"
+        export PLA_HTTPD_ROOT_SYMBOL_LINK="${PLA_HTTPD_ROOT}"
+        export PLA_CONF_DIR="${PLA_HTTPD_ROOT}/config"
+    else
+        export PLA_HTTPD_ROOT="${HTTPD_SERVERROOT}/phpldapadmin-${PLA_VERSION}"
+        export PLA_HTTPD_ROOT_SYMBOL_LINK="${HTTPD_SERVERROOT}/phpldapadmin"
+        export PLA_CONF_DIR="${PLA_HTTPD_ROOT}/config"
+    fi
 
 elif [ X"${DISTRO}" == X"FREEBSD" -o X"${DISTRO}" == X'OPENBSD' ]; then
     # Install phpLDAPadmin via ports tree

iRedMail/conf/phpmyadmin

 # along with iRedMail.  If not, see <http://www.gnu.org/licenses/>.
 #---------------------------------------------------------------------
 
-export PHPMYADMIN_VERSION='4.1.13-all-languages'
+export PHPMYADMIN_VERSION='4.1.14-all-languages'
 export PHPMYADMIN_TARBALL="phpMyAdmin-${PHPMYADMIN_VERSION}.tar.bz2"
 
 # Install phpMyAdmin with source tarball.

iRedMail/functions/awstats.sh

 <Directory ${AWSTATS_CGI_DIR}/>
     DirectoryIndex awstats.pl
     Options ExecCGI
-    Order allow,deny
-    Allow from all
-    #Allow from ${LOCAL_ADDRESS}
 
     AuthName "Authorization Required"
     AuthType Basic
 
     # Close <Directory> container.
     cat >> ${AWSTATS_HTTPD_CONF} <<EOF
-    ${HTTPD_DIRECTIVE_REQUIRE}
+    Order allow,deny
+    Allow from all
+    Require valid-user
 </Directory>
 EOF
 
 
     if [ X"${DISTRO}" == X'DEBIAN' -o X"${DISTRO}" == X'UBUNTU' ]; then
         a2enmod cgi &>/dev/null
+
+        # serve-cgi-bin.conf contains duplicate and conflict setting for cgi-bin
+        a2disconf serve-cgi-bin &>/dev/null
         a2enconf awstats &>/dev/null
     fi
 

iRedMail/functions/cluebringer.sh

 
 <Directory ${CLUEBRINGER_HTTPD_ROOT}/>
     DirectoryIndex index.php
-    Order allow,deny
-    Allow from all
-    #Allow from ${CLUEBRINGER_BIND_HOST}
-
     AuthType basic
     AuthName "Authorization Required"
 EOF
 Auth_MySQL_General_DB ${VMAIL_DB}
 EOF
 
-            a2enconf cluebringer &>/dev/null
-
             # Set file permission.
             chmod 0600 ${CLUEBRINGER_HTTPD_CONF}
 
 
         # Close <Directory> container.
         cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
-    ${HTTPD_DIRECTIVE_REQUIRE}
+    Order allow,deny
+    Allow from all
+    Require valid-user
 </Directory>
 EOF
 
+    if [ X"${DISTRO}" == X'UBUNTU' ]; then
+        a2enconf cluebringer &>/dev/null
+    fi
+
     echo 'export status_cluebringer_webui_config="DONE"' >> ${STATUS_FILE}
 }

iRedMail/functions/packages.sh

         ALL_PKGS="${ALL_PKGS} httpd${PKG_ARCH} mod_ssl${PKG_ARCH} php${PKG_ARCH} php-common${PKG_ARCH} php-gd${PKG_ARCH} php-xml${PKG_ARCH} php-mysql${PKG_ARCH} php-ldap${PKG_ARCH} php-pgsql${PKG_ARCH} php-imap${PKG_ARCH} php-mbstring${PKG_ARCH}"
 
     elif [ X"${DISTRO}" == X'DEBIAN' -o X"${DISTRO}" == X'UBUNTU' ]; then
-        ALL_PKGS="${ALL_PKGS} libapache2-mod-php5 php5-imap php5-json php5-gd php5-mcrypt php5-curl"
+        ALL_PKGS="${ALL_PKGS} libapache2-mod-php5 php5-imap php5-json php5-gd php5-mcrypt php5-curl mcrypt"
         [ X"${BACKEND}" == X'OPENLDAP' ] && ALL_PKGS="${ALL_PKGS} php5-ldap php5-mysql"
         [ X"${BACKEND}" == X'MYSQL' ] && ALL_PKGS="${ALL_PKGS} php5-mysql"
         [ X"${BACKEND}" == X'PGSQL' ] && ALL_PKGS="${ALL_PKGS} php5-pgsql"
     # phpLDAPadmin
     if [ X"${USE_PHPLDAPADMIN}" == X"YES" ]; then
         if [ X"${DISTRO}" == X'DEBIAN' -o X"${DISTRO}" == X'UBUNTU' ]; then
-            ALL_PKGS="${ALL_PKGS} phpldapadmin"
+            if [ X"${DISTRO_CODENAME}" == X'wheezy'
+                -o X"${DISTRO_CODENAME}" == X'precise' ]; then
+                ALL_PKGS="${ALL_PKGS} phpldapadmin"
+            fi
         elif [ X"${DISTRO}" == X'OPENBSD' ]; then
             ALL_PKGS="${ALL_PKGS} phpldapadmin"
         fi

iRedMail/functions/phpldapadmin.sh

         # Create symbol link, so that we don't need to modify apache
         # conf.d/phpldapadmin.conf file after upgrade this component.
         ln -s ${PLA_HTTPD_ROOT} ${PLA_HTTPD_ROOT_SYMBOL_LINK} 2>/dev/null
+
+        # Patch phpldapadmin-1.2.3 to work under PHP 5.5.x
+        cd ${PLA_HTTPD_ROOT} && \
+            patch -p1 < ${PATCH_DIR}/phpldapadmin/php55.patch >/dev/null
     fi
 
     ECHO_DEBUG "Copy example config file."
     chown -R ${SYS_ROOT_USER}:${SYS_ROOT_GROUP} ${PLA_HTTPD_ROOT}
     chmod -R 0755 ${PLA_HTTPD_ROOT}
 
-    ECHO_DEBUG "Create directory alias for phpLDAPadmin."
-    cat > ${HTTPD_CONF_DIR}/phpldapadmin.conf <<EOF
-${CONF_MSG}
-# Note: Please refer to ${HTTPD_SSL_CONF} for SSL/TLS setting.
-<Directory "${PLA_HTTPD_ROOT_SYMBOL_LINK}/">
-    Options -Indexes
-</Directory>
-EOF
-
     # Make phpldapadmin can be accessed via HTTPS only.
     perl -pi -e 's#^(\s*</VirtualHost>)#Alias /phpldapadmin "$ENV{PLA_HTTPD_ROOT_SYMBOL_LINK}/"\nAlias /ldap "$ENV{PLA_HTTPD_ROOT_SYMBOL_LINK}/"\n${1}#' ${HTTPD_SSL_CONF}
 

iRedMail/functions/roundcubemail.sh

     * URL:
         - http://${HOSTNAME}/mail/
         - https://${HOSTNAME}/mail/ (Over SSL/TLS)
-        - http://${HOSTNAME}/webmail/
-        - https://${HOSTNAME}/webmail/ (Over SSL/TLS)
     * Login account:
         - Username: ${FIRST_USER}@${FIRST_DOMAIN}, password: ${FIRST_USER_PASSWD_PLAIN}
     * See also:

iRedMail/patches/phpldapadmin/php55.patch

+diff -Naur a/lib/PageRender.php b/lib/PageRender.php
+--- a/lib/PageRender.php	2012-10-01 14:54:14.000000000 +0800
++++ b/lib/PageRender.php	2013-08-29 13:13:56.000000000 +0800
+@@ -287,7 +287,7 @@
+ 						break;
+ 
+ 					default:
+-						$vals[$i] = password_hash($passwordvalue,$enc);
++						$vals[$i] = password_hash_custom($passwordvalue,$enc);
+ 				}
+ 
+ 				$vals = array_unique($vals);
+@@ -957,7 +957,7 @@
+ 		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 @@
+ 		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">';
+ 
+diff -Naur a/lib/ds_ldap.php b/lib/ds_ldap.php
+--- a/lib/ds_ldap.php	2012-10-01 14:54:14.000000000 +0800
++++ b/lib/ds_ldap.php	2013-08-29 13:13:56.000000000 +0800
+@@ -1116,13 +1116,24 @@
+ 
+ 		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) {
+diff -Naur a/lib/ds_ldap_pla.php b/lib/ds_ldap_pla.php
+--- a/lib/ds_ldap_pla.php	2012-10-01 14:54:14.000000000 +0800
++++ b/lib/ds_ldap_pla.php	2013-08-29 13:13:56.000000000 +0800
+@@ -16,7 +16,7 @@
+ 	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');
+ 
+diff -Naur a/lib/functions.php b/lib/functions.php
+--- a/lib/functions.php	2012-10-01 14:54:14.000000000 +0800
++++ b/lib/functions.php	2013-08-29 13:13:56.000000000 +0800
+@@ -2127,7 +2127,7 @@
+  *        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 +2318,7 @@
+ 
+ 		# 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 +2327,7 @@
+ 
+ 		# 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 +2392,7 @@
+ 
+ 		# 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 +2564,24 @@
+ 	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
++		);
+ 	}
+ }
+ 

iRedMail/pkgs/MD5.misc

 0c3406444444c15d1c76a38500693a1c  misc/iRedAdmin-0.3.tar.bz2
 59a49054039ceb852c2da377d8742360  misc/phpldapadmin-1.2.3.tgz
-d12f97999256e19a9b4aad05003956d6  misc/phpMyAdmin-4.1.13-all-languages.tar.bz2
+9ff863c072276431c174e6b79f6b0224  misc/phpMyAdmin-4.1.14-all-languages.tar.bz2
 af334b09d503e0257080928eb8666837  misc/iRedAPD-1.4.2.tar.bz2
 ad8f05cef0c443d9ce2940bf36319c24  misc/phpPgAdmin-5.1.tar.bz2
 325f79deeadb8993ca8a20f0077f2535  misc/roundcubemail-1.0.0.tar.gz

iRedMail/pkgs/get_all.sh

 
 echo_end_msg()
 {
-    cat <<EOF
+    if [ X"$(basename $0)" != X'get_all.sh' ]; then
+        cat <<EOF
 ********************************************************
 * All tasks had been finished successfully. Next step:
 *
 ********************************************************
 
 EOF
+    fi
 }
 
 if [ -e ${STATUS_FILE} ]; then