#include "base/pblock.h" /* pblock_findval */ #include "frame/http.h" /* PROTOCOL_NOT_FOUND */ /* PW-no-wpleak.so Usage: At the beginning of obj.conf: Init fn=load-modules shlib=PW_no_wpleak.so funcs="PW-no-wpleak" Inside an object in obj.conf (preferably at the top of the default object): PathCheck fn=PW-no-wpleak The PathCheck gives a 404 for any request containing known WebPublisher tags. (i.e. with a QUERY_STRING beginning with a known tag) */ NSAPI_PUBLIC int PW_no_wpleak(pblock *pb, Session *sn, Request *rq) { /* working variables */ char *requestQuery = pblock_findval("query", rq->reqpb); char *webPubTags[] = { "wp-cs-dump", "wp-ver-info", "wp-html-rend", "wp-usr-prop", "wp-ver-diff", "wp-verify-link", "wp-start-ver", "wp-stop-ver", "wp-uncheckout", NULL }; int i = 0; /* bail out if we've got nothing to work with */ if (!requestQuery) return REQ_NOACTION; /* check the query string against known tags */ while ( webPubTags[i] != NULL ) { if (strstr(requestQuery,webPubTags[i++]) == requestQuery ) { /* found a match, throw a 404 error */ protocol_status(sn, rq, PROTOCOL_NOT_FOUND, NULL); return REQ_ABORTED; } } /* looks OK */ return REQ_NOACTION; }