[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Problems when using ldap_add_s() API call

Lucas Brasilino wrote:


    I've running in problems using ldap_add_s(). I've been searching
ml archives about this problem. The most close thread about it is:

    Well, I'm populating an LDAPMod (properly, I think) structure
and calling ldap_add_s() it returns "no values for attribute type".
But there's values to attribute!!!
    Here comes the code snippet:

  LDAP *ldapconn;
  char *dn = "cn=logan,ou=People,dc=emprel,dc=recife";
  LDAPMod *attrs[4];
  int protocol;

if ((attrs[0] = (LDAPMod *)malloc (sizeof (LDAPMod *))) == NULL) exit (2);
attrs[0]->mod_op = 0;
attrs[0]->mod_type = "objectClass";
attrs[0]->mod_values = (char **)malloc (3 * sizeof (char **));
*attrs[0]->mod_values = strdup("top");

Don't do that ^^^^^^^^^^^^^

    Any tip, recommendation or help?

thanks a lot in advance

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc
  Symas: Premier OpenSource Development and Support