Win32: How to validate credentials against Active Directory?

前端 未结 5 689
一个人的身影
一个人的身影 2020-11-30 01:08

It has been asked, and answered for .NET, but now it\'s time to get an answer for native Win32 code:

How do i validate a Windows username and password?

5条回答
  •  清歌不尽
    2020-11-30 01:49

    For the native equivalnt of your valid .NET solution see this MSDN page and ldap_bind

    Howerver I think that LogonUser is the right API for the task when use with LOGON32_LOGON_NETWORK. Note that the limitation of SE_CHANGE_NOTIFY_NAME is only for Windows 2000 (so Windows XP and newer do not require this priviledge) and that by default SE_CHANGE_NOTIFY_NAME is enabled for all users. Also the MSDN page says

    The SE_TCB_NAME privilege is not required for this function unless you are logging onto a Passport account.

    In this case you are logging onto an AD account so SE_TCB_NAME is not required.

提交回复
热议问题