qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/2] Allow -runas to be specified as UID:GID as


From: Avi Kivity
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
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0

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 via email to

[Prev in Thread] Current Thread [Next in Thread]