Rahul
Rahul

Reputation: 1421

C++/.net (Framework 2.0) MS SQL db windows authentication with user name and password

I am using following set of API(C++) to validate a windows user name and password (domain account) with MS SQL db:

  1. LogonUser
  2. CreateEnvironmentBlock
  3. ImpersonateLoggedOnUser
  4. SQLDriverConnect

It works just fine but problem occurs when a service account (domain account but you cant log-in in windows using it) is used to for validation. it fails in the LogonUser API.

Is there any way in C++ or .net (Framework 2.0) to validate a domain account with MS SQL db without using impersonation mechanism?

Thanks,

Rahul

Upvotes: 0

Views: 397

Answers (1)

Paul Farry
Paul Farry

Reputation: 4768

Maybe instead of using LogonUser, maybe you could try using LogonUserEx it allows you to specify the type of logon you are requesting. With a dwLogonType = LOGON32_LOGON_SERVICE

Upvotes: 1

Related Questions