Release a new version of the Apache module, with the context support. master
authorSteinar H. Gunderson <sesse@samfundet.no>
Tue, 15 Mar 2022 21:55:14 +0000 (22:55 +0100)
committerSteinar H. Gunderson <sesse@samfundet.no>
Tue, 15 Mar 2022 21:55:14 +0000 (22:55 +0100)
libapache2-mod-authz-itkacl-0.7/Makefile [moved from libapache2-mod-authz-itkacl-0.6/Makefile with 100% similarity]
libapache2-mod-authz-itkacl-0.7/debian/authz_itkacl.load [moved from libapache2-mod-authz-itkacl-0.6/debian/authz_itkacl.load with 100% similarity]
libapache2-mod-authz-itkacl-0.7/debian/changelog [moved from libapache2-mod-authz-itkacl-0.6/debian/changelog with 86% similarity]
libapache2-mod-authz-itkacl-0.7/debian/compat [moved from libapache2-mod-authz-itkacl-0.6/debian/compat with 100% similarity]
libapache2-mod-authz-itkacl-0.7/debian/control [moved from libapache2-mod-authz-itkacl-0.6/debian/control with 82% similarity]
libapache2-mod-authz-itkacl-0.7/debian/dirs [moved from libapache2-mod-authz-itkacl-0.6/debian/dirs with 100% similarity]
libapache2-mod-authz-itkacl-0.7/debian/rules [moved from libapache2-mod-authz-itkacl-0.6/debian/rules with 100% similarity]
libapache2-mod-authz-itkacl-0.7/mod_authz_itkacl.c [moved from libapache2-mod-authz-itkacl-0.6/mod_authz_itkacl.c with 86% similarity]

similarity index 86%
rename from libapache2-mod-authz-itkacl-0.6/debian/changelog
rename to libapache2-mod-authz-itkacl-0.7/debian/changelog
index 1a7b937c0a81607a5f6085494cd42efeb908959f..30c40952fe8a93d439b21632923126df1e86cdb1 100644 (file)
@@ -1,3 +1,10 @@
+libapache2-mod-authz-itkacl (0.7) unstable; urgency=medium
+
+  * Use the new context system, for increased performance.
+  * No longer depend on obsolete apache2-prefork-dev.
+
+ -- Steinar H. Gunderson <sesse@samfundet.no>  Tue, 15 Mar 2022 22:46:53 +0100
+
 libapache2-mod-authz-itkacl (0.6) unstable; urgency=medium
 
   * Update to Apache 2.4.
 libapache2-mod-authz-itkacl (0.6) unstable; urgency=medium
 
   * Update to Apache 2.4.
similarity index 82%
rename from libapache2-mod-authz-itkacl-0.6/debian/control
rename to libapache2-mod-authz-itkacl-0.7/debian/control
index 9a73611f990360737e65b0db653011f6f0d15920..832bc66ac8ac1233312f0d3a8d0d16ef1367c56a 100644 (file)
@@ -2,7 +2,7 @@ Source: libapache2-mod-authz-itkacl
 Section: web
 Priority: optional
 Maintainer: Steinar H. Gunderson <sesse@samfundet.no>
 Section: web
 Priority: optional
 Maintainer: Steinar H. Gunderson <sesse@samfundet.no>
-Build-Depends: debhelper (>= 7.0.0), apache2-prefork-dev, libitkacl-dev, dh-apache2 | apache2-dev
+Build-Depends: debhelper (>= 7.0.0), libitkacl-dev, dh-apache2 | apache2-dev
 Standards-Version: 3.9.1
 
 Package: libapache2-mod-authz-itkacl
 Standards-Version: 3.9.1
 
 Package: libapache2-mod-authz-itkacl
similarity index 86%
rename from libapache2-mod-authz-itkacl-0.6/mod_authz_itkacl.c
rename to libapache2-mod-authz-itkacl-0.7/mod_authz_itkacl.c
index 51ec224c00438326eceb4f6c9e1f062abad6f252..97017ef0693f06d6973af1a3c9138073192a8469 100644 (file)
@@ -1,8 +1,8 @@
 /*
 /*
- * ITKACL module, (C) 2004-2015 Steinar H. Gunderson
+ * ITKACL module, (C) 2004-2022 Steinar H. Gunderson
  */
 
  */
 
-#define MODAUTHITKACL_VERSION "0.6"
+#define MODAUTHITKACL_VERSION "0.7"
 
 #include "apr_strings.h"
 
 
 #include "apr_strings.h"
 
 #include "http_protocol.h"
 #include "http_request.h"
 #include "mod_auth.h"
 #include "http_protocol.h"
 #include "http_request.h"
 #include "mod_auth.h"
+#include "itkacl.h"
 
 module AP_MODULE_DECLARE_DATA authz_itkacl_module;
 
 module AP_MODULE_DECLARE_DATA authz_itkacl_module;
-
-extern int itkacl_check(const char * const realm, const char * const user,
-                       char *errmsg, size_t errmsg_size);
+static struct itkacl_ctx *ctx = NULL;
 
 static int handle_require(request_rec *r, const char *username, const char *acl_path)
 {
        char errmsg[1024];
        int ret;
 
 
 static int handle_require(request_rec *r, const char *username, const char *acl_path)
 {
        char errmsg[1024];
        int ret;
 
-       ret = itkacl_check(acl_path, username, errmsg, 1024);
+       ret = itkacl_check_with_ctx(ctx, acl_path, username, errmsg, 1024);
        if (ret == 0) {
                return AUTHZ_GRANTED;
        }
        if (ret == 0) {
                return AUTHZ_GRANTED;
        }
@@ -107,6 +106,17 @@ static authz_status authz_itkacl_authorize_user(request_rec *r, const char *requ
 static int authz_itkacl_init_handler(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
 {
        ap_add_version_component(p, "mod_auth_itkacl/" MODAUTHITKACL_VERSION);
 static int authz_itkacl_init_handler(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
 {
        ap_add_version_component(p, "mod_auth_itkacl/" MODAUTHITKACL_VERSION);
+       if (ctx != NULL) {
+               itkacl_free_ctx(ctx);
+       }
+       {
+               char errmsg[1024];
+               ctx = itkacl_create_ctx(errmsg, sizeof(errmsg));
+               if (ctx == NULL) {
+                       ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "Error while initializing libitkacl: %s", errmsg);
+                       return HTTP_INTERNAL_SERVER_ERROR;
+               }
+       }
        return OK;
 }
 
        return OK;
 }