static svn_error_t * test_has_section_case_sensitive(const svn_test_opts_t *opts, apr_pool_t *pool) { svn_config_t *cfg; const char *cfg_file; SVN_ERR(get_config_file_path(&cfg_file, opts, 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"); if (svn_config_has_section(cfg, "SECTION1")) return fail(pool, "Returned true on missing section"); if (! svn_config_has_section(cfg, "UpperCaseSection")) return fail(pool, "Failed to find UpperCaseSection"); if (svn_config_has_section(cfg, "uppercasesection")) return fail(pool, "Returned true on missing section"); if (svn_config_has_section(cfg, "notthere")) return fail(pool, "Returned true on missing section"); return SVN_NO_ERROR; }
static svn_error_t * test_ignore_bom(apr_pool_t *pool) { svn_config_t *cfg; svn_string_t *cfg_string = svn_string_create("\xEF\xBB\xBF[s1]\nfoo=bar\n", pool); svn_stream_t *stream = svn_stream_from_string(cfg_string, pool); SVN_ERR(svn_config_parse(&cfg, stream, TRUE, TRUE, pool)); if (! svn_config_has_section(cfg, "s1")) return fail(pool, "failed to find section s1"); return SVN_NO_ERROR; }
/* Copy group definitions from GROUPS_CFG to the resulting AUTHZ. * If AUTHZ already contains any group definition, report an error. * Use POOL for temporary allocations. */ static svn_error_t * authz_copy_groups(svn_authz_t *authz, svn_config_t *groups_cfg, apr_pool_t *pool) { /* Easy out: we prohibit local groups in the authz file when global groups are being used. */ if (svn_config_has_section(authz->cfg, SVN_CONFIG_SECTION_GROUPS)) { return svn_error_create(SVN_ERR_AUTHZ_INVALID_CONFIG, NULL, "Authz file cannot contain any groups " "when global groups are being used."); } svn_config_enumerate2(groups_cfg, SVN_CONFIG_SECTION_GROUPS, authz_copy_group, authz->cfg, pool); return SVN_NO_ERROR; }
static svn_error_t * test_stream_interface(const svn_test_opts_t *opts, apr_pool_t *pool) { svn_config_t *cfg; const char *cfg_file; svn_stream_t *stream; SVN_ERR(get_config_file_path(&cfg_file, opts, pool)); SVN_ERR(svn_stream_open_readonly(&stream, cfg_file, pool, 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 * empty. */ if (! svn_config_has_section(cfg, "section1")) return fail(pool, "Failed to find section1"); return SVN_NO_ERROR; }