1
0
Fork 0
mirror of git://git.psyced.org/git/psyced synced 2024-08-15 03:25:10 +00:00

introducing TLS requirement for IRC users

This commit is contained in:
psyc://loupsycedyglgamf.onion/~lynX 2018-07-30 19:32:12 +02:00
parent 372e704a58
commit fbc563a94e
4 changed files with 28 additions and 2 deletions

View file

@ -613,10 +613,15 @@ htget(prot, query, headers, qs) {
#ifdef CHALLENGE_MATCH
#include <sys/regexp.h>
#define CHALOG(verb) log_file("CHALLENGE", "%s %s %O A:%O P:%O C:%O\n", \
MYNICK, verb, query_ip_name(), \
query["answer"], query["parameters"], headers["cookie"])
// maybe this all belongs into archetype.gen.. chesmo!
htget(prot, query, headers, qs, data, noprocess) {
if (stringp(headers["cookie"]) && regmatch(headers["cookie"],
"challenge=complete&answer="+ md5(CHALLENGE_MATCH))) {
CHALOG("completes");
htnotify(query, headers, "_accomplished_web",
"Challenge accomplished in [_nick_place] by [_web_on] coming from [_web_from].");
# ifdef CHALLENGE_REDIRECT
@ -638,6 +643,7 @@ htget(prot, query, headers, qs, data, noprocess) {
string nu = stringp(query["parameters"]) &&
strlen(query["parameters"]) ?
item +"?"+ query["parameters"] : item;
CHALOG("reloads");
htredirect(prot, nu, "Reload, please", 0, "Set-Cookie: psycplace=\"challenge=complete&answer="+ md5(CHALLENGE_MATCH) +"\"; path="+ item +";\n");
return 1;
}
@ -646,6 +652,7 @@ htget(prot, query, headers, qs, data, noprocess) {
// url that allows other people to bypass the challenge.
// could add a timeout here...
htok3(prot, 0, "Set-Cookie: psycplace=\"challenge=given\"; path="+ item +";\n");
CHALOG("challenges");
w("_PAGES_group_challenge", 0,
([ "_challenge" : htquote(CHALLENGE_QUESTION),
// if the user failed the challenge,
@ -655,6 +662,7 @@ htget(prot, query, headers, qs, data, noprocess) {
// printf("%O vs %O\n", query, headers);
htnotify(query, headers, "_challenged_web",
"[_nick_place] challenges [_web_on] coming from [_web_from].");
// (query [_web_query], cookie [_web_cookie]).");
return 1;
}
#endif