" -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;
{
char *infile, *filtpattern, **attrs = NULL, line[BUFSIZ];
FILE *fp = NULL;
+ FILE *log = NULL;
int rc, i, first, scope, deref, attrsonly, manageDSAit;
int referrals, timelimit, sizelimit, debug;
int authmethod, version, want_bindpw;
debug = verbose = not = vals2tmp = referrals =
attrsonly = manageDSAit = ldif = want_bindpw = 0;
+ lutil_log_initialize(argc, argv);
+
deref = sizelimit = timelimit = version = -1;
scope = LDAP_SCOPE_SUBTREE;
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 (version == -1 ) {
- version = 3;
+ version = LDAP_VERSION3;
}
if( ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version )
return EXIT_FAILURE;
}
+
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",