Checkout
Branko ─îibej
committed
on 22 Jan
Introduce a warning callback to the authz file parser API.

We need this to warn about the use of empty groups in authz files;
this is not a… Show more
Introduce a warning callback to the authz file parser API.

We need this to warn about the use of empty groups in authz files;

this is not an error and doesn't affect the authz file semantics,

but it's nice to be able to tell the user about it.

See issues #4794, #4802 and #4803.

* subversion/include/svn_repos.h

 (svn_repos_authz_warning_func_t): New callback function type.

 (svn_repos_authz_read4): New; API revision.

 (svn_repos_authz_read3): Deprecated.

 (svn_repos_authz_parse2): New; API revision.

 (svn_repos_authz_parse): Deprecated.

* subversion/libsvn_repos/authz.h

 (svn_authz__parse): Add warning function and baton parameters.

* subversion/libsvn_repos/authz.c

 (authz_read): Add warning function and baton parameters.

  Update calls to svn_authz__parse.

 (svn_repos_authz_read4): Revised from svn_repos_authz_read3.

 (svn_repos_authz_parse2): Revised from svn_repos_authz_parse.

* subversion/libsvn_repos/authz_parse.c

 (struct ctor_baton_t): Add members warning_func and warning_baton.

 (create_ctor_baton): Initialise these new members of the constructor baton.

 (emit_parser_warning): New.

 (SVN_AUTHZ_PARSE_WARN): New; wrapper macro for the above.

 (array_insert_ace): Ignore and warn about the use of empty groups.

 (svn_authz__parse): Update implementation to match prototype.

* subversion/libsvn_repos/deprecated.c

 (svn_repos_authz_read3, svn_repos_authz_parse): Implement deprecated functions.

* subversion/mod_authz_svn/mod_authz_svn.c

 (log_svn_message): New; replaces log_svn_error so that it's useful for

  logging warnings as well.

 (log_svn_error): Reimplement, calling log_svn_message.

 (struct authz_warning_baton_t): New.

 (log_authz_warning): New.

 (get_access_conf): Set up an authz warning handler and baton, and call

  svn_repos_authz_read4 instead of svn_repos_authz_read3.

* subversion/svnserve/logger.h

 (logger__log_error): Make the 'err' parameter a pointer-to-const.

  Update the docstring to say that the error is not cleared.

 (logger__log_warning): New.

* subversion/svnserve/logger.c

 (log_message): New; common base for logger__log_error and logger__log_message.

  Also *do not* allocate 8k on the stack, use the logger pool, which gets

  cleared at the end of the function.

 (logger__log_error): Reimplement.

 (logger__log_warning): Implement.

* subversion/svnserve/serve.c

 (log_error): Make the error parameter const. Fix the docstring.

 (log_warning): New.

 (load_authz_config): Add warning function and baton parameters and fix pool

  handling. Now calls svn_repos_authz_read4 instead of svn_repos_authz_read3.

 (find_repos): Add warning function and baton parameters for load_authz_config.

 (handle_authz_warning): New.

 (construct_server_baton): Pass an authz warning handler and baton to find_repos.

* subversion/tests/cmdline/authz_tests.py

 (group_member_empty_string): Fix docstring.

 (empty_group): New test case.

 (test_list): Run it.

* subversion/tests/cmdline/svnauthz_tests.py

 (svnauthz_empty_group_test): Extend the @Issues decorator.

  Add a check for the expected warning on stderr.

Show less