Commit Graph

856 Commits

Author SHA1 Message Date
Jordan Bancino 582df63a31 Format source code. 2023-04-16 17:51:52 +00:00
Jordan Bancino 4ee66ae3c7 Begin implementing user privileges. 2023-04-16 17:51:03 +00:00
Jordan Bancino 768ecda41a Break up todo items into more milestones. 2023-04-15 13:31:08 +00:00
Jordan Bancino 6ca1265076 Begin working on User-Interactive authentication fallback. 2023-04-15 02:36:28 +00:00
Jordan Bancino e882693c78 Add route for requestToken endpoints. 2023-04-14 23:59:40 +00:00
Jordan Bancino b21d018daa Move router building function into a more sensible location. 2023-04-14 21:37:00 +00:00
Jordan Bancino 83971dfaff Refactor routing system to use HttpRouter. 2023-04-14 21:20:56 +00:00
Jordan Bancino a90f7c4b9e Apply #69 2023-04-14 17:50:14 +00:00
Jordan Bancino 3192063340 Fix broken tt script. 2023-04-07 14:20:22 +00:00
Jordan Bancino 1f8df737da Add HttpRouter API; still have to convert the code to use it. 2023-04-06 01:48:32 +00:00
Jordan Bancino 7c865d06fd Format code. 2023-04-01 02:46:59 +00:00
Jordan Bancino e0c8530b12 Clean up http client enough to replace curl in send-patch. 2023-04-01 02:46:07 +00:00
Jordan Bancino e592840c99 Clean up some HTTP client stuff. 2023-04-01 02:13:41 +00:00
Jordan Bancino 7b3d537175 Remove UtilStreamCopy() 2023-04-01 00:20:18 +00:00
Jordan Bancino f341fd2b6e Fix OpenSSL server accept call.
Apparently it can EAGAIN on non-blocking connections... I don't think
LibreSSL's TLS library does this, but something to keep in mind if it
doesn't work for somebody.
2023-03-31 23:10:52 +00:00
Jordan Bancino eef615fc9a Fix warnings in RouteChangePwd.c 2023-03-28 02:28:58 +00:00
Jordan Bancino 9b21e2460a Accept #67: Add the password modification endpoint. 2023-03-28 01:17:47 +00:00
Jordan Bancino c6f4a4a546 Fix leak of StreamStdout() when logging to a file. 2023-03-27 17:56:45 +00:00
Jordan Bancino a9da9fbca7 Update TODO 2023-03-27 17:52:20 +00:00
Jordan Bancino c37d3801b2 Fix warning about uninitialized variable. 2023-03-25 00:00:53 +00:00
Jordan Bancino a24c27bf4f Fix leak in TlsOpenSSL. 2023-03-24 17:37:44 +00:00
Jordan Bancino af776c64a7 Remove duplicate return line. 2023-03-24 14:18:29 +00:00
Jordan Bancino a25573063f Fix up TlsOpenSSL a little bit.
Server is still broken...
2023-03-24 03:05:12 +00:00
Jordan Bancino aeb49f80e5 Add support for OpenSSL. This is a good demo of how easy it is to support TLS libraries. 2023-03-24 02:41:01 +00:00
Jordan Bancino 007e639b0c Don't require the TLS_ in the environment variable.
It's redundant.
2023-03-24 00:25:44 +00:00
Jordan Bancino fe32c652cd Fix bug in HttpClient where it wouldn't retry on EAGAIN. 2023-03-24 00:23:49 +00:00
Jordan Bancino 20d41d794b Fix compile error. I had this in here at some point, not sure where it went. 2023-03-23 17:41:02 +00:00
Jordan Bancino b4e4263cea Remove my testing configuration from contrib/development.conf 2023-03-23 16:40:23 +00:00
Jordan Bancino e13442c122 Fix strange behavior in TlsLibreSSL.
tls_read() and tls_write() may return TLS_WANT_POLLIN or TLS_WANT_POLLOUT
if data isn't ready to be read or written yet. We have to account for this
by converting it to EAGAIN, which is how a typical read() or write()
function should behave.

Also installed a SIGPIPE handler; we do not want to be terminated by
SIGPIPE, and it's safe to ignore this signal because it should be
handled thoroughly in the code.
2023-03-23 16:39:15 +00:00
Jordan Bancino 2441f07848 Add support for spinning up multiple HTTP servers.
This is useful for having a TLS and a non-TLS version port, like Synapse.
I verified that the multiple-servers does in fact work as intended,
although the TLS server part is broken; I must be doing something
incorrectly with LibreSSL in setting up the server.
2023-03-23 02:12:45 +00:00
Jordan Bancino 2fab7b55fe Remove obsolete warning about setting root directory.
We don't use chroot() anymore.
2023-03-22 18:30:30 +00:00
Jordan Bancino 089d8d4d94 Only install the memory hook if -v is given.
This way, we can still set the debug level in the configuration, and not
see the log just absolutely flooded with memory allocations and whatnot.
This is helpful because I want debug messages to show up in development,
but not in production, but having all the memory logging makes it
almost impossible to pick anything else out of the log. I want the
feature available, just not on by default because it's useful in limited
circumstances.
2023-03-22 18:29:05 +00:00
Jordan Bancino 9ec330f40a Log once we get the response status, not right when we get the request. 2023-03-22 18:13:59 +00:00
Jordan Bancino fccd15b239 Don't unconditionally close standard input; it may have been used and
closed before. If it was never used, it was never opened.
2023-03-22 18:12:46 +00:00
Jordan Bancino 35f65a667d Update changelog. 2023-03-22 17:49:06 +00:00
Jordan Bancino 8faf6f2126 Delete TelodendriaConfig.c 2023-03-22 17:20:53 +00:00
Jordan Bancino fc975e6a93 TelodendriaConfig -> Config 2023-03-22 17:17:30 +00:00
Jordan Bancino 413c7ad803 Start building support for running multiple HTTP servers.
The standard use case for this is going to be running a TLS and a non-TLS
HTTP server. I can't see a need for *more* than two, but it is theoretically
possible.

We shouldn't have to change anything with the database or anything; it
should suffice to simply spin up more HTTP servers, and they should
interact with each other the same way a single HTTP server with multiple
threads will.
2023-03-22 17:00:48 +00:00
Jordan Bancino e30fa3ee33 Remove remnants of non-global LogConfig from TelodendriaConfig 2023-03-22 16:31:24 +00:00
Jordan Bancino e6f3dfad18 Add an ArraySet() method for replacing entries in an array.
This is much more efficient than using ArrayDelete() and ArrayInsert(),
and will serve us well in the future.
2023-03-22 16:31:06 +00:00
Jordan Bancino b8d00bc8bf Make td run warn if Memory.txt gets created. 2023-03-22 14:57:57 +00:00
Jordan Bancino f3c4c0ac65 Add a global log configuration.
This is the easiest and cleanest way to get logging into some of the
fundamental APIs, such as the database and TLS APIs. We don't want to
have to pass logging functions to those, but they can safely use the
global logging configuration.
2023-03-22 14:52:04 +00:00
Jordan Bancino 8782aa046d Fix compile error in Tls, work on getting certs and keys into HttpServer. 2023-03-22 02:18:31 +00:00
Jordan Bancino bdaea9872e Format source code. 2023-03-22 01:46:45 +00:00
Jordan Bancino b58ca7d22e Start working on adding TLS support to HttpServer. 2023-03-22 01:46:24 +00:00
Jordan Bancino 6561b5bae1 Add TLS build support to td. 2023-03-22 01:17:42 +00:00
Jordan Bancino 996356832e Define TLS API, update HttpClient to support optional TLS.
Also added a LibreSSL TLS implementation. Client is verified to work;
server has not been tested yet.
2023-03-22 00:41:21 +00:00
Jordan Bancino d1b4ecff48 Apparently the order of LDFLAGS matters to some compilers.
Also don't to -pg in debug mode, because that's not supported on all
compilers either.
2023-03-22 00:13:27 +00:00
Jordan Bancino 63d07365db Don't close standard output twice, that leads to a segfault! 2023-03-22 00:12:04 +00:00
Jordan Bancino 2a92d0de7e Fix bit flag check. 2023-03-22 00:11:24 +00:00