1. 05 Oct, 2018 2 commits
    • config_file: properly ignore includes without "path" value · 614c266d
      In case a configuration includes a key "include.path=" without any
      value, the generated configuration entry will have its value set to
      `NULL`. This is unexpected by the logic handling includes, and as soon
      as we try to calculate the included path we will unconditionally
      dereference that `NULL` pointer and thus segfault.
      
      Fix the issue by returning early in both `parse_include` and
      `parse_conditional_include` in case where the `file` argument is `NULL`.
      Add a test to avoid future regression.
      
      The issue has been found by the oss-fuzz project, issue 10810.
      
      (cherry picked from commit d06d4220)
      Patrick Steinhardt committed
    • tests: always unlink created config files · aa220b0f
      While our tests in config::include create a plethora of configuration
      files, most of them do not get removed at the end of each test. This can
      cause weird interactions with tests that are being run at a later stage
      if these later tests try to create files or directories with the same
      name as any of the created configuration files.
      
      Fix the issue by unlinking all created files at the end of these tests.
      
      (cherry picked from commit bf662f7c)
      Patrick Steinhardt committed
  2. 15 Jul, 2017 4 commits
    • config_file: refuse modifying included variables · 1b329089
      Modifying variables pulled in by an included file currently succeeds,
      but it doesn't actually do what one would expect, as refreshing the
      configuration will cause the values to reappear. As we are currently not
      really able to support this use case, we will instead just return an
      error for deleting and setting variables which were included via an
      include.
      Patrick Steinhardt committed
    • config_file: move reader into `config_read` only · 28c2cc3d
      Right now, we have multiple call sites which initialize a `reader`
      structure. As the structure is only actually used inside of
      `config_read`, we can instead just move the reader inside of the
      `config_read` function. Instead, we can just pass in the configuration
      file into `config_read`, which eases code readability.
      Patrick Steinhardt committed
    • config_file: refresh all files if includes were modified · 83bcd3a1
      Currently, we only re-parse the top-level configuration file when it has
      changed itself. This can cause problems when an include is changed, as
      we were not updating all values correctly.
      
      Instead of conditionally reparsing only refreshed files, the logic
      becomes much clearer and easier to follow if we always re-parse the
      top-level configuration file when either the file itself or one of its
      included configuration files has changed on disk. This commit implements
      this logic.
      
      Note that this might impact performance in some cases, as we need to
      re-read all configuration files whenever any of the included files
      changed. It could increase performance to just re-parse include files
      which have actually changed, but this would compromise maintainability
      of the code without much gain. The only case where we will gain anything
      is when we actually use includes and when only these includes are
      updated, which will probably be quite an unusual scenario to actually be
      worthwhile to optimize.
      Patrick Steinhardt committed
  3. 23 Mar, 2017 2 commits
  4. 03 Mar, 2015 2 commits
    • Plug a few leaks · fe21d708
      Carlos Martín Nieto committed
    • config: borrow refcounted references · 9a97f49e
      This changes the get_entry() method to return a refcounted version of
      the config entry, which you have to free when you're done.
      
      This allows us to avoid freeing the memory in which the entry is stored
      on a refresh, which may happen at any time for a live config.
      
      For this reason, get_string() has been forbidden on live configs and a
      new function get_string_buf() has been added, which stores the string in
      a git_buf which the user then owns.
      
      The functions which parse the string value takea advantage of the
      borrowing to parse safely and then release the entry.
      Carlos Martín Nieto committed
  5. 12 Feb, 2015 1 commit
  6. 10 Dec, 2014 1 commit
  7. 03 Nov, 2014 1 commit
  8. 01 Nov, 2014 1 commit
  9. 23 Oct, 2014 1 commit
  10. 15 May, 2014 1 commit
    • Better search path sandboxing · 8487e237
      There are a number of tests that modify the global or system
      search paths during the tests.  This adds a helper function to
      make it easier to restore those paths and makes sure that they
      are getting restored in a manner that preserves test isolation.
      Russell Belfer committed
  11. 14 Nov, 2013 1 commit
  12. 07 Sep, 2013 4 commits