3 * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
11 #include <ac/stdlib.h>
14 #include <ac/signal.h>
15 #include <ac/string.h>
16 #include <ac/unistd.h>
23 #ifdef HAVE_SYS_TYPES_H
24 #include <sys/types.h>
33 #include "ldap_defaults.h"
36 usage( const char *s )
39 "usage: %s [options] filter [attributes...]\nwhere:\n"
40 " filter\tRFC-1558 compliant LDAP search filter\n"
41 " attributes\twhitespace-separated list of attributes to retrieve\n"
42 "\t\t1.1 -- no attributes\n"
43 "\t\t* -- all user attributes\n"
44 "\t\t+ -- all operational attributes\n"
45 "\t\tempty list -- all non-operational attributes\n"
47 " -a deref\tone of `never', `always', `search', or `find' (alias\n"
49 " -A\t\tretrieve attribute names only (no values)\n"
50 " -b basedn\tbase dn for search\n"
51 " -d level\tset LDAP debugging level to `level'\n"
52 " -D binddn\tbind DN\n"
53 " -E\t\trequest SASL privacy (-EE to make it critical)\n"
54 " -f file\t\tperform sequence of searches listed in `file'\n"
55 " -h host\t\tLDAP server\n"
56 " -I\t\trequest SASL integrity checking (-II to make it\n"
58 " -k\t\tuse Kerberos authentication\n"
59 " -K\t\tlike -k, but do only step 1 of the Kerberos bind\n"
60 " -l limit\ttime limit (in seconds) for search\n"
61 " -L\t\tprint entries in LDIF format (default)\n"
62 " -LL\t\tprint entries in LDIF format without comments\n"
63 " -LLL\t\tprint entries in LDIF format without comments and\n"
65 " -M\t\tenable Manage DSA IT control (-MM to make critical)\n"
66 " -n\t\tshow what would be done but don't actually search\n"
67 " -p port\t\tport on LDAP server\n"
68 " -P version\tprocotol version (2 or 3)\n"
69 " -R\t\tdo not automatically follow referrals\n"
70 " -s scope\tone of base, one, or sub (search scope)\n"
71 " -S attr\t\tsort the results by attribute `attr'\n"
72 " -t\t\twrite binary values to files in TMPDIR\n"
73 " -tt\t\twrite all values to files in TMPDIR\n"
74 " -T path\t\twrite files to directory specified by path (default:\n"
76 " -u\t\tinclude User Friendly entry names in the output\n"
77 " -U user\t\tSASL authentication identity (username)\n"
78 " -v\t\trun in verbose mode (diagnostics to standard output)\n"
79 " -V prefix\tURL prefix for files (default: \"file://tmp/\")\n"
80 " -w passwd\tbind passwd (for simple authentication)\n"
81 " -W\t\tprompt for bind passwd\n"
82 " -X id\t\tSASL authorization identity (\"dn:<dn>\" or \"u:<user>\")\n"
83 " -Y mech\t\tSASL mechanism\n"
84 " -z limit\tsize limit (in entries) for search\n"
85 " -Z\t\tissue Start TLS request (-ZZ to require successful response)\n"
91 static void print_extended(
93 LDAPMessage *extended );
95 static void print_partial(
97 LDAPMessage *partial );
99 static void print_reference(
101 LDAPMessage *reference );
103 static void print_entry LDAP_P((
108 static int write_ldif LDAP_P((
114 static int dosearch LDAP_P((
123 #define TMPDIR "/tmp"
124 #define URLPRE "file:/tmp/"
126 static char *tmpdir = NULL;
127 static char *urlpre = NULL;
129 static char *binddn = NULL;
130 static struct berval passwd = { 0, NULL };
131 static char *base = NULL;
132 static char *ldaphost = NULL;
133 static int ldapport = 0;
134 #ifdef HAVE_CYRUS_SASL
135 static char *sasl_authc_id = NULL;
136 static char *sasl_authz_id = NULL;
137 static char *sasl_mech = NULL;
138 static int sasl_integrity = 0;
139 static int sasl_privacy = 0;
141 static int use_tls = 0;
142 static char *sortattr = NULL;
143 static int skipsortattr = 0;
144 static int verbose, not, includeufn, vals2tmp, ldif;
147 main( int argc, char **argv )
149 char *infile, *filtpattern, **attrs, line[ BUFSIZ ];
151 int rc, i, first, scope, deref, attrsonly, manageDSAit;
152 int referrals, timelimit, sizelimit, debug;
153 int authmethod, version, want_bindpw;
157 debug = verbose = not = vals2tmp =
158 attrsonly = manageDSAit = ldif = want_bindpw = 0;
160 deref = sizelimit = timelimit = version = -1;
162 /* default should be off */
165 scope = LDAP_SCOPE_SUBTREE;
166 authmethod = LDAP_AUTH_SIMPLE;
168 while (( i = getopt( argc, argv,
169 "Aa:b:D:d:Ef:h:IKkLl:MnP:p:RS:s:T:tU:uV:vWw:X:Y:Zz:")) != EOF )
172 case 'n': /* do nothing */
175 case 'v': /* verbose mode */
179 debug |= atoi( optarg );
181 case 'k': /* use kerberos bind */
182 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
183 authmethod = LDAP_AUTH_KRBV4;
185 fprintf( stderr, "%s was not compiled with Kerberos support\n", argv[0] );
186 return( EXIT_FAILURE );
189 case 'K': /* use kerberos bind, 1st part only */
190 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
191 authmethod = LDAP_AUTH_KRBV41;
193 fprintf( stderr, "%s was not compiled with Kerberos support\n", argv[0] );
194 return( EXIT_FAILURE );
198 case 'u': /* include UFN */
201 case 't': /* write attribute values to /tmp files */
205 /* enable Manage DSA IT */
208 case 'R': /* don't automatically chase referrals */
211 case 'A': /* retrieve attribute names only -- no values */
214 case 'L': /* print entries in LDIF format */
218 case 's': /* search scope */
219 if ( strcasecmp( optarg, "base" ) == 0 ) {
220 scope = LDAP_SCOPE_BASE;
221 } else if ( strncasecmp( optarg, "one", sizeof("one")-1 ) == 0 ) {
222 scope = LDAP_SCOPE_ONELEVEL;
223 } else if ( strncasecmp( optarg, "sub", sizeof("sub")-1 ) == 0 ) {
224 scope = LDAP_SCOPE_SUBTREE;
226 fprintf( stderr, "scope should be base, one, or sub\n" );
231 case 'a': /* set alias deref option */
232 if ( strcasecmp( optarg, "never" ) == 0 ) {
233 deref = LDAP_DEREF_NEVER;
234 } else if ( strncasecmp( optarg, "search", sizeof("search")-1 ) == 0 ) {
235 deref = LDAP_DEREF_SEARCHING;
236 } else if ( strncasecmp( optarg, "find", sizeof("find")-1 ) == 0 ) {
237 deref = LDAP_DEREF_FINDING;
238 } else if ( strcasecmp( optarg, "always" ) == 0 ) {
239 deref = LDAP_DEREF_ALWAYS;
241 fprintf( stderr, "alias deref should be never, search, find, or always\n" );
246 case 'T': /* field separator */
247 if( tmpdir ) free( tmpdir );
248 tmpdir = strdup( optarg );
250 case 'V': /* field separator */
251 if( urlpre ) free( urlpre );
252 urlpre = strdup( optarg );
254 case 'f': /* input file */
255 infile = strdup( optarg );
257 case 'h': /* ldap host */
258 ldaphost = strdup( optarg );
260 case 'b': /* searchbase */
261 base = strdup( optarg );
263 case 'D': /* bind DN */
264 binddn = strdup( optarg );
266 case 'p': /* ldap port */
267 ldapport = atoi( optarg );
269 case 'w': /* bind password */
270 passwd.bv_val = strdup( optarg );
274 for( p = optarg; *p == '\0'; p++ ) {
278 passwd.bv_len = strlen( passwd.bv_val );
280 case 'l': /* time limit */
281 timelimit = atoi( optarg );
283 case 'z': /* size limit */
284 sizelimit = atoi( optarg );
286 case 'S': /* sort attribute */
287 sortattr = strdup( optarg );
293 switch( atoi( optarg ) )
296 version = LDAP_VERSION2;
299 version = LDAP_VERSION3;
302 fprintf( stderr, "protocol version should be 2 or 3\n" );
307 #ifdef HAVE_CYRUS_SASL
309 authmethod = LDAP_AUTH_SASL;
311 fprintf( stderr, "%s was not compiled with SASL support\n",
313 return( EXIT_FAILURE );
317 #ifdef HAVE_CYRUS_SASL
319 authmethod = LDAP_AUTH_SASL;
321 fprintf( stderr, "%s was not compiled with SASL support\n",
323 return( EXIT_FAILURE );
327 #ifdef HAVE_CYRUS_SASL
328 if ( strcasecmp( optarg, "any" ) && strcmp( optarg, "*" ) ) {
329 sasl_mech = strdup( optarg );
331 authmethod = LDAP_AUTH_SASL;
333 fprintf( stderr, "%s was not compiled with SASL support\n",
335 return( EXIT_FAILURE );
339 #ifdef HAVE_CYRUS_SASL
340 sasl_authc_id = strdup( optarg );
341 authmethod = LDAP_AUTH_SASL;
343 fprintf( stderr, "%s was not compiled with SASL support\n",
345 return( EXIT_FAILURE );
349 #ifdef HAVE_CYRUS_SASL
350 sasl_authz_id = strdup( optarg );
351 authmethod = LDAP_AUTH_SASL;
353 fprintf( stderr, "%s was not compiled with SASL support\n",
355 return( EXIT_FAILURE );
362 fprintf( stderr, "%s was not compiled with TLS support\n",
364 return( EXIT_FAILURE );
372 /* no alternative format */
373 if( ldif == 0 ) ldif = 1;
375 if ( ( authmethod == LDAP_AUTH_KRBV4 ) || ( authmethod ==
376 LDAP_AUTH_KRBV41 ) ) {
377 if( version > LDAP_VERSION2 ) {
378 fprintf( stderr, "Kerberos requires LDAPv2\n" );
379 return( EXIT_FAILURE );
381 version = LDAP_VERSION2;
383 else if ( authmethod == LDAP_AUTH_SASL ) {
384 if( version != -1 && version != LDAP_VERSION3 ) {
385 fprintf( stderr, "SASL requires LDAPv3\n" );
386 return( EXIT_FAILURE );
388 version = LDAP_VERSION3;
392 if( version != -1 && version != LDAP_VERSION3 ) {
393 fprintf(stderr, "manage DSA control requires LDAPv3\n");
396 version = LDAP_VERSION3;
400 if( version != -1 && version != LDAP_VERSION3 ) {
401 fprintf(stderr, "Start TLS requires LDAPv3\n");
404 version = LDAP_VERSION3;
407 if ( argc - optind < 1 ) {
411 filtpattern = strdup( argv[ optind ] );
413 if ( argv[ optind + 1 ] == NULL ) {
415 } else if ( sortattr == NULL || *sortattr == '\0' ) {
416 attrs = &argv[ optind + 1 ];
418 for ( i = optind + 1; i < argc; i++ ) {
419 if ( strcasecmp( argv[ i ], sortattr ) == 0 ) {
425 argv[ optind ] = sortattr;
429 attrs = &argv[ optind ];
432 if ( infile != NULL ) {
433 if ( infile[0] == '-' && infile[1] == '\0' ) {
435 } else if (( fp = fopen( infile, "r" )) == NULL ) {
442 && (tmpdir = getenv("TMPDIR")) == NULL
443 && (tmpdir = getenv("TMP")) == NULL
444 && (tmpdir = getenv("TEMP")) == NULL )
449 if( urlpre == NULL ) {
450 urlpre = malloc( sizeof("file:////") + strlen(tmpdir) );
452 if( urlpre == NULL ) {
457 sprintf( urlpre, "file:///%s/",
458 tmpdir[0] == '/' ? &tmpdir[1] : tmpdir );
460 /* urlpre should be URLized.... */
464 if( ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ) != LBER_OPT_SUCCESS ) {
465 fprintf( stderr, "Could not set LBER_OPT_DEBUG_LEVEL %d\n", debug );
467 if( ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug ) != LDAP_OPT_SUCCESS ) {
468 fprintf( stderr, "Could not set LDAP_OPT_DEBUG_LEVEL %d\n", debug );
474 (void) SIGNAL( SIGPIPE, SIG_IGN );
479 (ldapport ? "ldap_init( %s, %d )\n" : "ldap_init( %s, <DEFAULT> )\n"),
480 (ldaphost != NULL) ? ldaphost : "<DEFAULT>",
484 if (( ld = ldap_init( ldaphost, ldapport )) == NULL ) {
485 perror( "ldap_init" );
486 return( EXIT_FAILURE );
490 ldap_set_option( ld, LDAP_OPT_DEREF, (void *) &deref ) != LDAP_OPT_SUCCESS )
492 fprintf( stderr, "Could not set LDAP_OPT_DEREF %d\n", deref );
494 if (timelimit != -1 &&
495 ldap_set_option( ld, LDAP_OPT_TIMELIMIT, (void *) &timelimit ) != LDAP_OPT_SUCCESS )
497 fprintf( stderr, "Could not set LDAP_OPT_TIMELIMIT %d\n", timelimit );
499 if (sizelimit != -1 &&
500 ldap_set_option( ld, LDAP_OPT_SIZELIMIT, (void *) &sizelimit ) != LDAP_OPT_SUCCESS )
502 fprintf( stderr, "Could not set LDAP_OPT_SIZELIMIT %d\n", sizelimit );
504 if (referrals != -1 &&
505 ldap_set_option( ld, LDAP_OPT_REFERRALS,
506 (referrals ? LDAP_OPT_ON : LDAP_OPT_OFF) ) != LDAP_OPT_SUCCESS )
508 fprintf( stderr, "Could not set LDAP_OPT_REFERRALS %s\n",
509 referrals ? "on" : "off" );
512 if (version == -1 ) {
516 if( ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version )
517 != LDAP_OPT_SUCCESS )
519 fprintf( stderr, "Could not set LDAP_OPT_PROTOCOL_VERSION %d\n",
523 if ( use_tls && ldap_start_tls_s( ld, NULL, NULL ) != LDAP_SUCCESS ) {
525 ldap_perror( ld, "ldap_start_tls" );
526 return( EXIT_FAILURE );
531 passwd.bv_val = getpassphrase("Enter LDAP Password: ");
532 passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0;
535 if ( authmethod == LDAP_AUTH_SASL ) {
536 #ifdef HAVE_CYRUS_SASL
537 int minssf = 0, maxssf = 0;
539 if ( sasl_integrity > 0 )
541 if ( sasl_integrity > 1 )
543 if ( sasl_privacy > 0 )
544 maxssf = 100000; /* Something big value */
545 if ( sasl_privacy > 1 )
548 if ( ldap_set_option( ld, LDAP_OPT_X_SASL_MINSSF,
549 (void *)&minssf ) != LDAP_OPT_SUCCESS ) {
550 fprintf( stderr, "Could not set LDAP_OPT_X_SASL_MINSSF"
552 return( EXIT_FAILURE );
554 if ( ldap_set_option( ld, LDAP_OPT_X_SASL_MAXSSF,
555 (void *)&maxssf ) != LDAP_OPT_SUCCESS ) {
556 fprintf( stderr, "Could not set LDAP_OPT_X_SASL_MAXSSF"
558 return( EXIT_FAILURE );
561 rc = ldap_negotiated_sasl_bind_s( ld, binddn, sasl_authc_id,
562 sasl_authz_id, sasl_mech,
563 passwd.bv_len ? &passwd : NULL,
566 if( rc != LDAP_SUCCESS ) {
567 ldap_perror( ld, "ldap_negotiated_sasl_bind_s" );
568 return( EXIT_FAILURE );
571 fprintf( stderr, "%s was not compiled with SASL support\n",
573 return( EXIT_FAILURE );
576 if ( ldap_bind_s( ld, binddn, passwd.bv_val, authmethod )
578 ldap_perror( ld, "ldap_bind" );
579 return( EXIT_FAILURE );
586 LDAPControl *ctrls[2];
590 c.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
591 c.ldctl_value.bv_val = NULL;
592 c.ldctl_value.bv_len = 0;
593 c.ldctl_iscritical = manageDSAit > 1;
595 err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, &ctrls );
597 if( err != LDAP_OPT_SUCCESS ) {
598 fprintf( stderr, "Could not set Manage DSA IT Control\n" );
599 if( c.ldctl_iscritical ) {
600 exit( EXIT_FAILURE );
606 fprintf( stderr, "filter%s: %s\nreturning: ",
607 infile != NULL ? " pattern" : "",
610 if ( attrs == NULL ) {
611 fprintf( stderr, "ALL" );
613 for ( i = 0; attrs[ i ] != NULL; ++i ) {
614 fprintf( stderr, "%s ", attrs[ i ] );
617 fprintf( stderr, "\n" );
621 printf( "version: 2\n\n");
625 printf( "#\n# filter%s: %s\n# returning: ",
626 infile != NULL ? " pattern" : "",
629 if ( attrs == NULL ) {
632 for ( i = 0; attrs[ i ] != NULL; ++i ) {
633 printf( "%s ", attrs[ i ] );
639 if ( infile == NULL ) {
640 rc = dosearch( ld, base, scope, attrs, attrsonly, NULL, filtpattern );
645 while ( rc == 0 && fgets( line, sizeof( line ), fp ) != NULL ) {
646 line[ strlen( line ) - 1 ] = '\0';
652 rc = dosearch( ld, base, scope, attrs, attrsonly,
674 char filter[ BUFSIZ ];
681 LDAPMessage *res, *msg;
684 if( filtpatt != NULL ) {
685 sprintf( filter, filtpatt, value );
688 fprintf( stderr, "filter is: (%s)\n", filter );
692 printf( "#\n# filter: %s\n#\n", filter );
696 sprintf( filter, "%s", value );
700 return( LDAP_SUCCESS );
703 msgid = ldap_search( ld, base, scope, filter, attrs, attrsonly );
706 ldap_perror( ld, "ldap_search" );
707 ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
711 nresponses = nentries = nreferences = nextended = npartial = 0;
714 while ((rc = ldap_result( ld, LDAP_RES_ANY,
715 sortattr ? 1 : 0, NULL, &res )) > 0 )
718 (void) ldap_sort_entries( ld, &res,
719 ( *sortattr == '\0' ) ? NULL : sortattr, strcasecmp );
722 for ( msg = ldap_first_message( ld, res );
724 msg = ldap_next_message( ld, msg ) )
728 switch( ldap_msgtype( msg ) ) {
729 case LDAP_RES_SEARCH_ENTRY:
730 if( nresponses > 1 ) putchar('\n');
732 print_entry( ld, msg, attrsonly );
735 case LDAP_RES_SEARCH_REFERENCE:
736 if( nresponses > 1 ) putchar('\n');
738 print_reference( ld, msg );
741 case LDAP_RES_EXTENDED:
742 if( nresponses > 1 ) putchar('\n');
744 print_extended( ld, msg );
746 rc = ldap_result2error( ld, msg, 0 );
748 if( rc != LDAP_SUCCESS ) {
749 ldap_perror( ld, "ldap_search" );
752 if( ldap_msgid( msg ) == 0 ) {
753 /* unsolicited extended operation */
759 case LDAP_RES_EXTENDED_PARTIAL:
760 if( nresponses > 1 ) putchar('\n');
762 print_partial( ld, msg );
765 case LDAP_RES_SEARCH_RESULT:
766 /* if( nresponses > 1 ) putchar('\n'); */
767 rc = ldap_result2error( ld, msg, 0 );
769 if( rc != LDAP_SUCCESS ) {
770 ldap_perror( ld, "ldap_search" );
782 ldap_perror( ld, "ldap_result" );
788 printf( "%d responses\n", nresponses );
795 static void print_reference(
797 LDAPMessage *reference )
803 printf("# search reference\n");
806 rc = ldap_parse_reference( ld, reference, &refs, NULL, 0 );
808 for( i=0; refs[i] != NULL; i++ ) {
809 write_ldif( LDIF_PUT_VALUE, "ref", refs[i], strlen(refs[i]) );
812 ber_memvfree( (void **) refs );
814 if( rc != LDAP_SUCCESS ) {
815 ldap_perror(ld, "ldap_parse_reference");
816 exit( EXIT_FAILURE );
820 static void print_extended(
822 LDAPMessage *extended )
827 struct berval *retdata = NULL;
830 printf("# extended result response\n");
833 rc = ldap_parse_extended_result( ld, extended,
834 &retoid, &retdata, 0 );
836 write_ldif( LDIF_PUT_VALUE, "extended",
837 retoid, retoid ? strlen(retoid) : 0 );
840 write_ldif( LDIF_PUT_BINARY, "data",
841 retdata->bv_val, retdata->bv_len );
844 sprintf( rst, "%ld", (long) rst );
845 write_ldif( LDIF_PUT_VALUE, "result", rst, strlen(rst));
847 if( rc != LDAP_SUCCESS ) {
848 ldap_perror(ld, "ldap_parse_extended_result");
849 exit( EXIT_FAILURE );
853 static void print_partial(
855 LDAPMessage *partial )
859 struct berval *retdata = NULL;
862 printf("# extended partial response\n");
865 rc = ldap_parse_extended_partial( ld, partial,
866 &retoid, &retdata, NULL, 0 );
868 write_ldif( LDIF_PUT_VALUE, "partial",
869 retoid, retoid ? strlen(retoid) : 0 );
872 write_ldif( LDIF_PUT_BINARY, "data",
873 retdata->bv_val, retdata->bv_len );
876 if( rc != LDAP_SUCCESS ) {
877 ldap_perror(ld, "ldap_parse_extended_partial");
878 exit( EXIT_FAILURE );
889 char tmpfname[ 256 ];
892 BerElement *ber = NULL;
893 struct berval **bvals;
896 dn = ldap_get_dn( ld, entry );
900 ufn = ldap_dn2ufn( dn );
901 write_ldif( LDIF_PUT_COMMENT, NULL, ufn, ufn ? strlen( ufn ) : 0 );
904 write_ldif( LDIF_PUT_VALUE, "dn", dn, dn ? strlen( dn ) : 0);
906 printf( "%s\n", dn );
911 ufn = ldap_dn2ufn( dn );
914 write_ldif( LDIF_PUT_VALUE, "ufn", ufn, ufn ? strlen( ufn ) : 0 );
916 printf( "%s\n", ufn );
920 if( ufn != NULL ) ldap_memfree( ufn );
923 for ( a = ldap_first_attribute( ld, entry, &ber ); a != NULL;
924 a = ldap_next_attribute( ld, entry, ber ) )
926 if ( skipsortattr && strcasecmp( a, sortattr ) == 0 ) {
932 write_ldif( LDIF_PUT_NOVALUE, a, NULL, 0 );
937 } else if (( bvals = ldap_get_values_len( ld, entry, a )) != NULL ) {
938 for ( i = 0; bvals[i] != NULL; i++ ) {
939 if ( vals2tmp > 1 || ( vals2tmp
940 && ldif_is_not_printable( bvals[i]->bv_val, bvals[i]->bv_len ) ))
943 /* write value to file */
944 sprintf( tmpfname, "%s" LDAP_DIRSEP "ldapsearch-%s-XXXXXX",
948 if ( mktemp( tmpfname ) == NULL ) {
953 if (( tmpfd = open( tmpfname, O_WRONLY|O_CREAT|O_EXCL, 0600 )) == -1 ) {
958 if (( tmpfp = fdopen( tmpfd, "w")) == NULL ) {
963 if ( fwrite( bvals[ i ]->bv_val,
964 bvals[ i ]->bv_len, 1, tmpfp ) == 0 )
973 sprintf( url, "%s%s", urlpre,
974 &tmpfname[strlen(tmpdir) + sizeof(LDAP_DIRSEP) - 1] );
976 write_ldif( LDIF_PUT_URL, a, url, strlen( url ));
979 write_ldif( LDIF_PUT_VALUE, a,
980 bvals[ i ]->bv_val, bvals[ i ]->bv_len );
983 ber_bvecfree( bvals );
994 write_ldif( int type, char *name, char *value, ber_len_t vallen )
998 if (( ldif = ldif_put( type, name, value, vallen )) == NULL ) {
1002 fputs( ldif, stdout );
1003 ber_memfree( ldif );