Commit Graph

393 Commits

Author SHA1 Message Date
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
Omar Polo 4d7043e33c add check for program_invocation_short_name 2021-02-11 09:12:40 +00:00
Omar Polo 1606927ea1 add -levent in the example 2021-02-11 09:12:10 +00:00
Omar Polo 8e56d6adc4 use fatal instead of err/fprintf+exit
fatal logs to the correct place, err only on stderr.
2021-02-11 09:07:28 +00:00
Omar Polo 2a911637be fix compilation on OSes without sandbox 2021-02-11 09:04:47 +00:00
Omar Polo 0b040b9909 fix setproctitle detection on FreeBSD 2021-02-10 22:17:20 +00:00
Omar Polo 4ad0601d18 link to compat/ even in regress
this unlocks the full regress tests on arch, for instance, or every
OS where we don't have strl*
2021-02-10 22:06:16 +00:00
Omar Polo 6827d2781e [seccomp] allow newfstatat and gettimeofday
these are required to run on arch linux (at least)
2021-02-10 19:20:59 +00:00
Omar Polo 4c857c0afc [seccomp] epoll_wait(2) isn't available on every arch 2021-02-10 18:02:08 +00:00
Omar Polo aa37287565 add newline after usage 2021-02-10 17:58:43 +00:00
Omar Polo 49b73ba1ab fix "first location" bug
reported by devel at datenbrei dot de.  The first location would
overwrite the default value for a server, triggering the "`foo' rule
specified more than once" error.  This also needed a small tweak on
how we match locations to avoid breaking other tests.
2021-02-10 16:37:08 +00:00
Omar Polo 2898780aea fix ca generation 2021-02-10 15:09:08 +00:00
Omar Polo 4283d65fc1 don't allocate BIGNUM on the stack
on fedora 33 the BIGNUM type is opaque.  Allocate always to avoid headaches.
2021-02-10 14:25:39 +00:00
Omar Polo f6b9a079e3 allow epoll_wait
fedora 33 issue an epoll_wait instead of pwait.
2021-02-10 14:21:56 +00:00
Omar Polo 2d34f732f1 typo 2021-02-10 13:13:17 +00:00
Omar Polo 002a84a123 improve errors during config parsing 2021-02-10 11:53:05 +00:00
Omar Polo d3f073c9ed don't delete valid.ext 2021-02-09 22:40:04 +00:00
Omar Polo eb59f87e67 sort 2021-02-09 22:38:10 +00:00
Omar Polo 02be96c6dd add `require client ca' rule to require certs signed by a CA 2021-02-09 22:30:04 +00:00
Omar Polo 2ff026b09b add conf for a ca 2021-02-09 22:12:19 +00:00
Omar Polo 31b3662c54 gg: add support for client certs 2021-02-09 15:01:12 +00:00
Omar Polo 57ec3e776e refactor apply_block_return
move the strip and fmt logic to their own function
2021-02-08 20:50:30 +00:00
Omar Polo 747b35d0da align 2021-02-08 18:54:34 +00:00
Omar Polo b9231167fb mention libevent 2021-02-08 18:47:36 +00:00
Omar Polo c214d1ab67 allow sigreturn and sigaction on linux 2021-02-08 18:39:23 +00:00
Omar Polo df58efff26 fix seccomp for the new event loop
add/remove syscalls from the BPF filter and move sandbox() after
libevent initialisation
2021-02-08 12:46:46 +00:00
Omar Polo d090dc8491 define config_path as global variable 2021-02-08 12:44:34 +00:00
Omar Polo 319b7fa909 define conf in the test program, not in puny.c 2021-02-08 12:43:36 +00:00
Omar Polo 1516fd4dad fix detection on non-openbsd systems 2021-02-08 10:28:56 +00:00