diff -r 198ad9d8cec1 -r 70010b94bda5 src/server/safs/pathcheck.c --- a/src/server/safs/pathcheck.c Tue Dec 27 11:16:39 2016 +0100 +++ b/src/server/safs/pathcheck.c Tue Dec 27 13:12:32 2016 +0100 @@ -108,3 +108,52 @@ return REQ_PROCEED; } + +int find_index(pblock *pb, Session *sn, Request *rq) { + char *inames = pblock_findval("index-names", pb); + if(!inames) { + log_ereport( + LOG_MISCONFIG, + "find-index: index-names parameter missing"); + return REQ_ABORTED; + } + + ssize_t ni = 0; + sstr_t *names = sstrsplit(sstr(inames), S(","), &ni); + if(ni <= 0) { + log_ereport( + LOG_MISCONFIG, + "find-index: no files specified in index-names parameter"); + return REQ_ABORTED; + } + + int ret = REQ_NOACTION; + + char *path = pblock_findkeyval(pb_key_path, rq->vars); + size_t pathlen = strlen(path); + sstr_t p = sstrn(path, pathlen); + if(path[pathlen-1] == '/') { + for(int i=0;ivars); + free(newpath.ptr); + ret = REQ_PROCEED; + } else { + free(newpath.ptr); + } + } + } + + for(int i=0;i