[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
| Title: | X.500 Directory Services | 
| Notice: | Sprt: FORTY2::X500_SUPPORT, Kits: 216.*, try dir/titl=OFFICIAL | 
| Moderator: | FORTY2::PULLEN | 
|  | 
| Created: | Tue Jan 30 1990 | 
| Last Modified: | Thu Jun 05 1997 | 
| Last Successful Update: | Fri Jun 06 1997 | 
| Number of topics: | 1016 | 
| Total number of notes: | 4299 | 
975.0. "LDAP API question" by EVTAI1::LEPAUL (Paris by night) Fri Feb 14 1997 16:33
Hello,
First of all i'm a c beginner.
I try to modify the LDAP search.c program in usr/examples/ibx
to display the names and the values of attributes.
I've no problem with the API ldapFirstAttribute. I can display all values
of the fisrt attribute of all DNs that matches the filter.
But the ldapNextAttribute is always NULL and i cannot understand why. 
Following some extract:
1) The attrs is an arrray containing the list of attribute to search.
All my X.500 directory entries have these attributes.
	      attrs[0] = "tel";
	      attrs[1] = "surname";
              attrs[2] = "userid";
              attrs[3] = "cn";
              attrs[4] = NULL;
              
2) The search request 
 
	      ret = ldapSearchWLim(ldap_handle,   
                                BASE,             
                                LDAP_SCOPE_SUBTREE,  
                                FILTER,                 
                                attrs,             
                                FALSE,            
                                0,                           
                                0,                       
                                &res_chain);      
3) The piece of code to display attributes.
               attrib = ldapFirstAttribute(ldap_handle,ret_mess,&test);
               attribval = ldapGetValues(ldap_handle,ret_mess,attrib);
                  if (attribval == NULL)
                      /* Cas impossible mais..... */ 
                      printf("No attribute value....\n");
                  else
                  {
                      int i = 0;
                      printf("Attribut :  %s\n",attrib);
                      while (attribval[i] != NULL)
                      {printf("Valeur %d  %s \n",i,attribval[i]);
                      i++;
                      }
                      ldapValueFree(attribval);
                  } 
               nextattrib = ldapNextAttribute(ldap_handle,ret_mess,&suite);
               if (nextattrib == NULL) printf("No next attribute  %s\n",nextattrib);   
               
I have always the values of the first atribute and the "No next attribute"
message. What is wrong?
Pierre.  
| T.R | Title | User | Personal Name
 | Date | Lines | 
|---|
| 975.1 |  | IOSG::CARLIN | Dick Carlin IOSG, Reading, England | Mon Feb 17 1997 11:32 | 6 | 
|  |     Pierre
    
    Shouldn't the third parameter in the ldap_next_attribute call be test
    (the index variable from ldap_first_attribute)?
    
    Dick
 | 
| 975.2 | Merci | EVTAI1::62662::LEPAUL | Paloma, la cote d'azur..... | Mon Feb 17 1997 13:22 | 7 | 
|  | Dick,
All works fine now.
Best regards,
Pierre.
 |