From patchwork Wed Oct 25 21:58:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 10027265 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7DDE1601E8 for ; Wed, 25 Oct 2017 21:59:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66EB328C63 for ; Wed, 25 Oct 2017 21:59:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A1CA28C65; Wed, 25 Oct 2017 21:59:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DF53928C63 for ; Wed, 25 Oct 2017 21:59:11 +0000 (UTC) Received: from localhost ([::1]:50158 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7Thd-00065B-FO for patchwork-qemu-devel@patchwork.kernel.org; Wed, 25 Oct 2017 17:59:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43121) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7Tgu-000651-OI for qemu-devel@nongnu.org; Wed, 25 Oct 2017 17:58:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7Tgs-0007DD-0b for qemu-devel@nongnu.org; Wed, 25 Oct 2017 17:58:24 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:43350) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7Tgr-0007Al-OO for qemu-devel@nongnu.org; Wed, 25 Oct 2017 17:58:21 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9PLsvgI059917 for ; Wed, 25 Oct 2017 17:58:16 -0400 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0a-001b2d01.pphosted.com with ESMTP id 2du0kdx6a3-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 25 Oct 2017 17:58:16 -0400 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 25 Oct 2017 17:58:14 -0400 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 25 Oct 2017 17:58:13 -0400 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9PLwCMv48693424; Wed, 25 Oct 2017 21:58:12 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7D7DA2803D; Wed, 25 Oct 2017 17:58:05 -0400 (EDT) Received: from localhost (unknown [9.80.110.224]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP id 420DA2803A; Wed, 25 Oct 2017 17:58:05 -0400 (EDT) MIME-Version: 1.0 To: =?utf-8?b?VG9tw6HFoSBHb2xlbWJpb3Zza8O9?= , Chen Hanxiao From: Michael Roth In-Reply-To: <20170929233102.4b068e2f@fiorina> References: <20170929091122.22726-1-chen_han_xiao@126.com> <20170929233102.4b068e2f@fiorina> User-Agent: alot/0.6 Date: Wed, 25 Oct 2017 16:58:07 -0500 X-TM-AS-GCONF: 00 x-cbid: 17102521-0008-0000-0000-000002961AB4 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007950; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000239; SDB=6.00936431; UDB=6.00471883; IPR=6.00716696; BA=6.00005660; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017714; XFM=3.00000015; UTC=2017-10-25 21:58:14 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17102521-0009-0000-0000-0000371E242A Message-Id: <150896868721.17721.8644098584872122342@sif> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-25_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710250281 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: Re: [Qemu-devel] [PATCH] qga-win: fall back to hardcoded user and group names if LookupAccountSidW failed X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Quoting Tomáš Golembiovský (2017-09-29 16:31:02) > On Fri, 29 Sep 2017 17:11:22 +0800 > Chen Hanxiao wrote: > > > From: Chen Hanxiao > > > > On some of windows (win08 sp2), > > it doesn't work by calling LookupAccountSidW with > > well-known SIDs, > > We got an error: > > error 997 overlapped I/O operation is in progress > > > > But hardcoded names work. > > > > This patch introduces a workaroud for this issue: > > if LookupAccountSidW failed, try hardcoded one. > > > > Signed-off-by: Chen Hanxiao > > --- > > qga/vss-win32/install.cpp | 10 ++++++++-- > > 1 file changed, 8 insertions(+), 2 deletions(-) > > > > I wonder if it's caused by qga itself or a race/conflict with some other > app. But still... > > > Reviewed-by: Tomáš Golembiovský I think it might be getNameByStringSID()/LookupAccountSidW() reporting a stale GetLastError() value. Does this fix the issue? > > > -- > Tomáš Golembiovský > diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp index ba7c94eb25..94c921e8de 100644 --- a/qga/vss-win32/install.cpp +++ b/qga/vss-win32/install.cpp @@ -149,9 +149,10 @@ static HRESULT getNameByStringSID( wchar_t domainName[BUFFER_SIZE]; chk(ConvertStringSidToSidW(sid, &psid)); - LookupAccountSidW(NULL, psid, buffer, bufferLen, - domainName, &domainNameLen, &groupType); - hr = HRESULT_FROM_WIN32(GetLastError()); + if (!LookupAccountSidW(NULL, psid, buffer, bufferLen, + domainName, &domainNameLen, &groupType)) { + hr = HRESULT_FROM_WIN32(GetLastError()); + } LocalFree(psid);