Consult a domain user authentication

Dear friends, ask the verification problem domain user under a Linux.
In the Linux environment, there are some domain user and password information, thought the correctness domain server windows to verify the domain user password.
On windows I are done, but on the Linux, did not find suitable methods, LDAP saw a half day, did not find the method
BOOL CCommonFun::CheckUserPasswordInDomain(CString strAccountName, CString strPassword, CString strDomain /*= ""*/)
{
HRESULT hr;
if (strDomain.GetLength() == 0)
{
HRESULT hr;
IADsADSystemInfo *pSys;
hr = CoCreateInstance(CLSID_ADSystemInfo,
NULL,
CLSCTX_INPROC_SERVER,
IID_IADsADSystemInfo,
(void**)&pSys);
BSTR bstr;
if (SUCCEEDED(hr) && SUCCEEDED(pSys->get_DomainDNSName(&bstr)))
{
strDomain = bstr;
SysFreeString(bstr);
}
else
strDomain = "rootDSE";

if(pSys)
pSys->Release();
}
CString str, str1, str2;
IADs *pADs = NULL;
BSTR bstrUrl, bstrName, bstrPass;
str="LDAP://"+ strDomain;
bstrUrl = str.AllocSysString();
str1 = strDomain+"\\"+strAccountName;
bstrName = str1.AllocSysString();
str2 = strPassword;
bstrPass = str2.AllocSysString();
hr = ADsOpenObject( bstrUrl, bstrName, bstrPass, ADS_SECURE_AUTHENTICATION, IID_IADs, (void**)&pADs);
SysFreeString( bstrUrl );
SysFreeString( bstrName );
SysFreeString( bstrPass );
if ( hr != S_OK || NULL == pADs)
{
CCommonFun::WriteFileLog("CheckUserPasswordInDomain hr = %X",hr);
return FALSE;
}
if (pADs)
{
pADs->Release();
pADs = NULL;
}
return TRUE;
}

Started by Michell at January 01, 2017 - 11:59 AM

? ? ? ? ? ? ? ? ? ?

Posted by Michell at January 05, 2017 - 12:22 PM

????????????????????

Posted by Michell at January 09, 2017 - 12:56 PM