From 5851298957974ba73c1bb6c574d4bfabec5d06ea Mon Sep 17 00:00:00 2001 From: lda Date: Sat, 6 Jan 2024 15:53:26 +0100 Subject: [PATCH] [FIX] Fix conflicts and make branch buildable. --- src/Parser.c | 3 ++- src/Routes/RouteAliasDirectory.c | 8 ++++---- src/Uia.c | 2 +- src/include/Parser.h | 3 ++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Parser.c b/src/Parser.c index 62ba03a..1382175 100644 --- a/src/Parser.c +++ b/src/Parser.c @@ -1,5 +1,6 @@ /* - * Copyright (C) 2022-2023 Jordan Bancino <@jordan:bancino.net> + * Copyright (C) 2022-2024 Jordan Bancino <@jordan:bancino.net> with + * other valuable contributors. See CONTRIBUTORS.txt for the full list. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation files diff --git a/src/Routes/RouteAliasDirectory.c b/src/Routes/RouteAliasDirectory.c index 137e1ce..2a93b1c 100644 --- a/src/Routes/RouteAliasDirectory.c +++ b/src/Routes/RouteAliasDirectory.c @@ -53,14 +53,14 @@ ROUTE_IMPL(RouteAliasDirectory, path, argp) User *user = NULL; CommonID aliasID; - Config *config; + Config config; aliasID.sigil = '\0'; aliasID.local = NULL; aliasID.server.hostname = NULL; aliasID.server.port = NULL; - config = ConfigLock(db); + ConfigLock(db, &config); if (!ParseCommonID(alias, &aliasID) || aliasID.sigil != '#') { @@ -121,7 +121,7 @@ ROUTE_IMPL(RouteAliasDirectory, path, argp) char *serverPart; serverPart = ParserRecomposeServerPart(aliasID.server); - if (!StrEquals(serverPart, config->serverName)) + if (!StrEquals(serverPart, config.serverName)) { msg = "Invalid server name."; HttpResponseStatus(args->context, HTTP_BAD_REQUEST); @@ -235,7 +235,7 @@ ROUTE_IMPL(RouteAliasDirectory, path, argp) finish: CommonIDFree(aliasID); - ConfigUnlock(config); + ConfigUnlock(&config); UserUnlock(user); DbUnlock(db, ref); JsonFree(request); diff --git a/src/Uia.c b/src/Uia.c index ff00b06..8c83440 100644 --- a/src/Uia.c +++ b/src/Uia.c @@ -366,7 +366,7 @@ UiaComplete(Array * flows, HttpServerContext * context, Db * db, config.serverName); if (!type || !StrEquals(type, "m.id.user") - || !userId + || !userId || !ParserServerNameEquals(userId->server, config.serverName)) { HttpResponseStatus(context, HTTP_UNAUTHORIZED); diff --git a/src/include/Parser.h b/src/include/Parser.h index bd57dc0..a4cadfa 100644 --- a/src/include/Parser.h +++ b/src/include/Parser.h @@ -1,5 +1,6 @@ /* - * Copyright (C) 2022-2023 Jordan Bancino <@jordan:bancino.net> + * Copyright (C) 2022-2024 Jordan Bancino <@jordan:bancino.net> with + * other valuable contributors. See CONTRIBUTORS.txt for the full list. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation files