diff --git a/contrib/TlsImplTemplate.c b/contrib/TlsImplTemplate.c index 8df1397..0127cb8 100644 --- a/contrib/TlsImplTemplate.c +++ b/contrib/TlsImplTemplate.c @@ -1,12 +1,30 @@ /* - * Telodendria TLS Implementation Template File. + * Copyright (C) 2022-2023 Jordan Bancino <@jordan:bancino.net> * - * This file can serve as a baseline for new TLS implementations. - * Please consult the Tls(3) man page for details. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ #include -#if TLS_IMPL == TLS_TEMPLATE /* Set your TLS_* implementation flag here */ +#if TLS_IMPL == TLS_TEMPLATE /* Set your TLS_* implementation + * flag here */ /* * #include statements and any implementation structures diff --git a/src/Io.c b/src/Io.c index 552c330..54d250c 100644 --- a/src/Io.c +++ b/src/Io.c @@ -159,7 +159,8 @@ IoVprintf(Io * io, const char *fmt, va_list ap) ret = IoWrite(io, buf, bufSize); } - free(buf); /* Allocated by stdlib, not Memory API */ + free(buf); /* Allocated by stdlib, not Memory + * API */ return ret; } diff --git a/src/Main.c b/src/Main.c index afab7de..d4d303c 100644 --- a/src/Main.c +++ b/src/Main.c @@ -275,7 +275,7 @@ main(int argc, char **argv) /* Bind the socket before possibly dropping permissions */ httpServer = HttpServerCreate(HTTP_FLAG_NONE, tConfig->listenPort, tConfig->threads, - tConfig->maxConnections, MatrixHttpHandler, &matrixArgs); + tConfig->maxConnections, MatrixHttpHandler, &matrixArgs); if (!httpServer) { Log(lc, LOG_ERR, "Unable to create HTTP server on port %d: %s", diff --git a/src/Tls.c b/src/Tls.c index 815db62..d3ad08f 100644 --- a/src/Tls.c +++ b/src/Tls.c @@ -1,3 +1,26 @@ +/* + * Copyright (C) 2022-2023 Jordan Bancino <@jordan:bancino.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include #ifdef TLS_IMPL diff --git a/src/Tls/TlsLibreSSL.c b/src/Tls/TlsLibreSSL.c index 1ab6112..f91b60c 100644 --- a/src/Tls/TlsLibreSSL.c +++ b/src/Tls/TlsLibreSSL.c @@ -1,9 +1,32 @@ +/* + * Copyright (C) 2022-2023 Jordan Bancino <@jordan:bancino.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include #if TLS_IMPL == TLS_LIBRESSL #include -#include /* LibreSSL TLS */ +#include /* LibreSSL TLS */ typedef struct LibreSSLCookie { diff --git a/src/include/Tls.h b/src/include/Tls.h index 3f1076a..f408b6a 100644 --- a/src/include/Tls.h +++ b/src/include/Tls.h @@ -1,38 +1,52 @@ -#ifndef TELODENDRIA_TLS_H -#define TELODENDRIA_TLS_H - -#define TLS_LIBRESSL 1 - /* - * Other TLS_* macros can be declared here as support - * for other implementations is added. + * Copyright (C) 2022-2023 Jordan Bancino <@jordan:bancino.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ #include extern Stream * -TlsClientStream(int, const char *); + TlsClientStream(int, const char *); extern Stream * -TlsServerStream(int, const char *, const char *); + TlsServerStream(int, const char *, const char *); /* * These are provided by individual TLS implementations. */ extern void * -TlsInitClient(int, const char *); + TlsInitClient(int, const char *); extern void * -TlsInitServer(int, const char *, const char *); + TlsInitServer(int, const char *, const char *); extern ssize_t -TlsRead(void *, void *, size_t); + TlsRead(void *, void *, size_t); extern ssize_t -TlsWrite(void *, void *, size_t); + TlsWrite(void *, void *, size_t); extern int -TlsClose(void *); + TlsClose(void *); -#endif /* TELODENDRIA_TLS_H */ +#endif /* TELODENDRIA_TLS_H */