Commits

Zhang Huangbin committed 9d188a6

Fix patch for Roundcube password plugin (PostgreSQL backend).

  • Participants
  • Parent commits a40ec99

Comments (0)

Files changed (3)

iRedMail/functions/cleanup.sh

     echo 'export status_cleanup_replace_mysql_config="DONE"' >> ${STATUS_FILE}
 }
 
-cleanup_amavisd_preconfig()
+cleanup_update_compile_spamassassin_rules()
 {
     # Required on Gentoo and FreeBSD to start Amavisd-new.
     ECHO_INFO "Updating SpamAssassin rules (sa-update), please wait ..."
     ECHO_INFO "Compiling SpamAssassin rulesets (sa-compile), please wait ..."
     ${BIN_SA_COMPILE} &>/dev/null
 
+    echo 'export status_cleanup_update_compile_spamassassin_rules="DONE"' >> ${STATUS_FILE}
+}
+
+cleanup_update_clamav_signatures()
+{
     # Update clamav before start clamav-clamd service.
     ECHO_INFO "Updating ClamAV database (freshclam), please wait ..."
     freshclam
 
-    echo 'export status_cleanup_amavisd_preconfig="DONE"' >> ${STATUS_FILE}
+    echo 'export status_cleanup_update_clamav_signatures="DONE"' >> ${STATUS_FILE}
 }
 
 cleanup_backup_scripts()
     cat ${DOC_FILE} >> /tmp/.links.eml
     ${DOVECOT_DELIVER} -c ${DOVECOT_CONF} -f root@${HOSTNAME} -d ${tip_recipient} < /tmp/.links.eml
 
-    # Don't execute 'cleanup_amavisd_preconfig' before sending emails.
-    if [ X"${DISTRO}" == X'GENTOO' \
-        -o X"${DISTRO}" == X'FREEBSD' \
-        -o X"${DISTRO}" == X'OPENBSD' \
-        ]; then
-        check_status_before_run cleanup_amavisd_preconfig
-    fi
+    check_status_before_run cleanup_update_compile_spamassassin_rules
+    check_status_before_run cleanup_update_clamav_signatures
 
     cat <<EOF
 ********************************************************************

iRedMail/functions/roundcubemail.sh

         ECHO_DEBUG "Set correct permission for Roundcubemail: ${RCM_HTTPD_ROOT}."
         chown -R ${SYS_ROOT_USER}:${SYS_ROOT_GROUP} ${RCM_HTTPD_ROOT}
         chown -R ${HTTPD_USER}:${HTTPD_GROUP} ${RCM_HTTPD_ROOT}/{temp,logs}
-        chmod 0000 ${RCM_HTTPD_ROOT}/{CHANGELOG,INSTALL,LICENSE,README,UPGRADING,installer,SQL}
+        chmod 0000 ${RCM_HTTPD_ROOT}/{CHANGELOG,INSTALL,LICENSE,README*,UPGRADING,installer,SQL}
     fi
 
     cd ${RCM_HTTPD_ROOT}/config/
     # 0 - disabled, 1 - username and host only, 2 - username, host, password
     perl -pi -e 's#(.*login_autocomplete.*=)(.*)#${1} 2;#' main.inc.php
 
+    perl -pi -e 's#(.*ip_check.*=)(.*)#${1} true;#' main.inc.php
+
     # If users authentication is not case sensitive this must be enabled
     perl -pi -e 's#(.*login_lc.*=)(.*)#${1} true;#' main.inc.php
 
     perl -pi -e 's#(.*upload_max_filesize.*)5M#${1}10M#' ${RCM_HTTPD_ROOT}/.htaccess
     perl -pi -e 's#(.*post_max_size.*)6M#${1}12M#' ${RCM_HTTPD_ROOT}/.htaccess
 
-    ECHO_DEBUG "Patch: Display Username."
-    perl -pi -e 's#(.*id="taskbar">)#${1}\n<span style="padding-right: 3px;"><roundcube:object name="username" /></span>#' ${RCM_HTTPD_ROOT}/skins/default/includes/taskbar.html
-
     cat >> ${TIP_FILE} <<EOF
 Roundcube webmail:
     * Configuration files:
     cd ${RCM_HTTPD_ROOT}/plugins/password/ && \
         cp config.inc.php.dist config.inc.php
 
-    if [ X"${BACKEND}" == X"PGSQL" ]; then
+    if [ X"${BACKEND}" == X'PGSQL' ]; then
         # Patch to escape single quote while updating password
         cd ${RCM_HTTPD_ROOT}
         patch -p0 <${PATCH_DIR}/roundcubemail/password_driver_pgsql.patch &>/dev/null

iRedMail/patches/roundcubemail/password_driver_pgsql.patch

---- plugins/password/drivers/sql.php	2011-11-15 18:50:30.000000000 +0800
-+++ plugins/password/drivers/sql.php	2012-01-21 16:23:31.000000000 +0800
-@@ -52,7 +52,8 @@
-     	    $salt .= $seedchars[rand(0, 63)];
+--- plugins/password/drivers/sql.php	2012-08-07 00:18:12.000000000 +0800
++++ sql.php	2012-08-08 18:39:04.000000000 +0800
+@@ -55,7 +55,8 @@
+     	        $salt .= $seedchars[rand(0, 63)];
+             }
+ 
+-            $sql = str_replace('%c',  $db->quote(crypt($passwd, CRYPT_MD5 ? '$1$'.$salt.'$' : $salt)), $sql);
++            //$sql = str_replace('%c',  $db->quote(crypt($passwd, CRYPT_MD5 ? '$1$'.$salt.'$' : $salt)), $sql);
++            $sql = str_replace('%c', str_replace("'", "\'", $db->quote(crypt($passwd, CRYPT_MD5 ? '$1$'.$salt.'$' : $salt))), $sql);
          }
  
--        $sql = str_replace('%c',  $db->quote(crypt($passwd, CRYPT_MD5 ? '$1$'.$salt.'$' : $salt)), $sql);
-+        //$sql = str_replace('%c',  $db->quote(crypt($passwd, CRYPT_MD5 ? '$1$'.$salt.'$' : $salt)), $sql);
-+        $sql = str_replace('%c', str_replace("'", "\'", $db->quote(crypt($passwd, CRYPT_MD5 ? '$1$'.$salt.'$' : $salt))), $sql);
-     }
+         // dovecotpw
+@@ -152,7 +153,8 @@
+         // at least we should always have the local part
+         $sql = str_replace('%l', $db->quote($local_part, 'text'), $sql);
+         $sql = str_replace('%d', $db->quote($domain_part, 'text'), $sql);
+-        $sql = str_replace('%u', $db->quote($username, 'text'), $sql);
++        //$sql = str_replace('%u', $db->quote($username, 'text'), $sql);
++        $sql = str_replace('%u', str_replace("'", "\'", $db->quote($username, 'text')), $sql);
+         $sql = str_replace('%h', $db->quote($host, 'text'), $sql);
  
-     // dovecotpw
-@@ -150,7 +151,8 @@
-     // at least we should always have the local part
-     $sql = str_replace('%l', $db->quote($local_part, 'text'), $sql);
-     $sql = str_replace('%d', $db->quote($domain_part, 'text'), $sql);
--    $sql = str_replace('%u', $db->quote($username, 'text'), $sql);
-+    //$sql = str_replace('%u', $db->quote($username, 'text'), $sql);
-+    $sql = str_replace('%u', str_replace("'", "\'", $db->quote($username, 'text')), $sql);
-     $sql = str_replace('%h', $db->quote($host, 'text'), $sql);
- 
-     $res = $db->query($sql, $sql_vars);
+         $res = $db->query($sql, $sql_vars);