Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi

I'm really sorry, but it seems like this is just completely my own fault.
Apparently MS-Windows works around this issue by preventing people from creating accounts with the 
same name as the
machine.
When I installed this machine and ran into that, I assumed it was a bug and found a way to force 
windows to make my
machine name the same as my account name.

So I've been wasting your time - sorry about time. I'll rename my machine and that should make this 
problem go away.

Regards, Noel.


Tor Lillqvist wrote:
This appears to be a windows weirdity related to the fact that my account 
name and my machine name is the same.
Under this situation, the LookupAccountName API call will return the wrong 
answer.
Well, "wrong" or "right" is a matter of opinion here, I guess... The documentation doesn't 
exactly mention this for LookupAccountName(),, true, but on the other hand, I guess that in 
general member computers also are "accounts" in the domain, or something, so it makes sense from 
that point of view...

Anyway, great catch!

Does this help?

diff --git a/sal/qa/osl/security/osl_Security.cxx b/sal/qa/osl/security/osl_Security.cxx
index ea59027..f5da4d9 100644
--- a/sal/qa/osl/security/osl_Security.cxx
+++ b/sal/qa/osl/security/osl_Security.cxx
@@ -464,8 +466,11 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *,
         // Set the count variables to the buffer sizes and retrieve the SID.
         cbSid = dwSidBufferSize;
         cchDomainName = dwDomainBufferSize;
+        WCHAR wszComputerName[MAX_COMPUTERNAME_LENGTH+1];
+        DWORD nComputerNameSize = MAX_COMPUTERNAME_LENGTH + 1;
+        GetComputerNameW( wszComputerName, &nComputerNameSize );
         if (LookupAccountNameW(
-                           NULL,            // Computer name. NULL for the local computer
+                           wszComputerName,
                            wszAccName,
                            pSid,          // Pointer to the SID buffer. Use NULL to get the size 
needed,
                            &cbSid,          // Size of the SID buffer needed.

--tml




Disclaimer: http://www.peralex.com/disclaimer.html



Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.