Skip to content
Snippets Groups Projects
Commit 6b7cee69 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Patch: 'ldapmodify -c' should return error on failure (ITS#2133)

Written by Hallvard B. Furuseth and placed into the public domain.
This software is not subject to any license of the University of Oslo.

'ldapmodify -c' returned the error status from the _last_ LDIF entry,
so a bad entry followed by a good entry returns success.
This patch makes it return the status of the last _failed_ entry,
or 0 if all entries succeeded.
parent b06ceb8f
No related branches found
No related tags found
No related merge requests found
......@@ -154,7 +154,8 @@ main( int argc, char **argv )
char *infile, *rejfile, *rbuf, *start, *rejbuf = NULL;
FILE *fp, *rejfp;
char *matched_msg = NULL, *error_msg = NULL;
int rc, i, authmethod, version, want_bindpw, debug, manageDSAit, noop, referrals;
int rc, retval, i, authmethod, version, want_bindpw;
int debug, manageDSAit, noop, referrals;
int count, len;
char *pw_file = NULL;
char *control, *cvalue;
......@@ -832,6 +833,7 @@ main( int argc, char **argv )
}
count = 0;
retval = 0;
while (( rc == 0 || contoper ) &&
( rbuf = read_one_record( fp )) != NULL ) {
count++;
......@@ -849,6 +851,8 @@ main( int argc, char **argv )
rc = process_ldif_rec( start, count );
if ( rc )
retval = rc;
if ( rc && rejfp ) {
fprintf(rejfp, "# Error: %s (%d)", ldap_err2string(rc), rc);
......@@ -876,7 +880,7 @@ main( int argc, char **argv )
fclose( rejfp );
}
return( rc );
return( retval );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment