-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomment.c
54 lines (50 loc) · 1.52 KB
/
comment.c
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
/*
* Require:
* - enable "Option ExecCGI"
* - add below lines to the .htaccess
* AddHandler cgi-script .cgi
* AddHandler server-parsed .html
*
* How to install:
* (to use TZ=Asia/Tokyo from jail)
* % sudo mkdir -p /var/www/usr/share/zoneinfo/Asia
* % sudo cp /usr/share/zoneinfo/Asia/Tokyo \
* /var/www/usr/share/zoneinfo/Asia/
* % cc -Wall -static -o comment.cgi comment.c
* % touch comment-data.txt
* % sudo chown www comment-data.txt
*
* HTML example:
* <form action="./comment.cgi" id="commentForm" method="POST">
* お名前: <input type="text" name="name" size="10">
* コメント: <input type="text" name="comment" size="40">
* <input type="submit">
* </form>
* <ul>
* <!--#include file="comment-data.txt" -->
* </ul>
*
* See also the comment on top of comment_subr.c.
*
* Author: YASUOKA Masahiko <[email protected]>
* $Id: comment.c 138101 2012-06-25 08:03:51Z yasuoka $
*/
#define CHECK_CAPTCHA 1
#include "captcha.c"
#include "comment_subr.c"
#define COMMENT_PATH "comment-data.txt" // file name of comment data.
int
main(int argc, char *argv[])
{
setenv("TZ", "Asia/Tokyo", 1); // time zone
if (unveil(COMMENT_PATH, "rw") == -1)
err(1, "unveil");
if (pledge("stdio inet flock rpath wpath", NULL) == -1)
err(1, "pledge");
comment_cgi(
COMMENT_PATH,
"comment.html", // file name of HTML displays the form
"[email protected]", // sender mail address of hte notice
"[email protected]"); // recipient mail address of the notice
exit(EXIT_SUCCESS);
}