1
0
mirror of https://git.sr.ht/~sircmpwn/gmnisrv synced 2024-11-03 06:07:17 -05:00

check if file served as cgi is executable

if not, send a response 50 to the client
fixes ~sircmpwn/gmni#47
This commit is contained in:
René Wagner 2020-11-05 14:42:45 +01:00 committed by Drew DeVault
parent c145ac6a65
commit 02a386b568

View File

@ -457,6 +457,12 @@ serve_request(struct gmnisrv_client *client)
assert(s != -1);
strcpy(real_path, temp_path);
} else if (S_ISREG(st.st_mode)) {
if (route->cgi && access(real_path, X_OK)) {
client_submit_response(client,
GEMINI_STATUS_PERMANENT_FAILURE, "Internal Server Error", NULL);
return;
}
break;
} else {
// Don't serve special files