httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1555543 - in /httpd/httpd/branches/2.4.x: ./ CHANGES STATUS docs/manual/ docs/manual/mod/ docs/manual/mod/mod_authz_groupfile.xml modules/aaa/mod_authz_groupfile.c
Date Sun, 05 Jan 2014 16:11:45 GMT
Author: jim
Date: Sun Jan  5 16:11:44 2014
New Revision: 1555543

URL: http://svn.apache.org/r1555543
Log:
Merge r1554175, r1554184 from trunk:

mod_authnz_groupfile: Support the expression parser within the require directives.


Pass the correct pointer that made it past the test suite.

Submitted by: minfrin
Reviewed/backported by: jim

Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/CHANGES
    httpd/httpd/branches/2.4.x/STATUS
    httpd/httpd/branches/2.4.x/docs/manual/   (props changed)
    httpd/httpd/branches/2.4.x/docs/manual/mod/   (props changed)
    httpd/httpd/branches/2.4.x/docs/manual/mod/mod_authz_groupfile.xml
    httpd/httpd/branches/2.4.x/modules/aaa/mod_authz_groupfile.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1554175,1554184

Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1555543&r1=1555542&r2=1555543&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Sun Jan  5 16:11:44 2014
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.4.8
 
+  *) mod_authnz_groupfile: Support the expression parser within the require
+     directives. [Graham Leggett]
+
   *) mod_authnz_dbm: Support the expression parser within the require
      directives. [Graham Leggett]
 

Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1555543&r1=1555542&r2=1555543&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Sun Jan  5 16:11:44 2014
@@ -98,18 +98,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  * mod_authz_dbm: Support the expression parser within the require directives.
-    trunk patch: http://svn.apache.org/r1554170
-                 http://svn.apache.org/r1554181
-    2.4.x patch: trunk works (modulo CHANGES and log-message-tags)
-    +1: minfrin, jim, covener
-
-  * mod_authz_groupfile: Support the expression parser within the require directives.
-    trunk patch: http://svn.apache.org/r1554175
-                 http://svn.apache.org/r1554184
-    2.4.x patch: trunk works (modulo CHANGES and log-message-tags)
-    +1: minfrin, jim, covener
-
   * mod_authz_host: Support the expression parser within the require directives.
     trunk patch: http://svn.apache.org/r1554188
     2.4.x patch: trunk works (modulo CHANGES and log-message-tags)

Propchange: httpd/httpd/branches/2.4.x/docs/manual/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk/docs/manual:r1554175

Propchange: httpd/httpd/branches/2.4.x/docs/manual/mod/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk/docs/manual/mod:r1554175

Modified: httpd/httpd/branches/2.4.x/docs/manual/mod/mod_authz_groupfile.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/docs/manual/mod/mod_authz_groupfile.xml?rev=1555543&r1=1555542&r2=1555543&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/docs/manual/mod/mod_authz_groupfile.xml (original)
+++ httpd/httpd/branches/2.4.x/docs/manual/mod/mod_authz_groupfile.xml Sun Jan  5 16:11:44
2014
@@ -38,6 +38,41 @@
 
 <seealso><directive module="mod_authz_core">Require</directive></seealso>
 
+<section id="requiredirectives"><title>The Require Directives</title>
+
+    <p>Apache's <directive module="mod_authz_core">Require</directive>
+    directives are used during the authorization phase to ensure that
+    a user is allowed to access a resource.  mod_authz_groupfile extends the
+    authorization types with <code>group</code> and <code>group-file</code>.
+    </p>
+
+    <p>Since v2.5.0, <a href="../expr.html">expressions</a> are supported
+    within the groupfile require directives.</p>
+
+<section id="reqgroup"><title>Require group</title>
+
+    <p>This directive specifies group membership that is required for the
+    user to gain access.</p>
+
+    <highlight language="config">
+      Require group admin
+    </highlight>
+
+</section>
+
+<section id="reqfilegroup"><title>Require file-group</title>
+
+    <p>When this directive is specified, the user must be a member of the group
+    assigned to the file being accessed.</p>
+
+    <highlight language="config">
+      Require file-group
+    </highlight>
+
+</section>
+
+</section>
+
 <directivesynopsis>
 <name>AuthGroupFile</name>
 <description>Sets the name of a text file containing the list

Modified: httpd/httpd/branches/2.4.x/modules/aaa/mod_authz_groupfile.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/aaa/mod_authz_groupfile.c?rev=1555543&r1=1555542&r2=1555543&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/aaa/mod_authz_groupfile.c (original)
+++ httpd/httpd/branches/2.4.x/modules/aaa/mod_authz_groupfile.c Sun Jan  5 16:11:44 2014
@@ -139,6 +139,11 @@ static authz_status group_check_authoriz
     authz_groupfile_config_rec *conf = ap_get_module_config(r->per_dir_config,
             &authz_groupfile_module);
     char *user = r->user;
+
+    const char *err = NULL;
+    const ap_expr_info_t *expr = parsed_require_args;
+    const char *require;
+
     const char *t, *w;
     apr_table_t *grpstatus = NULL;
     apr_status_t status;
@@ -175,7 +180,15 @@ static authz_status group_check_authoriz
         return AUTHZ_DENIED;
     }
 
-    t = require_args;
+    require = ap_expr_str_exec(r, expr, &err);
+    if (err) {
+        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02592)
+                      "authz_groupfile authorize: require group: Can't "
+                      "evaluate require expression: %s", err);
+        return AUTHZ_DENIED;
+    }
+
+    t = require;
     while ((w = ap_getword_conf(r->pool, &t)) && w[0]) {
         if (apr_table_get(grpstatus, w)) {
             return AUTHZ_GRANTED;
@@ -257,10 +270,29 @@ static authz_status filegroup_check_auth
     return AUTHZ_DENIED;
 }
 
+static const char *groupfile_parse_config(cmd_parms *cmd, const char *require_line,
+                                          const void **parsed_require_line)
+{
+    const char *expr_err = NULL;
+    ap_expr_info_t *expr = apr_pcalloc(cmd->pool, sizeof(*expr));
+
+    expr = ap_expr_parse_cmd(cmd, require_line, AP_EXPR_FLAG_STRING_RESULT,
+            &expr_err, NULL);
+
+    if (expr_err)
+        return apr_pstrcat(cmd->temp_pool,
+                           "Cannot parse expression in require line: ",
+                           expr_err, NULL);
+
+    *parsed_require_line = expr;
+
+    return NULL;
+}
+
 static const authz_provider authz_group_provider =
 {
     &group_check_authorization,
-    NULL,
+    &groupfile_parse_config,
 };
 
 static const authz_provider authz_filegroup_provider =



Mime
View raw message