]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/posix: fix inverted If-None-Match check allowing overwrite
authorSun Yuechi <sunyuechi@iscas.ac.cn>
Tue, 30 Jun 2026 06:44:56 +0000 (14:44 +0800)
committerSun Yuechi <sunyuechi@iscas.ac.cn>
Wed, 1 Jul 2026 12:19:10 +0000 (20:19 +0800)
If-None-Match: * must fail when the object exists, but the posix writer
did the opposite, disabling overwrite protection. Return
PRECONDITION_FAILED when the object exists.

Fixes: https://tracker.ceph.com/issues/77871
Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
src/rgw/driver/posix/rgw_sal_posix.cc

index 92710d01669166f3184a149b9eb724abb6902890..ab3310f9596a8f49eacedcb4fddf2255e6af480d 100644 (file)
@@ -4577,7 +4577,7 @@ int POSIXAtomicWriter::complete(size_t accounted_size, const std::string& etag,
   if (if_nomatch) {
     if (strcmp(if_nomatch, "*") == 0) {
       // test the object is not existing
-      if (!exists) {
+      if (exists) {
        return -ERR_PRECONDITION_FAILED;
       }
     } else {