summaryrefslogtreecommitdiff
path: root/mail/squirrelmail
diff options
context:
space:
mode:
authortaca <taca>2010-03-04 16:00:37 +0000
committertaca <taca>2010-03-04 16:00:37 +0000
commit95326a03060a7ab70097d556549a2ea66e4be55d (patch)
treee4dabda31401e3349d9e2442154e810d1dacd0c1 /mail/squirrelmail
parent54d543a8d31e4c048274a94542cc0e096b192ba0 (diff)
downloadpkgsrc-95326a03060a7ab70097d556549a2ea66e4be55d.tar.gz
Overhaul squirrelmail package:
* Add DESTDIR support. * Add more changes from squirrelmail's repositry including secure token support, hoping early release of real 1.4.20. Bump PKGREVISION.
Diffstat (limited to 'mail/squirrelmail')
-rw-r--r--mail/squirrelmail/Makefile52
-rw-r--r--mail/squirrelmail/distinfo27
-rw-r--r--mail/squirrelmail/patches/patch-ab4
-rw-r--r--mail/squirrelmail/patches/patch-ac53
-rw-r--r--mail/squirrelmail/patches/patch-af63
-rw-r--r--mail/squirrelmail/patches/patch-aj14
-rw-r--r--mail/squirrelmail/patches/patch-ak17
-rw-r--r--mail/squirrelmail/patches/patch-al20
-rw-r--r--mail/squirrelmail/patches/patch-am14
-rw-r--r--mail/squirrelmail/patches/patch-an15
-rw-r--r--mail/squirrelmail/patches/patch-ao44
-rw-r--r--mail/squirrelmail/patches/patch-ap33
-rw-r--r--mail/squirrelmail/patches/patch-aq13
-rw-r--r--mail/squirrelmail/patches/patch-ar12
-rw-r--r--mail/squirrelmail/patches/patch-as13
-rw-r--r--mail/squirrelmail/patches/patch-at13
-rw-r--r--mail/squirrelmail/patches/patch-au30
-rw-r--r--mail/squirrelmail/patches/patch-av13
-rw-r--r--mail/squirrelmail/patches/patch-aw13
-rw-r--r--mail/squirrelmail/patches/patch-ca29
-rw-r--r--mail/squirrelmail/patches/patch-cb20
-rw-r--r--mail/squirrelmail/patches/patch-cc12
-rw-r--r--mail/squirrelmail/patches/patch-cd13
-rw-r--r--mail/squirrelmail/patches/patch-ce16
-rw-r--r--mail/squirrelmail/patches/patch-cf12
25 files changed, 504 insertions, 61 deletions
diff --git a/mail/squirrelmail/Makefile b/mail/squirrelmail/Makefile
index 6a4fa70c9fe..86698499f5b 100644
--- a/mail/squirrelmail/Makefile
+++ b/mail/squirrelmail/Makefile
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.111 2010/02/05 17:40:51 wiz Exp $
+# $NetBSD: Makefile,v 1.112 2010/03/04 16:00:37 taca Exp $
DISTNAME= squirrelmail-1.4.20-RC2
PKGNAME= ${DISTNAME:S/-RC2/rc2/}
-PKGREVISION= 3
+PKGREVISION= 4
CATEGORIES= mail www
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=squirrelmail/}
EXTRACT_SUFX= .tar.bz2
@@ -19,9 +19,11 @@ CONFLICTS+= ja-squirrelmail-[0-9]*
DEPENDS+= ${PHP_PKG_PREFIX}-gettext>=4.3.3:../../devel/php-gettext
+PKG_DESTDIR_SUPPORT= user-destdir
+
USE_LANGUAGES= # empty
NO_BUILD= yes
-USE_TOOLS+= perl:run
+USE_TOOLS+= pax perl:run
REPLACE_PERL+= config/conf.pl
PKG_GROUPS_VARS+= APACHE_GROUP
@@ -33,14 +35,14 @@ BUILD_DEFS+= VARBASE
PKG_SYSCONFSUBDIR?= httpd
MESSAGE_SUBST+= PKG_SYSCONFDIR=${PKG_SYSCONFDIR}
-EGDIR= ${PREFIX}/share/examples/squirrelmail
-SMDIR= ${PREFIX}/share/squirrelmail
+EGDIR= share/examples/squirrelmail
+SMDIR= share/squirrelmail
DATADIR= ${VARBASE}/spool/squirrelmail
ATTACHMENTS_DIR= ${DATADIR}/attachments
USER_PREFS_DIR= ${DATADIR}/data
-MESSAGE_SUBST+= SMDIR=${SMDIR}
-FILES_SUBST+= SMDIR=${SMDIR}
+MESSAGE_SUBST+= SMDIR=${PREFIX}/${SMDIR}
+FILES_SUBST+= SMDIR=${PREFIX}/${SMDIR}
CONF_FILES= ${SMDIR}/config/config_default.php \
${SMDIR}/config/config.php
@@ -48,11 +50,13 @@ CONF_FILES+= ${SMDIR}/data/default_pref \
${DATADIR}/data/default_pref
CONF_FILES+= ${EGDIR}/squirrelmail.conf \
${PKG_SYSCONFDIR}/squirrelmail.conf
+CONF_FILES+= ${USER_PREFS_DIR}/.htaccess ${DATADIR}/data/.htaccess
+CONF_FILES+= ${USER_PREFS_DIR}/index.php ${DATADIR}/data/index.php
REQD_DIRS+= ${SMDIR} ${SMDIR}/config
-OWN_DIRS= ${DATADIR}
-OWN_DIRS_PERMS= ${ATTACHMENTS_DIR} ${ROOT_USER} ${APACHE_GROUP} 730
+OWN_DIRS+= ${DATADIR}
+OWN_DIRS_PERMS+= ${ATTACHMENTS_DIR} ${REAL_ROOT_USER} ${APACHE_GROUP} 730
OWN_DIRS_PERMS+= ${USER_PREFS_DIR} ${APACHE_USER} ${APACHE_GROUP} 755
SUBST_CLASSES+= paths
@@ -61,32 +65,32 @@ SUBST_FILES.paths+= config/config_default.php
SUBST_SED.paths+= -e 's,@PREFIX@,${PREFIX},g'
SUBST_SED.paths+= -e 's,@ATTACHMENTS_DIR@,${ATTACHMENTS_DIR},g'
SUBST_SED.paths+= -e 's,@USER_PREFS_DIR@,${USER_PREFS_DIR},g'
-SUBST_SED.paths+= -e 's,@SMDIR@,${SMDIR},g'
-SUBST_STAGE.paths= post-patch
+SUBST_SED.paths+= -e 's,@SMDIR@,${PREFIX}/${SMDIR},g'
+SUBST_STAGE.paths= pre-configure
INSTALLATION_DIRS= ${PKGMANDIR}/man8
INSTALLATION_DIRS+= share/examples/squirrelmail
INSTALLATION_DIRS+= share/squirrelmail
post-extract:
- cp ${FILESDIR}/squirrelmail.conf.dist \
+ ${CP} ${FILESDIR}/squirrelmail.conf.dist \
${WRKDIR}/squirrelmail.conf.dist
+ ${CP} -p ${WRKSRC}/contrib/conf.pl.8 ${WRKDIR}/squirrelmail-conf.pl.8
-pre-configure:
- find ${WRKSRC} \( -name '*.orig*' -o -name '.cvsignore' \) \
+pre-install:
+ ${FIND} ${WRKSRC} \( -name '*.orig*' -o -name '.cvsignore' \) \
-exec rm -f {} \;
+ ${FIND} ${WRKSRC} -type d -exec chmod ${PKGDIRMODE} {} \;
+ ${FIND} ${WRKSRC} -type f -exec chmod ${SHAREMODE} {} \;
+ ${CHMOD} 0555 ${WRKSRC}/config/conf.pl
+ ${RM} -f ${WRKSRC}/contrib/conf.pl.8
do-install:
- ${INSTALL_DATA} ${WRKDIR}/squirrelmail.conf.dist ${EGDIR}/squirrelmail.conf
- cp -R ${WRKSRC}/* ${SMDIR}
- chown -R ${SHAREOWN}:${SHAREGRP} ${SMDIR}
- find ${SMDIR} -type d -exec chmod ${PKGDIRMODE} {} \;
- find ${SMDIR} -type f -exec chmod ${SHAREMODE} {} \;
- chmod a+x ${SMDIR}/config/conf.pl
- ${INSTALL_DATA} ${WRKSRC}/data/index.php ${USER_PREFS_DIR}/
- ${INSTALL_DATA} ${WRKSRC}/data/.htaccess ${USER_PREFS_DIR}/
- mv ${PREFIX}/share/squirrelmail/contrib/conf.pl.8 \
- ${PREFIX}/${PKGMANDIR}/man8/squirrelmail-conf.pl.8
+ ${INSTALL_DATA} ${WRKDIR}/squirrelmail.conf.dist \
+ ${DESTDIR}${PREFIX}/${EGDIR}/squirrelmail.conf
+ cd ${WRKSRC}; pax -rw -pp . ${DESTDIR}${PREFIX}/${SMDIR}
+ ${INSTALL_DATA} ${WRKDIR}/squirrelmail-conf.pl.8 \
+ ${DESTDIR}${PREFIX}/${PKGMANDIR}/man8
.include "../../lang/php/phpversion.mk"
.include "../../mk/bsd.pkg.mk"
diff --git a/mail/squirrelmail/distinfo b/mail/squirrelmail/distinfo
index 71013a9b55a..0861af21247 100644
--- a/mail/squirrelmail/distinfo
+++ b/mail/squirrelmail/distinfo
@@ -1,9 +1,30 @@
-$NetBSD: distinfo,v 1.57 2010/02/05 17:40:51 wiz Exp $
+$NetBSD: distinfo,v 1.58 2010/03/04 16:00:37 taca Exp $
SHA1 (squirrelmail-1.4.20-RC2.tar.bz2) = f1cdccfdd17d8974adc0b79aba44b62f98f78f64
RMD160 (squirrelmail-1.4.20-RC2.tar.bz2) = f736e33af6f7b5a4c49f96968ed3fdeb2d42f06f
Size (squirrelmail-1.4.20-RC2.tar.bz2) = 516825 bytes
SHA1 (patch-aa) = 4c5556c804c1b728eec87322272abb06edcfcc2a
-SHA1 (patch-ab) = 503bef625388a3224ad6f54aa332190e7440dde3
-SHA1 (patch-ac) = 1145e03ab1b084e27c2b97958d7fc13720977357
+SHA1 (patch-ab) = 9b522ab15b3be1ee6d4f93e13117402bc0c34ea5
+SHA1 (patch-ac) = 9a67070fd00baeae71260ea828461ad297f9ed88
+SHA1 (patch-af) = bcaaf9f0e4e185aedca1cd43ae28ac3fb7f376d2
SHA1 (patch-ai) = 701fdbc84afde5f8e255af13ba0e44469343e17c
+SHA1 (patch-aj) = 0347dfe01a977a5b112bbcfc2aa68fbf5fcda3e4
+SHA1 (patch-ak) = deef584a60802d1530091872b9af9d088ce80924
+SHA1 (patch-al) = f961e26e47215aaa2b91d409142d81d77549d468
+SHA1 (patch-am) = 3bbd987153bf20ad2c4a148bfa455bfeaf1936f2
+SHA1 (patch-an) = 263e5943b5c9ed64f97d6e23403be98c63f6e661
+SHA1 (patch-ao) = b62b142252f596ced511deffc9fa0aa7362d93c9
+SHA1 (patch-ap) = 7f950d47f26521f1671529143860dc8d0309ebb2
+SHA1 (patch-aq) = cb15f6ac784991016752316d0f4e85857dd12f16
+SHA1 (patch-ar) = f3c824cdee855ad6870ccc479617221469c6ec3e
+SHA1 (patch-as) = 737ea47e5a94ebb5754f5b2eab05069adf4e2037
+SHA1 (patch-at) = 7a6f120bce676f747dff9c0c3e9202c6fa8b49ca
+SHA1 (patch-au) = 448d9895a9be60f8ae5c605bb58d35efbd62047c
+SHA1 (patch-av) = 12b82f72507ff313a05aeed08161d6f553247621
+SHA1 (patch-aw) = 0b64a0ef5395b3ceb293d0c8d874ddc95f002151
+SHA1 (patch-ca) = deaf791fd6eaf25001b369d505531ae065fe0801
+SHA1 (patch-cb) = 76d8d0ade2d01ce7fc8d0151c817562bdf10c027
+SHA1 (patch-cc) = 5bdd4f6346bc119ed2bec43d69cb855892f2d051
+SHA1 (patch-cd) = ec265daffc4b2c98fb5e77584971e28c6813f956
+SHA1 (patch-ce) = d73c3d38b77ac589bac5c01f3775df6995b476f8
+SHA1 (patch-cf) = 237c0f584d4d393ca74241b52380abd2217a2ac0
diff --git a/mail/squirrelmail/patches/patch-ab b/mail/squirrelmail/patches/patch-ab
index ece5805dd27..773765eb517 100644
--- a/mail/squirrelmail/patches/patch-ab
+++ b/mail/squirrelmail/patches/patch-ab
@@ -1,4 +1,4 @@
-$NetBSD: patch-ab,v 1.14 2009/10/04 01:27:15 taca Exp $
+$NetBSD: patch-ab,v 1.15 2010/03/04 16:00:37 taca Exp $
* Use case ignore match for detecting encoded word.
* Fix encoding problem of attached filenames; don't convert encoding here.
@@ -10,7 +10,7 @@ $NetBSD: patch-ab,v 1.14 2009/10/04 01:27:15 taca Exp $
case 'decodeheader':
$ret = str_replace("\t", "", $ret);
- if (preg_match('/=\?([^?]+)\?(q|b)\?([^?]+)\?=/', $ret))
-+ if (preg_match('/=\?([^?]*)\?(Q|B)\?([^?]*)\?=/Ui', $ret))
++ if (preg_match('/=\?([^?]*)\?(Q|B)\?([^?]*)\?=/i', $ret))
$ret = @mb_decode_mimeheader($ret);
$ret = @mb_convert_encoding($ret, 'EUC-JP', 'AUTO');
break;
diff --git a/mail/squirrelmail/patches/patch-ac b/mail/squirrelmail/patches/patch-ac
index 14cb17d07d1..fda6a99aa04 100644
--- a/mail/squirrelmail/patches/patch-ac
+++ b/mail/squirrelmail/patches/patch-ac
@@ -1,14 +1,22 @@
-$NetBSD: patch-ac,v 1.5 2010/02/05 17:40:51 wiz Exp $
+$NetBSD: patch-ac,v 1.6 2010/03/04 16:00:37 taca Exp $
Patch for fixing IMAP search problems:
http://thread.gmane.org/gmane.mail.squirrelmail.user/36642
---- functions/imap_search.php.orig 2010-02-05 18:35:41.000000000 +0100
+--- functions/imap_search.php.orig 2009-07-29 11:21:06.000000000 +0900
+++ functions/imap_search.php
-@@ -46,22 +46,23 @@ function sqimap_search($imapConnection,
- on the client side, but should be fixed on the server
- as per the RFC */
+@@ -38,30 +38,17 @@ function sqimap_search($imapConnection,
+ $multi_search = explode(' ', $search_what);
+ $search_string = '';
+- /* it seems macosx and hmailserver do not support the prefered search
+- syntax so we fall back to the older style. This IMAP
+- server has a problem with multiple search terms. Instead
+- of returning the messages that match all the terms it
+- returns the messages that match each term. Could be fixed
+- on the client side, but should be fixed on the server
+- as per the RFC */
+-
- if ($imap_server_type == 'macosx' || $imap_server_type == 'hmailserver') {
- foreach ($multi_search as $multi_search_part) {
- if (strtoupper($languages[$squirrelmail_language]['CHARSET']) == 'ISO-2022-JP') {
@@ -20,13 +28,7 @@ http://thread.gmane.org/gmane.mail.squirrelmail.user/36642
+ $multi_search[$idx] = mb_convert_encoding($search_parth, 'JIS', 'auto');
}
}
-+
-+ $search_lit = array();
-+
-+ if ($imap_server_type == 'macosx' || $imap_server_type == 'hmailserver') {
-+ $search_string .= $search_where . ' ' . implode(' ', $multi_search);
-+ }
- else {
+- else {
- foreach ($multi_search as $multi_search_part) {
- if (strtoupper($languages[$squirrelmail_language]['CHARSET']) == 'ISO-2022-JP') {
- $multi_search_part = mb_convert_encoding($multi_search_part, 'JIS', 'auto');
@@ -34,29 +36,16 @@ http://thread.gmane.org/gmane.mail.squirrelmail.user/36642
- $search_string .= $search_where . ' {' . strlen($multi_search_part)
- . "}\r\n" . $multi_search_part . ' ';
- }
-+ $search_string .= $search_where;
-+ $search_lit = array(
-+ 'command' => '',
-+ 'literal_args' => $multi_search
-+ );
++
++ foreach ($multi_search as $string) {
++ $search_string .= $search_where
++ . ' "'
++ . str_replace(array('\\', '"'), array('\\\\', '\\"'), $string)
++ . '" ';
}
$search_string = trim($search_string);
-@@ -76,15 +77,24 @@ function sqimap_search($imapConnection,
- $ss = "SEARCH ALL $search_string";
- }
-
-- /* read data back from IMAP */
-- $readin = sqimap_run_command($imapConnection, $ss, false, $result, $message, $uid_support);
-+ if (empty($search_lit)) {
-+ /* read data back from IMAP */
-+ $readin = sqimap_run_command($imapConnection, $ss, false, $result, $message, $uid_support);
-+ } else {
-+ $search_lit['command'] = $ss;
-+ $readin = sqimap_run_literal_command($imapConnection, $search_lit, false, $result, $message, $uid_support);
-+ }
-
- /* try US-ASCII charset if search fails */
+@@ -83,8 +70,12 @@ function sqimap_search($imapConnection,
if (isset($languages[$squirrelmail_language]['CHARSET'])
&& strtolower($result) == 'no') {
$ss = "SEARCH CHARSET \"US-ASCII\" ALL $search_string";
diff --git a/mail/squirrelmail/patches/patch-af b/mail/squirrelmail/patches/patch-af
new file mode 100644
index 00000000000..e140ce7632d
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-af
@@ -0,0 +1,63 @@
+$NetBSD: patch-af,v 1.3 2010/03/04 16:00:37 taca Exp $
+
+--- src/search.php.orig 2009-08-12 17:29:53.000000000 +0900
++++ src/search.php
+@@ -226,7 +226,7 @@ function printSearchMessages($msgs,$mail
+ if ((!empty($allow_server_sort) && $allow_server_sort) || (!empty($allow_server_thread) && $allow_server_thread)) {
+ $msort = $msgs;
+ } else {
+- $msort = calc_msort($msgs, $sort);
++ $msort = calc_msort($msgs, $sort, $mailbox);
+ }
+
+ if ( $mailbox == 'INBOX' ) {
+@@ -368,6 +368,7 @@ if ($saved_count > 0) {
+ . '?mailbox=' . urlencode($saved_attributes['saved_folder'][$i + 1])
+ . '&amp;what=' . urlencode($saved_attributes['saved_what'][$i + 1])
+ . '&amp;where=' . urlencode($saved_attributes['saved_where'][$i + 1])
++ . '&amp;smtoken=' . sm_generate_security_token()
+ . '">' . _("edit") . '</a>'
+ . '&nbsp;|&nbsp;'
+ . '<a href="search.php'
+@@ -375,9 +376,10 @@ if ($saved_count > 0) {
+ . '&amp;what=' . urlencode($saved_attributes['saved_what'][$i + 1])
+ . '&amp;where=' . urlencode($saved_attributes['saved_where'][$i + 1])
+ . '&amp;submit=Search_no_update'
++ . '&amp;smtoken=' . sm_generate_security_token()
+ . '">' . _("search") . '</a>'
+ . '&nbsp;|&nbsp;'
+- . "<a href=\"search.php?count=$i&amp;submit=delete\">"
++ . "<a href=\"search.php?count=$i&amp;submit=delete&amp;smtoken=" . sm_generate_security_token() .'">'
+ . _("delete")
+ . '</a>'
+ . '</td></tr>';
+@@ -395,7 +397,7 @@ if ($recent_count > 0) {
+ . html_tag( 'td' )
+ . html_tag( 'table', '', 'center', '', 'width="100%" cellpadding="0" cellspacing="0" border="0"' );
+ for ($i=1; $i <= $recent_count; ++$i) {
+- if (isset($attributes['search_folder'][$i])) {
++ if (isset($attributes['search_folder'][$i])) {
+ if ($attributes['search_folder'][$i] == "") {
+ $attributes['search_folder'][$i] = "INBOX";
+ }
+@@ -411,7 +413,7 @@ if ($recent_count > 0) {
+ . html_tag( 'td', htmlspecialchars($attributes['search_what'][$i]), 'left' )
+ . html_tag( 'td', htmlspecialchars($attributes['search_where'][$i]), 'center' )
+ . html_tag( 'td', '', 'right' )
+- . "<a href=\"search.php?count=$i&amp;submit=save\">"
++ . "<a href=\"search.php?count=$i&amp;submit=save&amp;smtoken=" . sm_generate_security_token() . '">'
+ . _("save")
+ . '</a>'
+ . '&nbsp;|&nbsp;'
+@@ -420,9 +422,10 @@ if ($recent_count > 0) {
+ . '&amp;what=' . urlencode($attributes['search_what'][$i])
+ . '&amp;where=' . urlencode($attributes['search_where'][$i])
+ . '&amp;submit=Search_no_update'
++ . '&amp;smtoken=' . sm_generate_security_token()
+ . '">' . _("search") . '</a>'
+ . '&nbsp;|&nbsp;'
+- . "<a href=\"search.php?count=$i&amp;submit=forget\">"
++ . "<a href=\"search.php?count=$i&amp;submit=forget&amp;smtoken=" . sm_generate_security_token() . '">'
+ . _("forget")
+ . '</a>'
+ . '</td></tr>';
diff --git a/mail/squirrelmail/patches/patch-aj b/mail/squirrelmail/patches/patch-aj
new file mode 100644
index 00000000000..69fb3dc30b8
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-aj
@@ -0,0 +1,14 @@
+$NetBSD: patch-aj,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- class/mime/Message.class.php.orig 2009-04-16 07:00:49.000000000 +0900
++++ class/mime/Message.class.php
+@@ -1059,8 +1059,7 @@ class Message {
+ }
+
+ if (!$exclude) {
+- if (($entity->type0 == 'multipart') &&
+- ($entity->type1 != 'related')) {
++ if ($entity->type0 == 'multipart') {
+ $result = $entity->getAttachments($exclude_id, $result);
+ } else if ($entity->type0 != 'multipart') {
+ $result[] = $entity;
diff --git a/mail/squirrelmail/patches/patch-ak b/mail/squirrelmail/patches/patch-ak
new file mode 100644
index 00000000000..b9a7ab58710
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-ak
@@ -0,0 +1,17 @@
+$NetBSD: patch-ak,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- functions/attachment_common.php.orig 2009-07-29 10:35:45.000000000 +0900
++++ functions/attachment_common.php
+@@ -205,10 +205,9 @@ function attachment_common_octet_stream(
+
+ $Ext = '';
+ if (is_array($Regs) && isset($Regs[1])) {
+- $Ext = $Regs[1];
++ $Ext = $Regs[1];
++ $Ext = strtolower($Regs[1]);
+ }
+-
+- $Ext = strtolower($Regs[1]);
+
+ if ($Ext == '' || ! isset($FileExtensionToMimeType[$Ext]))
+ return;
diff --git a/mail/squirrelmail/patches/patch-al b/mail/squirrelmail/patches/patch-al
new file mode 100644
index 00000000000..054178109c5
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-al
@@ -0,0 +1,20 @@
+$NetBSD: patch-al,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- functions/auth.php.orig 2009-08-12 17:19:16.000000000 +0900
++++ functions/auth.php
+@@ -63,13 +63,13 @@ function is_logged_in() {
+ if ($check_referrer == '###DOMAIN###') $check_referrer = $domain;
+ if (!empty($check_referrer)) {
+ $ssl_check_referrer = 'https://' . $check_referrer;
+- $check_referrer = 'http://' . $check_referrer;
++ $plain_check_referrer = 'http://' . $check_referrer;
+ }
+ if (!sqgetGlobalVar('HTTP_REFERER', $referrer, SQ_SERVER)) $referrer = '';
+ if (sqsession_is_registered('user_is_logged_in')
+ && (!$check_referrer || empty($referrer)
+ || ($check_referrer && !empty($referrer)
+- && (strpos(strtolower($referrer), strtolower($check_referrer)) === 0
++ && (strpos(strtolower($referrer), strtolower($plain_check_referrer)) === 0
+ || strpos(strtolower($referrer), strtolower($ssl_check_referrer)) === 0)))) {
+ return;
+ } else {
diff --git a/mail/squirrelmail/patches/patch-am b/mail/squirrelmail/patches/patch-am
new file mode 100644
index 00000000000..f6b270a1b60
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-am
@@ -0,0 +1,14 @@
+$NetBSD: patch-am,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- functions/page_header.php.orig 2009-04-13 16:52:57.000000000 +0000
++++ functions/page_header.php
+@@ -28,7 +28,8 @@ function displayHtmlHeader( $title = 'Sq
+
+ echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' .
+ "\n\n" . html_tag( 'html' ,'' , '', '', '' ) . "\n<head>\n" .
+- "<meta name=\"robots\" content=\"noindex,nofollow\">\n";
++ "<meta name=\"robots\" content=\"noindex,nofollow\">\n" .
++ "<meta http-equiv=\"x-dns-prefetch-control\" content=\"off\">\n";
+
+ if ( !isset( $custom_css ) || $custom_css == 'none' ) {
+ if ($theme_css != '') {
diff --git a/mail/squirrelmail/patches/patch-an b/mail/squirrelmail/patches/patch-an
new file mode 100644
index 00000000000..94fd4bf9262
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-an
@@ -0,0 +1,15 @@
+$NetBSD: patch-an,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- functions/imap_mailbox.php.orig 2009-07-29 11:52:32.000000000 +0900
++++ functions/imap_mailbox.php
+@@ -755,8 +755,8 @@ function sqimap_mailbox_list_all($imap_s
+ $boxesallbyname[$mailbox] = $g;
+ $parentfolder = readMailboxParent($mailbox, $delimiter);
+ /* @FIXME shouldn't use preg_match for simple string matching */
+- if((preg_match('/^inbox'.quotemeta($delimiter).'/i', $mailbox)) ||
+- (preg_match('/^'.$folder_prefix.'/', $mailbox)) ||
++ if((preg_match('|^inbox'.quotemeta($delimiter).'|i', $mailbox)) ||
++ (preg_match('|^'.$folder_prefix.'|', $mailbox)) ||
+ ( isset($boxesallbyname[$parentfolder]) && (strlen($parentfolder) > 0) ) ) {
+ if ($dm_count) {
+ $boxes[$g]['formatted'] = str_repeat('&nbsp;&nbsp;', $dm_count);
diff --git a/mail/squirrelmail/patches/patch-ao b/mail/squirrelmail/patches/patch-ao
new file mode 100644
index 00000000000..773826708ff
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-ao
@@ -0,0 +1,44 @@
+$NetBSD: patch-ao,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- functions/imap_messages.php.orig 2009-07-29 11:21:06.000000000 +0900
++++ functions/imap_messages.php
+@@ -930,19 +930,27 @@ function sqimap_get_small_header_list($i
+
+ /* non server sort stuff */
+ if (!$allow_server_sort) {
+- $from = parseAddress($from);
+- if ($from[0][1]) {
+- $from = decodeHeader($from[0][1], true, false);
+- } else {
+- $from = $from[0][0];
+- }
+- $messages[$msgi]['FROM-SORT'] = $from;
+- $subject_sort = strtolower(decodeHeader($subject, true, false));
+- if (preg_match("/^(?:(?:vedr|sv|re|aw|fw|fwd|\[\w\]):\s*)*\s*(.*)$/si", $subject_sort, $matches)){
++ $from = parseAddress($from);
++ if ($from[0][1]) {
++ $from = decodeHeader($from[0][1], true, false);
++ } else {
++ $from = $from[0][0];
++ }
++ $messages[$msgi]['FROM-SORT'] = $from;
++ $subject_sort = strtolower(decodeHeader($subject, true, false));
++ if (preg_match("/^(?:(?:vedr|sv|re|aw|fw|fwd|\[\w\]):\s*)*\s*(.*)$/si", $subject_sort, $matches)){
+ $messages[$msgi]['SUBJECT-SORT'] = $matches[1];
+- } else {
+- $messages[$msgi]['SUBJECT-SORT'] = $subject_sort;
+- }
++ } else {
++ $messages[$msgi]['SUBJECT-SORT'] = $subject_sort;
++ }
++
++ $to = parseAddress($to);
++ if ($to[0][1]) {
++ $to = decodeHeader($to[0][1], true, false);
++ } else {
++ $to = $to[0][0];
++ }
++ $messages[$msgi]['TO-SORT'] = $to;
+ }
+ ++$msgi;
+ }
diff --git a/mail/squirrelmail/patches/patch-ap b/mail/squirrelmail/patches/patch-ap
new file mode 100644
index 00000000000..7c889b2db99
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-ap
@@ -0,0 +1,33 @@
+$NetBSD: patch-ap,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- functions/mailbox_display.php.orig 2009-08-12 17:29:53.000000000 +0900
++++ functions/mailbox_display.php
+@@ -487,7 +487,7 @@ function showMessagesForMailbox($imapCon
+ if (!$use_cache) {
+ $msgs = getSelfSortMessages($imapConnection, $start_msg, $show_num,
+ $num_msgs, $sort, $mbxresponse);
+- $msort = calc_msort($msgs, $sort);
++ $msort = calc_msort($msgs, $sort, $mailbox);
+ } /* !use cache */
+ break;
+ } // switch
+@@ -545,7 +545,7 @@ function showMessagesForMailbox($imapCon
+ //echo("elapsed time = $t seconds\n");
+ }
+
+-function calc_msort($msgs, $sort) {
++function calc_msort($msgs, $sort, $mailbox = 'INBOX') {
+
+ /*
+ * 0 = Date (up)
+@@ -565,8 +565,9 @@ function calc_msort($msgs, $sort) {
+ $msort[] = $item['TIME_STAMP'];
+ }
+ } elseif (($sort == 2) || ($sort == 3)) {
++ $fld_sort = (handleAsSent($mailbox)?'TO-SORT':'FROM-SORT');
+ foreach ($msgs as $item) {
+- $msort[] = $item['FROM-SORT'];
++ $msort[] = $item[$fld_sort];
+ }
+ } elseif (($sort == 4) || ($sort == 5)) {
+ foreach ($msgs as $item) {
diff --git a/mail/squirrelmail/patches/patch-aq b/mail/squirrelmail/patches/patch-aq
new file mode 100644
index 00000000000..710a221e765
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-aq
@@ -0,0 +1,13 @@
+$NetBSD: patch-aq,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- src/addressbook.php.orig 2009-08-12 17:29:53.000000000 +0900
++++ src/addressbook.php
+@@ -48,7 +48,7 @@ sqgetGlobalVar('deladdr', $deladdr,
+ sqgetGlobalVar('compose_to', $compose_to, SQ_POST);
+ sqgetGlobalVar('sel', $sel, SQ_POST);
+ // renumber $sel array
+-if (!empty($sel)) $sel = array_merge($sel);
++if (!empty($sel)) $sel = array_merge($sel, array());
+ sqgetGlobalVar('oldnick', $oldnick, SQ_POST);
+ sqgetGlobalVar('backend', $backend, SQ_POST);
+ sqgetGlobalVar('doedit', $doedit, SQ_POST);
diff --git a/mail/squirrelmail/patches/patch-ar b/mail/squirrelmail/patches/patch-ar
new file mode 100644
index 00000000000..0deed457f84
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-ar
@@ -0,0 +1,12 @@
+$NetBSD: patch-ar,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- src/delete_message.php.orig 2009-08-18 08:17:41.000000000 +0900
++++ src/delete_message.php
+@@ -78,6 +78,7 @@ $location = get_location();
+
+ if (isset($where) && isset($what)) {
+ header("Location: $location/search.php?where=" . $where .
++ '&smtoken=' . sm_generate_security_token() .
+ '&what=' . $what . '&mailbox=' . urlencode($mailbox));
+ } else {
+ if (!empty($saved_draft) || !empty($mail_sent)) {
diff --git a/mail/squirrelmail/patches/patch-as b/mail/squirrelmail/patches/patch-as
new file mode 100644
index 00000000000..450a0cf7d7c
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-as
@@ -0,0 +1,13 @@
+$NetBSD: patch-as,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- src/folders_delete.php.orig 2009-08-12 17:29:53.000000000 +0900
++++ src/folders_delete.php
+@@ -106,7 +106,7 @@ else
+ /** lets see if we CAN move folders to the trash.. otherwise,
+ ** just delete them **/
+ if ((isset($delete_folder) && $delete_folder) ||
+- preg_match('/^' . $trash_folder . '.+/', $mailbox) ) {
++ preg_match('/^' . preg_quote($trash_folder, '/') . '.+/i', $mailbox) ) {
+ $can_move_to_trash = FALSE;
+ }
+
diff --git a/mail/squirrelmail/patches/patch-at b/mail/squirrelmail/patches/patch-at
new file mode 100644
index 00000000000..bc829a9f380
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-at
@@ -0,0 +1,13 @@
+$NetBSD: patch-at,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- src/options.php.orig 2009-08-12 17:29:53.000000000 +0900
++++ src/options.php
+@@ -143,7 +143,7 @@ sqgetGlobalVar('delimiter', $delimiter,
+ sqgetGlobalVar('optpage', $optpage);
+ sqgetGlobalVar('optmode', $optmode, SQ_FORM);
+ sqgetGlobalVar('optpage_data',$optpage_data, SQ_POST);
+-if (!sqgetGlobalVar('smtoken',$submitted_token, SQ_POST)) {
++if (!sqgetGlobalVar('smtoken',$submitted_token, SQ_FORM)) {
+ $submitted_token = '';
+ }
+ /* end of getting globals */
diff --git a/mail/squirrelmail/patches/patch-au b/mail/squirrelmail/patches/patch-au
new file mode 100644
index 00000000000..69c6b35701b
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-au
@@ -0,0 +1,30 @@
+$NetBSD: patch-au,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- src/options_highlight.php.orig 2009-08-12 17:29:53.000000000 +0900
++++ src/options_highlight.php
+@@ -40,7 +40,7 @@ sqGetGlobalVar('color_type', $color_type
+ sqGetGlobalVar('match_type', $match_type);
+ sqGetGlobalVar('value', $value);
+
+-if (!sqgetGlobalVar('smtoken',$submitted_token, SQ_POST)) {
++if (!sqgetGlobalVar('smtoken',$submitted_token, SQ_FORM)) {
+ $submitted_token = '';
+ }
+ /* end of get globals */
+@@ -163,13 +163,13 @@ if ($mhl_count > 0) {
+
+ $links = '<small>[<a href="options_highlight.php?action=edit&amp;theid=' . $i . '">' .
+ _("Edit") .
+- '</a>]&nbsp;[<a href="options_highlight.php?action=delete&amp;theid='. $i . '">' .
++ '</a>]&nbsp;[<a href="options_highlight.php?action=delete&amp;smtoken=' . sm_generate_security_token() . '&amp;theid='. $i . '">' .
+ _("Delete");
+ if($i > 0) {
+- $links .= '</a>]&nbsp;[<a href="options_highlight.php?action=up&amp;theid='. $i . '">' . _("Up");
++ $links .= '</a>]&nbsp;[<a href="options_highlight.php?action=up&amp;smtoken=' . sm_generate_security_token() . '&amp;theid='. $i . '">' . _("Up");
+ }
+ if($i+1 < $mhl_count) {
+- $links .= '</a>]&nbsp;[<a href="options_highlight.php?action=down&amp;theid='. $i . '">' . _("Down");
++ $links .= '</a>]&nbsp;[<a href="options_highlight.php?action=down&amp;smtoken=' . sm_generate_security_token() . '&amp;theid='. $i . '">' . _("Down");
+ }
+ $links .= '</a>]</small>';
+
diff --git a/mail/squirrelmail/patches/patch-av b/mail/squirrelmail/patches/patch-av
new file mode 100644
index 00000000000..edd5fbc27ff
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-av
@@ -0,0 +1,13 @@
+$NetBSD: patch-av,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- src/read_body.php.orig 2009-08-18 08:17:41.000000000 +0900
++++ src/read_body.php
+@@ -533,7 +533,7 @@ function formatMenubar($mailbox, $passed
+
+ $msgs_url = $base_uri . 'src/';
+ if (isset($where) && isset($what)) {
+- $msgs_url .= 'search.php?where=' . urlencode($where) .
++ $msgs_url .= 'search.php?smtoken=' . sm_generate_security_token() . '&amp;where=' . urlencode($where) .
+ '&amp;what=' . urlencode($what) . '&amp;mailbox=' . $urlMailbox;
+ $msgs_str = _("Search Results");
+ } else {
diff --git a/mail/squirrelmail/patches/patch-aw b/mail/squirrelmail/patches/patch-aw
new file mode 100644
index 00000000000..0370125a277
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-aw
@@ -0,0 +1,13 @@
+$NetBSD: patch-aw,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- src/webmail.php.orig 2009-05-12 07:48:03.000000000 +0900
++++ src/webmail.php
+@@ -48,8 +48,6 @@ if(sqgetGlobalVar('mailtodata', $mailtod
+ $mailtourl = '';
+ }
+
+-is_logged_in();
+-
+ // this value may be changed by a plugin, but initialize
+ // it first to avoid register_globals headaches
+ //
diff --git a/mail/squirrelmail/patches/patch-ca b/mail/squirrelmail/patches/patch-ca
new file mode 100644
index 00000000000..81fd1b0fc8e
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-ca
@@ -0,0 +1,29 @@
+$NetBSD: patch-ca,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- plugins/filters/filters.php.orig 2009-07-27 10:40:44.000000000 +0900
++++ plugins/filters/filters.php
+@@ -317,8 +317,14 @@ function filter_search_and_delete($imap,
+ if ($allow_charset_search &&
+ isset($languages[$squirrelmail_language]['CHARSET']) &&
+ $languages[$squirrelmail_language]['CHARSET']) {
++ if ($squirrelmail_language == 'ja_JP') {
++ $cs = 'euc-JP';
++ } else {
++ $cs = $languages[$squirrelmail_language]['CHARSET'];
++ }
++ $cs = strtoupper($cs);
+ $search_str = 'SEARCH CHARSET '
+- . strtoupper($languages[$squirrelmail_language]['CHARSET'])
++ . $cs
+ . ' ' . $category;
+ } else {
+ $search_str = 'SEARCH CHARSET US-ASCII ' . $category;
+@@ -552,7 +558,7 @@ function load_filters() {
+
+ $filters = array();
+ for ($i = 0; $fltr = getPref($data_dir, $username, 'filter' . $i); $i++) {
+- $ary = explode(',', $fltr);
++ $ary = explode(',', $fltr, 3);
+ $filters[$i]['where'] = $ary[0];
+ $filters[$i]['what'] = str_replace('###COMMA###', ',', $ary[1]);
+ $filters[$i]['folder'] = $ary[2];
diff --git a/mail/squirrelmail/patches/patch-cb b/mail/squirrelmail/patches/patch-cb
new file mode 100644
index 00000000000..2b47bf17f10
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-cb
@@ -0,0 +1,20 @@
+$NetBSD: patch-cb,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- plugins/newmail/newmail_opt.php.orig 2009-04-16 07:00:49.000000000 +0900
++++ plugins/newmail/newmail_opt.php
+@@ -71,6 +71,7 @@ echo '</td></tr>' .
+ html_tag( 'td', '', 'center', $color[4] ) . "\n" . '<hr style="width: 25%; height: 1px;" />' . "\n";
+
+ echo '<form action="'.sqm_baseuri().'src/options.php" method="post">' . "\n" .
++ '<input type="hidden" name="smtoken" value="' . sm_generate_security_token() . '">' . "\n" .
+ html_tag( 'table', '', '', '', 'width="100%" cellpadding="5" cellspacing="0" border="0"' ) . "\n";
+
+ // Option: media_allbox
+@@ -182,6 +183,7 @@ echo html_tag( 'tr', "\n" .
+ html_tag( 'td',
+ '<input type="hidden" name="optmode" value="submit" />' .
+ '<input type="hidden" name="optpage" value="newmail" />' .
++ '<input type="hidden" name="smtoken" value="' . sm_generate_security_token() . '" />' .
+ '<input type="submit" value="' . _("Submit") . '" name="submit_newmail" />',
+ 'left' )
+ ) . "\n";
diff --git a/mail/squirrelmail/patches/patch-cc b/mail/squirrelmail/patches/patch-cc
new file mode 100644
index 00000000000..d269c68cc17
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-cc
@@ -0,0 +1,12 @@
+$NetBSD: patch-cc,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- plugins/spamcop/spamcop.php.orig 2009-04-16 07:00:49.000000000 +0900
++++ plugins/spamcop/spamcop.php
+@@ -153,6 +153,7 @@ echo "</p>";
+ $report_email = 'quick.' . $spamcop_id . '@spam.spamcop.net';
+ $form_action = sqm_baseuri() . 'src/compose.php';
+ ?> <form method="post" action="<?php echo $form_action?>">
++ <input type="hidden" name="smtoken" value="<?php echo sm_generate_security_token(); ?>" />
+ <input type="hidden" name="mailbox" value="<?php echo htmlspecialchars($mailbox) ?>" />
+ <input type="hidden" name="spamcop_is_composing" value="<?php echo htmlspecialchars($passed_id) ?>" />
+ <input type="hidden" name="send_to" value="<?php echo htmlspecialchars($report_email)?>" />
diff --git a/mail/squirrelmail/patches/patch-cd b/mail/squirrelmail/patches/patch-cd
new file mode 100644
index 00000000000..fdf0781a98c
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-cd
@@ -0,0 +1,13 @@
+$NetBSD: patch-cd,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- plugins/squirrelspell/modules/edit_dic.mod.orig 2009-04-16 07:00:49.000000000 +0900
++++ plugins/squirrelspell/modules/edit_dic.mod
+@@ -96,7 +96,7 @@ if (!$words){
+ /**
+ * Check if all dictionaries were empty.
+ */
+- if (!$msg) {
++ if (empty($msg)) {
+ $msg = '<p>' . _("No words in your personal dictionary.") . '</p>';
+ } else {
+ $msg .= '</table>';
diff --git a/mail/squirrelmail/patches/patch-ce b/mail/squirrelmail/patches/patch-ce
new file mode 100644
index 00000000000..7d4fde38811
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-ce
@@ -0,0 +1,16 @@
+$NetBSD: patch-ce,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- plugins/squirrelspell/modules/lang_change.mod.orig 2009-04-16 07:00:49.000000000 +0900
++++ plugins/squirrelspell/modules/lang_change.mod
+@@ -16,6 +16,11 @@
+ * @subpackage squirrelspell
+ */
+
++if (!sqgetGlobalVar('smtoken',$submitted_token, SQ_POST)) {
++ $submitted_token = '';
++}
++sm_validate_security_token($submitted_token, 3600, TRUE);
++
+ global $SQSPELL_APP_DEFAULT;
+
+ $use_langs = $_POST['use_langs'];
diff --git a/mail/squirrelmail/patches/patch-cf b/mail/squirrelmail/patches/patch-cf
new file mode 100644
index 00000000000..ee45fceab4f
--- /dev/null
+++ b/mail/squirrelmail/patches/patch-cf
@@ -0,0 +1,12 @@
+$NetBSD: patch-cf,v 1.1 2010/03/04 16:00:37 taca Exp $
+
+--- plugins/squirrelspell/modules/lang_setup.mod.orig 2009-04-16 07:00:49.000000000 +0900
++++ plugins/squirrelspell/modules/lang_setup.mod
+@@ -23,6 +23,7 @@ $msg = '<p>'
+ . '</p>'
+ . '<form method="post">'
+ . '<input type="hidden" name="MOD" value="lang_change" />'
++ . '<input type="hidden" name="smtoken" value="' . sm_generate_security_token() . '" />'
+ . '<blockquote><p>';
+ /**
+ * Present a nice listing.