cabasm
November 30th, 2006, 04:24 AM
Hi,
I wrote a server and a client application. The client tries to connect to the server by using some credentials. I'm using the security context SSPI API to achieve this, i.t. I call AcceptSecurityContext on the server side and InitializeSecurityContext on the client side. I'm using sockets to exchange data packages between client and server.
The problem is I want to be notified on the client side if the server cannot authenticate it but I have problems to achieve this. On the server side AcceptSecurityContext fails as expected but on the client side InitializeSecurityContext returns no error.
How can I get an error on the client from InitializeSecurityContext if AcceptSecurityContext fails on the server side? (now, I'm disconnecting the client socket on the server side).
Server:
=====
ULONG attribs = 0;
AcceptSecurityContext(&cred, NULL, &inBuf, attribs, SECURITY_NATIVE_DREP, &ctxt, &outBuf, &attribs, &time);
.....
// data package exchange via sockets
....
// this second call returns a negative error code when client uses bad credentials
AcceptSecurityContext(&cred, &ctxt, &inBuf, attribs, SECURITY_NATIVE_DREP, &ctxt, &outBuf, &attribs, &time);
Client:
=====
ULONG attribs;
InitializeSecurityContext(&cred, &ctxt, target, ISC_REQ_CONFIDENTIALITY, 0, SECURITY_NATIVE_DREP, &inBuf, 0, &ctxt, &outBuf, &attribs, &time);
....
// data package exchange via sockets
....
InitializeSecurityContext(&cred, NULL, target, ISC_REQ_CONFIDENTIALITY, 0, SECURITY_NATIVE_DREP, NULL, 0, &ctxt, &outBuf, &attribs, &time);
Thanx!
I wrote a server and a client application. The client tries to connect to the server by using some credentials. I'm using the security context SSPI API to achieve this, i.t. I call AcceptSecurityContext on the server side and InitializeSecurityContext on the client side. I'm using sockets to exchange data packages between client and server.
The problem is I want to be notified on the client side if the server cannot authenticate it but I have problems to achieve this. On the server side AcceptSecurityContext fails as expected but on the client side InitializeSecurityContext returns no error.
How can I get an error on the client from InitializeSecurityContext if AcceptSecurityContext fails on the server side? (now, I'm disconnecting the client socket on the server side).
Server:
=====
ULONG attribs = 0;
AcceptSecurityContext(&cred, NULL, &inBuf, attribs, SECURITY_NATIVE_DREP, &ctxt, &outBuf, &attribs, &time);
.....
// data package exchange via sockets
....
// this second call returns a negative error code when client uses bad credentials
AcceptSecurityContext(&cred, &ctxt, &inBuf, attribs, SECURITY_NATIVE_DREP, &ctxt, &outBuf, &attribs, &time);
Client:
=====
ULONG attribs;
InitializeSecurityContext(&cred, &ctxt, target, ISC_REQ_CONFIDENTIALITY, 0, SECURITY_NATIVE_DREP, &inBuf, 0, &ctxt, &outBuf, &attribs, &time);
....
// data package exchange via sockets
....
InitializeSecurityContext(&cred, NULL, target, ISC_REQ_CONFIDENTIALITY, 0, SECURITY_NATIVE_DREP, NULL, 0, &ctxt, &outBuf, &attribs, &time);
Thanx!