We've the following settings: Two machines with the latest patch-level of updates and there are no registry patches applied to bypass the DCOM Hardening for Windows. That means, a client which tries to connect to the server needs at least the authetication level of RPC_C_AUTHN_LEVEL_PKT_INTEGRITY.
At the server side we've got a tiny DCOM Service provided from MS (C++) for tests (Takes two numbers, returns the sum.) At the client side a caller - also from MS (C++) - which receives the sum. The client tool serves the possibility to set the authetication level.
So we've build the same client along the test tool, but in Delphi connecting to the provided DCOM Service from MS(c++).
But unfortunately it seems, that the Delphi-Client is ignoring it at all.
The tests with the MS-Tool as expected:
- Doing a test with the MS-Tool with auth-level RPC_C_AUTHN_LEVEL_CONNECT (=2), the connection is refused. The eventlog of the server states the expected error: ' 10036 - The server-side authentication level policy does not allow the user ...'
- Doing it with the correct level RPC_C_AUTHN_LEVEL_PKT_INTEGRITY it works.
But now, look what happens when using the delphi tool.
- Doing a test with the Delphi-Test-Tool with auth-level RPC_C_AUTHN_LEVEL_CONNECT (= 2): It works!
- Doing a test with the Delphi-Test-Tool with auth-level RPC_C_AUTHN_LEVEL_PKT_INTEGRITY (= 5): It works!
So, it's uncommon, to ask something because it works, but I'm not happy with this, cause I don't understand, what's happening.
Any ideas?
Thanks in advance.
Vesan.
That's the way in Delphi:
COINITBASE_MULTITHREADED = $0;
RPC_C_AUTHN_LEVEL_CONNECT = 2;
RPC_C_AUTHN_LEVEL_PKT_INTEGRITY = 5;
RPC_C_IMP_LEVEL_IMPERSONATE = 3;
CoInitializeEx(COINITBASE_MULTITHREADED);
// That should NOT work, but works!
//CoInitializeSecurity(nil, -1, nil, nil, RPC_C_AUTHN_LEVEL_CONNECT, RPC_C_IMP_LEVEL_IMPERSONATE, nil, EOAC_NONE, nil);
// That is working!
CoInitializeSecurity(nil, -1, nil, nil, RPC_C_AUTHN_LEVEL_PKT_INTEGRITY, RPC_C_IMP_LEVEL_IMPERSONATE, nil, EOAC_NONE, nil);
testComObject := TTestCOM.Create(Nil); // -> TOleServer.Create
testComObject.RemoteMachineName := servername;
testComObject.ConnectKind := TConnectKind.ckRemote;
number := testComObject.Sum(4, 6);