All of lore.kernel.org
 help / color / mirror / Atom feed
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:47:11 +0200	[thread overview]
Message-ID: <4ECE750F.3070008@redhat.com> (raw)
In-Reply-To: <4ECE74CB.7060001@redhat.com>

On 11/24/2011 06:46 PM, Avi Kivity wrote:
> 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.

In fact this is a bug - you allocate a pointer instead of a struct passwd.

-- 
error compiling committee.c: too many arguments to function

  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     ` Avi Kivity [this message]
2011-11-24 16:47     ` Chris Webb

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=4ECE750F.3070008@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.