]> Nishi Git Mirror - mandshurica.git/commitdiff
changing basic auth to cookie auth
authornishi <nishi@f982e544-4a7d-3444-ad1a-fde59a2a69f1>
Fri, 19 Apr 2024 23:37:52 +0000 (23:37 +0000)
committernishi <nishi@f982e544-4a7d-3444-ad1a-fde59a2a69f1>
Fri, 19 Apr 2024 23:37:52 +0000 (23:37 +0000)
git-svn-id: file:///raid/svn-main/nishi-mandshurica/trunk@42 f982e544-4a7d-3444-ad1a-fde59a2a69f1

Mandshurica/config.c
Module/Makefile
Module/cookie.c [moved from Module/basic.c with 88% similarity]
Module/http.c
Webroot/index.html.tmpl

index 35dd6b1f4e1371c8e0f27c069a8dd51d9b4fc837..093b44d5039668eb152f031f8885a8fc056aba97 100644 (file)
@@ -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);
index 24185c05fcfe28b20c1014b0b2a3a92a9346935c..b536a03d2c23bc26b48a9646de676831be435bf3 100644 (file)
@@ -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)
similarity index 88%
rename from Module/basic.c
rename to Module/cookie.c
index 1e3497c144c518b9fc383ec9349474cadef800b7..629a718070571040798b652f871f2bbe4b44b58c 100644 (file)
 
 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);
 
index e85eed2d9d9f76564ea96f50fb6665f132df01cb..a7188b5a2af83c6b3c35502de18353e5fcd21517 100644 (file)
@@ -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;
 }
index cc832268f0a53eadc1e3a3a215f3dc0ab1135f4f..f16732ba721ec5ea05920f2383e486ce1b1a7838 100644 (file)
@@ -8,5 +8,6 @@ vim: syntax=html
        <body>
                <img src="/mandshurica.gif">
                <h1>Mandshurica</h1>
+               <hr>
        </body>
 </html>