Commit Graph

421 Commits

Author SHA1 Message Date
Omar Polo c836cdfadb handle CGI scripts that replies with the maximum header length allowed
the 1024 bytes limits is for the META only, not for the whole
response.  That means that the maximum size for the header line is
1029!
2021-03-29 09:42:06 +00:00
omar-polo 071dce449d
Add missing libevent-dev dependency
Merge pull request #2 from kornellapacz/master, thanks!
2021-03-29 11:01:38 +02:00
Korneliusz Łapacz c928dcc7ba add missing libevent-dev dependency 2021-03-29 05:35:32 +02:00
Omar Polo c8249bada3 gmid v1.6 -- "Stargazers" 2021-03-20 12:04:23 +00:00
Omar Polo b890467e60 typo 2021-03-20 11:46:12 +00:00
Omar Polo 94be0bf03b update README 2021-03-20 11:08:17 +00:00
Omar Polo 8e09ee1d50 typo 2021-03-20 10:48:11 +00:00
Omar Polo b9c9123b8e fix signal handling so it works on linux too
it seems that linux calls the signal handlers even when we're waiting
on sigwait for that signal.  Work around that.
2021-03-20 10:43:23 +00:00
Omar Polo e3d81f49cc [seccomp] allow prlimit64
it's needed by getdtablesize, at least on glibc
2021-03-20 09:24:44 +00:00
Omar Polo d632468df5 fix correct shutdown after SIG{INT,TERM} 2021-03-20 09:23:53 +00:00
Omar Polo 7e3aaf3752 sync changelog 2021-03-20 08:54:03 +00:00
Omar Polo 052c9d2403 kill only $pid during regress testing
before we did `pkill gmid', but that would influence also other
instances of gmid!
2021-03-20 08:51:58 +00:00
Omar Polo 1d3eb470b0 quit every process cleanly when receiving SIGINT or SIGTERM 2021-03-20 08:51:17 +00:00
Omar Polo 62e001b067 move all sandbox-related code to sandbox.c
while there, add capsicum for the logger process
2021-03-20 08:42:08 +00:00
Omar Polo ad5301d1a0 sync ChangeLog 2021-03-20 07:46:47 +00:00
Omar Polo bc99d868bc refactoring: imsg everywhere
use imsg to handle ALL kinds of IPC in gmid.  This simplifies and shorten the
code, and  makes everything more uniform too.
2021-03-19 19:21:29 +00:00
Omar Polo 1fbac5ba7c handle SIGHUP gracefully
i.e. don't print scary messages with LOG_CRIT priority!
2021-03-03 17:52:13 +00:00
Omar Polo dbe262a45d split usage string into two lines 2021-03-03 17:51:42 +00:00
Omar Polo de62c38d81 fix out-of-bounds access
obviously msg[datalen] is an off-by-one
2021-03-03 17:51:30 +00:00
Omar Polo 2c3e53dac6 give each server process its own socket for the executor
this fixes a bug introduced with the prefork mechanics: every server
process shared the same socket, and this would cause a race condition
when multiple server processes asked for a script cgi being executed.

This gives each server process its own socket to talk to the executor,
so the race cannot happen.
2021-03-03 17:22:01 +00:00
Omar Polo fda7b99fc7 include sys/types.s to fix the build on OpenBSD 2021-02-23 14:07:49 +00:00
Omar Polo 290b5baa97 updated readme 2021-02-23 13:22:29 +00:00
Omar Polo 9899a837af
[seccomp] allow sendmsg 2021-02-23 13:44:20 +01:00
Omar Polo 17458f11e1
sync global variables 2021-02-23 13:44:20 +01:00
Omar Polo 376a540764
move log_init & vars to gmid.c, retain logger_main in log.c
this is to let the regression suite compile
2021-02-23 13:44:20 +01:00
Omar Polo aa627c91fc
checks for compat + don't initialise HAVE_* 2021-02-23 13:44:20 +01:00
Omar Polo 4f8128452c
fix various error in compat/err.c 2021-02-23 13:43:53 +01:00
Omar Polo a3c5f7451a
make sure -o is passed to ${CC} in suffix rule 2021-02-23 13:43:33 +01:00
Omar Polo 6b78d24c31
clean objects in compat dir 2021-02-23 13:43:33 +01:00
Omar Polo 3c56e99ab0
add compat/*.o
got doesn't seem to match (say) compat/freezero.o with *.o
2021-02-23 13:43:33 +01:00
Omar Polo 4604dc9671
move vhost_should_log call to server.c
log.o is linked to some regress/ stuff.  Calling from there a vhost_*
function means that we should link the regress/stuff to server.o too
(and that would pull in other stuff...).  Moving the call is easier,
and also probably better.
2021-02-23 13:43:33 +01:00
Omar Polo 793835cb26
add `log on/off' to enable/disable logs per-location 2021-02-23 13:43:24 +01:00
Omar Polo fd9a486925
don't directly include sys/queue.h 2021-02-23 13:43:23 +01:00
Omar Polo 6b191ed52a
tests and compat for imsg 2021-02-23 13:43:14 +01:00
Omar Polo d278a0c3c5
moving logging to its own process 2021-02-23 13:40:59 +01:00
Omar Polo c39b26d308 mark reschedule_write inline & static 2021-02-12 20:25:48 +00:00
Omar Polo eecad7a3ca other s/fnmatch/matches 2021-02-12 19:51:54 +00:00
Omar Polo dfa6d77b70 typo 2021-02-12 12:55:29 +00:00
Omar Polo 5b6dc93c8a kill debug printf 2021-02-12 12:51:47 +00:00
Omar Polo 7689871446 include config.h first 2021-02-12 12:49:36 +00:00
Omar Polo 52418c8d82 fix various compilation errors
Include gmid.h as first header in every file, as it then includes
config.h (that defines _GNU_SOURCE for instance).

Fix also a warning about unsigned vs signed const char pointers in
openssl.
2021-02-12 12:47:20 +00:00
Omar Polo 3cb3dd4d42 accept4 -> accept
accept4(2) isn't part of any standard (even though it'll be part in
the future) and raises warnings on some linux distro.  Moreover, we
don't have thread that may fork at any time, so doing a mark_nonblock
after isn't a big deal.
2021-02-12 11:59:03 +00:00
Omar Polo 9356f61a63 BUFSIZ is variable, we need *exactly* 1024
Using BUFSIZ in sbuf is not OK.  It's variable, and in various places
we assume that sbuf is 1024 (like handle_cgi_reply).  We could patch
those, but we aren't sure BUFSIZ is >= 1024!  Let's keep the hardcoded
number.

(found by debugging on arch on amd64, where BUFSIZ is bigger)
2021-02-12 11:56:13 +00:00
Omar Polo 5e3285d52e typo 2021-02-12 11:34:17 +00:00
Omar Polo 98ee8406aa fix occurrence of (killed) load_file 2021-02-12 11:32:49 +00:00
Omar Polo a4188b7865 echo parsing test result 2021-02-12 11:27:52 +00:00
Omar Polo 27b2fa9ae5 don't mmap
Before we mmap(2) file for reading, and use a buffer to handle CGI
scripts.  Turns out, for sequential access over the whole mmap isn't
better than our loop on read.  This has also the additional advantage
that we can use handle_cgi (now handle_copy) for both files and CGI,
which is pretty cool.

This also fixes a nasty bug where we could hang a connection forever,
because we scheduled the wrong type of event (read on POLLOUT and
write on POLLIN, it's the other way around!)
2021-02-12 11:27:33 +00:00
Omar Polo a6e689d745 fix config reload
the old server processes would stick around waiting on the signals
events.  While there, also drop the `struct server_events' and define
events as globals.
2021-02-12 08:50:25 +00:00
Omar Polo e1b4612359 dup line 2021-02-12 08:49:31 +00:00
Omar Polo a72cc6be31 improve compat/getprogname on GNU libc
but why'd they called it program_invocation_short_name?  They couldn't
find a longer name?
2021-02-11 09:13:58 +00:00