|
About:
ldapdiff compares ldif files with a running LDAP server and does an appropriate add/delete/update for every different entry/attribute.
Author:
Thomas Reith <Thomas (dot) Reith (at) rhoen (dot) de>
[contact developer]
Homepage:
http://webtomware.rhoen.de/
Tar/GZ:
http://webtomware.rhoen.de/ldapdiff-1.3.0.tgz
Trove categories:
[change]
Dependencies:
[change]
libiconv (required)
OpenLDAP (recommended)
[download links]
|
|
» Rating:
(not rated)
» Vitality: 0.02% (Rank 3042)
» Popularity: 1.37% (Rank 4015)

(click to enlarge graphs)
Record hits: 9,978
URL hits: 3,732
Subscribers: 51
|
|
Branches
Comments
[»]
Bug that prevents streaming operations
by Enzo Michelangeli - Mar 16th 2007 04:40:58
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 [...]
[reply]
[top]
[»]
Re: Bug that prevents streaming operations
by Thomas Reith - May 9th 2007 13:12:07
Thanks Enzo,
your patch has been applied to "ldapdiff-1.2.3" available at
http://webtomware.rhoen.de.
regards
Thomas
-- --------------------------------------
http://webtomware.rhoen.de
mailto:Thomas.Reith@rhoen.de
[reply]
[top]
|