Author: breser Date: Fri May 3 21:21:54 2013 New Revision: 1478983 URL: http://svn.apache.org/r1478983 Log: Merge the r1475772 group from trunk:
* r1475772, r1476092, r1478897 Fix a bug in authz file processing where group and user names were not treated case-sensitively, which could lead to unpredictable results depending on the ordering of the authz config entries. See http://subversion.tigris.org/issues/show_bug.cgi?id=4361 Justification: See above about unpredictable results. A related fix for repository paths handling was made in 1.7.0. Notes: r1476092 and r1478897 (obvious fix) are the CHANGES updates. Votes: +1: brane +1: philip, cmpilato (for 1.8.0 only, not later 1.8.x) Modified: subversion/branches/1.8.x/ (props changed) subversion/branches/1.8.x/CHANGES subversion/branches/1.8.x/STATUS subversion/branches/1.8.x/subversion/include/svn_config.h subversion/branches/1.8.x/subversion/libsvn_fs_fs/fs_fs.c subversion/branches/1.8.x/subversion/libsvn_repos/authz.c subversion/branches/1.8.x/subversion/libsvn_repos/hooks.c subversion/branches/1.8.x/subversion/libsvn_subr/config.c subversion/branches/1.8.x/subversion/libsvn_subr/config_impl.h subversion/branches/1.8.x/subversion/libsvn_subr/deprecated.c subversion/branches/1.8.x/subversion/svnserve/serve.c subversion/branches/1.8.x/subversion/svnserve/svnserve.c subversion/branches/1.8.x/subversion/tests/libsvn_subr/cache-test.c subversion/branches/1.8.x/subversion/tests/libsvn_subr/config-test.c subversion/branches/1.8.x/subversion/tests/libsvn_subr/config-test.cfg subversion/branches/1.8.x/tools/server-side/mod_dontdothat/mod_dontdothat.c Propchange: subversion/branches/1.8.x/ ------------------------------------------------------------------------------ Merged /subversion/trunk:r1475772,1476092,1478897 Modified: subversion/branches/1.8.x/CHANGES URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/CHANGES?rev=1478983&r1=1478982&r2=1478983&view=diff ============================================================================== --- subversion/branches/1.8.x/CHANGES (original) +++ subversion/branches/1.8.x/CHANGES Fri May 3 21:21:54 2013 @@ -55,6 +55,7 @@ http://svn.apache.org/repos/asf/subversi - Server-side bugfixes: * SVNParentPath / repository listing now authz-filtered (r1408184) + * user and group names in the authz config file are case-sensitive (r1475772) - Other tool improvements and bugfixes: * 'svnmucc' promoted to first-class supported utility (issue #3308) Modified: subversion/branches/1.8.x/STATUS URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1478983&r1=1478982&r2=1478983&view=diff ============================================================================== --- subversion/branches/1.8.x/STATUS (original) +++ subversion/branches/1.8.x/STATUS Fri May 3 21:21:54 2013 @@ -87,16 +87,3 @@ Veto-blocked changes: Approved changes: ================= - * r1475772, r1476092, r1478897 - Fix a bug in authz file processing where group and user names were - not treated case-sensitively, which could lead to unpredictable - results depending on the ordering of the authz config entries. - See http://subversion.tigris.org/issues/show_bug.cgi?id=4361 - Justification: - See above about unpredictable results. A related fix for - repository paths handling was made in 1.7.0. - Notes: - r1476092 and r1478897 (obvious fix) are the CHANGES updates. - Votes: - +1: brane - +1: philip, cmpilato (for 1.8.0 only, not later 1.8.x) Modified: subversion/branches/1.8.x/subversion/include/svn_config.h URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/include/svn_config.h?rev=1478983&r1=1478982&r2=1478983&view=diff ============================================================================== --- subversion/branches/1.8.x/subversion/include/svn_config.h (original) +++ subversion/branches/1.8.x/subversion/include/svn_config.h Fri May 3 21:21:54 2013 @@ -211,15 +211,30 @@ svn_config_get_config(apr_hash_t **cfg_h const char *config_dir, apr_pool_t *pool); - /** 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. * + * Pass TRUE to @a option_names_case_sensitive if + * option names are to be populated case sensitively. + * + * @since New in 1.8. + */ +svn_error_t * +svn_config_create2(svn_config_t **cfgp, + svn_boolean_t section_names_case_sensitive, + svn_boolean_t option_names_case_sensitive, + apr_pool_t *result_pool); + +/** Similar to svn_config_create2, but always passes @c FALSE to + * @a option_names_case_sensitive. + * * @since New in 1.7. + * @deprecated Provided for backward compatibility with 1.7 API. */ +SVN_DEPRECATED svn_error_t * svn_config_create(svn_config_t **cfgp, svn_boolean_t section_names_case_sensitive, @@ -234,18 +249,35 @@ svn_config_create(svn_config_t **cfgp, * If @a section_names_case_sensitive is @c TRUE, populate section name hashes * case sensitively, except for the default #SVN_CONFIG__DEFAULT_SECTION. * - * @since New in 1.7. + * If @a option_names_case_sensitive is @c TRUE, populate option name hashes + * case sensitively. + * + * @since New in 1.8. */ +svn_error_t * +svn_config_read3(svn_config_t **cfgp, + const char *file, + svn_boolean_t must_exist, + svn_boolean_t section_names_case_sensitive, + svn_boolean_t option_names_case_sensitive, + apr_pool_t *result_pool); +/** Similar to svn_config_read3, but always passes @c FALSE to + * @a option_names_case_sensitive. + * + * @since New in 1.7. + * @deprecated Provided for backward compatibility with 1.7 API. + */ +SVN_DEPRECATED 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); + apr_pool_t *result_pool); /** Similar to svn_config_read2, but always passes @c FALSE to - * section_names_case_sensitive. + * @a section_names_case_sensitive. * * @deprecated Provided for backward compatibility with 1.6 API. */ @@ -254,7 +286,7 @@ svn_error_t * svn_config_read(svn_config_t **cfgp, const char *file, svn_boolean_t must_exist, - apr_pool_t *pool); + apr_pool_t *result_pool); /** Read configuration data from @a stream into @a *cfgp, allocated in * @a result_pool. @@ -262,6 +294,9 @@ svn_config_read(svn_config_t **cfgp, * If @a section_names_case_sensitive is @c TRUE, populate section name hashes * case sensitively, except for the default #SVN_CONFIG__DEFAULT_SECTION. * + * If @a option_names_case_sensitive is @c TRUE, populate option name hashes + * case sensitively. + * * @since New in 1.8. */ @@ -269,6 +304,7 @@ svn_error_t * svn_config_parse(svn_config_t **cfgp, svn_stream_t *stream, svn_boolean_t section_names_case_sensitive, + svn_boolean_t option_names_case_sensitive, apr_pool_t *result_pool); /** Like svn_config_read(), but merges the configuration data from @a file Modified: subversion/branches/1.8.x/subversion/libsvn_fs_fs/fs_fs.c URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_fs_fs/fs_fs.c?rev=1478983&r1=1478982&r2=1478983&view=diff ============================================================================== --- subversion/branches/1.8.x/subversion/libsvn_fs_fs/fs_fs.c (original) +++ subversion/branches/1.8.x/subversion/libsvn_fs_fs/fs_fs.c Fri May 3 21:21:54 2013 @@ -1157,9 +1157,9 @@ read_config(fs_fs_data_t *ffd, const char *fs_path, apr_pool_t *pool) { - SVN_ERR(svn_config_read2(&ffd->config, + SVN_ERR(svn_config_read3(&ffd->config, svn_dirent_join(fs_path, PATH_CONFIG, pool), - FALSE, FALSE, pool)); + FALSE, FALSE, FALSE, pool)); /* Initialize ffd->rep_sharing_allowed. */ if (ffd->format >= SVN_FS_FS__MIN_REP_SHARING_FORMAT) Modified: subversion/branches/1.8.x/subversion/libsvn_repos/authz.c URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_repos/authz.c?rev=1478983&r1=1478982&r2=1478983&view=diff ============================================================================== --- subversion/branches/1.8.x/subversion/libsvn_repos/authz.c (original) +++ subversion/branches/1.8.x/subversion/libsvn_repos/authz.c Fri May 3 21:21:54 2013 @@ -824,7 +824,7 @@ authz_retrieve_config_repo(svn_config_t { if (!must_exist) { - SVN_ERR(svn_config_create(cfg_p, TRUE, result_pool)); + SVN_ERR(svn_config_create2(cfg_p, TRUE, TRUE, result_pool)); return SVN_NO_ERROR; } else @@ -842,7 +842,7 @@ authz_retrieve_config_repo(svn_config_t } SVN_ERR(svn_fs_file_contents(&contents, root, fs_path, scratch_pool)); - err = svn_config_parse(cfg_p, contents, TRUE, result_pool); + err = svn_config_parse(cfg_p, contents, TRUE, TRUE, result_pool); /* Add the URL to the error stack since the parser doesn't have it. */ if (err != SVN_NO_ERROR) @@ -891,7 +891,7 @@ authz_retrieve_config(svn_config_t **cfg else { /* Outside of repo file or Windows registry*/ - SVN_ERR(svn_config_read2(cfg_p, path, must_exist, TRUE, pool)); + SVN_ERR(svn_config_read3(cfg_p, path, must_exist, TRUE, TRUE, pool)); } return SVN_NO_ERROR; @@ -944,7 +944,7 @@ svn_repos__authz_read(svn_authz_t **auth if (accept_urls) SVN_ERR(authz_retrieve_config(&authz->cfg, path, must_exist, pool)); else - SVN_ERR(svn_config_read2(&authz->cfg, path, must_exist, TRUE, pool)); + SVN_ERR(svn_config_read3(&authz->cfg, path, must_exist, TRUE, TRUE, pool)); if (groups_path) { @@ -956,8 +956,8 @@ svn_repos__authz_read(svn_authz_t **auth SVN_ERR(authz_retrieve_config(&groups_cfg, groups_path, must_exist, pool)); else - SVN_ERR(svn_config_read2(&groups_cfg, groups_path, must_exist, - TRUE, pool)); + SVN_ERR(svn_config_read3(&groups_cfg, groups_path, must_exist, + TRUE, TRUE, pool)); /* Copy the groups from groups_cfg into authz. */ err = authz_copy_groups(authz, groups_cfg, pool); @@ -998,14 +998,14 @@ svn_repos_authz_parse(svn_authz_t **auth svn_authz_t *authz = apr_palloc(pool, sizeof(*authz)); /* Parse the authz stream */ - SVN_ERR(svn_config_parse(&authz->cfg, stream, TRUE, pool)); + SVN_ERR(svn_config_parse(&authz->cfg, stream, TRUE, TRUE, pool)); if (groups_stream) { svn_config_t *groups_cfg; /* Parse the groups stream */ - SVN_ERR(svn_config_parse(&groups_cfg, groups_stream, TRUE, pool)); + SVN_ERR(svn_config_parse(&groups_cfg, groups_stream, TRUE, TRUE, pool)); SVN_ERR(authz_copy_groups(authz, groups_cfg, pool)); } Modified: subversion/branches/1.8.x/subversion/libsvn_repos/hooks.c URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_repos/hooks.c?rev=1478983&r1=1478982&r2=1478983&view=diff ============================================================================== --- subversion/branches/1.8.x/subversion/libsvn_repos/hooks.c (original) +++ subversion/branches/1.8.x/subversion/libsvn_repos/hooks.c Fri May 3 21:21:54 2013 @@ -421,7 +421,8 @@ svn_repos__parse_hooks_env(apr_hash_t ** if (local_abspath) { - SVN_ERR(svn_config_read2(&cfg, local_abspath, FALSE, TRUE, scratch_pool)); + SVN_ERR(svn_config_read3(&cfg, local_abspath, FALSE, + TRUE, TRUE, scratch_pool)); b.cfg = cfg; b.hooks_env = apr_hash_make(result_pool); (void)svn_config_enumerate_sections2(cfg, parse_hooks_env_section, &b, Modified: subversion/branches/1.8.x/subversion/libsvn_subr/config.c URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_subr/config.c?rev=1478983&r1=1478982&r2=1478983&view=diff ============================================================================== --- subversion/branches/1.8.x/subversion/libsvn_subr/config.c (original) +++ subversion/branches/1.8.x/subversion/libsvn_subr/config.c Fri May 3 21:21:54 2013 @@ -77,9 +77,10 @@ struct cfg_option_t svn_error_t * -svn_config_create(svn_config_t **cfgp, - svn_boolean_t section_names_case_sensitive, - apr_pool_t *result_pool) +svn_config_create2(svn_config_t **cfgp, + svn_boolean_t section_names_case_sensitive, + svn_boolean_t option_names_case_sensitive, + apr_pool_t *result_pool) { svn_config_t *cfg = apr_palloc(result_pool, sizeof(*cfg)); @@ -90,21 +91,26 @@ svn_config_create(svn_config_t **cfgp, cfg->tmp_key = svn_stringbuf_create_empty(result_pool); cfg->tmp_value = svn_stringbuf_create_empty(result_pool); cfg->section_names_case_sensitive = section_names_case_sensitive; + cfg->option_names_case_sensitive = option_names_case_sensitive; *cfgp = cfg; return SVN_NO_ERROR; } svn_error_t * -svn_config_read2(svn_config_t **cfgp, const char *file, +svn_config_read3(svn_config_t **cfgp, const char *file, svn_boolean_t must_exist, svn_boolean_t section_names_case_sensitive, - apr_pool_t *pool) + svn_boolean_t option_names_case_sensitive, + apr_pool_t *result_pool) { svn_config_t *cfg; svn_error_t *err; - SVN_ERR(svn_config_create(&cfg, section_names_case_sensitive, pool)); + SVN_ERR(svn_config_create2(&cfg, + section_names_case_sensitive, + option_names_case_sensitive, + result_pool)); /* Yes, this is platform-specific code in Subversion, but there's no practical way to migrate it into APR, as it's simultaneously @@ -114,10 +120,10 @@ svn_config_read2(svn_config_t **cfgp, co #ifdef WIN32 if (0 == strncmp(file, SVN_REGISTRY_PREFIX, SVN_REGISTRY_PREFIX_LEN)) err = svn_config__parse_registry(cfg, file + SVN_REGISTRY_PREFIX_LEN, - must_exist, pool); + must_exist, result_pool); else #endif /* WIN32 */ - err = svn_config__parse_file(cfg, file, must_exist, pool); + err = svn_config__parse_file(cfg, file, must_exist, result_pool); if (err != SVN_NO_ERROR) return err; @@ -130,13 +136,17 @@ svn_config_read2(svn_config_t **cfgp, co svn_error_t * svn_config_parse(svn_config_t **cfgp, svn_stream_t *stream, svn_boolean_t section_names_case_sensitive, + svn_boolean_t option_names_case_sensitive, apr_pool_t *result_pool) { svn_config_t *cfg; svn_error_t *err; apr_pool_t *scratch_pool = svn_pool_create(result_pool); - err = svn_config_create(&cfg, section_names_case_sensitive, result_pool); + err = svn_config_create2(&cfg, + section_names_case_sensitive, + option_names_case_sensitive, + result_pool); if (err == SVN_NO_ERROR) err = svn_config__parse_stream(cfg, stream, result_pool, scratch_pool); @@ -189,7 +199,8 @@ read_all(svn_config_t **cfgp, SVN_ERR(svn_config_merge(*cfgp, sys_file_path, FALSE)); else { - SVN_ERR(svn_config_read2(cfgp, sys_file_path, FALSE, FALSE, pool)); + SVN_ERR(svn_config_read3(cfgp, sys_file_path, + FALSE, FALSE, FALSE, pool)); red_config = TRUE; } } @@ -216,13 +227,14 @@ read_all(svn_config_t **cfgp, SVN_ERR(svn_config_merge(*cfgp, usr_file_path, FALSE)); else { - SVN_ERR(svn_config_read2(cfgp, usr_file_path, FALSE, FALSE, pool)); + SVN_ERR(svn_config_read3(cfgp, usr_file_path, + FALSE, FALSE, FALSE, pool)); red_config = TRUE; } } if (! red_config) - SVN_ERR(svn_config_create(cfgp, FALSE, pool)); + SVN_ERR(svn_config_create2(cfgp, FALSE, FALSE, pool)); return SVN_NO_ERROR; } @@ -352,7 +364,10 @@ svn_config_merge(svn_config_t *cfg, cons ### We could use a tmp subpool for this, since merge_cfg is going to be tossed afterwards. Premature optimization, though? */ svn_config_t *merge_cfg; - SVN_ERR(svn_config_read2(&merge_cfg, file, must_exist, FALSE, cfg->pool)); + SVN_ERR(svn_config_read3(&merge_cfg, file, must_exist, + cfg->section_names_case_sensitive, + cfg->option_names_case_sensitive, + cfg->pool)); /* Now copy the new options into the original table. */ for_each_option(merge_cfg, cfg, merge_cfg->pool, merge_callback); @@ -427,7 +442,8 @@ find_option(svn_config_t *cfg, const cha /* Canonicalize the option key */ svn_stringbuf_set(cfg->tmp_key, option); - make_hash_key(cfg->tmp_key->data); + if (! cfg->option_names_case_sensitive) + make_hash_key(cfg->tmp_key->data); opt = apr_hash_get(sec->options, cfg->tmp_key->data, cfg->tmp_key->len); @@ -606,13 +622,17 @@ static void svn_config_create_option(cfg_option_t **opt, const char *option, const char *value, + svn_boolean_t option_names_case_sensitive, apr_pool_t *pool) { cfg_option_t *o; o = apr_palloc(pool, sizeof(cfg_option_t)); o->name = apr_pstrdup(pool, option); - o->hash_key = make_hash_key(apr_pstrdup(pool, option)); + if(option_names_case_sensitive) + o->hash_key = o->name; + else + o->hash_key = make_hash_key(apr_pstrdup(pool, option)); o->value = apr_pstrdup(pool, value); o->x_value = NULL; @@ -677,7 +697,9 @@ svn_config_set(svn_config_t *cfg, } /* Create a new option */ - svn_config_create_option(&opt, option, value, cfg->pool); + svn_config_create_option(&opt, option, value, + cfg->option_names_case_sensitive, + cfg->pool); if (sec == NULL) { @@ -1043,10 +1065,11 @@ svn_config_dup(svn_config_t **cfgp, apr_hash_index_t *optidx; *cfgp = 0; - SVN_ERR(svn_config_create(cfgp, FALSE, pool)); + SVN_ERR(svn_config_create2(cfgp, FALSE, FALSE, pool)); (*cfgp)->x_values = src->x_values; (*cfgp)->section_names_case_sensitive = src->section_names_case_sensitive; + (*cfgp)->option_names_case_sensitive = src->option_names_case_sensitive; for (sectidx = apr_hash_first(pool, src->sections); sectidx != NULL; @@ -1076,7 +1099,9 @@ svn_config_dup(svn_config_t **cfgp, apr_hash_this(optidx, &optkey, &optkeyLength, &optval); srcopt = optval; - svn_config_create_option(&destopt, srcopt->name, srcopt->value, pool); + svn_config_create_option(&destopt, srcopt->name, srcopt->value, + (*cfgp)->option_names_case_sensitive, + pool); destopt->value = apr_pstrdup(pool, srcopt->value); destopt->x_value = apr_pstrdup(pool, srcopt->x_value); Modified: subversion/branches/1.8.x/subversion/libsvn_subr/config_impl.h URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_subr/config_impl.h?rev=1478983&r1=1478982&r2=1478983&view=diff ============================================================================== --- subversion/branches/1.8.x/subversion/libsvn_subr/config_impl.h (original) +++ subversion/branches/1.8.x/subversion/libsvn_subr/config_impl.h Fri May 3 21:21:54 2013 @@ -67,6 +67,9 @@ struct svn_config_t /* Specifies whether section names are populated case sensitively. */ svn_boolean_t section_names_case_sensitive; + + /* Specifies whether option names are populated case sensitively. */ + svn_boolean_t option_names_case_sensitive; }; Modified: subversion/branches/1.8.x/subversion/libsvn_subr/deprecated.c URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_subr/deprecated.c?rev=1478983&r1=1478982&r2=1478983&view=diff ============================================================================== --- subversion/branches/1.8.x/subversion/libsvn_subr/deprecated.c (original) +++ subversion/branches/1.8.x/subversion/libsvn_subr/deprecated.c Fri May 3 21:21:54 2013 @@ -1176,16 +1176,39 @@ svn_mergeinfo_intersect(svn_mergeinfo_t } /*** From config.c ***/ +svn_error_t * +svn_config_create(svn_config_t **cfgp, + svn_boolean_t section_names_case_sensitive, + apr_pool_t *result_pool) +{ + return svn_error_trace(svn_config_create2(cfgp, + section_names_case_sensitive, + FALSE, + result_pool)); +} + +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 *result_pool) +{ + return svn_error_trace(svn_config_read3(cfgp, file, + must_exist, + section_names_case_sensitive, + FALSE, + result_pool)); +} svn_error_t * svn_config_read(svn_config_t **cfgp, const char *file, svn_boolean_t must_exist, - apr_pool_t *pool) + apr_pool_t *result_pool) { - return svn_error_trace(svn_config_read2(cfgp, file, + return svn_error_trace(svn_config_read3(cfgp, file, must_exist, - FALSE, - pool)); + FALSE, FALSE, + result_pool)); } #ifdef SVN_DISABLE_FULL_VERSION_MATCH Modified: subversion/branches/1.8.x/subversion/svnserve/serve.c URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/svnserve/serve.c?rev=1478983&r1=1478982&r2=1478983&view=diff ============================================================================== --- subversion/branches/1.8.x/subversion/svnserve/serve.c (original) +++ subversion/branches/1.8.x/subversion/svnserve/serve.c Fri May 3 21:21:54 2013 @@ -276,7 +276,8 @@ svn_error_t *load_pwdb_config(server_bat pwdb_path = svn_dirent_internal_style(pwdb_path, pool); pwdb_path = svn_dirent_join(server->base, pwdb_path, pool); - err = svn_config_read2(&server->pwdb, pwdb_path, TRUE, FALSE, pool); + err = svn_config_read3(&server->pwdb, pwdb_path, TRUE, + FALSE, FALSE, pool); if (err) { log_server_error(err, server, conn, pool); @@ -3286,9 +3287,10 @@ static svn_error_t *find_repos(const cha { b->base = svn_repos_conf_dir(b->repos, pool); - SVN_ERR(svn_config_read2(&b->cfg, svn_repos_svnserve_conf(b->repos, pool), + SVN_ERR(svn_config_read3(&b->cfg, svn_repos_svnserve_conf(b->repos, pool), FALSE, /* must_exist */ FALSE, /* section_names_case_sensitive */ + FALSE, /* option_names_case_sensitive */ pool)); SVN_ERR(load_pwdb_config(b, conn, pool)); SVN_ERR(load_authz_config(b, conn, repos_root, pool)); Modified: subversion/branches/1.8.x/subversion/svnserve/svnserve.c URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/svnserve/svnserve.c?rev=1478983&r1=1478982&r2=1478983&view=diff ============================================================================== --- subversion/branches/1.8.x/subversion/svnserve/svnserve.c (original) +++ subversion/branches/1.8.x/subversion/svnserve/svnserve.c Fri May 3 21:21:54 2013 @@ -755,9 +755,10 @@ int main(int argc, const char *argv[]) { params.base = svn_dirent_dirname(config_filename, pool); - SVN_INT_ERR(svn_config_read2(¶ms.cfg, config_filename, + SVN_INT_ERR(svn_config_read3(¶ms.cfg, config_filename, TRUE, /* must_exist */ FALSE, /* section_names_case_sensitive */ + FALSE, /* option_names_case_sensitive */ pool)); } Modified: subversion/branches/1.8.x/subversion/tests/libsvn_subr/cache-test.c URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/tests/libsvn_subr/cache-test.c?rev=1478983&r1=1478982&r2=1478983&view=diff ============================================================================== --- subversion/branches/1.8.x/subversion/tests/libsvn_subr/cache-test.c (original) +++ subversion/branches/1.8.x/subversion/tests/libsvn_subr/cache-test.c Fri May 3 21:21:54 2013 @@ -155,8 +155,8 @@ test_memcache_basic(const svn_test_opts_ if (opts->config_file) { - SVN_ERR(svn_config_read2(&config, opts->config_file, - TRUE, FALSE, pool)); + SVN_ERR(svn_config_read3(&config, opts->config_file, + TRUE, FALSE, FALSE, pool)); SVN_ERR(svn_cache__make_memcache_from_config(&memcache, config, pool)); } @@ -223,8 +223,8 @@ test_memcache_long_key(const svn_test_op if (opts->config_file) { - SVN_ERR(svn_config_read2(&config, opts->config_file, - TRUE, FALSE, pool)); + SVN_ERR(svn_config_read3(&config, opts->config_file, + TRUE, FALSE, FALSE, pool)); SVN_ERR(svn_cache__make_memcache_from_config(&memcache, config, pool)); } Modified: subversion/branches/1.8.x/subversion/tests/libsvn_subr/config-test.c URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/tests/libsvn_subr/config-test.c?rev=1478983&r1=1478982&r2=1478983&view=diff ============================================================================== --- subversion/branches/1.8.x/subversion/tests/libsvn_subr/config-test.c (original) +++ subversion/branches/1.8.x/subversion/tests/libsvn_subr/config-test.c Fri May 3 21:21:54 2013 @@ -109,7 +109,7 @@ test_text_retrieval(apr_pool_t *pool) SVN_ERR(init_params(pool)); cfg_file = apr_pstrcat(pool, srcdir, "/", "config-test.cfg", (char *)NULL); - SVN_ERR(svn_config_read2(&cfg, cfg_file, TRUE, FALSE, pool)); + SVN_ERR(svn_config_read3(&cfg, cfg_file, TRUE, FALSE, FALSE, pool)); /* Test values retrieved from our ConfigParser instance against values retrieved using svn_config. */ @@ -160,7 +160,7 @@ test_boolean_retrieval(apr_pool_t *pool) SVN_ERR(init_params(pool)); cfg_file = apr_pstrcat(pool, srcdir, "/", "config-test.cfg", (char *)NULL); - SVN_ERR(svn_config_read2(&cfg, cfg_file, TRUE, FALSE, pool)); + SVN_ERR(svn_config_read3(&cfg, cfg_file, TRUE, FALSE, FALSE, pool)); for (i = 0; true_keys[i] != NULL; i++) { @@ -220,7 +220,7 @@ test_has_section_case_insensitive(apr_po SVN_ERR(init_params(pool)); cfg_file = apr_pstrcat(pool, srcdir, "/", "config-test.cfg", (char *)NULL); - SVN_ERR(svn_config_read2(&cfg, cfg_file, TRUE, FALSE, pool)); + SVN_ERR(svn_config_read3(&cfg, cfg_file, TRUE, FALSE, FALSE, pool)); if (! svn_config_has_section(cfg, "section1")) return fail(pool, "Failed to find section1"); @@ -250,7 +250,7 @@ test_has_section_case_sensitive(apr_pool SVN_ERR(init_params(pool)); cfg_file = apr_pstrcat(pool, srcdir, "/", "config-test.cfg", (char *)NULL); - SVN_ERR(svn_config_read2(&cfg, cfg_file, TRUE, TRUE, pool)); + SVN_ERR(svn_config_read3(&cfg, cfg_file, TRUE, TRUE, FALSE, pool)); if (! svn_config_has_section(cfg, "section1")) return fail(pool, "Failed to find section1"); @@ -271,6 +271,48 @@ test_has_section_case_sensitive(apr_pool } static svn_error_t * +test_has_option_case_sensitive(apr_pool_t *pool) +{ + svn_config_t *cfg; + const char *cfg_file; + apr_int64_t value; + int i; + + static struct test_dataset { + const char *option; + apr_int64_t value; + } const test_data[] = { + { "a", 1 }, + { "A", 2 }, + { "B", 3 }, + { "b", 4 } + }; + static const int test_data_size = sizeof(test_data)/sizeof(*test_data); + + if (!srcdir) + SVN_ERR(init_params(pool)); + + cfg_file = apr_pstrcat(pool, srcdir, "/", "config-test.cfg", (char *)NULL); + SVN_ERR(svn_config_read3(&cfg, cfg_file, TRUE, TRUE, TRUE, pool)); + + for (i = 0; i < test_data_size; ++i) + { + SVN_ERR(svn_config_get_int64(cfg, &value, "case-sensitive-option", + test_data[i].option, -1)); + if (test_data[i].value != value) + return fail(pool, + apr_psprintf(pool, + "case-sensitive-option.%s != %" + APR_INT64_T_FMT" but %"APR_INT64_T_FMT, + test_data[i].option, + test_data[i].value, + value)); + } + + return SVN_NO_ERROR; +} + +static svn_error_t * test_stream_interface(apr_pool_t *pool) { svn_config_t *cfg; @@ -283,7 +325,7 @@ test_stream_interface(apr_pool_t *pool) cfg_file = apr_pstrcat(pool, srcdir, "/", "config-test.cfg", (char *)NULL); SVN_ERR(svn_stream_open_readonly(&stream, cfg_file, pool, pool)); - SVN_ERR(svn_config_parse(&cfg, stream, TRUE, pool)); + SVN_ERR(svn_config_parse(&cfg, stream, TRUE, TRUE, pool)); /* nominal test to make sure cfg is populated with something since * svn_config_parse will happily return an empty cfg if the stream is @@ -313,6 +355,8 @@ struct svn_test_descriptor_t test_funcs[ "test svn_config_has_section (case insensitive)"), SVN_TEST_PASS2(test_has_section_case_sensitive, "test svn_config_has_section (case sensitive)"), + SVN_TEST_PASS2(test_has_option_case_sensitive, + "test case-sensitive option name lookup"), SVN_TEST_PASS2(test_stream_interface, "test svn_config_parse"), SVN_TEST_NULL Modified: subversion/branches/1.8.x/subversion/tests/libsvn_subr/config-test.cfg URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/tests/libsvn_subr/config-test.cfg?rev=1478983&r1=1478982&r2=1478983&view=diff ============================================================================== --- subversion/branches/1.8.x/subversion/tests/libsvn_subr/config-test.cfg (original) +++ subversion/branches/1.8.x/subversion/tests/libsvn_subr/config-test.cfg Fri May 3 21:21:54 2013 @@ -55,3 +55,9 @@ false2 = no false3 = oFf false4 = 0 bad_false = nyet! + +[case-sensitive-option] +a = 1 +A = 2 +B = 3 +b = 4 Modified: subversion/branches/1.8.x/tools/server-side/mod_dontdothat/mod_dontdothat.c URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/tools/server-side/mod_dontdothat/mod_dontdothat.c?rev=1478983&r1=1478982&r2=1478983&view=diff ============================================================================== --- subversion/branches/1.8.x/tools/server-side/mod_dontdothat/mod_dontdothat.c (original) +++ subversion/branches/1.8.x/tools/server-side/mod_dontdothat/mod_dontdothat.c Fri May 3 21:21:54 2013 @@ -584,7 +584,8 @@ dontdothat_insert_filters(request_rec *r /* XXX is there a way to error out from this point? Would be nice... */ - err = svn_config_read2(&config, cfg->config_file, TRUE, FALSE, r->pool); + err = svn_config_read3(&config, cfg->config_file, TRUE, + FALSE, TRUE, r->pool); if (err) { char buff[256];
