qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Tomáš Golembiovský" <tgolembi@redhat.com>
To: Chen Hanxiao <chen_han_xiao@126.com>
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qga-win: fall back to hardcoded user and group names if LookupAccountSidW failed
Date: Fri, 3 Nov 2017 12:16:51 +0100	[thread overview]
Message-ID: <20171103121651.43730e76@fiorina> (raw)
In-Reply-To: <7cc46892.bc57.15f7c622d65.Coremail.chen_han_xiao@126.com>

On Thu, 2 Nov 2017 18:58:49 +0800 (CST)
"Chen Hanxiao" <chen_han_xiao@126.com> wrote:

> At 2017-10-27 09:05:25, "Michael Roth" <mdroth@linux.vnet.ibm.com> wrote:
> >Quoting Tomáš Golembiovský (2017-10-26 08:54:37)  
> >> On Wed, 25 Oct 2017 16:58:07 -0500
> >> Michael Roth <mdroth@linux.vnet.ibm.com> wrote:
> >>   
> >> > Quoting Tomáš Golembiovský (2017-09-29 16:31:02)  
> >> > > On Fri, 29 Sep 2017 17:11:22 +0800
> >> > > Chen Hanxiao <chen_han_xiao@126.com> wrote:
> >> > > 
> >> > > Reviewed-by: Tomáš Golembiovský <tgolembi@redhat.com>    
> >> > 
> >> > I think it might be getNameByStringSID()/LookupAccountSidW() reporting a
> >> > stale GetLastError() value.
> >> >   
> >> 
> >> I suppose you're right! Taking a closer look there's one more issue with
> >> getNameByStringSID(). The call ConvertStringSidToSidW() does not return
> >> HRESULT so using chk() makes no sense.
> >> 
> >> I propose slightly modified version of your fix:
> >> 
> >> diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
> >> index ba7c94eb25..65f68f94a3 100644
> >> --- a/qga/vss-win32/install.cpp
> >> +++ b/qga/vss-win32/install.cpp
> >> @@ -148,10 +148,15 @@ static HRESULT getNameByStringSID(
> >>      DWORD domainNameLen = BUFFER_SIZE;
> >>      wchar_t domainName[BUFFER_SIZE];
> >>  
> >> -    chk(ConvertStringSidToSidW(sid, &psid));
> >> -    LookupAccountSidW(NULL, psid, buffer, bufferLen,
> >> -                domainName, &domainNameLen, &groupType);
> >> -    hr = HRESULT_FROM_WIN32(GetLastError());
> >> +    if (!ConvertStringSidToSidW(sid, &psid) {
> >> +        hr = HRESULT_FROM_WIN32(GetLastError());
> >> +        goto out;
> >> +    }
> >> +    if (!LookupAccountSidW(NULL, psid, buffer, bufferLen,
> >> +                           domainName, &domainNameLen, &groupType)) {
> >> +        hr = HRESULT_FROM_WIN32(GetLastError());
> >> +        /* Fall through and free psid */
> >> +    }
> >>  
> >>      LocalFree(psid);  
> >
> >
> >Thanks! It's not yet clear if this fixes the issue completely (though it
> >seems likely), but it's clearly a bug either way so I've gone ahead and
> >applied it to the qga tree:
> >
> >  https://github.com/mdroth/qemu/commit/8cedc80555e5a395a4fda7130b0115015e775c48
> >
> >Chen, if there's still an issue with the updated patch please let me know.  
> 
> Sorry for the late reply.
> 
> I tested the upstream qga-win on that windows VM for several times.
> It works fine by my limit tests.
> 

I'm glad to hear that.

    Tomas

> Regards,
> - Chen
> 
> 
> 
> >  
> >>  
> >> 
> >> -- 
> >> Tomáš Golembiovský <tgolembi@redhat.com>
> >>   
> >  


-- 
Tomáš Golembiovský <tgolembi@redhat.com>

      reply	other threads:[~2017-11-03 11:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-29  9:11 [Qemu-devel] [PATCH] qga-win: fall back to hardcoded user and group names if LookupAccountSidW failed Chen Hanxiao
2017-09-29 21:31 ` Tomáš Golembiovský
2017-10-25 21:58   ` Michael Roth
2017-10-26  9:27     ` Chen Hanxiao
2017-10-26  9:59       ` Michael Roth
2017-10-26 11:01         ` Chen Hanxiao
2017-10-26 13:54     ` Tomáš Golembiovský
2017-10-27  1:05       ` Michael Roth
2017-11-02 10:58         ` Chen Hanxiao
2017-11-03 11:16           ` Tomáš Golembiovský [this message]

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=20171103121651.43730e76@fiorina \
    --to=tgolembi@redhat.com \
    --cc=chen_han_xiao@126.com \
    --cc=mdroth@linux.vnet.ibm.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).