Compare commits


503 Commits

Author SHA1 Message Date
lda 2c6d5194d2 Set an error message with MatrixErrorCreate whenever applicable (#45)
Closes #6.

Co-authored-by: Jordan Bancino <>
Reviewed-on: #45
Co-authored-by: lda <>
Co-committed-by: lda <>
2023-12-02 10:24:08 -05:00
Jordan Bancino 0a91a0c40b Remove site files & update README with current site.
The website is now managed in Grav.
2023-11-21 09:16:50 -05:00
Jordan Bancino d3dcf334f0 Update change log. 2023-11-21 09:14:03 -05:00
lda 3dae19e82d Refactor code to comply with #8 (#39)
Reviewed-on: #39
Co-authored-by: lda <>
Co-committed-by: lda <>
2023-11-21 09:11:45 -05:00
Jordan Bancino 2d30719be4 Implement Registration Token Administrator API (#43)
This pull request fully implements and documents all of the registration token administrator API endpoints.

**NOTE:** There is a memory leak when listing all of the registration tokens. Debug this before merging.
~~Closes~~ Supersedes #37.

Closes #26.

This pull request is based off of #37, which addresses #26. This pull makes a number of improvements to the logic, organization, and behavior of the API endpoints.

Co-authored-by: hatkid <>
Co-authored-by: LoaD Accumulator <>
Co-authored-by: LoaD Accumulator <>
Co-authored-by: lda <>
Co-authored-by: Load Accumulator <>
Reviewed-on: #43
2023-11-10 09:30:53 -05:00
Jordan Bancino 503bfb6104 Suppress warnings of unused variables.
I will use them eventually when I implement all these functions.

I'm probably going to start CI work here soon, so I don't want warnings showing up in the logs unless they're important.
2023-11-08 15:17:27 -05:00
Jordan Bancino 77800e4117 Housekeeping tasks with documentation and versioning. 2023-11-08 14:30:45 -05:00
Jordan Bancino db4ae0408c Fix admin endpoint names in documentation 2023-11-08 11:21:20 -05:00
Jordan Bancino edee1288d8 Remove unused global variables. 2023-11-08 09:45:49 -05:00
Jordan Bancino 4b90800a2b Fix leak in RouteConfig, update documentation.
Closes #15.
2023-11-07 01:26:26 -05:00
Jordan Bancino 6e7f170768 Start working on #15. 2023-11-06 20:42:39 -05:00
Jordan Bancino 1f02f3c2a2 Allow customization of compiler in configure. 2023-11-04 15:56:57 -04:00
Jordan Bancino 582c79b608 Schema are now generated out-of-tree.
Closes #40.
2023-11-04 15:28:20 -04:00
Jordan Bancino 42a901b7f5 Update docs/dev/ 2023-11-01 20:35:48 -04:00
Jordan Bancino 1fee47a628 Use `Makefile`s instead of a custom script (#38)
This pull request also requires the use of the external [Cytoplasm](/Telodendria/Cytoplasm) repository by removing the in-tree copy of Cytoplasm. The increased modularity requires a little more complex build process, but is overall better. Closes #19

The appropriate documentation has been updated. Closes #18


Please review the developer certificate of origin:

1. The contribution was created in whole or in part by me, and I have
the right to submit it under the open source licenses of the
Telodendria project; or
1. The contribution is based upon a previous work that, to the best of
my knowledge, is covered under an appropriate open source license and
I have the right under that license to submit that work with
modifications, whether created in whole or in part by me, under the
Telodendria project license; or
1. The contribution was provided directly to me by some other person
who certified (1), (2), or (3), and I have not modified it.
1. I understand and agree that this project and the contribution are
made public and that a record of the contribution&mdash;including all
personal information I submit with it&mdash;is maintained indefinitely
and may be redistributed consistent with this project or the open
source licenses involved.

- [x] I have read the Telodendria Project development certificate of
origin, and I certify that I have permission to submit this patch
under the conditions specified in it.

Reviewed-on: #38
2023-11-01 12:27:45 -04:00
Jordan Bancino 6377689a83 Update docs/ 2023-11-01 12:16:03 -04:00
Jordan Bancino 23237f97b5 Format source code and apply license. 2023-09-28 19:16:45 -04:00
Jordan Bancino 82ae2d4e41 Update 'docs/' 2023-09-25 16:18:35 -04:00
Jordan Bancino 7d3d84d969 Move Admin routes to /_telodendria/admin/v1 (with version number)
Closes #16.
2023-09-25 16:10:44 -04:00
Jordan Bancino bf1ce839d0 If HOST_NAME_MAX is undefined, use _POSIX_HOST_NAME_MAX.
Probably good enough. Closes #2
2023-09-25 16:02:09 -04:00
Jordan Bancino f8d3e54fec Use int instead of char in EvalExpr.
Closes #5
2023-09-25 15:58:43 -04:00
lda cb41716bf3 Implement #27 (#36)
Implements #27.

Co-authored-by: LoaD Accumulator <>
Co-authored-by: Jordan Bancino <>
Reviewed-on: Telodendria/telodendria#36
Co-authored-by: LoaD Accumulator <>
Co-committed-by: LoaD Accumulator <>
2023-09-25 09:39:21 -04:00
Jordan Bancino 6247085df1 Add change log entry for #35. 2023-09-11 11:01:50 -04:00
lda 0172fa083b Fixes issue #33 related to a memory issue, and format some code. (#35)
Fixes #33.

Co-authored-by: LoaD Accumulator <>
Reviewed-on: Telodendria/telodendria#35
Co-authored-by: LoaD Accumulator <>
Co-committed-by: LoaD Accumulator <>
2023-09-11 10:57:16 -04:00
Jordan Bancino 0b820b80f7 Convert configuration documentation. 2023-09-09 17:43:43 -04:00
Jordan Bancino 6dcfa7dc02 Remove `send-patch` and `tp`. See #20. 2023-09-09 16:58:47 -04:00
Jordan Bancino 024482d4e8 Put the finishing touches on ``. 2023-09-09 16:57:52 -04:00
Jordan Bancino 7a091c5b93 Add contributing documentation. 2023-09-09 16:50:38 -04:00
Jordan Bancino 9e8523d92e Fix issue config. 2023-09-09 15:39:12 -04:00
Jordan Bancino 419017bcc9 Don't allow blank issues. 2023-09-09 15:36:58 -04:00
Jordan Bancino 1a009e87c3 Fix a few small bugs in Gitea templates. 2023-09-09 15:32:43 -04:00
Jordan Bancino 08594e0fb1 Add Gitea issue templates. 2023-09-09 15:28:33 -04:00
Jordan Bancino 56508afe4c Merge branch 'master' of 2023-09-09 00:12:07 -04:00
Jordan Bancino ac3582ddeb Fix table rendering in 2023-09-09 00:12:00 -04:00
Jordan Bancino 61f7ab1040 Fix table rendering in 2023-09-09 00:11:32 -04:00
Jordan Bancino a672c05112 Finish moving over current Administrator API documentation. 2023-09-09 00:03:09 -04:00
Jordan Bancino 09023089f5 Another typo. 2023-09-08 23:27:55 -04:00
Jordan Bancino 6d6fd1645c Fix typo in 2023-09-08 23:27:14 -04:00
Jordan Bancino 043c2e9e33 Add privileges documentation. 2023-09-08 23:26:47 -04:00
Jordan Bancino 9e2f047e82 Fix typo in docs/user/admin/ 2023-09-08 17:23:06 -04:00
Jordan Bancino c78d075a93 Add admin documentation home page. 2023-09-08 17:22:24 -04:00
Jordan Bancino e4a217550f Add logo and center title. 2023-09-08 16:40:33 -04:00
Jordan Bancino d50372a91a Add technical rationale document. 2023-09-08 16:34:27 -04:00
Jordan Bancino fa3b5e95bd Add a nice README which will serve as the basis for the website. 2023-09-08 16:04:48 -04:00
Jordan Bancino 7033a1f0b1 Add repository structure documentation. 2023-09-08 12:12:07 -04:00
Jordan Bancino f6c54cbc7f Add setup documentation. 2023-09-08 11:58:54 -04:00
Jordan Bancino 3cb04417ff Add porting instructions. 2023-09-07 21:53:22 -04:00
Jordan Bancino 93e6582db5 Add usage and install documentation. 2023-09-07 21:10:46 -04:00
Jordan Bancino ee62d31c68 Add documentation home page. 2023-09-07 20:23:40 -04:00
Jordan Bancino 4bd527aa9a Remove old change log. 2023-09-07 20:06:12 -04:00
Jordan Bancino 79ce36c860 Add `` 2023-09-07 19:53:56 -04:00
Jordan Bancino be3ee54bd8 Merge pull request 'added git ignore and removed cvs ignore files' (#29) from array-in-a-matrix/telodendria:master into master
Reviewed-on: Telodendria/telodendria#29
2023-09-06 14:37:29 -04:00
array-in-a-matrix 5367ffca96 replaced .cvsignore with .gitignore 2023-09-06 11:45:44 -04:00
Jordan Bancino c5b2fcf586 Convert Cytoplasm README to markdown. 2023-09-05 22:10:33 -04:00
Jordan Bancino 2b43a93524 Break proposals/admin.7 into multiple issues.
Closes #17
2023-09-05 21:54:26 -04:00
Jordan Bancino fd28f97449 Finish remaining issues in TODO.txt and add docs/ 2023-09-05 21:30:09 -04:00
Jordan Bancino 745a208f14 Move over some more issues. 2023-09-05 19:31:46 -04:00
Jordan Bancino 8843b34ba6 Merge branch 'master' of 2023-09-05 17:11:13 -04:00
Jordan Bancino b059f966f1 Make progress toward migrating TODO.txt to issues.
Still have a ways to go, but wanted to save my progress.
2023-09-05 17:09:58 -04:00
Jordan Bancino 8bf8afd91d Merge pull request '[MOD] Make the README(Markdown) file reflect the current situation.' (#11) from lda/telodendria:lda-dev into master
Reviewed-on: Telodendria/telodendria#11
2023-09-05 16:34:04 -04:00
lda 6db3f3c612
[MOD] Make the README(Markdown) file reflect the current situation.
Signed-off-by: LoaD Accumulator <>
2023-09-05 22:25:39 +02:00
Jordan Bancino fd1172ff56 Summarize Matrix room activity in TODO.txt
I really want to get back to work on Telodendria. I need to find some
more time for it.
2023-09-04 13:35:28 +00:00
Jordan Bancino 468656eee6 Apply #72 2023-09-04 13:30:22 +00:00
Jordan Bancino b625655439 Fix memory leak in some generated code. 2023-08-17 18:09:53 +00:00
Jordan Bancino dab666c969 Update documentation on UtilServerTs(). 2023-08-17 18:09:20 +00:00
Jordan Bancino 36413b4dca Ignore special case in Int64Str. This is hack but good enough for now. 2023-08-13 12:33:18 +00:00
Jordan Bancino 1c32e18c74 Json now uses Int64 for integers.
This should fix all timestamp errors on 32-bit systems in Cytoplasm and
2023-08-13 03:11:40 +00:00
Jordan Bancino 2382638005 Make all timestamps use UInt64. 2023-08-12 23:02:06 +00:00
Jordan Bancino 38a303da91 Allow forcing the emulation mode for testing purposes. 2023-08-12 21:51:51 +00:00
Jordan Bancino 2f76d5b9ae Add signed 64-bit integer support. 2023-08-12 19:59:16 +00:00
Jordan Bancino 93c4b6bfc4 Add 64-bit emulation for platforms that don't have a native 64-bit type. 2023-08-12 16:30:24 +00:00
Jordan Bancino d565640455 Add schema for PDUs v1 and v3, the only unique PDU formats.
All other room versions use one of these two PDU formats.
2023-08-10 00:08:33 +00:00
Jordan Bancino bc71a7ec01 Add admin privilege to manage room aliases. 2023-08-09 15:50:03 +00:00
Jordan Bancino 69d28f39d1 Begin working on room aliases.
These endpoints will help me build out some functionality that will be
needed when actually implementing rooms.
2023-08-09 15:19:45 +00:00
Jordan Bancino e0af88145e Add RouteCreateRoom stub. 2023-08-08 15:11:50 +00:00
Jordan Bancino 6ef965d1e0 Apply patch to make MatrixErrorCreate() take a custom message. 2023-08-05 19:26:03 +00:00
Jordan Bancino 28d9e1cb3b Add RoomCreateRequest schema. 2023-08-05 15:00:52 +00:00
Jordan Bancino 78302d6320 Print admin registration token to configured log, not default stdout.
If Telodendria is started as a daemon and is logging to the syslog, we
want the token to show up in the syslog.
2023-08-05 14:12:02 +00:00
Jordan Bancino 6ec87b8d76 Properly exclude Schema directories from showing up in CVS. 2023-08-05 14:03:08 +00:00
Jordan Bancino 5f3220372e Implement filter validation by using j2s. 2023-08-05 13:46:23 +00:00
Jordan Bancino 77d71989df Don't install configuration files. 2023-08-04 21:15:49 +00:00
Jordan Bancino e9600a21e9 Add support for arrays of primitives. 2023-08-04 20:47:36 +00:00
Jordan Bancino 942d2aad18 Fix memory leaks and remove logging messages. 2023-08-01 22:36:52 +00:00
Jordan Bancino aeaa8487c3 Add leaky Cytoplasm JSON -> Struct code generator.
It is basically complete, I just have to finish cleaning up some of the
memory leaks and remove the log messages.
2023-08-01 20:23:19 +00:00
Jordan Bancino ed37afe564 Add [time] to interpolate dates and times using strftime(). 2023-07-29 18:27:35 +00:00
Jordan Bancino 2e193d4bcf Format code. 2023-07-29 18:27:17 +00:00
Jordan Bancino d22baf440f Update TODO. 2023-07-29 15:50:45 +00:00
Jordan Bancino c467d0913d Add tp, a simple but powerful text preprocessor.
I might rename it, and I have yet to document it in a man page, but I have
found this extremely useful so I thought I'd give it a home here.
2023-07-29 00:04:42 +00:00
Jordan Bancino 68b644a4f2 Add HashMapKeys() and HashMapValues() functions for convenience. 2023-07-18 00:15:29 +00:00
Jordan Bancino b65394ab50 Add basic Graph API.
This is going to be useful with state resolution and dependency ordering,
both of which will be crutial components of Telodendria.
2023-07-16 01:12:56 +00:00
Jordan Bancino a958c4a529 Apply #71: Add ArrayUnique() function. 2023-07-15 22:27:24 +00:00
Jordan Bancino c96ac30f28 Fix Unicode handling in Json, don't sign-extend bytes in Stream. 2023-07-15 17:57:21 +00:00
Jordan Bancino a4330123b9 Add EventRedact() prototype. 2023-07-09 23:18:18 +00:00
Jordan Bancino b1c23ee53a Begin prototyping state resolution API. 2023-07-07 03:15:13 +00:00
Jordan Bancino bc8283f844 Begin prototyping room API. 2023-07-07 02:56:09 +00:00
Jordan Bancino 5f34b846ee Fix stable release version scheme (more details in an upcoming newsletter) 2023-07-01 20:18:59 +00:00
Jordan Bancino 3054a80906 Fix Unicode handling. 2023-06-21 02:49:58 +00:00
Jordan Bancino 539fde773f Fix CanonicalJson and ArraySort. 2023-06-21 02:37:56 +00:00
Jordan Bancino 1fa07d2d3c Update TODO. 2023-06-18 03:25:03 +00:00
Jordan Bancino 80da024e4e Update change log. 2023-06-18 03:19:12 +00:00
Jordan Bancino e3badbd55c Format source code. 2023-06-18 02:53:52 +00:00
Jordan Bancino 861d4146c0 Add Filter API to validate filters and process events. 2023-06-18 02:53:06 +00:00
Jordan Bancino f9e1250d47 Begin working on filtering. 2023-06-17 19:09:06 +00:00
Jordan Bancino 4e184102cb Add Sha1 implementation. 2023-06-17 17:36:46 +00:00
Jordan Bancino 8bda70b1fb Refactor Sha API to return raw bytes, added Sha1() function. 2023-06-17 17:36:11 +00:00
Jordan Bancino 8f0d197480 Bump version: v0.3.0 -> v0.4.0 2023-06-16 16:01:19 +00:00
Jordan Bancino b9641e89d6 Update TODO 2023-06-13 14:06:05 +00:00
Jordan Bancino 1381a31cbd Update TODO. 2023-06-13 14:05:34 +00:00
Jordan Bancino c3287c1674 Update TODO. 2023-06-12 18:00:26 +00:00
Jordan Bancino 071a86114c Apply #70: Add StrLower() function. 2023-06-12 14:10:59 +00:00
Jordan Bancino 1f14169284 Apply #70: Fix warnings of unused variables. 2023-06-12 14:10:08 +00:00
Jordan Bancino 2f946848cb Telodendria Bot can now send messages again.
The problem here is that some Matrix homeservers reject requests that don't
have a Content-Length. http was not sending a Content-Length because it was
reading from standard input. By reading from an actual file, we can actually
easily get the size of the file to send as the Content-Length.
2023-06-12 14:01:56 +00:00
Jordan Bancino 2b3d0aaeaf Prepare for v0.3.0 release.
Not exactly as complete as I initially imagined, but I want to get something
out because I've been spending too much time on the same issues.
2023-06-10 13:29:56 +00:00
Jordan Bancino af15234799 Make the debug server more accurately mimic the actual server. 2023-06-10 13:16:41 +00:00
Jordan Bancino 971f099bb6 Fix potential race condition. 2023-06-09 19:27:49 +00:00
Jordan Bancino 96a1d3c3c4 Move stream assignment; this makes debugging easier. 2023-06-04 18:50:02 +00:00
Jordan Bancino 095e05e927 Make Memory use a recursive mutex.
This allows some additional operations to be performed inside the memory
hooks, although it's still a bad idea to allocate or free memory while
inside the hook.
2023-06-04 18:44:37 +00:00
Jordan Bancino c511ca9f0f Add a recipe to build the examples. 2023-05-30 13:20:23 +00:00
Jordan Bancino faaa12c51f Re-add memory bounds checking.
Also fixed a recursive lock error in some configurations, and replaced
a usage of strcpy() with strncpy().
2023-05-29 23:53:17 +00:00
Jordan Bancino 88f73a6131 Fix a few segfaults in http and json. 2023-05-29 22:48:50 +00:00
Jordan Bancino c206ec495d Format code. 2023-05-27 18:22:38 +00:00
Jordan Bancino 27e40135ad Log a message stating that TLS is disabled if the config requests it. 2023-05-27 17:55:49 +00:00
Jordan Bancino 5df684b609 Show human-readable thread ID in log messages.
This helps debug some multithreading issues.
2023-05-27 17:10:07 +00:00
Jordan Bancino b5b1a021d8 It appears that OpenSSL closes the socket descriptor for us.
When we close it again manually, we may actually be closing another thread's
file descriptor, which causes all kinds of problems.
2023-05-27 17:03:40 +00:00
Jordan Bancino 54924b9444 Fix potential write out of bounds. 2023-05-26 23:47:36 +00:00
Jordan Bancino 42526c95bb Remove memory bound checking logic.
While this was nifty and impressive, it seems like it is too easy to mess
up, and is too platform-specific.
2023-05-26 23:10:00 +00:00
Jordan Bancino 34f33a1c1b Fix SIGBUS on some platforms. Memory alignment matters!
This is a temporary fix; I'm not convinced it will work on all platforms,
so I will probably end up removing all of the memory boundary code
2023-05-26 23:05:35 +00:00
Jordan Bancino d24c1161f6 Add a Cytoplasm example, which I'll use to debug some stuff. 2023-05-26 22:25:03 +00:00
Jordan Bancino d81600d944 Fix more memory leaks in json.
By doing a little reference tracking, we can make sure we don't miss any
JsonValues that may be floating around by the time we're done.
2023-05-26 22:11:07 +00:00
Jordan Bancino efb27c9db8 Push Main return value into MainArgs.
This prevents weird things from happing on some architectures.
2023-05-26 21:05:06 +00:00
Jordan Bancino 3b659ce09e Adjust milestone requirements. I really want v0.3.0 out soon. 2023-05-26 19:21:25 +00:00
Jordan Bancino 34eb9ff670 Report memory hook issues as errors, segfault on error. 2023-05-25 18:26:17 +00:00
Jordan Bancino e87a0647e0 Fix incorrect block size. 2023-05-25 00:03:17 +00:00
Jordan Bancino 836229fd1a Don't log anything at the end of main; user may have redirected and closeed stream.
This would cause a segfault.
2023-05-24 23:32:53 +00:00
Jordan Bancino 2693b89598 Add sane default memory hook to Cytoplasm, fix more leaks in json. 2023-05-23 22:43:37 +00:00
Jordan Bancino e22cf38eac Fix leaks in json. 2023-05-23 20:34:27 +00:00
Jordan Bancino b1049a9a70 Fix leak in http. 2023-05-23 20:19:27 +00:00
Jordan Bancino 441599b088 Don't leak so much memory. 2023-05-23 17:53:19 +00:00
Jordan Bancino 42191ec03f Properly initialize and destroy logging mutex in LogConfigCreate() and
LogConfigFree(), respectively.
2023-05-23 17:42:08 +00:00
Jordan Bancino a4f369a0a9 Fix leak in HttpClient. 2023-05-21 13:55:49 +00:00
Jordan Bancino 4cc876eb10 Fix warning about integer size mismatch. 2023-05-21 13:35:56 +00:00
Jordan Bancino 51b9e2eaed Clean Cytoplasm when td clean is run. 2023-05-21 13:34:05 +00:00
Jordan Bancino e71ffec164 Add some basic heap memory bounds protection. 2023-05-21 13:24:00 +00:00
Jordan Bancino d38ec7cb38 Document hdoc 2023-05-21 00:21:39 +00:00
Jordan Bancino 896f561213 Apparently this expansion syntax only works on ksh. 2023-05-20 21:38:03 +00:00
Jordan Bancino f2f972bb9d Fix memory leaks in hdoc. 2023-05-15 22:38:52 +00:00
Jordan Bancino ff0a9f33b8 Update TODO. 2023-05-15 01:43:46 +00:00
Jordan Bancino 4043285413 Telodendria and all tools now use the Cytoplasm runtime stub.
This reduces the amount of manual work programs have to do, and gives us
some free features, like automatic leak reports in all tools.
2023-05-14 22:15:48 +00:00
Jordan Bancino 8021cff122 Make Telodendria use Cytoplasm.
This commit removes all the duplicate code and makes Telodendria use the
new Cytoplasm library.
2023-05-14 19:35:23 +00:00
Jordan Bancino 5c8a42117c Import new Cytoplasm library based off of code from Telodendria.
Telodendria doesn't use this library yet, but it will soon.
2023-05-13 17:30:09 +00:00
Jordan Bancino a1e3bd7d8e Clean up TODO 2023-05-11 12:00:44 +00:00
Jordan Bancino 4d9c907b58 Attach device ID to authenticated user.
Now RouteWhoAmI can use UserAuthenticate just like the other endpoints.
2023-05-11 03:03:40 +00:00
Jordan Bancino c1c57fd4cf Make RandState thread-specific. 2023-05-11 02:17:04 +00:00
Jordan Bancino 609890654e Fix handling of STATIC and broken compilation on GNU systems. 2023-05-10 03:32:56 +00:00
Jordan Bancino 31866a14b4 Remove some extraneous whitespace from Util.c, not sure how that got there. 2023-05-07 12:08:26 +00:00
Jordan Bancino e6dd20e2b2 Update changelog. 2023-05-07 03:21:52 +00:00
Jordan Bancino ebc3da9b23 Fix some compile warnings. 2023-05-06 23:06:13 +00:00
Jordan Bancino a2eec3946c I missed an instance of strcmp() 2023-05-06 23:02:46 +00:00
Jordan Bancino 0b11b97022 Add StrEquals(), as equality checking is the most common use for strcmp().
This allows us to get rid of the hideous MATRIX_PATH_PART_EQUALS macro,
and prevents inconsistent usage of strcmp() (for example, !strcmp() vs
strcmp() == 0).

StrEquals() also has sensible behavior for dealing with NULL strings (it
doesn't just segfault like strcmp()).
2023-05-06 22:34:36 +00:00
Jordan Bancino 0e69a12784 Register route. 2023-05-06 22:06:54 +00:00
Jordan Bancino 2a87583d2f Add /_matrix/client/v3/account/deactivate 2023-05-06 22:06:23 +00:00
Jordan Bancino 95ceba0645 Add length calculations to JsonEncode() so we can set Content-Length. 2023-05-06 19:23:13 +00:00
Jordan Bancino bbea55be6c Document http-debug-server, fixed typo in HttpServer docs. 2023-05-06 18:21:21 +00:00
Jordan Bancino 3d9a7664b1 Add support for building static and shared libraries. 2023-05-06 17:04:35 +00:00
Jordan Bancino cb7ee91908 Update telodendria(8) 2023-04-30 02:20:59 +00:00
Jordan Bancino f1f66c6331 Fix the Makefile by sourcing tools/ if TELODENDRIA_ENV is unset. 2023-04-30 01:47:27 +00:00
Jordan Bancino abbbfe4d7f Replace all usages of curl in tp, document tp and tt. 2023-04-29 23:28:33 +00:00
Jordan Bancino 872fa1aa66 More documentation. It never ends! 2023-04-29 19:52:51 +00:00
Jordan Bancino a08018870e Remove obsolete documentation. 2023-04-29 18:47:20 +00:00
Jordan Bancino e0c94d7bd2 Site now pulls built man pages. 2023-04-29 18:39:01 +00:00
Jordan Bancino f819093b7d Don't spew unknown expression warnings if @suppress-warnings is set. 2023-04-29 15:28:42 +00:00
Jordan Bancino 0b1b4a8b29 Cope with preprocessor macro usage at the top level of the header.
This workaround allows us to parse the Routes.h properly, although it
notably lacks support for multi-word unknown expressions.
2023-04-29 15:24:46 +00:00
Jordan Bancino a3cc06ff2a Fix line numbers when parsing multi-line macros. 2023-04-29 15:16:58 +00:00
Jordan Bancino 2d8d5244c4 Document some new headers. 2023-04-29 15:04:16 +00:00
Jordan Bancino b70c3f0bed Finish converting all existing documentation. Next up is writing new docs. 2023-04-29 02:54:49 +00:00
Jordan Bancino 71fa96d10d Format source code. 2023-04-27 20:05:08 +00:00
Jordan Bancino a00ded6d06 Add support for parsing global variables, not just function declarations. 2023-04-27 20:04:15 +00:00
Jordan Bancino 9292f1d9da Add docs recipe for generating documentation from the headers.
Note that since all the headers are not documented yet, this will fail
because an undocumented function is a fatal error in hdoc.
2023-04-27 18:39:05 +00:00
Jordan Bancino 9880aac674 Split format recipe into format and license.
Format formats only C source code. License applies the license file to
C source code *and* header files.
2023-04-27 18:03:32 +00:00
Jordan Bancino 24a03ba126 Added some more header documentation. 2023-04-27 18:00:26 +00:00
Jordan Bancino 95cb14213f Add support for return types that are const, structs, or enums. 2023-04-27 16:02:15 +00:00
Jordan Bancino 6e976a2b8d Fix line counts on syntax errors. 2023-04-27 15:54:21 +00:00
Jordan Bancino 72467f6503 Begin moving documentation to headers. 2023-04-27 03:08:39 +00:00
Jordan Bancino 3b06ab120b Add some flags to hdoc to make it more useful. 2023-04-27 02:30:44 +00:00
Jordan Bancino 2447bb63cc Add hdoc, a simple tool for generating documentation from a C header.
This is a very early prototype. It works, but it is probably not efficient
or reliable. However, the documentation format it parses is stable, so I
will begin moving the documentation into the headers.
2023-04-27 01:34:49 +00:00
Jordan Bancino fdcf7ec065 Update changelog, add LD_EXTRA variable in td. 2023-04-26 01:43:32 +00:00
Jordan Bancino 459b2e856f Format source code. 2023-04-25 22:13:28 +00:00
Jordan Bancino 96ca9a725d Finish up capabilities for now. 2023-04-25 22:11:34 +00:00
Jordan Bancino e1367d5bff Use snprintf() instead of sprintf().
All linker warnings should now be eliminated.
2023-04-25 22:01:58 +00:00
Jordan Bancino d83db35df0 Use strncpy() instead of strcpy().
The OpenBSD linker is complaining about it. Even though every single
case strcpy() was used is safe, strncpy() provides a little bit of extra
security, and makes the linker happy.
2023-04-25 21:54:51 +00:00
Jordan Bancino d933d12e1b Make Rand use a provided Mersenne Twister.
This implementation is loosely inspired by the original paper on the
Mersenne Twister, and borrows code from a public-domain implementation of
it, adapting it to fit the style of Telodendria's code, and fixing a few
bugs regarding the size of the data type used.

Neither C nor POSIX provide a good, thread-safe pseudorandom number
generator. The OpenBSD linker started complaining about the use of
rand_r(), and no standard alternative presented itself as worthy of
consideration, so I finally decided it was time to roll my own PRNG.
2023-04-25 21:28:55 +00:00
Jordan Bancino 098eed44a0 Fix bug in MatrixWellKnown(), begin /_matrix/client/v3/capabilities 2023-04-25 18:37:25 +00:00
Jordan Bancino 2ac08ad74d Clean out finished TODO items. 2023-04-25 01:54:03 +00:00
Jordan Bancino 3e4698bf72 Update porting documentation. 2023-04-24 22:24:32 +00:00
Jordan Bancino 38565d4aa6 Update changelog. 2023-04-24 21:21:25 +00:00
Jordan Bancino 05cf076ebc Begin debugging OpenSSL. 2023-04-24 17:05:59 +00:00
Jordan Bancino a525830b64 Telodendria now responds correctly to SIGTERM. 2023-04-24 16:23:50 +00:00
Jordan Bancino 279f261aed Fix race conditions that are possible in Db.
This is accomplished by locking the entire database, and keeping it locked
until the last reference is unlocked. We get rid of per-reference locks,
because those are what cause race conditions.
2023-04-24 16:19:17 +00:00
Jordan Bancino 313249ca88 Fixed some caching bugs in Db.
Note that Db has the potential to deadlock when caching is being used,
and when caching isn't being used, an inconsistent state can occur. Future
changes to Db will fix both of these issues.
2023-04-24 15:43:24 +00:00
Jordan Bancino 737e060243 Finish up Uia fallback. 2023-04-22 15:40:25 +00:00
Jordan Bancino 5431c2cd90 Fix double-free in UiaCleanup(). 2023-04-22 13:45:01 +00:00
Jordan Bancino 2bbe13aaf0 Fix error setting up UIA flows. 2023-04-22 02:06:22 +00:00
Jordan Bancino 866343071a Continued work on UIA fallback. 2023-04-22 00:59:03 +00:00
Jordan Bancino 6a5d89e14b Work on implementing user interactive authentication fallback. 2023-04-21 02:13:06 +00:00
Jordan Bancino fb24f93aaa Fix bug with TLS where cert and key files were used after freeing them. 2023-04-20 21:12:08 +00:00
Jordan Bancino 0b7282c36a Fix build errors on some compilers due to missing symbols. 2023-04-20 19:19:23 +00:00
Jordan Bancino ec09882dbe Fix warnings about memset() 2023-04-20 17:50:22 +00:00
Jordan Bancino 3b28af2031 Fix warning on some compilers. 2023-04-20 17:40:14 +00:00
Jordan Bancino 19b0dcac5a Don't build the routing tree until absolutely necessary.
Saves us a lot of time and memory in case of an error.
2023-04-20 17:37:18 +00:00
Jordan Bancino 4a5c7480aa Fix up a few small warnings. 2023-04-20 13:49:25 +00:00
Jordan Bancino 687b89a83a Add some more user documentation to clarify how configuration works. 2023-04-20 01:39:09 +00:00
Jordan Bancino 25b7c0d059 Begin documenting Admin API. 2023-04-19 21:45:15 +00:00
Jordan Bancino ffeb45375e Implement /_telodendria/admin/privileges
Note that it's not exactly as the proposal defines it; theres a bit more
nuance that will be documented soon.
2023-04-19 18:52:05 +00:00
Jordan Bancino ae38791df2 Format code, remove dataDir from sample production.conf 2023-04-19 02:07:38 +00:00
Jordan Bancino 0cca38115a Move configuration to database, add process control API, fix memory leaks. 2023-04-19 00:33:38 +00:00
Jordan Bancino ff4d265dcc Registration tokens now determine what privileges a user gets. 2023-04-16 18:32:22 +00:00
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
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

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
Jordan Bancino 4a27f50538 Remove calls to pledge(), unveil(), and chroot().
Not only does this make us more POSIX, it actually makes things a lot
easier because TLS implementations will need to be able to access the
trusted certificates file, which most likely will not live in the
data directory.
2023-03-20 19:23:37 +00:00
Jordan Bancino 6c9e939b9f Fix broken IoVprintf().
You can't call vsnprintf() on the same va_list more than once! I learned
this the hard way with StreamVprintf().
2023-03-18 14:55:04 +00:00
Jordan Bancino 5289c16e2b Convert all code to new Stream API.
Also made a number of improvmements to tt, making it compatible with more
2023-03-18 14:32:09 +00:00
Jordan Bancino a97a593f21 Format code. 2023-03-16 16:53:18 +00:00
Jordan Bancino 27b3b6cdc6 Add StreamPuts(), don't make StreamVprintf() defer to IoVprintf(). 2023-03-16 16:51:41 +00:00
Jordan Bancino 8539a03d5b Add StreamFile() convenience method. 2023-03-16 16:25:24 +00:00
Jordan Bancino e0a3760a37 Don't buffer in IoWrite(), indicate that fwrite() returns size_t, not ssize_t. 2023-03-16 14:17:04 +00:00
Jordan Bancino 6ee1857f5f Format source code. 2023-03-16 12:29:38 +00:00
Jordan Bancino 7d9770fc12 Add some convenience functions for working with Io and Stream.
Also broke out IoFd into it's own file, and did the same with IoFile.
2023-03-16 12:28:55 +00:00
Jordan Bancino 65f4c90df3 Rename HttpStream() to HttpServerStream() to match HttpClientStream() 2023-03-16 02:17:48 +00:00
Jordan Bancino ff52cc78dc Update TODO 2023-03-15 17:30:14 +00:00
Jordan Bancino ab4755240a Add IoCopy() and StreamCopy()
Both do buffered reads and writes, but IoCopy() uses IoRead() and
IoWrite() directly, whereas StreamCopy() relies on StreamGetc() and
StreamPutc(), which manipulate the stream buffers.
2023-03-15 17:14:16 +00:00
Jordan Bancino 92da3542a6 Move low-level fopencookie()/funopen() functionality to Io API.
The Stream API now provides the buffered I/O functionality analogous to
the C standard library.
2023-03-15 16:47:34 +00:00
Jordan Bancino 5dbaf3c223 Apply #65, remove printf() in Db, and make tt show login messages. 2023-03-15 13:36:49 +00:00
Jordan Bancino afc7667737 Begin prototyping Stream API. 2023-03-15 02:40:23 +00:00
Jordan Bancino ae97d8116c Apply #64: Registration tokens. 2023-03-14 00:37:24 +00:00
Jordan Bancino 76bfa120ee Fix CPU pin if clients don't shutdown() their socket properly.
If we haven't read any bytes yet, then we try a few times a few ms apart
to see if we get anything. If not, treat it as an EOF. Otherwise, read
bytes until we get an EOF or EAGAIN. EAGAIN after a consistent read of
bytes is treaded as an EOF immediately.
2023-03-12 15:08:50 +00:00
Jordan Bancino 62cd1cdc98 Misc changes. 2023-03-12 03:37:57 +00:00
Jordan Bancino 7fa982a16f Fix bug in Uia 2023-03-12 03:36:40 +00:00
Jordan Bancino aba1ef9251 Add some more documentation. 2023-03-12 03:36:19 +00:00
Jordan Bancino b4a394c44b Move send-patch and td to section one of the manual.
I think they fit there better.
2023-03-10 23:02:09 +00:00
Jordan Bancino 64add9c9ab Fix unused variable warning. 2023-03-10 20:12:25 +00:00
Jordan Bancino 3037f12907 Add tt and http-debug-server tools. 2023-03-10 18:48:52 +00:00
Jordan Bancino 2d9b706f38 Fix I/O in JsonConsumeWhitespace() and UtilStreamCopy().
These functions previously operated on the assumption that fgetc() would
block; however it will not block on HttpServer streams because those are
non-blocking. They now check error conditions properly before failing
2023-03-10 18:46:03 +00:00
Jordan Bancino fd12dee62e Make sure a newline is printed after JSON object is pretty-printed. 2023-03-10 04:30:56 +00:00
Jordan Bancino 8ead9cc93a Apply #63, make some general bug fixes. 2023-03-10 03:24:04 +00:00
Jordan Bancino 3af2d3d12b Format code, update TODO items. 2023-03-09 03:35:40 +00:00
Jordan Bancino 7344d4fa46 Apparently some shells interpret the - in a string as an argument delimiter??? 2023-03-09 02:49:14 +00:00
Jordan Bancino ca053a12b1 Break out main() into Main.c, fix some compile warnings on Cygwin. 2023-03-09 02:46:04 +00:00
Jordan Bancino 9a1300ff2e Make sure input is initialized. 2023-03-09 02:22:13 +00:00
Jordan Bancino c32c3abfd6 Update TODO 2023-03-09 00:10:32 +00:00
Jordan Bancino 012c334ee5 Make send-patch use json instead of jq. 2023-03-09 00:06:15 +00:00
Jordan Bancino 20ebeb9c32 Switch tp from using jq to json; format td 2023-03-08 22:47:40 +00:00
Jordan Bancino 76413f834e Make json use ^ for removing fields, instead of !
Room IDs start with '!', we want to be able to access these.
2023-03-08 22:47:07 +00:00
Jordan Bancino efdf168085 Allow encoding user-provided strings. 2023-03-08 20:31:49 +00:00
Jordan Bancino 50e599f1cd Implement a mostly-functional query language for JSON. 2023-03-08 19:49:06 +00:00
Jordan Bancino 7b22fb02a2 Implement pretty-printing option in Json.
Telodendria itself doesn't use it, but the json CLI tool does.
2023-03-08 17:15:43 +00:00
Jordan Bancino cb8c4fceb5 Begin working on JSON CLI tool.
This is a similar situation to the HTTP CLI tool: since we have the
Json API anyway, we might as well have a little command line tool to
replace jq.
2023-03-08 04:06:43 +00:00
Jordan Bancino 19e89110cd Bump version number to v0.3.0 2023-03-08 03:46:38 +00:00
Jordan Bancino 1a169d1a2e Fix usage message. 2023-03-08 03:31:34 +00:00
Jordan Bancino 8d75d8a023 Add simple HTTP CLI tool that uses the HttpClient API.
You might be asking why I would just write a simple curl replacement
when curl does the job just fine. Well, the most immediate reason is
to test the HttpClient API, but since Telodendria's goal is to not
be dependent on any third-party code if at all possible, it makes
sense to have a simple HTTP client to use not only for testing
Telodendria, but also for configuring it. When we move the
configuration to the database, we'll ship a script that uses this
tool to allow admins to easily submit API requests.

Do not be concerned that HttpClient does not support TLS yet. TLS
support is necessary for federation to work, so it is coming
2023-03-08 03:30:36 +00:00
Jordan Bancino 7e144ae488 Clean up a few bugs in HttpClient and Uri 2023-03-08 02:53:47 +00:00
Jordan Bancino 3e42da279c Make improvements to HttpClient, add Uri 2023-03-08 01:54:33 +00:00
Jordan Bancino 313f0e2e73 Add HttpClient API 2023-03-07 23:10:06 +00:00
Jordan Bancino fc8fbc9a70 I forgot to set the date in the changelog. 2023-03-07 00:51:16 +00:00
Jordan Bancino 7e41251f07 Update README 2023-03-07 00:50:59 +00:00
Jordan Bancino cfba96edee Prepare for v0.2.0 release. 2023-03-07 00:44:53 +00:00
Jordan Bancino 04bf8ca1a1 Document Uia API. 2023-03-07 00:28:52 +00:00
Jordan Bancino 17734c90e8 This is unnecessary. 2023-03-06 23:54:55 +00:00
Jordan Bancino 154e5b82df Looks like CVS is being weird with Mdocdate strings. 2023-03-06 23:51:55 +00:00
Jordan Bancino 7750963c29 Something weird is going on here. 2023-03-06 23:49:30 +00:00
Jordan Bancino eae8fc5c79 Update Matrix documentation. 2023-03-06 22:49:21 +00:00
Jordan Bancino f2c2888c87 Document DbList() and DbListFree() 2023-03-06 22:29:46 +00:00
Jordan Bancino f1e565ef7b Update Json man page. 2023-03-06 22:21:56 +00:00
Jordan Bancino 0ac21d430a Document User API 2023-03-06 22:09:57 +00:00
Jordan Bancino e73cea64b7 Apply modified #60 2023-03-04 21:43:41 +00:00
Jordan Bancino c8c4c705a5 Convert proposals to man pages. 2023-03-04 20:26:16 +00:00
Jordan Bancino 8c2ed1c8f1 Apply #59 2023-03-04 15:34:44 +00:00
Jordan Bancino 0cbdb5f615 Multi-stage flows should theoretically work now. 2023-03-04 01:53:33 +00:00
Jordan Bancino e4ec250d8f Apply modified #57: Implement logout all. 2023-03-03 22:49:37 +00:00
Jordan Bancino 97990c5009 Get some more of my thoughts in the TODO file. 2023-03-03 18:56:36 +00:00
Jordan Bancino 5d590df83d Remove DB_MIN_CACHE because that's dumb.
You should be able to totally disable the cache if you so please. This
should ensure Telodendria uses less memory on constrained systems.
2023-03-03 14:26:10 +00:00
Jordan Bancino 1770789333 Fix leak in DbList() 2023-03-03 03:11:49 +00:00
Jordan Bancino 676d6f4c61 Basic formatting. 2023-03-02 22:32:47 +00:00
Jordan Bancino d899a836b6 Apply #54 2023-03-02 22:06:33 +00:00
Jordan Bancino f4838f8211 Remove non-standard use of d_type 2023-03-02 02:53:43 +00:00
Jordan Bancino d6f96757bc Apply #52: d_namlen is non-standard. 2023-03-01 21:39:22 +00:00
Jordan Bancino 7a951c980f Cleanup old user interactive auth sessions. 2023-03-01 19:52:44 +00:00
Jordan Bancino 8c4e6aa594 Implement DbList() 2023-03-01 19:33:25 +00:00
Jordan Bancino ce6d483135 Implement static login page. 2023-03-01 19:03:42 +00:00
Jordan Bancino 55b3728e7e Bake the platform name into the version number.
This is helpful as we're porting to different operating systems. I guess
it just makes the porting effort more satisfying. Seeing this header
makes me happy:

Server: Telodendria/0.2.0-Haiku
2023-03-01 03:19:21 +00:00
Jordan Bancino 2b77681763 Move getent check to 2023-03-01 03:11:10 +00:00
Jordan Bancino dd1b26bad8 Only use getent if the command can be found. 2023-03-01 03:09:46 +00:00
Jordan Bancino 755d08946a Add some more obscure platforms to td build script. 2023-03-01 03:08:53 +00:00
Jordan Bancino e7d1c0d951 Cross-platform code improvements. 2023-03-01 01:55:26 +00:00
Jordan Bancino 2e1220621c Use -pipe, supposedly this speeds things up.
The codebase is getting kind of big, we'll need all the help we can get.
2023-03-01 01:26:34 +00:00
Jordan Bancino 334a711b02 Fix compile error. 2023-03-01 01:23:52 +00:00
Jordan Bancino 2747660473 Add a TODO in Uia 2023-02-28 18:48:43 +00:00
Jordan Bancino 63634407d4 Update TODO.txt, add stub functions in Db. 2023-02-28 18:44:02 +00:00
Jordan Bancino 16c31b63d7 Begin work on static login page. 2023-02-28 17:52:09 +00:00
Jordan Bancino 36169181dd Build basic framework for creating static pages.
The login fallback, as well as the user-interactive authentication
fallbacks, are static HTML pages.
2023-02-28 16:51:40 +00:00
Jordan Bancino fae9eb4473 Implement password-based user interactive authentication. 2023-02-28 15:17:11 +00:00
Jordan Bancino e2806bc810 Add UserIdParse() and UserIdFree() functions.
The spec says that a username can be either just the localpart, or a
localpart and a server. This commit now ensures that the login endpoint
actually handles usernames properly by calling the proper parsing
2023-02-28 13:44:34 +00:00
Jordan Bancino 58dae3a0c9 Remove user create Admin endpoint, and the associated privilege.
If an admin wants to create a user, he or she should have the ISSUE_TOKEN
privilege. The admin can use that to create a one-time registration token,
and then just use the regular registration API with that token.
2023-02-27 18:02:35 +00:00
Jordan Bancino d89e3fd753 Update TODO 2023-02-27 17:25:39 +00:00
Jordan Bancino 6ce6cb4525 Implement flow handling in Uia API.
This commit should fix user interactive authentication for dummy flows,
but I still have to implement a few more flows, including passwords and
refresh token. I also have to fix the cleanup logic: when do we purge
UIA sessions?
2023-02-27 15:39:12 +00:00
Jordan Bancino 7703405c70 Fix bugs in Json API. 2023-02-26 15:07:46 +00:00
Jordan Bancino 31be432f7a Just discovered some bugs in Json. 2023-02-25 16:35:33 +00:00
Jordan Bancino adea499813 Add UiaFlowsFree() function, and clean up some memory issues. 2023-02-24 14:40:21 +00:00
Jordan Bancino 26b0f33f96 -not is not portable, grep -v should work good enough though. 2023-02-24 02:02:47 +00:00
Jordan Bancino d517b66316 Also delete refrsh token if present for device. 2023-02-24 01:06:02 +00:00
Jordan Bancino b60cac53e5 Make JsonValueString() call StrDuplicate(); refactor code to behave properly. 2023-02-24 00:17:56 +00:00
Jordan Bancino 8c96fd8d7d Begin the great StrDuplicate() refactor. 2023-02-23 23:19:23 +00:00
Jordan Bancino 41421557e0 Update TODO. 2023-02-23 16:46:27 +00:00
Jordan Bancino 4f562167f6 Update TODO 2023-02-23 16:20:15 +00:00
Jordan Bancino b99e8bd1cd Apply modified #50 and fix some misc. bugs. 2023-02-23 15:13:39 +00:00
Jordan Bancino 9e9b5c9cda Fix a write-out-of-bounds error in Json. 2023-02-23 03:46:05 +00:00
Jordan Bancino 3bbff5379f [WIP] Replace UserInteractiveAuth with a new Uia API.
Uia is a lot less characters to type. Do note that this API is far from
complete and this commit breaks user interactive authentication entirely.
2023-02-19 14:58:56 +00:00
Jordan Bancino d81e8f3a32 We're building up some tools; let's print them out in 2023-02-17 18:26:08 +00:00
Jordan Bancino 3faee8b432 Update TODO items. 2023-02-17 15:03:59 +00:00
Jordan Bancino fa88fc3323 Format source code. 2023-02-17 03:23:25 +00:00
Jordan Bancino ff879e715f Finish implementing token refresh.
This implementation just keeps the refresh token and only updates the
access token. The spec says that this is allowed. There's really no
reason to do this, other than the fact that it's easier.
2023-02-17 03:20:49 +00:00
Jordan Bancino 4b336de171 Build out the User API a bit more. 2023-02-17 03:18:24 +00:00
Jordan Bancino 46fe667988 Add HashMapGetKey() so we can free bucket keys before deleting them. 2023-02-17 03:14:43 +00:00
Jordan Bancino feb11de6b0 Fix some compile warnings. I'll get back to this eventually. 2023-02-16 18:51:10 +00:00
Jordan Bancino 72405a94f6 Add JsonGet(), JsonSet(), and JsonCreate() for convenience. 2023-02-16 18:49:19 +00:00
Jordan Bancino d255ce1a21 Begin working on refresh route. 2023-02-16 17:22:59 +00:00
Jordan Bancino b05e81776a Be smart about the type of man page we generate. 2023-02-16 17:22:32 +00:00
Jordan Bancino c78dc3bd31 Fix a memory bug in StrRandom() with RandIntN().
We're storing integers in this buffer, so we have to allocate enough
memory for them. An integer is usually more than one byte.
2023-02-16 13:10:09 +00:00
Jordan Bancino 38438c297e Looks like Matrix v1.6 is out. 2023-02-16 02:09:57 +00:00
Jordan Bancino 1f1cbc0461 Fix a bad jq parameter. 2023-02-16 02:01:25 +00:00
Jordan Bancino dc566a85b7 Ignore .patch files. 2023-02-16 02:01:14 +00:00
Jordan Bancino 85380efa3c [#48] Fix bug in MatrixGetAccessToken() 2023-02-16 01:33:46 +00:00
Jordan Bancino 2ce43ce457 Add a script for conveniently creating new library man pages. 2023-02-16 00:55:10 +00:00
Jordan Bancino 6735c101ec Add Rand man page. 2023-02-16 00:54:58 +00:00
Jordan Bancino 6a593ab8a0 [#48] Add Rand API and make StrRandom() use it. 2023-02-16 00:31:13 +00:00
Jordan Bancino fdecac576f Some browsers don't like this rule; making it !important seems to fix them. 2023-02-16 00:05:26 +00:00
Jordan Bancino cebc2959cc Fix a few things that were bothering me. 2023-02-15 21:53:39 +00:00
Jordan Bancino 50aa65617a Fix some bugs in the man page index generation. 2023-02-15 16:00:36 +00:00
Jordan Bancino de0ece10e2 Use generated tables instead of hand-crafted tables. 2023-02-15 03:30:52 +00:00
Jordan Bancino e3b8eaf941 Put description all on one line. 2023-02-15 03:30:40 +00:00
Jordan Bancino a72f75d6b5 Update some man page descriptions. 2023-02-15 02:37:44 +00:00
Jordan Bancino a7c1ccd3f1 Update lots of documentation. 2023-02-15 01:32:44 +00:00
Jordan Bancino f7d581538d Begin documenting Str. 2023-02-14 11:56:22 +00:00
Jordan Bancino 653d282bcd Document User API. 2023-02-14 02:02:22 +00:00
Jordan Bancino 5fef788053 Begin documenting User API 2023-02-12 02:31:14 +00:00
Jordan Bancino 2443c91bba Fix bug in HashMap that would allow iterating over deleted values. 2023-02-11 00:15:49 +00:00
Jordan Bancino 27c4713e5d I actually decided I don't like this. 2023-02-11 00:07:18 +00:00
Jordan Bancino 71a0181a6a Break out static options into an environment variable.
This allows users to turn off static compilation if the compiler or linker
throws a fit about it. Looking at you, Glibc. And PCC doesn't seem to like
static compilation either; it generates a binary that just segfaults
immediately on executation.
2023-02-05 14:46:20 +00:00
Jordan Bancino 8b8873103d Handle standard library quirks of non-conforming systems and compilers. 2023-02-05 14:20:12 +00:00
Jordan Bancino dc972385ea Don't shadow variables. 2023-02-05 14:19:07 +00:00
Jordan Bancino e1efac41fa Fix admin endpoint to be /_telodendria/admin instead of /admin.
This is how Synapse and Dendrite do it. It makes sense to me.
2023-02-04 00:24:17 +00:00
Jordan Bancino a4ec6cf6c7 Apply #45 2023-02-04 00:21:36 +00:00
Jordan Bancino 5b77236e82 Fix -v option 2023-01-17 21:38:39 +00:00
Jordan Bancino e0f7c133d1 Add a non-JSON landing page. This is the basis for other HTML pages. 2023-01-17 20:29:16 +00:00
Jordan Bancino 4e742d5179 Define project timeline a little more. 2023-01-17 19:05:26 +00:00
Jordan Bancino 70fd61cd23 Bring change log up to date-ish.
Next release I'll try to stay on top of this more.
2023-01-17 17:39:31 +00:00
Jordan Bancino 056804810f Fix man page links on website. 2023-01-17 13:53:31 +00:00
Jordan Bancino b0b2f11158 Refactor endpoint authentication flow.
Instead of one MatrixAuthenticate() function, we'll do
MatrixGetAccessToken(), and then UserAuthenticate(). This allows us to
give different error messages depending on what the user provided and what
the server state is.
2023-01-17 01:36:22 +00:00
Jordan Bancino 1e02971a7e Implement login route. 2023-01-17 00:02:50 +00:00
Jordan Bancino cc95c10f44 Move client well-known generation to MatrixClientWellKnown() function.
We'll be using this for client login.
2023-01-16 22:02:08 +00:00
Jordan Bancino 121682c006 Implement user login. 2023-01-16 21:17:44 +00:00
Jordan Bancino bd88c01c26 Don't read the timestamp after it's freed. 2023-01-16 03:57:01 +00:00
Jordan Bancino c0309c1ea8 Fix memory leak when log timestamp is not set in the config. 2023-01-16 03:21:59 +00:00
Jordan Bancino 9186cdb13d Verbose formatting on the terminal, because why not? 2023-01-10 01:21:35 +00:00
Jordan Bancino a4364dbb68 Fix use after free. 2023-01-10 00:38:47 +00:00
Jordan Bancino 599fa1a740 Document MemoryHexDump() and DbExists() 2023-01-09 21:39:59 +00:00
Jordan Bancino b8ce4c9239 Lock database in DbExists() to prevent race conditions. 2023-01-09 19:25:49 +00:00
Jordan Bancino c5bce0b14f Apply #43 with modifications. 2023-01-09 19:22:09 +00:00
Jordan Bancino 1421c478fd Fix bug where malformed requests cause Db locks that are never unlocked. 2023-01-09 19:16:12 +00:00
Jordan Bancino a7ab3e757a Apply #43 2023-01-09 18:20:19 +00:00
Jordan Bancino 02884b6bdb Fix typo. 2023-01-09 18:01:32 +00:00
Jordan Bancino a09e15f6bc Don't output server response. 2023-01-09 18:00:14 +00:00
Jordan Bancino cdb26b5223 Make Telodendria Bot retry fetching if it failed. 2023-01-09 17:56:24 +00:00
Jordan Bancino 90a74c3b0a Don't accept connections if the connection queue is full. 2023-01-09 17:44:12 +00:00
Jordan Bancino 1d9ed5dcbf Fix invalid read in HttpParamDecode(). 2023-01-09 15:48:56 +00:00
Jordan Bancino 9358264add Fix some invalid write errors. 2023-01-09 15:18:59 +00:00
Jordan Bancino 80ff232af9 Update TODO 2023-01-08 04:39:01 +00:00
Jordan Bancino 30c3690287 Renamed String.h to Str.h because Windows is dumb. 2023-01-08 04:38:06 +00:00
Jordan Bancino 148706b517 Use spaces instead of tabs. Tabs don't work over SSH? 2023-01-07 19:22:38 +00:00
Jordan Bancino 472a6ccbf7 Clean up build output on terminals.
If we're not writing out to a terminal, then echo each file out as it is
being compiled. Otherwise, if we are on a terminal, overwrite the previous
2023-01-07 19:14:15 +00:00
Jordan Bancino 56105c8a61 Fix logic error 2023-01-07 18:24:16 +00:00
Jordan Bancino f365f94389 Define User struct. 2023-01-07 16:15:11 +00:00
Jordan Bancino 08b36c071c Begin prototyping User.h 2023-01-07 15:51:56 +00:00
Jordan Bancino 0f661f435f Whoops, forgot to update the header. 2023-01-07 04:40:12 +00:00
Jordan Bancino 0a29aa7f5a Move string related functions to a new String API.
I think we have accumulated enough string functions that they should
have their own API. This shortens the function names a bit too.
2023-01-07 04:33:32 +00:00
Jordan Bancino 2ce09f8632 Convert UtilStringConcat() into a varargs function.
This allows us to concatenate an arbitrary amount of strings without
having to maintain a bunch of pointers or leak memory when nesting calls.
2023-01-07 03:17:06 +00:00
Jordan Bancino 0c807d0f22 Cross an item of TODO 2023-01-07 00:42:11 +00:00
Jordan Bancino 8323eb38c9 Make UtilRandomString() more secure.
Two ways this is more secure:

1. The seed is only generated once, not every time the function is called.
2. All threads share the same seed, which means timing attacks aren't

Because we are using a mutex, performance may suffer slightly.
2023-01-07 00:18:44 +00:00
Jordan Bancino 7cd9fe8bd7 Fix log output by changing __FILE__ 2023-01-06 23:00:18 +00:00
Jordan Bancino ea1828e95e Fix warning in RouteRegister.c 2023-01-06 21:54:33 +00:00
Jordan Bancino 7bda319f39 Format code 2023-01-06 21:18:44 +00:00
Jordan Bancino c63715c2e7 Update TODO 2023-01-06 21:17:55 +00:00
Jordan Bancino c48d666899 Add note on documenting patches. 2023-01-06 19:54:44 +00:00
Jordan Bancino 1282371680 Fix "bad pointer" warnings. 2023-01-06 18:50:31 +00:00
Jordan Bancino fe57f07fee Add onion location. We're on Tor now. 2023-01-04 01:07:48 +00:00
Jordan Bancino b753d58171 Apply #41 2023-01-03 13:01:22 +00:00
Jordan Bancino 6960743e43 Apply #40 2023-01-03 04:01:03 +00:00
Jordan Bancino 8e2399e648 Fix bug on some platforms that use unsigned characters. 2023-01-02 18:22:04 +00:00
Jordan Bancino d969f4d053 Fix visual bugs in MemoryHexDump() 2023-01-02 04:12:12 +00:00
Jordan Bancino 5c5aab71d8 Fix bug in UserInteractiveAuth() 2023-01-02 03:56:27 +00:00
Jordan Bancino e9aebab221 Move hex dump logic to Memory API. 2023-01-01 22:10:23 +00:00
Jordan Bancino 69862a1e6e Use -ansi in compiler flags. I think this more well supported. 2023-01-01 21:16:20 +00:00
Jordan Bancino d9d88eb028 Periodically purge old user interactive auth sessions.
Keeping them around is going to take up a lot of storage. If it takes more
than a half hour for a client to complete the auth, make him start over.
2022-12-28 15:52:19 +00:00
Jordan Bancino fbd7bf5944 Fix memory leak in DbDelete() 2022-12-28 15:44:21 +00:00
Jordan Bancino 1a43ea6470 Fix bugs in Cron 2022-12-26 16:28:58 +00:00
Jordan Bancino 3c8d89a52e Update copyright year 2022-12-26 15:52:52 +00:00
Jordan Bancino c9e42ff813 Break out UserInteractiveAuth into its own header.
We'll need this because user interactive auth will get complicated and
messy very soon.
2022-12-26 15:48:21 +00:00
Jordan Bancino dbecb28395 Update changelog 2022-12-24 23:41:50 +00:00
Jordan Bancino 4f48f9a5cc Document Cron 2022-12-24 23:07:46 +00:00
Jordan Bancino c18a9a96e6 Add job scheduler.
This will be used for expiring sessions and tokens, among other things that
need to happen periodically.
2022-12-24 21:49:37 +00:00
Jordan Bancino be2e267064 Turns out I don't need to do that. 2022-12-24 01:31:22 +00:00
Jordan Bancino 61e9cdbea3 Check INT_WIDTH and LONG_WIDTH... stupid GNU libc. 2022-12-24 01:00:36 +00:00
Jordan Bancino eeabe93e3f Revert using _POSIX_C_SOURCE.
It didn't fix the issue.
2022-12-24 00:51:49 +00:00
Jordan Bancino 2d1bfd8b74 Define _POSIX_C_SOURCE again. 2022-12-23 22:53:48 +00:00
Jordan Bancino 25dcff06a8 Fix type issues. 2022-12-19 23:25:37 +00:00
Jordan Bancino 72bfa34bcd Fix overflow on some platforms 2022-12-19 22:25:49 +00:00
Jordan Bancino b8027e1aaf Fix compiler warning on some platforms. 2022-12-19 22:21:24 +00:00
Jordan Bancino 94493e6ad8 Add Sha2 2022-12-19 22:15:41 +00:00
Jordan Bancino 88a11650cf Formatting. 2022-12-19 21:54:01 +00:00
Jordan Bancino c0bd70a391 Add MatrixUserValidate() and MatrixHistoricalUserValidate() 2022-12-18 20:20:08 +00:00
Jordan Bancino f32e5eafce This release is getting too big to be 0.1.1 2022-12-18 20:11:32 +00:00
Jordan Bancino c15895ae06 Username is technically optional. 2022-12-17 02:12:04 +00:00
Jordan Bancino 70c3d01125 Finish route param and request body validation 2022-12-17 00:08:31 +00:00
Jordan Bancino f837988156 Begin work on validating registration request. 2022-12-16 22:56:35 +00:00
Jordan Bancino 53846b0994 Document MatrixAuthenticate and MatrixRateLimit 2022-12-16 22:15:50 +00:00
Jordan Bancino 836b61dc42 Begin implementing a few helper functions 2022-12-16 22:06:01 +00:00
Jordan Bancino 9a31b1f350 Document user interactive authentication function 2022-12-16 20:52:55 +00:00
Jordan Bancino fb06d17b16 Abstract user interactive auth out to function. 2022-12-16 20:08:16 +00:00
Jordan Bancino 7ee31ad36b Copy diagram from scrap paper into code for clarity. 2022-12-15 22:14:16 +00:00
Jordan Bancino 1273d87df9 Finish user interactive logic (still need to abstract it out) 2022-12-15 22:04:30 +00:00
Jordan Bancino f475cac601 More validation in user-interactive API 2022-12-15 21:47:08 +00:00
Jordan Bancino 7d8cec8185 Persist session IDs for future calls. 2022-12-15 20:41:56 +00:00
Jordan Bancino 449851a67e Format code 2022-12-15 20:31:51 +00:00
Jordan Bancino bee07d90fc Fix memory leaks in database. 2022-12-15 20:29:19 +00:00
Jordan Bancino afa0d89e40 Fix links in download table 2022-12-15 20:28:42 +00:00
Jordan Bancino c3618488f2 Hexdump leaked memory to the log for debugging. 2022-12-15 20:18:12 +00:00
Jordan Bancino cc6ae2dbd3 Prevent directory traversals by replacing dots and slashes. 2022-12-15 16:07:45 +00:00
Jordan Bancino de6a857ce7 Format code. 2022-12-15 03:43:40 +00:00
Jordan Bancino 4f2f7cd966 Add random string generator 2022-12-15 03:41:59 +00:00
Jordan Bancino f0392044c2 Document DbDelete() 2022-12-15 02:48:42 +00:00
Jordan Bancino c8cd2cebb7 Implement DbDelete() 2022-12-15 02:39:58 +00:00
Jordan Bancino abb4a9cf20 More work on registration endpoint. 2022-12-15 01:48:49 +00:00
Jordan Bancino d48b6fc456 Add username check logic 2022-12-14 21:23:20 +00:00
Jordan Bancino 5080d066ab Remove some debug statements; make route error more specific. 2022-12-14 18:41:01 +00:00
Jordan Bancino e37e6f1bb8 Fix some memory bugs. 2022-12-14 18:19:20 +00:00
Jordan Bancino 5880cf3ea0 Check paths for /available and /(email|msisdn)/requestToken 2022-12-14 16:21:01 +00:00
Jordan Bancino 0305ef183d Begin work on RouteRegister 2022-12-14 15:40:23 +00:00
Jordan Bancino 07acad8573 Update changelog 2022-12-14 15:09:19 +00:00
Jordan Bancino e7e25cade5 Fix an instance of setting response headers after they were sent. 2022-12-14 15:02:10 +00:00
Jordan Bancino 708a840ec0 Fix memory leak when attempting to parse something that isn't JSON. 2022-12-14 14:54:06 +00:00
Jordan Bancino 5255c3f773 Fix whitespace issues in td 2022-12-14 01:00:52 +00:00
Jordan Bancino b63eeffb0f Implement variable substitution for site files.
It was such a pain to update the links in site/index.html for v0.1.0, so
this is necessary to prevent me from going insane manually updating all
these version numbers sprinkled everywhere.
2022-12-14 00:54:52 +00:00
Jordan Bancino 4eae5b771f Keep the change log relevant. 2022-12-13 21:27:17 +00:00
Jordan Bancino eb4b6b7704 Actually I don't want to release this yet. 2022-12-13 20:41:01 +00:00
Jordan Bancino 5d1451bf88 Bump version number 2022-12-13 20:36:03 +00:00
Jordan Bancino 6d5ef9d6ad Fix cvs tag command (for real this time) 2022-12-13 19:57:34 +00:00
153 changed files with 11926 additions and 11634 deletions

View File

@ -1,5 +0,0 @@

View File