if (version != -1 &&
ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version ) != LDAP_OPT_SUCCESS)
{
- fprintf( stderr, "Could not set LDAP_OPT_PROTOCOL_VERSION %d\n", version );
+ fprintf( stderr, "Could not set LDAP_OPT_PROTOCOL_VERSION to %d\n", version );
}
if ( ldap_bind_s( ld, binddn, passwd, authmethod ) != LDAP_SUCCESS ) {
if ( expect_ct ) {
expect_ct = 0;
if ( !use_record && saw_replica ) {
- printf( "%s: skipping change record for entry: %s\n\t(LDAP host/port does not match replica: lines)\n",
+ printf( "%s: skipping change record for entry: %s\n"
+ "\t(LDAP host/port does not match replica: lines)\n",
prog, dn );
free( dn );
return( 0 );
got_all = delete_entry = 1;
} else {
fprintf( stderr,
- "%s: unknown %s \"%s\" (line %d of entry: %s)\n",
+ "%s: unknown %s \"%s\" (line %d of entry \"%s\")\n",
prog, T_CHANGETYPESTR, value, linenum, dn );
rc = LDAP_PARAM_ERROR;
}
expect_deleteoldrdn = 1;
expect_newrdn = 0;
} else {
- fprintf( stderr, "%s: expecting \"%s:\" but saw \"%s:\" (line %d of entry %s)\n",
+ fprintf( stderr, "%s: expecting \"%s:\" but saw \"%s:\" (line %d of entry \"%s\")\n",
prog, T_NEWRDNSTR, type, linenum, dn );
rc = LDAP_PARAM_ERROR;
}
expect_newsup = 1;
got_all = 1;
} else {
- fprintf( stderr, "%s: expecting \"%s:\" but saw \"%s:\" (line %d of entry %s)\n",
+ fprintf( stderr, "%s: expecting \"%s:\" but saw \"%s:\" (line %d of entry \"%s\")\n",
prog, T_DELETEOLDRDNSTR, type, linenum, dn );
rc = LDAP_PARAM_ERROR;
}
}
expect_newsup = 0;
} else {
- fprintf( stderr, "%s: expecting \"%s:\" but saw \"%s:\" (line %d of entry %s)\n",
+ fprintf( stderr, "%s: expecting \"%s:\" but saw \"%s:\" (line %d of entry \"%s\")\n",
prog, T_NEWSUPSTR, type, linenum, dn );
rc = LDAP_PARAM_ERROR;
}
} else if ( got_all ) {
fprintf( stderr,
- "%s: extra lines at end (line %d of entry %s)\n",
+ "%s: extra lines at end (line %d of entry \"%s\")\n",
prog, linenum, dn );
rc = LDAP_PARAM_ERROR;
} else {
}
if ( value == NULL && new ) {
- fprintf( stderr, "%s: missing value on line %d (attr is %s)\n",
+ fprintf( stderr, "%s: missing value on line %d (attr=\"%s\")\n",
prog, linenum, attr );
rc = LDAP_PARAM_ERROR;
} else {
struct berval *bvp;
if ( pmods == NULL ) {
- fprintf( stderr, "%s: no attributes to change or add (entry %s)\n",
+ fprintf( stderr, "%s: no attributes to change or add (entry=\"%s\")\n",
prog, dn );
return( LDAP_PARAM_ERROR );
}
}
if ( newentry ) {
- printf( "%sadding new entry %s\n", not ? "!" : "", dn );
+ printf( "%sadding new entry \"%s\"\n", not ? "!" : "", dn );
} else {
- printf( "%smodifying entry %s\n", not ? "!" : "", dn );
+ printf( "%smodifying entry \"%s\"\n", not ? "!" : "", dn );
}
if ( !not ) {
{
int rc;
- printf( "%sdeleting entry %s\n", not ? "!" : "", dn );
+ printf( "%sdeleting entry \"%s\"\n", not ? "!" : "", dn );
if ( !not ) {
if (( rc = ldap_delete_s( ld, dn )) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_delete" );
{
int rc;
+
+ printf( "%smodifying rdn of entry \"%s\"\n", not ? "!" : "", dn );
if ( verbose ) {
- printf( "new RDN: %s (%skeep existing values)\n",
+ printf( "\tnew RDN: \"%s\" (%skeep existing values)\n",
newrdn, deleteoldrdn ? "do not " : "" );
}
-
- printf( "%smodifying rdn of entry %s\n", not ? "!" : "", dn );
if ( !not ) {
if (( rc = ldap_modrdn2_s( ld, dn, newrdn, deleteoldrdn ))
!= LDAP_SUCCESS ) {
usage (char *s)
{
fprintf (stderr, "Usage: %s [options] [filter]\n", s);
- fprintf (stderr, " -a attrib\tpassword attribute (default: %s)\n", LDAP_PASSWD_ATTRIB);
+ fprintf (stderr, " -a attrib\tpassword attribute (default: " LDAP_PASSWD_ATTRIB ")\n");
fprintf (stderr, " -b basedn\tbasedn to perform searches\n");
/* fprintf (stderr, " -C\t\tuse entry's current hash mechanism\n"); */
fprintf (stderr, " -D binddn\tbind dn\n");
#ifdef HAVE_GETTIMEOFDAY
/* this is of questionable value
- * gettimeofday not provide much usec
+ * gettimeofday may not provide much usec
*/
{
struct timeval tv;
gettimeofday (&tv, NULL);
- srand (tv.tv_usec);
+ srand(tv.sec * (tv.tv_usec + 1));
}
#else
/* The traditional seed */
{
char filter[BUFSIZ];
LDAPMessage *result = NULL, *e;
- char *attrs[3];
- attrs[0] = "dn";
- attrs[1] = pwattr;
- attrs[2] = NULL;
+ char *attrs[2];
+ attrs[0] = pwattr;
+ attrs[1] = NULL;
/* search */
sprintf (filter, "%s", filtpattern);