Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v5 1/1] syscalls/mq_unlink: convert to use new test library API
Date: Mon, 5 Dec 2016 15:49:44 +0100	[thread overview]
Message-ID: <20161205144943.GI22344@rei.lan> (raw)
In-Reply-To: <20161205143258.8102-1-pvorel@suse.cz>

Hi!
> +	pw = SAFE_GETPWNAM("nobody");
> I don't like hardwired constants, but nobody user name is used across whole
> codebase. I'd be happier to have some constant in lib (although it's unlikely
> one day we might want to allow user to choose their "nobody" user).

Yep, I've been thinking of adding uid_t tst_get_nobody_uid(void) or
uid_t tst_get_unprivileged_uid(void) and the same for gid_t or something
similar into the test library for some time. Haven't had time to do so
yet.

> > We may also run the test for nobody in a child process so
> > that we don't have to take care restoring the euid at the end of the
> > function.
> It's require to restore euid for other tests (to be running as root again). Or
> have I overlooked something?

If you fork() then call setuid() in the child, do the test and exit then
parent will still run under the same uid it has been started. No need to
resetore anything.

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2016-12-05 14:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-05 14:32 [LTP] [PATCH v5 1/1] syscalls/mq_unlink: convert to use new test library API Petr Vorel
2016-12-05 14:49 ` Cyril Hrubis [this message]
2016-12-05 16:13   ` Cyril Hrubis
2016-12-05 18:17     ` Petr Vorel

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=20161205144943.GI22344@rei.lan \
    --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