" -a deref one of never (default), always, search, or find\n"
" -A retrieve attribute names only (no values)\n"
" -b basedn base dn for search\n"
+" -F prefix URL prefix for files (default: \"" LDAP_FILE_URI_PREFIX ")\n"
" -l limit time limit (in seconds) for search\n"
" -L print responses in LDIFv1 format\n"
" -LL print responses in LDIF format without comments\n"
" -T path write files to directory specified by path (default:\n"
" " LDAP_TMPDIR ")\n"
" -u include User Friendly entry names in the output\n"
-" -V prefix URL prefix for files (default: \"" LDAP_FILE_URI_PREFIX ")\n"
" -z limit size limit (in entries) for search\n"
"Common options:\n"
" -P version procotol version (default: 3)\n"
" -Q use SASL Quiet mode\n"
" -R realm SASL realm\n"
-" -U user SASL authentication identity (username)\n"
+" -U authcid SASL authentication identity\n"
" -v run in verbose mode (diagnostics to standard output)\n"
" -w passwd bind passwd (for simple authentication)\n"
" -W prompt for bind passwd\n"
" -x Simple authentication\n"
-" -X id SASL authorization identity (\"dn:<dn>\" or \"u:<user>\")\n"
+" -X authzid SASL authorization identity (\"dn:<dn>\" or \"u:<user>\")\n"
" -Y mech SASL mechanism\n"
" -Z Start TLS request (-ZZ to require successful response)\n"
, s );
int attrsonly,
LDAPControl **sctrls,
LDAPControl **cctrls,
- struct timeval *timelimit,
+ struct timeval *timeout,
int sizelimit ));
static char *tmpdir = NULL;
attrsonly = manageDSAit = ldif = want_bindpw = 0;
lutil_log_initialize(argc, argv);
- lutil_set_debug_level( "LIBLBER", 8 );
- /* log = fopen( "ldapsearch.log", "w" ); */
- /* ber_set_option( NULL, LBER_OPT_LOG_PRINT_FILE, log ); */
deref = sizelimit = timelimit = version = -1;
prog = (prog = strrchr(argv[0], *LDAP_DIRSEP)) == NULL ? argv[0] : prog + 1;
- while (( i = getopt( argc, argv, "Aa:b:f:Ll:S:s:T:tuV:z:"
+ while (( i = getopt( argc, argv, "Aa:b:F:f:Ll:S:s:T:tuz:"
"Cd:D:h:H:IkKMnO:p:P:QR:U:vw:WxX:Y:Z")) != EOF )
{
switch( i ) {
}
infile = strdup( optarg );
break;
+ case 'F': /* uri prefix */
+ if( urlpre ) free( urlpre );
+ urlpre = strdup( optarg );
+ break;
case 'l': /* time limit */
timelimit = atoi( optarg );
+ if( timelimit < 0 ) {
+ fprintf( stderr, "%s: invalid timelimit (%d) specified\n",
+ prog, timelimit );
+ return EXIT_FAILURE;
+ }
break;
case 'L': /* print entries in LDIF format */
++ldif;
if( tmpdir ) free( tmpdir );
tmpdir = strdup( optarg );
break;
- case 'V': /* uri prefix */
- if( urlpre ) free( urlpre );
- urlpre = strdup( optarg );
- break;
case 'z': /* size limit */
sizelimit = atoi( optarg );
break;
{
char* p;
- for( p = optarg; *p == '\0'; p++ ) {
+ for( p = optarg; *p != '\0'; p++ ) {
*p = '\0';
}
}
if ( use_tls && ldap_start_tls_s( ld, NULL, NULL ) != LDAP_SUCCESS ) {
+ ldap_perror( ld, "ldap_start_tls" );
if ( use_tls > 1 ) {
- ldap_perror( ld, "ldap_start_tls" );
return EXIT_FAILURE;
}
- fprintf( stderr, "WARNING: could not start TLS\n" );
}
if (want_bindpw) {
}
if (ldif < 2 ) {
- printf( "#\n# filter%s: %s\n# requesting: ",
+ printf( "#\n# LDAPv%d\n# filter%s: %s\n# requesting: ",
+ version,
infile != NULL ? " pattern" : "",
filtpattern );
int attrsonly,
LDAPControl **sctrls,
LDAPControl **cctrls,
- struct timeval *timelimit,
+ struct timeval *timeout,
int sizelimit )
{
char filter[ BUFSIZ ];
}
rc = ldap_search_ext( ld, base, scope, filter, attrs, attrsonly,
- sctrls, cctrls, timelimit, sizelimit, &msgid );
+ sctrls, cctrls, timeout, sizelimit, &msgid );
if( rc != LDAP_SUCCESS ) {
fprintf( stderr, "%s: ldap_search_ext: %s (%d)\n",