summaryrefslogtreecommitdiff
path: root/mail/dbmail-devel/files/patch-2.0.4_bug79_imaputil.c
diff options
context:
space:
mode:
authorPav Lucistnik <pav@FreeBSD.org>2005-07-18 16:04:16 +0000
committerPav Lucistnik <pav@FreeBSD.org>2005-07-18 16:04:16 +0000
commit05065d99c78a53f6ab97086574a01d75be79decc (patch)
tree2f9f09b2b30cc41ccd58808030a38660205a46fb /mail/dbmail-devel/files/patch-2.0.4_bug79_imaputil.c
parent- Update to 1.3.2 (diff)
- Patch nine bugs:
#79 - INTERNALDATE reponses do not conform to RFC #145 - LMTP loses return-path #177 - Compile Fails on FreeBSD (fixes compilation on FreeBSD 4.X) #184 - socklen_t issue #190 - huge load if database crash #198 - DBMail processes killing each other #199 - spare child creates zombie #214 - dbmail-smtp dumps core with double free #216 - malformed header prevents delivery - Fix RC_SUBR usage PR: ports/83437, also ports/80736, ports/82437, ports/83575 Submitted by: Mark Starovoytov <mark@kikg.ifmo.ru>, parts also by: Radim Kolar <hsn@netmag.cz>, thompsa, Marcus Grando <marcus@corp.grupos.com.br> Approved by: maintainer timeout (2 months on oldest PR)
Diffstat (limited to '')
-rw-r--r--mail/dbmail-devel/files/patch-2.0.4_bug79_imaputil.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/mail/dbmail-devel/files/patch-2.0.4_bug79_imaputil.c b/mail/dbmail-devel/files/patch-2.0.4_bug79_imaputil.c
new file mode 100644
index 000000000000..dbeb799017be
--- /dev/null
+++ b/mail/dbmail-devel/files/patch-2.0.4_bug79_imaputil.c
@@ -0,0 +1,80 @@
+Index: imaputil.c
+===================================================================
+--- imaputil.c (revision 1726)
++++ imaputil.c (revision 1793)
+@@ -65,7 +65,7 @@
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+ /* returned by date_sql2imap() */
+-#define IMAP_STANDARD_DATE "03-Nov-1979 00:00:00 +0000"
++#define IMAP_STANDARD_DATE "Sat, 03-Nov-1979 00:00:00 +0000"
+ char _imapdate[IMAP_INTERNALDATE_LEN] = IMAP_STANDARD_DATE;
+
+ /* returned by date_imap2sql() */
+@@ -1776,50 +1776,35 @@
+
+ /*
+ * convert a mySQL date (yyyy-mm-dd hh:mm:ss) to a valid IMAP internal date:
+- * 0123456789012345678
+- * dd-mon-yyyy hh:mm:ss with mon characters (i.e. 'Apr' for april)
+- * 01234567890123456789
++ * [Mon, 30 May 2005 10:01:55 +0100] with mon characters (i.e. 'Apr' for april)
+ * return value is valid until next function call.
+ * NOTE: if date is not valid, IMAP_STANDARD_DATE is returned
+ */
+ char *date_sql2imap(const char *sqldate)
+ {
+- char *last_char;
+- struct tm tm_localtime, tm_sqldate;
+- time_t td;
++ struct tm tm_sql_date;
++ struct tm *tm_imap_date;
++
++ time_t ltime;
++ char *last;
+
+- /* we need to get the localtime to get the current timezone */
+- if (time(&td) == -1) {
+- trace(TRACE_ERROR, "%s,%s: error getting time()",
+- __FILE__, __func__);
+- return IMAP_STANDARD_DATE;
+- }
+- tm_localtime = *localtime(&td);
++ last = strptime(sqldate,"%Y-%m-%d %T", &tm_sql_date);
++ if ( (last == NULL) || (*last != '\0') ) {
++ strcpy(_imapdate, IMAP_STANDARD_DATE);
++ return _imapdate;
++ }
+
+- /* parse sqldate */
+- last_char = strptime(sqldate, "%Y-%m-%d %T", &tm_sqldate);
+- if (last_char == NULL || *last_char != '\0') {
+- trace(TRACE_DEBUG, "%s,%s, error parsing date [%s]",
+- __FILE__, __func__, sqldate);
+- strcpy(_imapdate, IMAP_STANDARD_DATE);
+- return _imapdate;
+- }
+- /* copy DST information from localtime */
+- tm_sqldate.tm_gmtoff = tm_localtime.tm_gmtoff;
+- tm_sqldate.tm_isdst = tm_localtime.tm_isdst;
++ /* FIXME: this works fine on linux, but may cause dst offsets in netbsd. */
++ ltime = mktime (&tm_sql_date);
++ tm_imap_date = localtime(&ltime);
+
+- (void) strftime(_imapdate, IMAP_INTERNALDATE_LEN,
+- "%d-%b-%Y %T %z", &tm_sqldate);
+-
+- return _imapdate;
++ strftime(_imapdate, sizeof(_imapdate), "%a, %d %b %Y %H:%M:%S %z", tm_imap_date);
++ return _imapdate;
+ }
+
+-
+ /*
+ * convert TO a mySQL date (yyyy-mm-dd) FROM a valid IMAP internal date:
+- * 0123456789
+ * dd-mon-yyyy with mon characters (i.e. 'Apr' for april)
+- * 01234567890
+ * OR
+ * d-mon-yyyy
+ * return value is valid until next function call.