Created stub for REPORT method
authorArt Cancro <ajc@uncensored.citadel.org>
Tue, 3 Jan 2012 23:13:57 +0000 (18:13 -0500)
committerArt Cancro <ajc@uncensored.citadel.org>
Tue, 3 Jan 2012 23:13:57 +0000 (18:13 -0500)
webcit/Makefile.in
webcit/context_loop.c
webcit/dav.h
webcit/dav_main.c
webcit/dav_options.c
webcit/dav_report.c [new file with mode: 0644]
webcit/netconf.c
webcit/sysdep.c
webcit/webcit.h
webcit/webserver.c

index ee7c89f38a89cedde7f373f9cdbe4afcc032d407..dfcb06db7144885f9c3b4e6045174519962ef16f 100644 (file)
@@ -54,7 +54,7 @@ webcit: webserver.o context_loop.o ical_dezonify.o \
        graphics.o netconf.o siteconfig.o subst.o bbsview_renderer.o \
        calendar.o calendar_tools.o calendar_view.o tasks.o event.o smtpqueue.o \
        availability.o iconbar.o crypto.o inetconf.o notes.o wiki.o \
-       dav_main.o dav_get.o dav_propfind.o fmt_date.o \
+       dav_main.o dav_get.o dav_propfind.o dav_report.o fmt_date.o \
        dav_options.o autocompletion.o gettext.o tabs.o sieve.o sitemap.o \
        dav_delete.o dav_put.o http_datestring.o setup_wizard.o \
        downloads.o addressbook_popup.o pushemail.o sysdep.o openid.o \
@@ -70,7 +70,7 @@ webcit: webserver.o context_loop.o ical_dezonify.o \
        graphics.o netconf.o preferences.o html2html.o openid.o bbsview_renderer.o \
        summary.o calendar.o calendar_tools.o calendar_view.o tasks.o event.o wiki.o \
        availability.o ical_dezonify.o iconbar.o crypto.o inetconf.o notes.o \
-       dav_main.o dav_get.o dav_propfind.o dav_delete.o \
+       dav_main.o dav_get.o dav_propfind.o dav_report.o dav_delete.o \
        dav_options.o autocompletion.o tabs.o smtpqueue.o sieve.o sitemap.o \
        dav_put.o http_datestring.o setup_wizard.o fmt_date.o modules_init.o \
        gettext.o downloads.o addressbook_popup.o pushemail.o sysdep.o decode.o \
index 04c5cf0a3ea714ecb6ed959fa97d4aeb5d87e23a..fb59144628ef36381458529276f4efafc6b8bf9f 100644 (file)
@@ -714,7 +714,8 @@ const char *ReqStrs[eNONE] = {
        "DELETE",
        "HEAD",
        "MOVE",
-       "COPY"
+       "COPY",
+       "REPORT"
 };
 
 void
@@ -760,6 +761,10 @@ ServerStartModule_CONTEXT
        v = malloc(sizeof(long));
        *v = eCOPY;
        Put(HttpReqTypes, HKEY("COPY"), v, NULL);
+
+       v = malloc(sizeof(long));
+       *v = eREPORT;
+       Put(HttpReqTypes, HKEY("REPORT"), v, NULL);
 }
 
 void 
index 63d67dfefa76c1fc001543db9b4149589907acaa..a2963f0fb7b30dfa158d98083f89d76e34cbca33 100644 (file)
@@ -17,6 +17,7 @@ void dav_put(void);
 void dav_delete(void);
 void dav_propfind(void);
 void dav_options(void);
+void dav_report(void);
 
 long locate_message_by_uid(const char *);
 void dav_folder_list(void);
index 833e75e75fe09ab2bb812b80bb97774bfbc560ea..f923a37b715e6e614964345d8d7232920c139f4f 100644 (file)
@@ -170,8 +170,15 @@ void dav_main(void)
        case eDELETE:
                dav_delete();
                break;
-       default:
 
+       /*
+        * The REPORT method tells us that Mike Shaver is a self-righteous asshole.
+        */
+       case eREPORT:
+               dav_report();
+               break;
+
+       default:
        /*
         * Couldn't find what we were looking for.  Die in a car fire.
         */
index b918730014434798ab65b225b89f40fcd0ce1bc8..250a3ce124b0453dac338e87d0f7fc6acef1cb6b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Handles DAV OPTIONS requests (experimental -- not required by GroupDAV)
  *
- * Copyright (c) 2005-2010 by the citadel.org team
+ * Copyright (c) 2005-2012 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -145,7 +145,7 @@ void dav_options(void)
                syslog(LOG_DEBUG, "\033[36mDAV: 1\033[0m");
        }
 
-       hprintf("Allow: OPTIONS, PROPFIND, GET, PUT\r\n");
+       hprintf("Allow: OPTIONS, PROPFIND, GET, PUT, REPORT\r\n");
        begin_burst();
        end_burst();
 }
diff --git a/webcit/dav_report.c b/webcit/dav_report.c
new file mode 100644 (file)
index 0000000..33d1683
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * Handles GroupDAV REPORT requests.
+ *
+ * Copyright (c) 2005-2012 by the citadel.org team
+ *
+ * This program is open source software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+
+/* SAMPLE QUERIES TO WORK WITH *
+
+REPORT /groupdav/calendar/ HTTP/1.1
+Content-type: application/xml
+Content-length: 349
+
+<C:calendar-query xmlns:C="urn:ietf:params:xml:ns:caldav" xmlns:D="DAV:">
+  <D:prop>
+    <D:getetag/>
+  </D:prop>
+  <C:filter>
+    <C:comp-filter name="VCALENDAR">
+      <C:comp-filter name="VEVENT">
+        <C:time-range start="20111129T231445Z" end="20120207T231445Z"/>
+      </C:comp-filter>
+    </C:comp-filter>
+  </C:filter>
+</C:calendar-query>
+
+
+REPORT /groupdav/calendar/ HTTP/1.1
+Content-type: application/xml
+Content-length: 255
+
+<C:calendar-query xmlns:C="urn:ietf:params:xml:ns:caldav" xmlns:D="DAV:">
+  <D:prop>
+    <D:getetag/>
+  </D:prop>
+  <C:filter>
+    <C:comp-filter name="VCALENDAR">
+      <C:comp-filter name="VEVENT"/>
+    </C:comp-filter>
+  </C:filter>
+</C:calendar-query>
+
+*/
+
+#include "webcit.h"
+#include "webserver.h"
+#include "dav.h"
+
+
+/*
+ * The pathname is always going to be /groupdav/room_name/msg_num
+ */
+void dav_report(void) 
+{
+       char datestring[256];
+       time_t now = time(NULL);
+
+       http_datestring(datestring, sizeof datestring, now);
+       const char *req = ChrPtr(WC->upload);
+
+       syslog(LOG_DEBUG, "REPORT: \033[31m%s\033[0m", req);
+
+       hprintf("HTTP/1.1 500 Internal Server Error\r\n");
+       dav_common_headers();
+       hprintf("Date: %s\r\n", datestring);
+       hprintf("Content-Type: text/plain\r\n");
+       wc_printf("An internal error has occurred at %s:%d.\r\n", __FILE__ , __LINE__ );
+       end_burst();
+       return;
+}
+
+
+
+extern int ParseMessageListHeaders_EUID(StrBuf *Line, 
+                                const char **pos, 
+                                message_summary *Msg, 
+                                StrBuf *ConversionBuffer);
+
+extern int DavUIDL_GetParamsGetServerCall(SharedMessageStatus *Stat, 
+                                   void **ViewSpecific, 
+                                   long oper, 
+                                   char *cmd, 
+                                   long len);
+
+extern int DavUIDL_RenderView_or_Tail(SharedMessageStatus *Stat, 
+                               void **ViewSpecific, 
+                               long oper);
+
+extern int DavUIDL_Cleanup(void **ViewSpecific);
+
+
+
+void 
+InitModule_REPORT
+(void)
+{
+       RegisterReadLoopHandlerset(
+               eReadEUIDS,
+               DavUIDL_GetParamsGetServerCall,
+               NULL,
+               ParseMessageListHeaders_EUID,
+               NULL,
+               DavUIDL_RenderView_or_Tail,
+               DavUIDL_Cleanup
+       );
+
+}
index a426217114c97cd6dbae6527f88e7f384e9c3ae2..caecca46f42681401be6e724d4067d40fd0a8864 100644 (file)
@@ -79,7 +79,6 @@ HashList *load_netconf(StrBuf *Target, WCTemplputParams *TP)
        char nnn[64];
        char buf[SIZ];
        int nUsed;
-       long len;
        NodeConf *Node;
 
        serv_puts("CONF getsys|application/x-citadel-ignet-config");
@@ -88,7 +87,7 @@ HashList *load_netconf(StrBuf *Target, WCTemplputParams *TP)
                Hash = NewHash(1, NULL);
 
                Buf = NewStrBuf();
-               while (len = StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000")) {
+               while (StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000")) {
                        Node = NewNode(Buf);
                        if (Node != NULL) {
                                nUsed = GetCount(Hash);
index 197d2df6f692801bbe1fedd8aa4842f8d897e04d..9ccbc1cd23e1edc84db6119ec462062f64d061a0 100644 (file)
@@ -331,8 +331,6 @@ void start_daemon(char *pid_file)
        pid_t child = 0;
        FILE *fp;
        int do_restart = 0;
-       int rv;
-       FILE *rvfp = NULL;
 
        current_child = 0;
 
@@ -340,7 +338,7 @@ void start_daemon(char *pid_file)
         * We don't just call close() because we don't want these fd's
         * to be reused for other files.
         */
-       rv = chdir("/");
+       chdir("/");
 
        signal(SIGHUP, SIG_IGN);
        signal(SIGINT, SIG_IGN);
@@ -353,9 +351,9 @@ void start_daemon(char *pid_file)
 
        setsid();
        umask(0);
-       rvfp = freopen("/dev/null", "r", stdin);
-       rvfp = freopen("/dev/null", "w", stdout);
-       rvfp = freopen("/dev/null", "w", stderr);
+       freopen("/dev/null", "r", stdin);
+       freopen("/dev/null", "w", stdout);
+       freopen("/dev/null", "w", stderr);
        signal(SIGTERM, graceful_shutdown_watcher);
        signal(SIGHUP, graceful_shutdown_watcher);
 
index c46e8b4b52d6ce8146d620694b4f3c7c94a316a2..e80489f22421531fcc802da4f31ffd50c5ee214e 100644 (file)
@@ -1,19 +1,13 @@
 /*
- * Copyright (c) 1987-2011 by the citadel.org team
+ * Copyright (c) 1987-2012 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
+ * modify it under the terms of the GNU General Public License version 3.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
 #include "sysdep.h"
@@ -410,6 +404,7 @@ enum {
        eHEAD,
        eMOVE,
        eCOPY,
+       eREPORT,
        eNONE
 };
 extern const char *ReqStrs[eNONE];
index ab523489bda8bd4fe2bd9efcc2297ac943165b0e..e8214883794ae063bbb8a9e8559a8a5f3286db07 100644 (file)
@@ -86,7 +86,6 @@ int main(int argc, char **argv)
        const char *basedir = NULL;
        char uds_listen_path[PATH_MAX]; /* listen on a unix domain socket? */
        const char *I18nDumpFile = NULL;
-       int rv = 0;
 
        WildFireInitBacktrace(argv[0], 2);
 
@@ -274,7 +273,7 @@ int main(int argc, char **argv)
                        syslog(1, "***********************************************\n");
                        return -1;
                }
-               rv = fwrite(ChrPtr(I18nDump), 1, StrLength(I18nDump), fd);
+               fwrite(ChrPtr(I18nDump), 1, StrLength(I18nDump), fd);
                fclose(fd);
                return 0;
        }