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

something about ldap_add_s



Hi:
    I met some problems about the api 'ldap_add_s'.I have spended more than 2 days on it,but 
    ,useless.My program is compiled successfully,but as soon as it run to the place:ldap_add_s()
    ,I always get the error reported from os: "Memoty default  Core dumped".I checked my 
    variable and use dbx to debug my program .I am sure values of the variable are all correct
    for I use 'print *(attr[?].mod_vals.modv.strvals)' to check all kinds of  values.
    I have to send this mail to get help from you.Maybe I have commited some fatal errors which
    I did not notice.
    Execuse my stupid!
    I copy some of my resource down 
    Any help is appreciated !

........
  
/* finish the necessary operation of connecting and binding  */
 
 char            *ch_value1[]=ch_value2[]=ch_value3[]={NULL,NULL};
 LDAPMod         *attr[4],attr1,attr2,attr3;
 
.........

           attr1.mod_op=0; 
           attr1.mod_type="objectclass";
           ch_value1[0]=malloc(sizeof("person")+1);
           ch_value1[0]="person\0";
           ch_value1[1]=NULL;
           attr1.mod_values=ch_value1;
           attr2.mod_op=0;
           attr2.mod_type="cn";
           ch_value2[0]=malloc(sizeof("rjy3")+1);
           ch_value2[0]="rjy3\0";
           ch_value2[1]=NULL;
           attr2.mod_values=ch_value2;
           ch_value3[0]=malloc(sizeof("no1")+1);
           ch_value3[0]="no1\0";
           ch_value3[1]=NULL;
           attr3.mod_values=ch_value3;
           attr3.mod_type="sn";
           attr3.mod_op=0;
           attr[0]=&attr1;
           attr[1]=&attr2;
           attr[2]=&attr3;
           attr[3]=NULL;
           if(ldap_add_s(ld,*adddn,attr)==LDAP_SUCCESS)
      
          {  printf("You may search the new entry\n");
          }
           else
           {ldap_perror(" can't perform the add operation\nldap_add_s:");
           }
............

_____________________________________________
Ê׶¼ÔÚÏß--ÏȽøÖйúÈ˵ÄÍøÉϼÒÔ° http://www.263.net
Ãâ·ÑÓÊÏä ÓʼþÔÓÖ¾ Ç©ÃûÓʼþ Óʼþ¼ÓÃÜ Óʼþ×·Éíºô
ËÑË÷ÒýÇæ ¸öÈËÕ¾µã ÔÚÏßÓÎÏ· ÍøÉÏÁÄÌì ÍøÉϹҺÅ
½ðÈÚÍõ¹ú ÔÚÏßɱ¶¾ ÌøÔéÊг¡ Èí¼þÏÂÔØ ÐÝÏÐÓéÀÖ