1 /* centipede.c - generate and install indexing information (view w/tabstop=4) */
11 #include <ac/unistd.h> /* get link(), unlink() */
18 #define DEFAULT_LDAPFILTER "(objectclass=*)"
20 #define CENTROID_VALUE 1
21 #define CENTROID_WORD 2
23 #define CENTROID_RELATIVE 1
24 #define CENTROID_FULL 2
26 #define WORD_BREAKS " -',.()!;:&$%*\"/\\+_<>=?[]|^~"
39 int srcldapauthmethod;
40 int destldapauthmethod;
44 static LDAP *start_ldap_search(char *ldapsrcurl, char *ldapfilter, char **attrs);
45 static LDAP *bind_to_destination_ldap(char *ldapsrcurl, char *ldapdesturl);
46 static int create_tmp_files(char **attrs, char ***tmpfile, LDBM **ldbm);
47 static int generate_new_centroids(LDAP *ld, char **attrs, LDBM *ldbm);
48 static LDAPMod **diff_centroids(char *attr, LDBM oldbm, LDBM nldbm, int nentries);
49 static LDAPMod **full_centroid(char *attr, LDBM ldbm, int nentries);
50 static char **charray_add_dup(char ***a, int *cur, int *max, char *s);
52 static void usage( char *name )
54 fprintf( stderr, "usage: %s [options] -s url -d url attributes\n", name );
55 fprintf( stderr, "where:\n" );
56 fprintf( stderr, "\t-s url\t\t[[ldap://][host[:port]]/]searchbasedn\n");
57 fprintf( stderr, "\t-d url\t\t[[ldap://][host[:port]]/]centroidentrydn\n");
58 fprintf( stderr, "options:\n" );
59 fprintf( stderr, "\t-v \t\tturn on verbose mode\n" );
60 fprintf( stderr, "\t-n \t\tgenerate, but do not install index info\n" );
61 fprintf( stderr, "\t-f filter\tentry selection filter\n" );
62 fprintf( stderr, "\t-F \t\tgenerate a full centroid\n" );
63 fprintf( stderr, "\t-R \t\tgenerate a relative centroid\n" );
64 fprintf( stderr, "\t-w \t\tgenerate a word-based centroid\n" );
65 fprintf( stderr, "\t-t directory\tcentroid directory\n" );
66 fprintf( stderr, "\t-b binddn\tsource bind dn\n" );
67 fprintf( stderr, "\t-p passwd\tsource bind passwd (for simple auth)\n" );
68 fprintf( stderr, "\t-m authmethod\tsource authmethod \"simple\" or \"kerberos\"\n" );
69 fprintf( stderr, "\t-B binddn\tdestination bind dn\n" );
70 fprintf( stderr, "\t-P passwd\tdestination bind passwd (for simple auth)\n" );
71 fprintf( stderr, "\t-M authmethod\tdestination authmethod \"simple\" or \"kerberos\"\n" );
72 fprintf( stderr, "\t-c size\t\tldbm cache size\n" );
76 main( int argc, char **argv )
79 char *ldapsrcurl, *ldapdesturl;
94 srcldapauthmethod = LDAP_AUTH_SIMPLE;
95 destldapauthmethod = LDAP_AUTH_SIMPLE;
98 destldapbinddn = NULL;
99 destldappasswd = NULL;
100 ldapfilter = DEFAULT_LDAPFILTER;
101 centroidvalues = CENTROID_VALUE;
102 centroidtype = CENTROID_RELATIVE;
107 while ( (i = getopt( argc, argv, "s:d:c:b:B:f:FRWp:P:m:M:t:vwn" ))
110 case 's': /* source url [[ldap://][host[:port]]/]basedn */
111 ldapsrcurl = strdup( optarg );
114 case 'd': /* destination url [[ldap://][host[:port]]/]entrydn */
115 ldapdesturl = strdup( optarg );
118 case 'f': /* specify a filter */
119 ldapfilter = strdup( optarg );
122 case 'F': /* generate full centroid */
123 centroidtype = CENTROID_FULL;
126 case 'R': /* generate relative centroid */
127 centroidtype = CENTROID_RELATIVE;
130 case 'w': /* generate word centroid */
131 centroidvalues = CENTROID_WORD;
134 case 'W': /* generate weights */
138 case 't': /* temp file directory */
139 centdir = strdup( optarg );
142 case 'b': /* src bind dn */
143 srcldapbinddn = strdup( optarg );
146 case 'p': /* src bind password */
147 srcldappasswd = strdup( optarg );
152 case 'B': /* dest bind dn */
153 destldapbinddn = strdup( optarg );
156 case 'P': /* dest bind password */
157 destldappasswd = strdup( optarg );
162 case 'm': /* src bind method */
163 if ( strcasecmp( optarg, "simple" ) == 0 ) {
164 srcldapauthmethod = LDAP_AUTH_SIMPLE;
165 } else if ( strcasecmp( optarg, "kerberos" ) == 0 ) {
166 srcldapauthmethod = LDAP_AUTH_KRBV4;
168 fprintf( stderr, "%s: unknown auth method\n", optarg );
169 fputs( "expecting \"simple\" or \"kerberos\"\n", stderr );
174 case 'M': /* dest bind method */
175 if ( strcasecmp( optarg, "simple" ) == 0 ) {
176 destldapauthmethod = LDAP_AUTH_SIMPLE;
177 } else if ( strcasecmp( optarg, "kerberos" ) == 0 ) {
178 destldapauthmethod = LDAP_AUTH_KRBV4;
180 fprintf( stderr, "%s: unknown auth method\n", optarg );
181 fputs( "expecting \"simple\" or \"kerberos\"\n", stderr );
186 case 'c': /* ldbm cache size */
187 ldbmcachesize = atoi( optarg );
190 case 'v': /* turn on verbose mode */
194 case 'n': /* don't actually install index info */
203 if ( optind == argc || ldapsrcurl == NULL || ldapdesturl == NULL ) {
207 attrs = &argv[optind];
210 * open the ldap connection and start searching for the entries
211 * we will use to generate the centroids.
214 if ( (ld = start_ldap_search( ldapsrcurl, ldapfilter, attrs )) == NULL ) {
215 fprintf( stderr, "could not initiate ldap search\n" );
219 if ( create_tmp_files( attrs, &tmpfile, &ldbm ) != 0 ) {
220 fprintf( stderr, "could not create temp files\n" );
225 * go through the entries returned, building a centroid for each
226 * attribute as we go.
229 if ( (count = generate_new_centroids( ld, attrs, ldbm )) < 1 ) {
231 fprintf( stderr, "no entries matched\n" );
234 fprintf( stderr, "could not generate new centroid\n" );
240 * for each centroid we generated above, compare to the existing
241 * centroid, if any, and produce adds and deletes, or produce
242 * an entirely new centroid. in either case, update the "current"
243 * centroid version with the new one we just generated.
246 if ( (ld = bind_to_destination_ldap( ldapsrcurl, ldapdesturl )) == NULL ) {
248 "could not bind to index server, or could not create index entry\n" );
252 for ( i = 0; ldbm[i] != NULL; i++ ) {
253 /* generate the name of the existing centroid, if any */
254 s = strrchr( tmpfile[i], '/' );
256 sprintf( buf, "%s/cent.%s", tmpfile[i], attrs[i] );
259 /* generate the full centroid changes */
260 if ( centroidtype == CENTROID_FULL || (oldbm = ldbm_open( buf,
261 LDBM_WRITER, 0, ldbmcachesize )) == NULL ) {
262 if ( (mods = full_centroid( attrs[i], ldbm[i], count )) == NULL ) {
263 fprintf( stderr, "could not produce full centroid for %s\n",
268 /* generate the differential centroid changes */
270 if ( (mods = diff_centroids( attrs[i], oldbm, ldbm[i], count ))
272 fprintf( stderr, "could not diff centroids\n" );
280 printf("changes:\n");
281 for ( j = 0; mods[j] != NULL; j++ ) {
282 switch( mods[j]->mod_op ) {
284 printf( "\tadd: %s\n",mods[j]->mod_type );
286 case LDAP_MOD_DELETE:
287 printf( "\tdelete: %s\n",mods[j]->mod_type );
289 case LDAP_MOD_REPLACE:
290 printf( "\treplace: %s\n",mods[j]->mod_type );
293 if ( mods[j]->mod_values != NULL ) {
294 for ( k = 0; mods[j]->mod_values[k] != NULL; k++ ) {
295 printf( "\t\t%s\n", mods[j]->mod_values[k] );
299 printf("end changes:\n");
303 printf( "%sModifying centroid...", not ? "Not " : "" );
307 /* attempt to make the changes to the index server entry */
308 if ( !not && ldap_modify_s( ld, ldapbase, mods ) != LDAP_SUCCESS ) {
309 fprintf( stderr, "could not apply centroid modification for %s\n",
311 ldap_perror( ld, ldapbase );
313 ldap_mods_free( mods, 1 );
320 /* move the new centroid into the old one's place */
322 (void) unlink( buf );
323 if ( link( tmpfile[i], buf ) != 0 ) {
325 fprintf( stderr, "could not rename %s to %s\n", buf,
330 (void) unlink( tmpfile[i] );
334 for ( i = 0; attrs[i] != NULL; i++ ) {
335 ldbm_close( ldbm[i] );
345 * open an ldap connection, bind, and initiate the search
359 if ( strncmp( ldapsrcurl, "ldap://", 7 ) != 0 ) {
360 fputs( "Not an LDAP URL", stderr ); /* Should be smarter? */
364 if ( (s2 = strchr( s, '/' )) == NULL ) {
365 ldapbase = strdup( s );
369 ldaphost = strdup( s );
372 ldapbase = strdup( s2 + 1 );
376 printf( "Base: %s\n", ldapbase );
377 printf( "Attributes:" );
378 for ( i = 0; attrs[i] != NULL; i++ ) {
379 printf( " %s", attrs[i] );
382 printf( "Binding to source LDAP server..." );
386 if ( (ld = ldap_open( ldaphost, 0 )) == NULL ) {
387 perror( "ldap_open" );
391 if ( ldap_bind_s( ld, srcldapbinddn, srcldappasswd, srcldapauthmethod )
393 ldap_perror( ld, "ldap_bind_s" );
398 printf( "\nInitiating search..." );
399 if ( ldap_search( ld, ldapbase, LDAP_SCOPE_SUBTREE, ldapfilter, attrs, 0 )
401 ldap_perror( ld, "ldap_search" );
414 * create the temporary ldbm files we will use to hold the new centroids
426 for ( i = 0; attrs[i] != NULL; i++ )
430 if ( (*tmpfile = (char **) malloc( i * sizeof(char *) )) == NULL ) {
434 if ( (*ldbm = (LDBM *) malloc( i * sizeof(LDBM) )) == NULL ) {
438 for ( i = 0; attrs[i] != NULL; i++ ) {
439 if ( ((*tmpfile)[i] = tempnam( centdir, NULL )) == NULL ) {
444 if ( ((*ldbm)[i] = ldbm_open( (*tmpfile)[i], LDBM_WRCREAT, 0600,
445 ldbmcachesize )) == NULL ) {
446 fprintf( stderr, "ldbm_open of \"%s\" failed\n", (*tmpfile)[i] );
447 perror( "ldbm_open" );
451 (*tmpfile)[i] = NULL;
458 * step through each entry returned from the search and generate
459 * the appropriate centroid values.
463 generate_new_centroids(
471 LDAPMessage *res, *e;
476 ldbm_datum_init( data );
479 printf( "Generating new centroids for..." );
486 while ( (rc = ldap_result( ld, LDAP_RES_ANY, 0, NULL, &res ))
487 == LDAP_RES_SEARCH_ENTRY ) {
489 e = ldap_first_entry( ld, res );
490 dn = ldap_get_dn( ld, e );
492 /* for each attr we want to generate a centroid for */
493 for ( i = 0; attrs[i] != NULL; i++ ) {
494 if ( (val = ldap_get_values( ld, e, attrs[i] )) == NULL ) {
499 for ( j = 0; val[j] != NULL; j++ ) {
501 ldbm_datum_init( key );
503 /* normalize the value */
504 for ( s = val[j]; *s; s++ ) {
505 /* May need other normalization here,
506 * unless that breaks compatibility
507 * with other centipedes
509 *s = TOLOWER( (unsigned char) *s );
512 if ( isascii( last ) && isdigit( last ) ) {
516 /* generate a value-based centroid */
517 if ( centroidvalues == CENTROID_VALUE ) {
519 key.dsize = strlen( key.dptr ) + 1;
520 (void) ldbm_store( ldbm[i], key, data, LDBM_INSERT );
522 /* generate a word-based centroid */
525 for ( w = ldap_pvt_strtok( val[j], WORD_BREAKS, &lasts );
527 w = ldap_pvt_strtok( NULL, WORD_BREAKS, &lasts ) ) {
529 key.dsize = strlen( key.dptr ) + 1;
530 (void) ldbm_store( ldbm[i], key, data, LDBM_INSERT );
534 ldap_value_free( val );
543 printf( "%d entries\n", count );
550 * compare the old and new centroids, generating the appropriate add
551 * and delete operations. if the underlying database is ordered, we
552 * can do this more efficiently.
568 char **avals, **dvals;
569 int amax, acur, dmax, dcur;
572 #ifdef HAVE_BERKELEY_DB2
575 #endif /* HAVE_BERKELEY_DB2 */
578 printf( "Generating mods for differential %s centroid...", attr );
582 ldbm_datum_init( okey );
583 ldbm_datum_init( nkey );
584 ldbm_datum_init( olast );
585 ldbm_datum_init( nlast );
586 ldbm_datum_init( lastkey );
587 ldbm_datum_init( key );
588 ldbm_datum_init( data );
590 if ( (mods = (LDAPMod **) malloc( sizeof(LDAPMod *) * 4 )) == NULL ||
591 (mods[0] = (LDAPMod *) malloc( sizeof(LDAPMod) )) == NULL ||
592 (mods[1] = (LDAPMod *) malloc( sizeof(LDAPMod) )) == NULL ||
593 (mods[2] = (LDAPMod *) malloc( sizeof(LDAPMod) )) == NULL ||
594 (vals = (char **) malloc( 2 * sizeof(char *) )) == NULL ||
595 (vals[0] = (char *) malloc( 20 )) == NULL )
600 /* add values in mods[0] */
601 mods[0]->mod_op = LDAP_MOD_ADD;
602 mods[0]->mod_type = attr;
603 mods[0]->mod_values = NULL;
606 /* delete values in mods[1] */
607 mods[1]->mod_op = LDAP_MOD_DELETE;
608 mods[1]->mod_type = attr;
609 mods[1]->mod_values = NULL;
612 /* number of entries in mods[2] */
613 sprintf( vals[0], "%d", nentries );
615 mods[2]->mod_op = LDAP_MOD_REPLACE;
616 mods[2]->mod_type = "nentries";
617 mods[2]->mod_values = vals;
618 /* null terminate list of mods */
623 * if the underlying database is ordered, we can do a more efficient
624 * dual traversal, yielding O(N) performance.
629 #ifdef HAVE_BERKELEY_DB2
630 for ( okey = ldbm_firstkey( oldbm, &ocursorp ),
631 nkey = ldbm_firstkey( nldbm, &ncursorp );
632 okey.dptr != NULL && nkey.dptr != NULL; )
634 for ( okey = ldbm_firstkey( oldbm ), nkey = ldbm_firstkey( nldbm );
635 okey.dptr != NULL && nkey.dptr != NULL; )
638 int rc = strcmp( okey.dptr, nkey.dptr );
641 /* value is in both places - leave it */
642 if ( olast.dptr != NULL ) {
643 ldbm_datum_free( oldbm, olast );
646 if ( nlast.dptr != NULL ) {
647 ldbm_datum_free( nldbm, nlast );
651 #ifdef HAVE_BERKELEY_DB2
652 okey = ldbm_nextkey( oldbm, olast, ocursorp );
653 nkey = ldbm_nextkey( nldbm, nlast, ncursorp );
655 okey = ldbm_nextkey( oldbm, olast );
656 nkey = ldbm_nextkey( nldbm, nlast );
658 } else if ( rc > 0 ) {
659 /* new value is not in old centroid - add it */
660 if ( charray_add_dup( &avals, &acur, &amax, nkey.dptr ) == NULL ) {
661 ldap_mods_free( mods, 1 );
665 if ( nlast.dptr != NULL ) {
666 ldbm_datum_free( nldbm, nlast );
670 #ifdef HAVE_BERKELEY_DB2
671 nkey = ldbm_nextkey( nldbm, nlast, ncursorp );
673 nkey = ldbm_nextkey( nldbm, nlast );
676 /* old value is not in new centroid - delete it */
677 if ( charray_add_dup( &dvals, &dcur, &dmax, okey.dptr ) == NULL ) {
678 ldap_mods_free( mods, 1 );
682 if ( olast.dptr != NULL ) {
683 ldbm_datum_free( oldbm, olast );
687 #ifdef HAVE_BERKELEY_DB2
688 okey = ldbm_nextkey( oldbm, olast, ocursorp );
690 okey = ldbm_nextkey( oldbm, olast );
695 while ( okey.dptr != NULL ) {
696 if ( charray_add_dup( &dvals, &dcur, &dmax, okey.dptr ) == NULL ) {
697 ldap_mods_free( mods, 1 );
701 #ifdef HAVE_BERKELEY_DB2
702 okey = ldbm_nextkey( oldbm, olast, ocursorp );
704 okey = ldbm_nextkey( oldbm, olast );
706 if ( olast.dptr != NULL ) {
707 ldbm_datum_free( oldbm, olast );
711 if ( olast.dptr != NULL ) {
712 ldbm_datum_free( oldbm, olast );
714 while ( nkey.dptr != NULL ) {
715 if ( charray_add_dup( &avals, &acur, &amax, nkey.dptr ) == NULL ) {
716 ldap_mods_free( mods, 1 );
720 #ifdef HAVE_BERKELEY_DB2
721 nkey = ldbm_nextkey( nldbm, nlast, ncursorp );
723 nkey = ldbm_nextkey( nldbm, nlast );
725 if ( nlast.dptr != NULL ) {
726 ldbm_datum_free( nldbm, nlast );
730 if ( nlast.dptr != NULL ) {
731 ldbm_datum_free( nldbm, nlast );
735 * if the underlying database is not ordered, we have to
736 * generate list of values to add by stepping through all new
737 * values and looking them up in the old centroid (not there => add),
738 * then stepping through all old values and looking them up in the
739 * new centroid (not there => delete). this yields O(Nf(N)) performance,
740 * where f(N) is the order to retrieve a single item.
743 /* generate list of values to add */
745 #ifdef HAVE_BERKELEY_DB2
746 for ( key = ldbm_firstkey( nldbm, &ncursorp ); key.dptr != NULL;
747 key = ldbm_nextkey( nldbm, lastkey, ncursorp ) )
749 for ( key = ldbm_firstkey( nldbm ); key.dptr != NULL;
750 key = ldbm_nextkey( nldbm, lastkey ) )
753 /* see if it's in the old one */
754 data = ldbm_fetch( oldbm, key );
756 /* not there - add it */
757 if ( data.dptr == NULL ) {
758 if ( charray_add_dup( &avals, &acur, &amax, key.dptr ) == NULL ) {
759 ldap_mods_free( mods, 1 );
763 ldbm_datum_free( oldbm, data );
765 if ( lastkey.dptr != NULL ) {
766 ldbm_datum_free( nldbm, lastkey );
770 if ( lastkey.dptr != NULL ) {
771 ldbm_datum_free( nldbm, lastkey );
774 /* generate list of values to delete */
776 #ifdef HAVE_BERKELEY_DB2
777 for ( key = ldbm_firstkey( oldbm, &ocursorp ); key.dptr != NULL;
778 key = ldbm_nextkey( oldbm, lastkey, ocursorp ) )
780 for ( key = ldbm_firstkey( oldbm ); key.dptr != NULL;
781 key = ldbm_nextkey( oldbm, lastkey ) )
784 /* see if it's in the new one */
785 data = ldbm_fetch( nldbm, key );
787 /* not there - delete it */
788 if ( data.dptr == NULL ) {
789 if ( charray_add_dup( &dvals, &dcur, &dmax, key.dptr ) == NULL ) {
790 ldap_mods_free( mods, 1 );
794 ldbm_datum_free( nldbm, data );
796 if ( lastkey.dptr != NULL ) {
797 ldbm_datum_free( oldbm, lastkey );
801 if ( lastkey.dptr != NULL ) {
802 ldbm_datum_free( oldbm, lastkey );
806 mods[0]->mod_values = avals;
807 mods[1]->mod_values = dvals;
814 if ( mods[1]->mod_values == NULL ) {
815 free( (char *) mods[1] );
818 if ( mods[0]->mod_values == NULL ) {
819 free( (char *) mods[0] );
823 if ( mods[0] == NULL ) {
824 free( (char *) mods );
843 #ifdef HAVE_BERKELEY_DB2
848 printf( "Generating mods for full %s centroid...", attr );
852 ldbm_datum_init( key );
853 ldbm_datum_init( lastkey );
855 if ( (mods = (LDAPMod **) malloc( sizeof(LDAPMod *) * 3 )) == NULL ||
856 (mods[0] = (LDAPMod *) malloc( sizeof(LDAPMod) )) == NULL ||
857 (mods[1] = (LDAPMod *) malloc( sizeof(LDAPMod) )) == NULL ||
858 (vals = (char **) malloc( 2 * sizeof(char *) )) == NULL ||
859 (vals[0] = (char *) malloc( 20 )) == NULL )
864 mods[0]->mod_op = LDAP_MOD_REPLACE;
865 mods[0]->mod_type = attr;
866 mods[0]->mod_values = NULL;
867 sprintf( vals[0], "%d", nentries );
869 mods[1]->mod_op = LDAP_MOD_REPLACE;
870 mods[1]->mod_type = "nentries";
871 mods[1]->mod_values = vals;
877 #ifdef HAVE_BERKELEY_DB2
878 for ( key = ldbm_firstkey( ldbm, &cursorp ); key.dptr != NULL;
879 key = ldbm_nextkey( ldbm, lastkey, cursorp ) )
881 for ( key = ldbm_firstkey( ldbm ); key.dptr != NULL;
882 key = ldbm_nextkey( ldbm, lastkey ) )
885 if ( charray_add_dup( &vals, &vcur, &vmax, key.dptr ) == NULL ) {
886 ldap_mods_free( mods, 1 );
890 if ( lastkey.dptr != NULL ) {
891 ldbm_datum_free( ldbm, lastkey );
895 if ( lastkey.dptr != NULL ) {
896 ldbm_datum_free( ldbm, lastkey );
898 mods[0]->mod_values = vals;
905 if ( mods[0]->mod_values == NULL ) {
906 free( (char *) mods[0] );
907 free( (char *) mods );
915 * extract the destination ldap host, port, and base object for the
916 * server to receive the index information. then, open a connection,
917 * bind, and see if the entry exists. if not, create it and set things
918 * up so the centroid full and diff routines can modify it to contain
919 * the new centroid information.
923 bind_to_destination_ldap(
932 char *attrs[2], *refvalues[2], *ocvalues[2];
938 printf( "Binding to destination LDAP server..." );
942 /* first, pick out the destination ldap server info */
943 if ( ldapbase != NULL ) {
947 if ( strncmp( ldapdesturl, "ldap://", 7 ) != 0 ) {
948 fputs( "Not an LDAP URL", stderr ); /* Should be smarter? */
952 if ( (s2 = strchr( s, '/' )) == NULL ) {
953 ldapbase = strdup( s );
957 if ( ldaphost != NULL )
959 ldaphost = strdup( s );
962 ldapbase = strdup( s2 + 1 );
964 strcpy( buf, "ref=" );
965 if ( strpbrk( ldapsrcurl, " ,;" ) != NULL ) {
968 for ( s = d = ldapsrcurl; *s; s++ ) {
974 strcat( buf, ldapsrcurl );
975 if ( strpbrk( ldapsrcurl, " ,;" ) != NULL ) {
979 strcat( buf, ldapbase );
981 ldapbase = strdup( buf );
983 if ( (ld = ldap_open( ldaphost, 0 )) == NULL ) {
984 perror( "ldap_open" );
988 if ( ldap_bind_s( ld, destldapbinddn, destldappasswd, destldapauthmethod )
990 ldap_perror( ld, "ldap_bind_s" );
1000 rc = ldap_search_s( ld, ldapbase, LDAP_SCOPE_BASE, "(objectclass=*)",
1002 ldap_msgfree( res );
1004 if ( rc == LDAP_NO_SUCH_OBJECT ) {
1006 printf( "%sCreating centroid entry...", not ? "Not " : "" );
1010 /* create the centroid index entry */
1012 m[0].mod_type = "ref";
1013 refvalues[0] = ldapsrcurl;
1014 refvalues[1] = NULL;
1015 m[0].mod_values = refvalues;
1017 m[1].mod_type = "objectclass";
1018 ocvalues[0] = "indexentry";
1020 m[1].mod_values = ocvalues;
1025 if ( !not && ldap_add_s( ld, ldapbase, mp ) != LDAP_SUCCESS ) {
1026 ldap_perror( ld, ldapbase );
1035 } else if ( rc != LDAP_SUCCESS ) {
1036 ldap_perror( ld, "ldap_search_s" );
1053 *a = (char **) malloc( (BUFSIZ + 1) * sizeof(char *) );
1056 } else if ( *cur >= *max ) {
1058 *a = (char **) realloc( *a, (*max + 1) * sizeof(char *) );
1064 (*a)[(*cur)++] = strdup( s );