Skip to content

[2.4.x] Merge changes to mod_dav - #1090

Merged
notroj merged 9 commits into
apache:2.4.xfrom
notroj:2.4.x-mod_dav
Nov 25, 2026
Merged

notroj merged 9 commits into
apache:2.4.xfrom
notroj:2.4.x-mod_dav

Conversation

@notroj

@notroj notroj commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Merge r1919580, r1923813, r1938296, r1939146, 9a9457f, d7ed293, c58a6f2 from trunk:

  • modules/dav/fs/repos.c (dav_fs_get_resource): Return a 404 rather
    than a 400 where r->path_info is not empty for a file; a valid but
    unsatisfiable request to a path which cannot exist,
    e.g. /dav/foo.txt/blah where /dav/foo.txt is not a directory.

Github: closes #465

mod_dav: Fix error handling for dav_fs_dir_file_name():

dav_fs_dir_file_name() will not set *fname_p to NULL on failure,
and all callers of dav_fs_dir_file_name() does not check the
return value of dav_fs_dir_file_name(), which could lead to an
undefined behavior against fname_p.

Fix this by adding return value check of dav_fs_dir_file_name()

Submitted by: Zhou Qingyang
Github: closes #309

  • modules/dav/fs/repos.c (dav_fs_copymove_file): Log the pathname when
    opening the source or destination file fails.

Suggested by: Bingyu Shen
Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com
GitHub: closes #143, closes #760

mod_dav: Do not advertise disabled TRACE

dav_method_options() builds its own Allow field and unconditionally
advertised TRACE for existing DAV resources, even when TraceEnable was
off.

Respect TraceEnable when constructing the DAV Allow field.

PR: 70264
GitHub: closes #827

mod_dav: Enforce the lock-owner check on the untagged If: fallback too (#889)

dav_find_submitted_locktoken() scans the whole If: header for a usable
locktoken without checking whether the lock belongs to the authenticated
user. dav_validate_resource_state() repeats that owner check itself on the
tagged-list path, but not here, so a non-matching If: tag (one whose URI
does not apply to the resource) forces the untagged fallback and lets an
authenticated writer use another user's locktoken.

Factor the existing owner check out into dav_lock_owned_by_other_user() and
call it from dav_find_submitted_locktoken() as well: a lock owned by
another user is skipped during the scan instead of being treated as a
usable match. The scan continues past the skip, so a header that
legitimately carries the current user's own token - under any tag, or none

  • still succeeds.
  • modules/dav/main/util.c (dav_lock_owned_by_other_user): New.
    (dav_find_submitted_locktoken): Take request_rec and skip a lock owned by
    another user. Both call sites updated.
    (dav_validate_resource_state): Use the new helper; no behaviour change.

mod_dav: Ignore negated lock tokens when checking for a submitted token:

  • modules/dav/main/util.c (dav_find_submitted_locktoken): Skip
    states with a "Not" condition.

  • test/modules/dav/test_006_if_not_locktoken.py: New test.

  • changes-entries/dav-if-not-locktoken.txt: New file.

Co-Authored-By: Claude Fable 5.2 noreply@anthropic.com

mod_dav: XML-quote core property values taken from the subrequest:

  • modules/dav/main/props.c (dav_insert_coreprop): Quote the
    getcontenttype and getcontentlanguage values.

  • test/modules/dav/test_007_propfind_quoting.py: New test.

  • changes-entries/dav-propfind-quoting.txt: New file.

Co-Authored-By: Claude Fable 5.2 noreply@anthropic.com

r1939146's test is already on 2.4.x, so only its code and changes entry are picked. The last two commits are test-only: one marks that test as backported in 2.4.72, the other sets DavLockDB in test_007_propfind_quoting.py, which 2.4.x needs as it has no default; both also need to land on trunk.

Checked against #399: no files in common, the two merge cleanly and the merged tree builds.

🤖 Generated with Claude Code

notroj and others added 9 commits November 25, 2026 20:33
  than a 400 where r->path_info is not empty for a file; a valid but
  unsatisfiable request to a path which cannot exist,
  e.g. /dav/foo.txt/blah where /dav/foo.txt is not a directory.

Github: closes apache#465

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1919580 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit a288cd3)
dav_fs_dir_file_name() will not set *fname_p to NULL on failure,
and all callers of dav_fs_dir_file_name() does not check the
return value of dav_fs_dir_file_name(), which could lead to an
undefined behavior against fname_p.

Fix this by adding return value check of dav_fs_dir_file_name()

Submitted by: Zhou Qingyang <zhou1615 umn.edu>
Github: closes apache#309

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1923813 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit 1e298dd)
  opening the source or destination file fails.

Suggested by: Bingyu Shen <ahshenbingyu gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
GitHub: closes apache#143, closes apache#760

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938296 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit 1c838de)
mod_dav: Do not advertise disabled TRACE

dav_method_options() builds its own Allow field and unconditionally
advertised TRACE for existing DAV resources, even when TraceEnable was
off.

Respect TraceEnable when constructing the DAV Allow field.

PR: 70264
GitHub: closes apache#827

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939146 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit 261058f)
apache#889)

dav_find_submitted_locktoken() scans the whole If: header for a usable
locktoken without checking whether the lock belongs to the authenticated
user. dav_validate_resource_state() repeats that owner check itself on the
tagged-list path, but not here, so a non-matching If: tag (one whose URI
does not apply to the resource) forces the untagged fallback and lets an
authenticated writer use another user's locktoken.

Factor the existing owner check out into dav_lock_owned_by_other_user() and
call it from dav_find_submitted_locktoken() as well: a lock owned by
another user is skipped during the scan instead of being treated as a
usable match. The scan continues past the skip, so a header that
legitimately carries the current user's own token - under any tag, or none
- still succeeds.

* modules/dav/main/util.c (dav_lock_owned_by_other_user): New.
  (dav_find_submitted_locktoken): Take request_rec and skip a lock owned by
  another user. Both call sites updated.
  (dav_validate_resource_state): Use the new helper; no behaviour change.

(cherry picked from commit 9a9457f)
* modules/dav/main/util.c (dav_find_submitted_locktoken): Skip
  states with a "Not" condition.

* test/modules/dav/test_006_if_not_locktoken.py: New test.

* changes-entries/dav-if-not-locktoken.txt: New file.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit d7ed293)
* modules/dav/main/props.c (dav_insert_coreprop): Quote the
  getcontenttype and getcontentlanguage values.

* test/modules/dav/test_007_propfind_quoting.py: New test.

* changes-entries/dav-propfind-quoting.txt: New file.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit c58a6f2)
  (TestOptionsTraceDisabled.test_dav_002_001): Mark as backported in
  2.4.72.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
  (TestDavPropfindQuoting._class_scope): Set DavLockDB, which has no
  default in 2.4.x.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@notroj
notroj merged commit 15beddf into apache:2.4.x Nov 25, 2026
68 of 69 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants