Zhang Huangbin avatar Zhang Huangbin committed 0686803

Code cleanup.

Comments (0)

Files changed (5)

iRedMail/conf/dovecot

 export SIEVE_RULE_FILENAME='dovecot.sieve'
 export DOVECOT_GLOBAL_SIEVE_FILE="/etc/dovecot/${SIEVE_RULE_FILENAME}"
 
-# A symbol link to global sieve rule file.
-export DOVECOT_GLOBAL_SIEVE_FILE_SYMBOL="${SIEVE_DIR}/${SIEVE_RULE_FILENAME}"
-
 if [ X"${DISTRO}" == X"RHEL" ]; then
     export DOVECOT_VERSION='2'
     export DOVECOT_CONF='/etc/dovecot/dovecot.conf'
     export DOVECOT_REALTIME_QUOTA_CONF='/usr/local/etc/dovecot-used-quota.conf'
     export DOVECOT_SHARE_FOLDER_CONF='/usr/local/etc/dovecot-share-folder.conf'
     export DOVECOT_GLOBAL_SIEVE_FILE="/usr/local/etc/${SIEVE_RULE_FILENAME}"
-    export DOVECOT_GLOBAL_SIEVE_FILE_SYMBOL='/usr/local/etc/dovecot.sieve'
     export DOVECOT_DELIVER='/usr/local/libexec/dovecot/deliver'
 fi
 

iRedMail/functions/dovecot1.sh

     chown ${VMAIL_USER_NAME}:${VMAIL_GROUP_NAME} ${DOVECOT_GLOBAL_SIEVE_FILE}
     chmod 0555 ${DOVECOT_GLOBAL_SIEVE_FILE}
 
-    # Create symbol link of global sieve rule.
-    if [ X"${DOVECOT_GLOBAL_SIEVE_FILE}" != X"${DOVECOT_GLOBAL_SIEVE_FILE_SYMBOL}" ]; then
-        rm -f ${DOVECOT_GLOBAL_SIEVE_FILE_SYMBOL} &>/dev/null
-        ln -s ${DOVECOT_GLOBAL_SIEVE_FILE} ${DOVECOT_GLOBAL_SIEVE_FILE_SYMBOL}
-    fi
-
     ECHO_DEBUG "Create dovecot log file: ${DOVECOT_LOG_FILE}, ${SIEVE_LOG_FILE}."
     touch ${DOVECOT_LOG_FILE} ${SIEVE_LOG_FILE}
     chown ${VMAIL_USER_NAME}:${VMAIL_GROUP_NAME} ${DOVECOT_LOG_FILE} ${SIEVE_LOG_FILE}

iRedMail/functions/dovecot2.sh

     # ---- IMAP shared folder ----
 
     ECHO_DEBUG "Copy sample sieve global filter rule file: ${DOVECOT_GLOBAL_SIEVE_FILE}.sample."
-    cp -f ${SAMPLE_DIR}/dovecot.sieve ${DOVECOT_GLOBAL_SIEVE_FILE}.sample
-    chown ${VMAIL_USER_NAME}:${VMAIL_GROUP_NAME} ${DOVECOT_GLOBAL_SIEVE_FILE}.sample
-    chmod 0500 ${DOVECOT_GLOBAL_SIEVE_FILE}.sample
+    cp -f ${SAMPLE_DIR}/dovecot.sieve ${DOVECOT_GLOBAL_SIEVE_FILE}
+    chown ${VMAIL_USER_NAME}:${VMAIL_GROUP_NAME} ${DOVECOT_GLOBAL_SIEVE_FILE}
+    chmod 0555 ${DOVECOT_GLOBAL_SIEVE_FILE}
 
     ECHO_DEBUG "Create dovecot log file: ${DOVECOT_LOG_FILE}, ${SIEVE_LOG_FILE}."
     touch ${DOVECOT_LOG_FILE} ${SIEVE_LOG_FILE}

iRedMail/functions/roundcubemail.sh

     cd ${RCM_HTTPD_ROOT}/config/ && \
     perl -pi -e 's#(.*rcmail_config.*plugins.*=.*array\()(.*)#${1}"managesieve",${2}#' main.inc.php
 
-    export MANAGESIEVE_BINDADDR MANAGESIEVE_PORT DOVECOT_GLOBAL_SIEVE_FILE_SYMBOL
+    export MANAGESIEVE_BINDADDR MANAGESIEVE_PORT
     cd ${RCM_HTTPD_ROOT}/plugins/managesieve/ && \
     cp config.inc.php.dist config.inc.php && \
     perl -pi -e 's#(.*managesieve_port.*=).*#${1} $ENV{'MANAGESIEVE_PORT'};#' config.inc.php
     cd ${RCM_HTTPD_ROOT}/config/ && \
     perl -pi -e 's#(.*rcmail_config.*plugins.*=.*array\()(.*\).*)#${1}"password",${2}#' main.inc.php
 
-    # Patch to use 'SSHA' with PHP-5.3.
-    cd ${RCM_HTTPD_ROOT}/ && \
-        patch -p0 < ${PATCH_DIR}/roundcube/ldap_simple.patch >/dev/null
-
     cd ${RCM_HTTPD_ROOT}/plugins/password/ && \
     cp config.inc.php.dist config.inc.php
 
         perl -pi -e 's#(.*password_driver.*=).*#${1} "sql";#' config.inc.php
         perl -pi -e 's#(.*password_db_dsn.*= )(.*)#${1}"$ENV{'PHP_CONN_TYPE'}://$ENV{'RCM_DB_USER'}:$ENV{'RCM_DB_PASSWD'}\@$ENV{'MYSQL_SERVER'}/$ENV{'VMAIL_DB'}";#' config.inc.php
         perl -pi -e 's#(.*password_query.*=).*#${1} "UPDATE $ENV{'VMAIL_DB'}.mailbox SET password=%c,passwordlastchange=NOW() WHERE username=%u LIMIT 1";#' config.inc.php
-        perl -pi -e 's#(.*password_hash_algorithm.*=).*#${1} "ssha";#' config.inc.php
+        perl -pi -e 's#(.*password_hash_algorithm.*=).*#${1} "md5crypt";#' config.inc.php
         perl -pi -e 's#(.*password_hash_base64.*=).*#${1} false;#' config.inc.php
 
     elif [ X"${BACKEND}" == X"OpenLDAP" ]; then
 
         # Use 'md5crypt' instead of 'ssha', because SSHA requires PHP module
         # 'mhash' which may be unavailable on some supported distros.
-        perl -pi -e 's#(.*password_ldap_encodage.*=).*#${1} "md5crypt";#' config.inc.php
+        perl -pi -e 's#(.*password_ldap_encodage.*=).*#${1} "ssha";#' config.inc.php
 
         perl -pi -e 's#(.*password_ldap_pwattr.*=).*#${1} "userPassword";#' config.inc.php
         perl -pi -e 's#(.*password_ldap_force_replace.*=).*#${1} false;#' config.inc.php

iRedMail/patches/roundcube/ldap_simple.patch

---- plugins/password/drivers/ldap_simple.php	2011-11-24 15:53:00.000000000 +0800
-+++ /Users/zhb/ldap_simple.php	2011-12-31 00:44:35.000000000 +0800
-@@ -216,7 +216,7 @@
- 			}
- 			break;
- 		case 'ssha':
--			if (function_exists('mhash') && function_exists('mhash_keygen_s2k')) {
-+			if (function_exists('mhash_keygen_s2k')) {
- 				mt_srand((double) microtime() * 1000000 );
- 				$salt = mhash_keygen_s2k(MHASH_SHA1, $password_clear, substr(pack('h*', md5(mt_rand())), 0, 8), 4);
- 				$crypted_password = '{SSHA}' . base64_encode(mhash(MHASH_SHA1, $password_clear . $salt) . $salt);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.