Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8691145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:03:58+00:00 2026-06-13T00:03:58+00:00

i am trying to modify the AD attribute value using ldap_modify function… the code

  • 0

i am trying to modify the AD attribute value using ldap_modify function…

the code is below…

    LDAPMod *list_of_attrs[1]={0};
    char *Password[] = {"Password2"};
    LDAPMessage *result=NULL;
    int msgid;
    int rc=0;   
    LDAPMod attribute2;     

    attribute2.mod_type = (PCHAR)"Password number";
    attribute2.mod_op = LDAP_MOD_REPLACE;
    attribute2.mod_vals.modv_strvals=Password;
    list_of_attrs[0] = &attribute2;


    wchar_t dnName[100]={0};
    char *dn = "CN=test,CN=Users,DC=raja,DC=com";
    mbstowcs(dnName,dn, 100);
    PWCHAR dnNameval = (PWCHAR)malloc(sizeof(PWCHAR) * 20);
    wcscpy(dnNameval,dnName);

    msgid=ldap_modify(pLdapConnection,(const PCHAR)dnNameval, list_of_attrs);

but,when it comes to last line(msgid)access violation exception occured..

*Unhandled exception at 0x76f693ac in AD2.exe: 0xC0000005: Access violation reading location 0xcccccccc.*

kindly help me to resolve that…
thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:03:58+00:00Added an answer on June 13, 2026 at 12:03 am

    I may guess from location 0xcccccccc that the crash occurs due to an uninitialized pointer. When reading the code, pLdapConnection appears to be that pointer.

    Update

    After reading the OP comment, now I can see that the problem is in the 3rd argument which is, quoting MSDN, a null-terminated array of modifications to make to the entry.
    Therefore, the correct usage should be e.g.

    LDAPMod attribute2;     
    // Initialize attribute2
    ............
    LDAPMod *list_of_attrs[2]={&attribute2, 0};
    

    That is, the size of the array should be one more than the number of entries you’d like to define and the last array item should be NULL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to modify the code below to check the input from a
How can i modify the value of an attribute within an xml loaded using
I am trying to modify the script below to click a button that looks
I am trying to modify a status flag in an XML structure using Javascript.
I am trying to modify a proprietory XML file using XSL and MSXSL. The
I'm trying without luck to create a modify() statement to change the value of
I'm trying to see if a list item with a certain attribute value does
I'm trying to modify the 'attr' function in the jQuery (V.6.1) core. I have
I'm trying to read an existing XML file, modify the InnerText and Attribute values
i'm trying to modify a existing user and add a attribute to him. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.