Hi All,

Here's the patch for the implementation of the logic.

Regards,
Arwin Arni

Index: subversion/libsvn_subr/config.c
===================================================================
--- subversion/libsvn_subr/config.c     (revision 1068869)
+++ subversion/libsvn_subr/config.c     (working copy)
@@ -78,7 +78,9 @@
 
 
 svn_error_t *
-svn_config_create(svn_config_t **cfgp, apr_pool_t *result_pool)
+svn_config_create(svn_config_t **cfgp,
+                  svn_boolean_t section_names_case_sensitive,
+                  apr_pool_t *result_pool)
 {
   svn_config_t *cfg = apr_palloc(result_pool, sizeof(*cfg));
 
@@ -88,19 +90,22 @@
   cfg->x_values = FALSE;
   cfg->tmp_key = svn_stringbuf_create("", result_pool);
   cfg->tmp_value = svn_stringbuf_create("", result_pool);
-
+  cfg->section_names_case_sensitive = section_names_case_sensitive; 
+  
   *cfgp = cfg;
   return SVN_NO_ERROR;
 }
 
 svn_error_t *
-svn_config_read(svn_config_t **cfgp, const char *file,
-                svn_boolean_t must_exist, apr_pool_t *pool)
+svn_config_read2(svn_config_t **cfgp, const char *file,
+                 svn_boolean_t must_exist, 
+                 svn_boolean_t section_names_case_sensitive,
+                 apr_pool_t *pool)
 {
   svn_config_t *cfg;
   svn_error_t *err;
 
-  SVN_ERR(svn_config_create(&cfg, pool));
+  SVN_ERR(svn_config_create(&cfg, section_names_case_sensitive, pool));
 
   /* Yes, this is platform-specific code in Subversion, but there's no
      practical way to migrate it into APR, as it's simultaneously
@@ -387,7 +392,8 @@
 
   /* Canonicalize the hash key */
   svn_stringbuf_set(cfg->tmp_key, section);
-  make_hash_key(cfg->tmp_key->data);
+  if (! cfg->section_names_case_sensitive)
+    make_hash_key(cfg->tmp_key->data);
 
   sec_ptr = apr_hash_get(cfg->sections, cfg->tmp_key->data,
                          cfg->tmp_key->len);
@@ -618,7 +624,10 @@
       /* Even the section doesn't exist. Create it. */
       sec = apr_palloc(cfg->pool, sizeof(*sec));
       sec->name = apr_pstrdup(cfg->pool, section);
-      sec->hash_key = make_hash_key(apr_pstrdup(cfg->pool, section));
+      if(cfg->section_names_case_sensitive)
+        sec->hash_key = sec->name;
+      else
+        sec->hash_key = make_hash_key(apr_pstrdup(cfg->pool, section));
       sec->options = apr_hash_make(cfg->pool);
       apr_hash_set(cfg->sections, sec->hash_key, APR_HASH_KEY_STRING, sec);
     }
Index: subversion/libsvn_subr/config_impl.h
===================================================================
--- subversion/libsvn_subr/config_impl.h        (revision 1068869)
+++ subversion/libsvn_subr/config_impl.h        (working copy)
@@ -63,6 +63,9 @@
   /* Temporary value used for expanded default values in svn_config_get.
      (Using a stringbuf so that frequent resetting is efficient.) */
   svn_stringbuf_t *tmp_value;
+
+  /* Specifies whether section names are populated case sensitively. */
+  svn_boolean_t section_names_case_sensitive;
 };
 
 
Index: subversion/libsvn_subr/deprecated.c
===================================================================
--- subversion/libsvn_subr/deprecated.c (revision 1068869)
+++ subversion/libsvn_subr/deprecated.c (working copy)
@@ -1064,3 +1064,16 @@
                                                      start, end, TRUE,
                                                      pool, pool));
 }
+
+/*** From config.c ***/
+
+svn_error_t *
+svn_config_read(svn_config_t **cfgp, const char *file,
+                svn_boolean_t must_exist,
+                apr_pool_t *pool)
+{
+  return svn_error_return(svn_config_read2(cfgp, file,
+                                           must_exist,
+                                           FALSE,
+                                           pool));
+}
Index: subversion/tests/cmdline/authz_tests.py
===================================================================
--- subversion/tests/cmdline/authz_tests.py     (revision 1068869)
+++ subversion/tests/cmdline/authz_tests.py     (working copy)
@@ -1084,7 +1084,6 @@
                                      [], 'ls', '-R',
                                      sbox.repo_url)
 
-@XFail()
 @Issue(3781)
 @Skip(svntest.main.is_ra_type_file)
 def case_sensitive_authz(sbox):
Index: subversion/include/svn_config.h
===================================================================
--- subversion/include/svn_config.h     (revision 1068869)
+++ subversion/include/svn_config.h     (working copy)
@@ -189,10 +189,14 @@
 /** Set @a *cfgp to an empty @c svn_config_t structure,
  * allocated in @a result_pool.
  *
+ * Pass TRUE to @a section_names_case_sensitive if 
+ * section names are to be populated case sensitively.
+ *
  * @since New in 1.7.
  */
 svn_error_t *
 svn_config_create(svn_config_t **cfgp,
+                  svn_boolean_t section_names_case_sensitive,
                   apr_pool_t *result_pool);
 
 /** Read configuration data from @a file (a file or registry path) into
@@ -200,8 +204,27 @@
  *
  * If @a file does not exist, then if @a must_exist, return an error,
  * otherwise return an empty @c svn_config_t.
+ * 
+ * If @a section_names_case_sensitive is TRUE, populate section name hashes 
+ * case sensitively.
+ * 
+ * @since New in 1.7.
  */
+
 svn_error_t *
+svn_config_read2(svn_config_t **cfgp,
+                 const char *file,
+                 svn_boolean_t must_exist,
+                 svn_boolean_t section_names_case_sensitive,
+                 apr_pool_t *pool);
+
+/** Similar to svn_config_read2, but always passes FALSE to 
+ * section_names_case_sensitive.
+ *
+ * @deprecated Provided for backward compatibility with 1.6 API.
+ */
+SVN_DEPRECATED
+svn_error_t *
 svn_config_read(svn_config_t **cfgp,
                 const char *file,
                 svn_boolean_t must_exist,
Index: subversion/libsvn_repos/authz.c
===================================================================
--- subversion/libsvn_repos/authz.c     (revision 1068869)
+++ subversion/libsvn_repos/authz.c     (working copy)
@@ -746,7 +746,7 @@
   baton.err = SVN_NO_ERROR;
 
   /* Load the rule file. */
-  SVN_ERR(svn_config_read(&authz->cfg, file, must_exist, pool));
+  SVN_ERR(svn_config_read2(&authz->cfg, file, must_exist, TRUE, pool));
   baton.config = authz->cfg;
 
   /* Step through the entire rule file, stopping on error. */
Fix Issue #3781 (Case sensitive authz).

* subversion/tests/cmdline/authz_tests.py
  (case_sensitive_authz): Removed XFail decorator.

* subversion/include/svn_config.h
  (svn_config_create) : Documented new parameter.
  (svn_config_read)   : Deprecated.
  (svn_config_read2)  : New function prototype, updated documentation.

* subversion/libsvn_subr/config_impl.h
  (svn_config_t): Added a new boolean called section_names_case_sensitive.

* subversion/libsvn_subr/deprecated.c
  (svn_config_read): New function that calls svn_config_read2
                     with section_names_case_sensitive as FALSE.

* subversion/libsvn_subr/config.c
  (svn_config_create): Added a parameter section_names_case_sensitive
                       which is used to initialize the config.
  (find_option, 
   svn_config_set)   : Added logic to make section names case sensitive.

  (svn_config_read)  : Deprecated.

  (svn_config_read2) : New function that deprecates svn_config_read.
                       Accepts a boolean section_names_case_sensitive,
                       and populates the section names case sensitively 
                       if TRUE.

* subversion/libsvn_repos/authz.c
  (svn_repos_authz_read) : Fixed the caller with 
                           section_names_case_sensitive as TRUE.

Patch by: Arwin Arni <arwin{_AT_}collab.net>
        

Reply via email to