I've changed the code to...

        char* vals0[2];
        vals0[0] = "[email protected]";
        vals0[1] = NULL;

        int rc = ldap_simple_bind_s(ld, user, pass);
        
        LDAPMod *modM;
        
        char *dn = "uflEduUniversityId=28833300,ou=People,dc=ufl,dc=edu";

        modM->mod_op = LDAP_MOD_ADD;
        modM->mod_type = "mail";
        modM->mod_values = vals0;
        
        if((ldap_modify_s(ld, dn, &modM)) != LDAP_SUCCESS)
        {
                
        // FAIL
                
        }

But still get the same error on the ldap_modify_s(ld, dn, &modM) command.

Cheers,
Ade

2009/4/27 Eli Bach <[email protected]>:
>
> On Apr 26, 2009, at 5:31 AM, Adrian St. John-Bee wrote:
>
>> char** vals0;
>
> ...
>>
>> vals0[0] = "[email protected]";
>
> It looks like these two lines are your problem.
>
> You are just defining vals0 as a pointer to a pointer, and then referencing
> it as an array of pointers.
>
> However, you don't allocate any memory to actually store any data into.
>
> If you switched you're code to something like:
>
> char* vals0[2];
> vals0[0] = "[email protected]";
> vals0[1] = NULL;
>
> I have no comment on whether you are using the ldap api's correctly or not.
>
>

Reply via email to