}
rc = 0;
+
if ( fp == NULL ) {
- for ( ; optind < argc; ++optind ) {
- rc = dodelete( ld, argv[ optind ] );
- }
- } else {
- while ((rc == 0 || contoper) && fgets(buf, sizeof(buf), fp) != NULL) {
- buf[ strlen( buf ) - 1 ] = '\0'; /* remove trailing newline */
- if ( *buf != '\0' ) {
- rc = dodelete( ld, buf );
- }
+ for ( ; optind < argc; ++optind ) {
+ rc = dodelete( ld, argv[ optind ] );
+
+ /* Stop on error and no -c option */
+ if( rc != 0 && contoper == 0) break;
+ }
+ } else {
+ while ((rc == 0 || contoper) && fgets(buf, sizeof(buf), fp) != NULL) {
+ buf[ strlen( buf ) - 1 ] = '\0'; /* remove trailing newline */
+
+ if ( *buf != '\0' ) {
+ rc = dodelete( ld, buf );
+ }
+ }
}
- }
ldap_unbind( ld );
static char *sasl_secprops = NULL;
#endif
static int use_tls = 0;
-static int ldapadd, replace, not, verbose, contoper, force;
+static int ldapadd, not, verbose, contoper, force;
static LDAP *ld = NULL;
#define LDAPMOD_MAXLINE 4096
" specified by \"-f file\".\n"
"Add or modify options:\n"
" -a add values (default%s)\n"
-" -r replace values\n"
" -F force all changes records to be used\n"
"Common options:\n"
case 'F': /* force all changes records to be used */
force = 1;
break;
- case 'r': /* default is to replace rather than add values */
- replace = 1;
- break;
/* Common Options */
case 'C':
prog );
return( EXIT_FAILURE );
#endif
+ case 'r': /* replace (obsolete) */
+ break;
+
case 'R':
#ifdef HAVE_CYRUS_SASL
if( sasl_realm != NULL ) {
addmodifyop( &pmods, modop, val.bv_val, NULL );
goto end_line;
} else { /* no modify op: use default */
- modop = replace ? LDAP_MOD_REPLACE : LDAP_MOD_ADD;
+ modop = ldapadd ? LDAP_MOD_ADD : LDAP_MOD_REPLACE;
}
}