libcephfs: fix ClearSetuid incorrectly using SETATTR_MODE mask

Both the STATX_MODE and SETATTR_MODE equal 1, so the test didn't
fail.

Fixes: https://tracker.ceph.com/issues/58680
Signed-off-by: Xiubo Li <xiubli@redhat.com>
This commit is contained in:
Xiubo Li 2023-03-14 11:16:53 +08:00
parent c5153d77fa
commit 463b932fff

View File

@ -2116,7 +2116,7 @@ TEST(LibCephFS, ClearSetuid) {
stx.stx_gid = g;
mode_t m = S_ISGID|S_ISUID|S_IRUSR|S_IWUSR;
stx.stx_mode = m;
ASSERT_EQ(ceph_ll_setattr(cmount, in, &stx, CEPH_STATX_MODE|CEPH_SETATTR_UID|CEPH_SETATTR_GID, rootcred), 0);
ASSERT_EQ(ceph_ll_setattr(cmount, in, &stx, CEPH_SETATTR_MODE|CEPH_SETATTR_UID|CEPH_SETATTR_GID, rootcred), 0);
ASSERT_EQ(ceph_ll_getattr(cmount, in, &stx, CEPH_STATX_MODE, 0, altcred), 0);
ASSERT_EQ(stx.stx_mode&(mode_t)ALLPERMS, m);
/* not dropped without exe bit */