annotate src/c/static.c @ 1512:dcc8abbc6dfd

Change cookie signature comparison to resist timing attacks (based on code suggested by Robin Green and Austin Seipp)
author Adam Chlipala <adam@chlipala.net>
date Tue, 19 Jul 2011 09:18:50 -0400
parents 2f9b7382dd1d
children 2d9f831d45c9
rev   line source
adam@1493 1 #include "config.h"
adam@1493 2
adam@1493 3 #include <stdio.h>
adam@1493 4 #include <stdarg.h>
adam@1493 5
adam@1493 6 #include "urweb.h"
adam@1493 7
adam@1493 8 extern uw_app uw_application;
adam@1493 9
adam@1493 10 static void log_debug(void *data, const char *fmt, ...) {
adam@1493 11 va_list ap;
adam@1493 12 va_start(ap, fmt);
adam@1493 13
adam@1493 14 vprintf(fmt, ap);
adam@1493 15 }
adam@1493 16
adam@1493 17 int main(int argc, char *argv[]) {
adam@1493 18 uw_context ctx;
adam@1493 19 failure_kind fk;
adam@1493 20
adam@1493 21 if (argc != 2) {
adam@1493 22 fprintf(stderr, "Pass exactly one argument: the URI to run\n");
adam@1493 23 return 1;
adam@1493 24 }
adam@1493 25
adam@1493 26 ctx = uw_init(0, NULL, log_debug);
adam@1493 27 uw_set_app(ctx, &uw_application);
adam@1493 28
adam@1498 29 while (1) {
adam@1498 30 fk = uw_begin(ctx, argv[1]);
adam@1498 31
adam@1498 32 if (fk == SUCCESS) {
adam@1498 33 uw_print(ctx, 1);
adam@1498 34 puts("");
adam@1498 35 return 0;
adam@1498 36 } else if (fk != UNLIMITED_RETRY) {
adam@1498 37 fprintf(stderr, "Error: %s\n", uw_error_message(ctx));
adam@1498 38 return 1;
adam@1498 39 }
adam@1502 40
adam@1502 41 uw_reset(ctx);
adam@1493 42 }
adam@1493 43 }
adam@1493 44
adam@1493 45 void *uw_init_client_data() {
adam@1493 46 return NULL;
adam@1493 47 }
adam@1493 48
adam@1493 49 void uw_free_client_data(void *data) {
adam@1493 50 }
adam@1493 51
adam@1493 52 void uw_copy_client_data(void *dst, void *src) {
adam@1493 53 }
adam@1493 54
adam@1493 55 void uw_do_expunge(uw_context ctx, uw_Basis_client cli, void *data) {
adam@1493 56 }
adam@1493 57
adam@1493 58 void uw_post_expunge(uw_context ctx, void *data) {
adam@1493 59 }
adam@1493 60
adam@1493 61 int uw_supports_direct_status = 0;