From 07ee721f327dc1ecf7b7b19b282a9ab9d3978848 Mon Sep 17 00:00:00 2001 From: nishi Date: Fri, 19 Apr 2024 23:37:52 +0000 Subject: [PATCH] changing basic auth to cookie auth git-svn-id: file:///raid/svn-main/nishi-mandshurica/trunk@42 f982e544-4a7d-3444-ad1a-fde59a2a69f1 --- Mandshurica/config.c | 4 ++-- Module/Makefile | 2 +- Module/{basic.c => cookie.c} | 10 +++++----- Module/http.c | 3 ++- Webroot/index.html.tmpl | 1 + 5 files changed, 11 insertions(+), 9 deletions(-) rename Module/{basic.c => cookie.c} (88%) diff --git a/Mandshurica/config.c b/Mandshurica/config.c index 35dd6b1..093b44d 100644 --- a/Mandshurica/config.c +++ b/Mandshurica/config.c @@ -201,14 +201,14 @@ int mandshurica_create_config(const char* path) { fprintf(f, "# Generated by Mandshurica " MANDSHURICA_VERSION "\n"); fprintf(f, "ServerRoot %s\n", PREFIX); fprintf(f, "\n"); - fprintf(f, "Set BasicDB %s/passwd.db\n", PREFIX); + fprintf(f, "Set CookieDB %s/passwd.db\n", PREFIX); fprintf(f, "Set HTTPPort 1024\n"); fprintf(f, "Set HTTPRoot %s\n", WEBROOT_PREFIX); fprintf(f, "\n"); fprintf(f, "Set HTTPMIME.html text/html\n"); fprintf(f, "Set HTTPMIME.gif image/gif\n"); fprintf(f, "\n"); - fprintf(f, "LoadModule %s/basic.so\n", MODULE_PREFIX); + fprintf(f, "LoadModule %s/cookie.so\n", MODULE_PREFIX); fprintf(f, "LoadModule %s/http.so\n", MODULE_PREFIX); fprintf(f, "LoadModule %s/subversion.so\n", MODULE_PREFIX); fprintf(f, "LoadModule %s/syslog.so\n", MODULE_PREFIX); diff --git a/Module/Makefile b/Module/Makefile index 24185c0..b536a03 100644 --- a/Module/Makefile +++ b/Module/Makefile @@ -10,7 +10,7 @@ ifeq ($(shell uname -s),Linux) EXTRA_LIBS += -ldl endif -all: ./subversion.so ./syslog.so ./http.so ./basic.so +all: ./subversion.so ./syslog.so ./http.so ./cookie.so ./%.so: ./%.o ./util.o $(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ $^ $(LIBS) $(EXTRA_LIBS) diff --git a/Module/basic.c b/Module/cookie.c similarity index 88% rename from Module/basic.c rename to Module/cookie.c index 1e3497c..629a718 100644 --- a/Module/basic.c +++ b/Module/cookie.c @@ -37,22 +37,22 @@ const char mod_type[] = MS_MOD_AUTH; -const char mod_auth_type[] = "Basic"; +const char mod_auth_type[] = "Cookie"; struct mandshurica_config* config; int mod_init(struct mandshurica_config* _config) { config = _config; - config->mandshurica_log(MS_INFO, "Basic authentication Module init"); + config->mandshurica_log(MS_INFO, "Cookie authentication Module init"); - char* db = config->mandshurica_get_param("BasicDB"); + char* db = config->mandshurica_get_param("CookieDB"); if(db == NULL) { - config->mandshurica_log(MS_ERROR, "Basic authentication Database path is not set!"); + config->mandshurica_log(MS_ERROR, "Cookie authentication Database path is not set!"); return 1; } - char* log = mandshurica_strcat("Basic authentication Database is ", db); + char* log = mandshurica_strcat("Cookie authentication Database is ", db); config->mandshurica_log(MS_INFO, log); free(log); diff --git a/Module/http.c b/Module/http.c index e85eed2..a7188b5 100644 --- a/Module/http.c +++ b/Module/http.c @@ -99,12 +99,13 @@ int mod_init(struct mandshurica_config* _config) { } config->mandshurica_log(MS_INFO, log); free(log); - free(auth); if(auth[0] == 0) { config->mandshurica_log(MS_ERROR, "Authentication module was not loaded!"); + free(auth); return 1; } + free(auth); return 0; } diff --git a/Webroot/index.html.tmpl b/Webroot/index.html.tmpl index cc83226..f16732b 100644 --- a/Webroot/index.html.tmpl +++ b/Webroot/index.html.tmpl @@ -8,5 +8,6 @@ vim: syntax=html

Mandshurica

+
-- 2.43.0