$Log$
+Revision 528.17 2005/01/24 03:37:48 ajc
+* Began laying the groundwork for http-authenticated GroupDAV sessions.
+
Revision 528.16 2005/01/22 22:50:51 ajc
* removed descriptions in non-main menus
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
+
mime_parser.o graphics.o netconf.o siteconfig.o subst.o \
calendar.o calendar_tools.o calendar_view.o event.o \
availability.o iconbar.o crypto.o inetconf.o notes.o \
+ groupdav_main.o \
$(LIBOBJS)
$(CC) webserver.o context_loop.o tools.o cookie_conversion.o \
webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o listsub.o \
mime_parser.o graphics.o netconf.o preferences.o html2html.o \
summary.o calendar.o calendar_tools.o calendar_view.o event.o \
availability.o ical_dezonify.o iconbar.o crypto.o inetconf.o notes.o \
+ groupdav_main.o \
$(LIBOBJS) $(LIBS) $(LDFLAGS) -o webserver
.c.o:
&& (strncasecmp(buf, "/listsub", 8))
&& (strncasecmp(buf, "/freebusy", 9))
&& (strncasecmp(buf, "/do_logout", 10))
+ && (strncasecmp(buf, "/groupdav", 9))
&& (got_cookie == 0)) {
strcpy(req->line, "GET /static/nocookies.html"
"?force_close_session=yes HTTP/1.0");
--- /dev/null
+/*
+ * $Id$
+ *
+ * Entry point for GroupDAV functions
+ *
+ */
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/socket.h>
+#include <limits.h>
+#include <string.h>
+#include <pwd.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <time.h>
+#include "webcit.h"
+#include "webserver.h"
+
+void groupdav_main(char *cmd) {
+
+ if (!WC->logged_in) {
+ wprintf(
+ "HTTP/1.1 401 Authorization Required\n"
+ "WWW-Authenticate: Basic realm=\"GroupDAV\"\n"
+ "Connection: close\n"
+ );
+ output_headers(0, 0, 0, 0, 0, 0, 0);
+ wprintf("Content-Type: text/plain\n");
+ wprintf("\n");
+ wprintf("GroupDAV sessions require HTTP authentication.\n");
+ wDumpContent(0);
+ }
+
+ output_static("smiley.gif"); /* FIXME */
+}
void session_loop(struct httprequest *req)
{
char cmd[SIZ];
+ char method[SIZ];
char action[SIZ];
char buf[SIZ];
int a, b;
strcpy(cmd, hptr->line);
hptr = hptr->next;
+ extract_token(method, cmd, 0, ' ');
extract_action(action, cmd);
while (hptr != NULL) {
ContentType, ContentLength);
body_start = strlen(content);
-/***** old version
- BytesRead = 0;
- while (BytesRead < ContentLength) {
- a=read(WC->http_sock, &content[BytesRead+body_start],
- ContentLength - BytesRead);
- if (a <= 0) BytesRead = ContentLength;
- else BytesRead += a;
- }
-*******/
-
- /* Now we're daring and read it all at once. */
- client_read(WC->http_sock, &content[BytesRead+body_start], ContentLength);
+ /* Be daring and read it all at once. */
+ client_read(WC->http_sock, &content[BytesRead+body_start],
+ ContentLength);
if (!strncasecmp(ContentType,
"application/x-www-form-urlencoded", 33)) {
goto SKIP_ALL_THIS_CRAP;
}
#endif
+ /*
+ * The GroupDAV stuff relies on HTTP authentication instead of
+ * our session's authentication.
+ */
+ if (!strncasecmp(action, "groupdav", 8)) {
+ groupdav_main(cmd);
+ goto SKIP_ALL_THIS_CRAP;
+ }
check_for_instant_messages();
char ImportantMessage[SIZ];
char last_chat_user[SIZ];
int ctdl_pid; /* Session ID on the Citadel server */
+ char httpauth_user[SIZ]; /* only for GroupDAV sessions */
+ char httpauth_pass[SIZ]; /* only for GroupDAV sessions */
};
#define extract(dest,source,parmnum) extract_token(dest,source,parmnum,'|')
#define VIEW_CALENDAR 3 /* Calendar view */
#define VIEW_TASKS 4 /* Tasks view */
#define VIEW_NOTES 5 /* Notes view */
+
+void groupdav_main(char *);