qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Chris Webb <chris@arachsys.com>
To: Avi Kivity <avi@redhat.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 16:47:11 +0000	[thread overview]
Message-ID: <20111124164710.GC19135@arachsys.com> (raw)
In-Reply-To: <4ECE74CB.7060001@redhat.com>

Avi Kivity <avi@redhat.com> writes:

> 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.

Okay, will re-spin; thanks!

Cheers,

Chris.

  reply	other threads:[~2011-11-24 16:47 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
2011-11-24 16:47     ` Chris Webb [this message]
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=20111124164710.GC19135@arachsys.com \
    --to=chris@arachsys.com \
    --cc=avi@redhat.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).