Closed
Bug 195441
Opened 23 years ago
Closed 23 years ago
command line tools: :< in LDIF fails to import file contents correctly
Categories
(Directory Graveyard :: LDAP C SDK, defect)
Directory Graveyard
LDAP C SDK
Tracking
(Not tracked)
RESOLVED
FIXED
5.12
People
(Reporter: saul.edwards.bugs, Assigned: mcs)
Details
Attachments
(2 files)
|
3.39 KB,
patch
|
Details | Diff | Splinter Review | |
|
12.14 KB,
text/plain
|
Details |
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
Build Identifier:
In an ldapmodify, when specifying a fileurl in the LDIF, the name of the file
becomes the value of the attribute, instead of the contents of the file. I'm
not sure how this code ever worked. Perhaps this is a regression.
In ldaptool_berval_from_ldif_value, the file url has been successfully
identified and is read correctly. After the contents of the file are placed
into berval bvp, it is overwritten by the name of the file at the end of the
function.
Reproducible: Always
Steps to Reproduce:
Try an ldapmodify such as: ldapmodify -h host -p port -D binddn -w passwd
version: 1
dn: somedn
changetype: modify
replace: someattr
someattr:< file:///somefilename
Actual Results:
Instead of the contents of /somefilename, someattr now contains:
"< file:///somefilename"
The problem is in fireurl.c in the command line tool code.
| Assignee | ||
Updated•23 years ago
|
Status: NEW → ASSIGNED
Summary: command line tools: -f option fails to import file contents correctly → command line tools: :< in LDIF fails to import file contents correctly
| Assignee | ||
Comment 1•23 years ago
|
||
This is a regression that was introduced on ldapcsdk_branch_50 a long time ago
when this change was committed:
revision 1.1.2.1.2.3
date: 2001/12/04 19:56:53; author: mhein%sun.com; state: Exp; lines: +44 -36
A base64 encode value that commences (after decoding) with a '<' is incorrectly
interpreted as LDIF URL syntax attr:<
I am surprised no one noticed it until now; good find.
| Assignee | ||
Comment 2•23 years ago
|
||
Please try this patch. It works for me. Note that I also cleaned up the
indentation in that function; I'll attach the entire revised file next.
| Assignee | ||
Comment 3•23 years ago
|
||
Comment 5•23 years ago
|
||
Fix looks ok.
| Assignee | ||
Comment 6•23 years ago
|
||
Fix committed to the trunk:
mozilla/directory/c-sdk/ldap/clients/tools/fileurl.c
new revision: 5.2; previous revision: 5.1
Fix 195441 - command line tools: :< in LDIF fails to import file
contents correctly.
Also removed a useless call to feof().
I did make one small additional change: removal of a useless call to feof() (we
never checked the return value from that call, although we did place it in a
local variable for safe keeping ;-). Here's the additional diff:
@@ -333,17 +337,16 @@
* Upon failure, a different LDAPTOOL_FILEURL_ error code is returned.
*/
static int
berval_from_file( const char *path, struct berval *bvp, int reporterrs )
{
FILE *fp;
long rlen;
- int eof;
#if defined( XP_WIN32 )
char mode[20] = "r+b";
#else
char mode[20] = "r";
#endif
if (( fp = ldaptool_open_file( path, mode )) == NULL ) {
if ( reporterrs ) perror( path );
@@ -366,17 +369,16 @@
if ( fseek( fp, 0L, SEEK_SET ) != 0 ) {
if ( reporterrs ) perror( path );
fclose( fp );
return( LDAPTOOL_FILEURL_FILEIOERROR );
}
rlen = fread( bvp->bv_val, 1, bvp->bv_len, fp );
- eof = feof( fp );
fclose( fp );
if ( rlen != (long)bvp->bv_len ) {
if ( reporterrs ) perror( path );
free( bvp->bv_val );
return( LDAPTOOL_FILEURL_FILEIOERROR );
}
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•