From: Avi Kivity <avi@redhat.com>
To: Chris Webb <chris@arachsys.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] Allow -runas to be specified as UID:GID as well as USERNAME
Date: Thu, 24 Nov 2011 18:46:03 +0200 [thread overview]
Message-ID: <4ECE74CB.7060001@redhat.com> (raw)
In-Reply-To: <d636c7af81d0ad2c2639e05c312c4aa7ce0457d6.1322152179.git.chris@arachsys.com>
On 11/24/2011 06:29 PM, Chris Webb wrote:
> This allows qemu to drop privileges to a dynamically allocated, anonymous UID
> and GID without needing a temporary /etc/passwd entry for that UID. The
> UID:GID format is very standard, being (for example) the syntax used by
> chown(1) for numeric IDs.
> @@ -179,6 +179,15 @@ void os_parse_cmd_args(int index, const char *optarg)
> case QEMU_OPTION_runas:
> user_pwd = getpwnam(optarg);
> if (!user_pwd) {
> + long uid, gid, tail;
> + if (sscanf(optarg, "%ld:%ld%ln", &uid, &gid, &tail) >= 2
> + && !optarg[tail]) {
> + user_pwd = g_malloc0(sizeof(user_pwd));
g_new0() please. user_pwd is never freed, not that it matters ,uch.
> + user_pwd->pw_uid = uid;
> + user_pwd->pw_gid = gid;
> + }
> + }
> + if (!user_pwd) {
> fprintf(stderr, "User \"%s\" doesn't exist\n", optarg);
> exit(1);
> }
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2011-11-24 16:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-24 16:29 [Qemu-devel] [PATCH 1/2] Do not generate spurious error for -runas root Chris Webb
2011-11-24 16:29 ` [Qemu-devel] [PATCH 2/2] Allow -runas to be specified as UID:GID as well as USERNAME Chris Webb
2011-11-24 16:46 ` Avi Kivity [this message]
2011-11-24 16:47 ` Chris Webb
2011-11-24 16:47 ` Avi Kivity
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=4ECE74CB.7060001@redhat.com \
--to=avi@redhat.com \
--cc=chris@arachsys.com \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).