From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v4] syscalls/chown: Rewrite chown/chown03.c with the new api
Date: Wed, 21 Apr 2021 13:58:17 +0200 [thread overview]
Message-ID: <YIATWfAJEvFhvZ77@yuki> (raw)
In-Reply-To: <20210420061954.155049-1-xieziyao@huawei.com>
Hi!
> + SAFE_SETEUID(0);
> + SAFE_CHOWN(FILENAME, -1, 0);
> + SAFE_CHMOD(FILENAME, NEW_PERMS);
> + SAFE_SETEUID(ltpuser->pw_uid);
> +
> + uid_t uid;
> + gid_t gid;
> + UID16_CHECK((uid = geteuid()), "chown");
> + GID16_CHECK((gid = getegid()), "chown");
> +
> + struct stat stat_buf;
> + SAFE_STAT(FILENAME, &stat_buf);
> + check_owner(&stat_buf, uid, 0);
We should check that the S_ISUID and S_ISGID bits are set here as well.
Otherwise it looks good to me.
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2021-04-21 11:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-19 1:34 [LTP] [PATCH v3] syscalls/chown: Rewrite chown/chown03.c with the new api Xie Ziyao
2021-04-19 14:55 ` Cyril Hrubis
2021-04-20 6:30 ` xieziyao
2021-04-19 16:09 ` Alexey Kodanev
2021-04-20 6:28 ` xieziyao
2021-04-20 6:19 ` [LTP] [PATCH v4] " Xie Ziyao
2021-04-21 11:58 ` Cyril Hrubis [this message]
2021-04-22 2:51 ` xieziyao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YIATWfAJEvFhvZ77@yuki \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox