Package: davical                                                                
Version: 1.1.3.1-1                                                              
Severity: normal
Tags: patch

Dear Maintainer,

trying to push a event started befor 1900 results in a database error
and therefor in a 500 response to the client. I can reproduce the error
with different clients (iceowl, ical4ol, claws):
1) create an event before 1900 (1814/10/14 as example)  
2) mark it whole-time
3) let it yearly repeat
4) sync it

As you might see the error was exposed by trying to sync Birthday
anniversaries.

A workaround patch is attached. 

Regards
    Benedikt Spranger

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.14-2-amd64 (SMP w/1 CPU core)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages davical depends on:
ii  libawl-php                                 0.55-1
ii  libdbd-pg-perl                             3.4.2-1
ii  libyaml-perl                               1.12-1
ii  perl                                       5.20.1-1
ii  php5                                       5.6.0+dfsg-1
ii  php5-cli                                   5.6.0+dfsg-1+b1
ii  php5-pgsql                                 5.6.0+dfsg-1+b1
ii  postgresql-client                          9.4+162
ii  postgresql-client-9.1 [postgresql-client]  9.1.11-1
ii  postgresql-client-9.3 [postgresql-client]  9.3.4-2
ii  postgresql-client-9.4 [postgresql-client]  9.4~beta2-1+b1

Versions of packages davical recommends:
ii  php5-curl   5.6.0+dfsg-1+b1
ii  postgresql  9.4+162

Versions of packages davical suggests:
pn  php5-ldap  <none>

-- no debconf information
>From ae04d9f2622c7a5d50a3009c3804719c82867acd Mon Sep 17 00:00:00 2001
From: Benedikt Spranger <[email protected]>
Date: Sun, 12 Oct 2014 09:38:17 +0200
Subject: [PATCH] handle events started before 1900

Signed-off-by: Benedikt Spranger <[email protected]>
---
 inc/caldav-PUT-functions.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/inc/caldav-PUT-functions.php b/inc/caldav-PUT-functions.php
index a1c9e3d..3f1b7d4 100644
--- a/inc/caldav-PUT-functions.php
+++ b/inc/caldav-PUT-functions.php
@@ -1278,12 +1278,16 @@ function write_resource( DAVResource $resource, $caldav_data, DAVResource $colle
   if ( $first->GetType() == 'VTODO' ) $due = $first->GetPValue('DUE'); 
   $calitem_params[':due'] = $due;
   $dtstart = $first->GetPValue('DTSTART');
-  if ( empty($dtstart) ) $dtstart = $due; 
+  if ( empty($dtstart) ) $dtstart = $due;
+  if (preg_match("/^[0-9][0-9][0-9][0-9][01][0-9][0-3][0-9]$/", $dtstart))
+     $dtstart = $dtstart . "T000000Z";
   $calitem_params[':dtstart'] = $dtstart;
   
   $dtend = $first->GetPValue('DTEND');
   if ( isset($dtend) && $dtend != '' ) {
     dbg_error_log( 'PUT', ' DTEND: "%s", DTSTART: "%s", DURATION: "%s"', $dtend, $dtstart, $first->GetPValue('DURATION') );
+    if (preg_match("/^[0-9][0-9][0-9][0-9][01][0-9][0-3][0-9]$/", $dtend))
+       $dtend = $dtend . "T000000Z";
     $calitem_params[':dtend'] = $dtend;
     $dtend = ':dtend';
   }
-- 
2.1.1

Reply via email to