You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2018/05/07 17:30:32 UTC

svn commit: r1831112 - /subversion/trunk/subversion/tests/libsvn_repos/authz-test.c

Author: philip
Date: Mon May  7 17:30:32 2018
New Revision: 1831112

URL: http://svn.apache.org/viewvc?rev=1831112&view=rev
Log:
* subversion/tests/libsvn_repos/authz-test.c
  (issue_4741_groups): New, regression test for issue 4741.
  (test_funcs): Add new test.

Modified:
    subversion/trunk/subversion/tests/libsvn_repos/authz-test.c

Modified: subversion/trunk/subversion/tests/libsvn_repos/authz-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_repos/authz-test.c?rev=1831112&r1=1831111&r2=1831112&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_repos/authz-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_repos/authz-test.c Mon May  7 17:30:32 2018
@@ -444,6 +444,40 @@ test_global_rights(apr_pool_t *pool)
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+issue_4741_groups(apr_pool_t *pool)
+{
+   const char rules[] =
+     "[groups]"      NL
+     "g1 = userA"    NL
+     "g2 = userB"    NL
+     "g = @g1, @g2"  NL
+     ""              NL
+     "[/]"           NL
+     "* ="           NL
+     "@g = rw"       NL
+     ;
+
+   svn_stringbuf_t *buf = svn_stringbuf_create(rules, pool);
+   svn_stream_t *stream = svn_stream_from_stringbuf(buf, pool);
+   svn_authz_t *authz;
+   svn_boolean_t access_granted;
+
+   SVN_ERR(svn_repos_authz_parse(&authz, stream, NULL, pool));
+
+   SVN_ERR(svn_repos_authz_check_access(authz, "repo", "/", "userA",
+                                        svn_authz_write, &access_granted,
+                                        pool));
+   SVN_TEST_ASSERT(access_granted == TRUE);
+
+   SVN_ERR(svn_repos_authz_check_access(authz, "repo", "/", "userB",
+                                        svn_authz_write, &access_granted,
+                                        pool));
+   SVN_TEST_ASSERT(access_granted == TRUE);
+
+   return SVN_NO_ERROR;
+}
+
 static int max_threads = 4;
 
 static struct svn_test_descriptor_t test_funcs[] =
@@ -453,6 +487,8 @@ static struct svn_test_descriptor_t test
                        "test svn_authz__parse"),
     SVN_TEST_PASS2(test_global_rights,
                    "test svn_authz__get_global_rights"),
+    SVN_TEST_PASS2(issue_4741_groups,
+                   "issue 4741 groups"),
     SVN_TEST_NULL
   };