ldapdiff compares ldif files with a running LDAP server and does an appropriate add/delete/update for every different entry/attribute.
| Tags | Systems Administration |
|---|---|
| Licenses | GPL |
| Operating Systems | POSIX |
| Implementation | C |
Recent releases


Changes: The source package has been "debianized" and moved to launchpad. objectClass values are compared case-insensitively now. The LDAP_CONTROL_MANAGEDSAIT Server Control Option has been implemented.


Changes: New ldapdiff.conf parameter scope: "base", "one", "sub", "subordinate", and "children". This is useful for managing the scope of searches. "configure.in" has been patched so that LDAP libraries and includes are searched in the default paths, if no option "--with-ldap-sdk" has been given. An implementation of "escaped filter values" conforming to rfc2254 has been added. Detection of existing LDAP entries with an identical DN (but a different filter) and appropriate deletion has been added.


Changes: The license has been changed to the GPLv3. A bug that generated LDAP server idle timeout for large LDIF input has been fixed. A bug that prevented streaming operations has been fixed. A bug that compared DNs case-sensitively has been fixed. This release has moved to the new LDAP API.


Changes: New features were added to merge data from multiple sources into a single LDAP server. The return codes were improved. Bugs in ldif file creation and path construction were fixed.


Changes: This release features a new config parameter "modifybydeladd: yes" in ldapdiff.conf that enables ldapdiff to replace LDAP attributes by deleting and adding the whole LDAP entry.
- All comments
Recent commentsRe: Bug that prevents streaming operations
Thanks Enzo,
your patch has been applied to "ldapdiff-1.2.3" available at webtomware.rhoen.de.
regards
Thomas
Bug that prevents streaming operations
If the "-f" option is not given, ldapdiff reads the LDIF data from stdin.
Unfortunately, in ldapread.c there is code calling ftell() and fseek(), which
fails (without warnings) if stdin is not seekable (e.g., it's a pipe). I
reported the bug to the author two weeks ago, but I haven't heard from him, so
here is the code for the fix, which replaces ftell()/fseek() with the pipe-friendly getc()/ungetc():
[...]#if 0 /* old code if'd out */ filepos =
ftell(f); while(fgets(folderline,sizeof(folderline),f) !=
NULL){ /* strip \n */ if((pstrip =
strchr(folderline,'\n')) != NULL){ *pstrip =
'\0'; } /* strip \r\n
*/ if((pstrip = strstr(folderline,"\r\n")) !=
NULL){ *pstrip = '\0';
} if(folderline[0] == ' ' || folderline[0] ==
'\t'){ clines++;
if(strlen(line) + strlen(folderline+1) >
MAXATTRLEN){
ldiflog(LOG0, "attribute size to big
file:%s line:%d",__FILE__,__LINE__);
exit(EXITLDERROR); }
pline = realloc(pline,strlen(pline)+1 +
strlen(folderline));
strcat(pline,folderline+1); filepos =
ftell(f); }else{
break; } }
fseek(f,filepos,SEEK_SET);#else /* new code
*/ for(;;) { char nextch =
getc(f); ungetc(nextch, f);
if(nextch != ' ' && nextch != '\t')
break; if(fgets(folderline,sizeof(folderline),f) ==
NULL) break; if((pstrip =
strchr(folderline,'\n')) != NULL){ *pstrip =
'\0'; } /* strip \r\n
*/ if((pstrip = strstr(folderline,"\r\n")) !=
NULL){ *pstrip = '\0';
} clines++; if(strlen(line) +
strlen(folderline+1) > MAXATTRLEN){
ldiflog(LOG0, "attribute size too big file:%s
line:%d",__FILE__,__LINE__);
exit(EXITLDERROR); } pline =
realloc(pline,strlen(pline)+1 + strlen(folderline));
strcat(pline,folderline+1);
}#endif[...]