1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
$NetBSD: patch-ac,v 1.1.1.1 2000/07/27 16:10:24 jlam Exp $
--- pks_www.c.orig Wed Jun 2 02:06:01 1999
+++ pks_www.c Thu Jul 27 10:17:35 2000
@@ -113,6 +113,9 @@
w_error(fd, vers, (unsigned char *) str, strlen(str));
}
+static const char homepage_str[] = "/";
+static int homepage_len = sizeof(homepage_str)-1;
+
static const char lookup_str[] = "/pks/lookup";
static int lookup_len = sizeof(lookup_str)-1;
@@ -291,6 +294,34 @@
search = -1;
search_len = 0;
+ if (is_token(uri, urilen, homepage_str, homepage_len, 1)) {
+ FILE *homepage;
+ char homepage_path[2048];
+ char buf[1024];
+ unsigned char *line;
+ xbuffer xb;
+
+ strncpy(homepage_path, conf->db_dir, 2035);
+ strncat(homepage_path, "/index.html", 2046);
+ if ((homepage = fopen(homepage_path,"r")) == NULL) {
+ log_fatal("pks_www", "non-existent homepage");
+ return;
+ }
+
+ xbuffer_alloc(&xb);
+
+ while (line = (unsigned char *) fgets(buf,sizeof(buf), homepage)) {
+ if (!xbuffer_append_str(&xb, line)) {
+ log_fatal("pks_www", "displaying home page");
+ return;
+ }
+ }
+
+ w_reply(fd, vers, xb.buf, xb.len);
+
+ xbuffer_free(&xb);
+ return;
+ }
if (is_token(uri, urilen, lookup_str, lookup_len, 1)) {
long op, op_len, exact, exact_len, fingerprint, fingerprint_len;
int flags;
@@ -498,4 +529,5 @@
void pks_www_init(pks_www_conf *conf)
{
www_init(conf->port, pks_www, conf);
+ www_init(conf->db_dir, pks_www, conf);
}
|