Announcement

Collapse
No announcement yet.

LDAP Bind object fails (0x8007052E) when connecting from client computer to server

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • LDAP Bind object fails (0x8007052E) when connecting from client computer to server

    Hi all,



    I am currently experiencing an error when trying to Bind an object on an AD Server from a Client computer. The error I encounter is: 0x8007052E. Which means bad username / password.


    I'm quite confused by this since the username / password I am submitting is correct. I tried with the NAA account and the Administrator account, but both fails.



    I even tried adding the client computers to the domain and they still don't work.



    Now I tried doing something, and the weird part is it works.



    In the Server I try to access, there is an account named "Administrator" with password "[email protected]".



    What I did was create a similar account in one of the client computers ("Administrator" with password "[email protected]") and tried doing the same thing only instead of supplying explicit Username and Password, I tried to access it using only current credentials.



    And it works!!



    I'm not really sure what I am doing wrong. Can you please tell me if my the parameters I pass is correct?



    LDAP String: "LDAP://sccmdc/DC=sccm,DC=com"



    Username: "sccm\lean.alcabasa" (NAA Account)



    Password: "[email protected]"



    Thank you!!



    Below is my code if you want:





    Code:
    int main(int argc, char* argv[])
    
    {
    
    // Initialize COM.
    
    CoInitialize(NULL);
    
     
    
    HRESULT hr = S_OK; // COM result variable
    
    ADS_SEARCH_COLUMN col;  // COL for iterations
    
     
    
    LPWSTR szUsername = L"sccm\Administrator"; // user name
    
    LPWSTR szPassword = L"[email protected]"; // password
    
     
    
    // Interface Pointers.
    
    IDirectorySearch     *pDSSearch;
    
     
    
    cout << "Initialize COM" << endl;
    
     
    
    hr = ADsOpenObject(L"LDAP://sccmdc/DC=sccm,DC=com", 
    
    NULL,
    
    NULL,
    
    ADS_SECURE_AUTHENTICATION,
    
    IID_IDirectorySearch,
    
    (void **)&pDSSearch);
    
     
    
    cout << "After ADSOpenObject2" << endl;
    
     
    
    if (SUCCEEDED(hr))
    
    {
    
    // Search for all users with a last name that starts with h.
    
    LPWSTR pszAttr[] = { L"ADsPath", L"Name", L"samAccountName" };
    
    ADS_SEARCH_HANDLE hSearch = NULL;
    
    DWORD dwCount= sizeof(pszAttr)/sizeof(LPWSTR);
    
     
    
    cout << "Reach 2" << endl;
    
     
    
    // Search for users with a last name that begins with "h".
    
    hr = pDSSearch->ExecuteSearch(L"(&(objectClass=user)(sn=l*))", pszAttr, dwCount, &hSearch );
    
     
    
    cout << "Reach 3" << endl;
    
    
    while( pDSSearch->GetNextRow( hSearch) != S_ADS_NOMORE_ROWS )
    
    {
    
    cout << "Reach 4" << endl;
    
     
    
    // Get the samAccountName
    
    hr = pDSSearch->GetColumn( hSearch, pszAttr[2], &col );
    
    if ( FAILED(hr) )
    
    {
    
    hr = pDSSearch->AbandonSearch( hSearch );
    
    hr = pDSSearch->CloseSearchHandle(hSearch);
    
    pDSSearch->Release();
    
    break;
    
    }
    
    if (col.dwADsType == ADSTYPE_CASE_IGNORE_STRING)
    
      printf("%S\n", col.pADsValues->CaseIgnoreString); 
    
      pDSSearch->FreeColumn( &col );
    
    }
    
    
    pDSSearch->CloseSearchHandle( hSearch );
    
    
    pDSSearch->Release();
    
    }
    
     
    
    if (FAILED(hr))
    
    {
    
    string error = format_error(hr, "Failed to initialize security. Error code = 0x");
    
    cout << "ERROR 2: " << error << endl;           
    
    }
    
     
    
    cout << "WPI" << endl;
    
     
    
     
    
    cout << "UNIINTIALIZE" << endl;
    
     
    
    CoUninitialize();
    
     
    
    return 0;
    
     
    
    }
    Last edited by Ossian; 2nd August 2010, 07:10. Reason: Added code tags

  • #2
    Re: LDAP Bind object fails (0x8007052E) when connecting from client computer to serve

    Could you give us just a tiny hint what operating systems are involved here?
    Tom Jones
    MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
    PhD, MSc, FIAP, MIITT
    IT Trainer / Consultant
    Ossian Ltd
    Scotland

    ** Remember to give credit where credit is due and leave reputation points where appropriate **

    Comment


    • #3
      Re: LDAP Bind object fails (0x8007052E) when connecting from client computer to serve

      Hi Ossian, thanks for replying.

      Sorry, I forgot to mention it.

      The Server I am trying to access is Windows Server 2008 x64. Also an Active Directory.

      The Clients I am trying to connect to the server from are Windows Server 2008 x86.

      Thank you!

      Comment


      • #4
        Re: LDAP Bind object fails (0x8007052E) when connecting from client computer to serve

        I'm not much of a scripter but your LDAP connection distinguished name looks funky.

        What I'm familiar with would look like:

        LDAP://DC=sccmdc,DC=sccm,DC=com

        Comment

        Working...
        X