Commit graph

31 commits

Author SHA1 Message Date
prx
f9dc956824 errcheck strlcat 2020-12-13 11:11:36 +01:00
prx
8aa3acd2d4 add errors checks on strlcpy, fgets, use faster memmove to don't need buffer 2020-12-13 11:11:25 +01:00
prx
e3448992bc use macro 2020-12-13 11:09:22 +01:00
prx
e3cb05af6d init all 2020-12-13 11:08:26 +01:00
prx
7381464bf7 initialize option 2020-12-13 11:08:23 +01:00
prx
44a767f577 initialize pos 2020-12-13 11:08:21 +01:00
prx
395eeeccea path is supposed to be const. format unveil in a fuction 2020-12-09 21:31:35 +01:00
prx
4e82f1e44c remove unused extension and fix warnings 2020-12-09 21:29:15 +01:00
Florian Obser
fa328268e2 No need to copy path to a local buffer, use it directly.
Since path is a pointer to a constant string we can make it
point to a different constant string ("/").
2020-12-06 13:18:58 +01:00
Florian Obser
5a238e8666 Use BUFSIZ for the amount of data to copy through stdio.
According to the book of armaments(posix):
BUFSIZ
    Size of <stdio.h> buffers. This shall expand to a positive value.

There is also no need for the buflen variable since the size never
changes during runtime and the compiler can infer the size via
sizeof().
2020-12-06 13:18:58 +01:00
Florian Obser
bfd1f66350 Return a constant string from the mimes database.
We are not modifying it so there is no need to copy memory around.
This also prevents file_mime getting out of sync as had already
happend. It had a size of 50 while the mime types database type used
to have a size of 70.
2020-12-05 18:05:17 +01:00
Solene Rapenne
16657e070c Fix file path after chroot() 2020-12-05 17:51:15 +01:00
Florian Obser
f28f906b6a stat(2) can fail, rearange error handling to handle this 2020-12-05 09:39:12 +01:00
Florian Obser
75cf996cec safely drop privs 2020-12-05 09:39:12 +01:00
Florian Obser
8d69d84784 errno is not set here 2020-12-05 09:39:12 +01:00
Florian Obser
27bc29da7a sys/ includes go at the front 2020-12-05 09:39:12 +01:00
Florian Obser
3d18122b7e main does not need a prototype 2020-12-05 09:39:12 +01:00
Florian Obser
5b3dc1dd02 Do not include c sources 2020-12-05 09:39:12 +01:00
Solene Rapenne
345215fa9b Code refactoring: get_file_mime got into mime.c and all security code moved into a procedure 2020-12-04 19:08:36 +01:00
Solene Rapenne
e9c3945ede Add syslog messages 2020-12-04 18:55:31 +01:00
Solene Rapenne
a05fdee016 Remove database iterator, no longer useful after the MIME database change. Proposed by oa. 2020-12-03 23:03:08 +01:00
Solene Rapenne
b3bb3b2f91 Add chroot() feature 2020-12-03 22:59:39 +01:00
Solene Rapenne
2cf92e196c Move the license from the code to dedicated LICENSE file 2020-12-03 21:22:22 +01:00
Solene Rapenne
cbcf526d76 Make the MIME database as a global variable, it's a lot more cleaner. (thanks to oa for recommendation) 2020-12-03 21:06:17 +01:00
Solene Rapenne
1e0bb0368c Add MIME support + according tests 2020-12-02 19:59:52 +01:00
Solene Rapenne
dd201d73d9 Add a flag to change the default language in the return status code 2020-12-02 18:07:10 +01:00
Solene Rapenne
615079e26c Add virtualhost features with a flag + according tests 2020-12-02 15:31:21 +01:00
Solene Rapenne
24aa4ba284 run OpenBSDindent(1) to fix coding style 2020-12-02 13:32:39 +01:00
Solene Rapenne
25977754ac Fix the License name, it's BSD2 and not MIT 2020-12-02 13:29:21 +01:00
Solene Rapenne
ddb799c866 Add ifdef OpenBSD for pledge/unveil, so it should compile on other OSes 2020-12-01 23:41:55 +01:00
Solene Rapenne
c2d813c0f1 Init vger 2020-12-01 23:39:05 +01:00