Issue 601 - Bug in ldapadd/ldapmodify reading url from ldif file
Summary: Bug in ldapadd/ldapmodify reading url from ldif file
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2000-06-20 17:21 UTC by Steve Sonntag
Modified: 2014-08-01 21:05 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Steve Sonntag 2000-06-20 17:21:42 UTC
URL files in an ldif file are not being read properly on non Unix systems.

The binary option needs to be set.  In addition, the code clobbers
the address of the buffer just realloc'd with the address of the
original buffer, which may cause memory corruption.

-Steve Sonntag
-Alan Clark

See below:

===================================================================
RCS file: /repo/OpenLDAP/pkg/ldap/libraries/libldif/fetch.c,v
retrieving revision 1.8
diff -w -u -r1.8 fetch.c
--- fetch.c     2000/05/13 00:38:40     1.8
+++ fetch.c     2000/06/20 17:10:51
@@ -59,7 +59,7 @@
                p = ber_strdup( p );
                ldap_pvt_hex_unescape( p );

-               url = fopen( p, "r" );
+               url = fopen( p, "rb" );

        } else {
                return -1;
@@ -79,7 +79,7 @@
                        fclose( url );
                        return -1;
                }
-               newp = p;
+               p = newp;
                SAFEMEMCPY( &p[total], buffer, bytes );
                total += bytes;
        }

Comment 1 Kurt Zeilenga 2000-06-20 22:44:42 UTC
Patch applied, thanks.

	Kurt

At 05:22 PM 6/20/00 GMT, vtag@novell.com wrote:
>URL files in an ldif file are not being read properly on non Unix systems.
>
>The binary option needs to be set.  In addition, the code clobbers
>the address of the buffer just realloc'd with the address of the
>original buffer, which may cause memory corruption.
>
>-Steve Sonntag
>-Alan Clark
>
>See below:
>
>===================================================================
>RCS file: /repo/OpenLDAP/pkg/ldap/libraries/libldif/fetch.c,v
>retrieving revision 1.8
>diff -w -u -r1.8 fetch.c
>--- fetch.c     2000/05/13 00:38:40     1.8
>+++ fetch.c     2000/06/20 17:10:51
>@@ -59,7 +59,7 @@
>                p = ber_strdup( p );
>                ldap_pvt_hex_unescape( p );
>
>-               url = fopen( p, "r" );
>+               url = fopen( p, "rb" );
>
>        } else {
>                return -1;
>@@ -79,7 +79,7 @@
>                        fclose( url );
>                        return -1;
>                }
>-               newp = p;
>+               p = newp;
>                SAFEMEMCPY( &p[total], buffer, bytes );
>                total += bytes;
>        }
>
>
>
Comment 2 Kurt Zeilenga 2000-06-25 12:00:33 UTC
changed notes
changed state Open to Closed
moved from Incoming to Development
Comment 3 Gann, Leopold 2001-01-12 07:23:59 UTC
Hi,

from where to get that patched ldapmodify binary ? Once, I've got ldapmodify
while installing the netscape
directory server (trial version V4.11) and I even used that sometimes in the
past. Now, I want 
to use ldapmodify for loading data via LDIF that is specificly defined in
URL files. Unfortunately, that 
bounced however with "ldap_add: Operations error". If you could send me a
patched ldapmodfiy 
binary that would be great. 

Thanks for your help,
Leo.
----------------------------------------------------------------------------
-----------------------------
Leopold Gann, Siemens AG, Otto-Hahn-Ring 6, 81730 Munich, Germany
Email:  Leopold.Gann@icn.siemens.de
SiemensOfficePhone. :  	+49-89-636-46143   ( Wednesday and Friday ) 
SiemensOfficeFax: 	+49-89-636-45860
HomeOfficePhone:	+43-7742-58115

Comment 4 Kurt Zeilenga 2001-01-12 16:31:28 UTC
The project only provides it wares in source form.
  http://www.openldap.org/software/

As far as problems using Netscape products, please contact Netscape
or use support forums specific to Netscape.  http://www.iplanet.com/

Kurt

At 07:24 AM 1/12/01 +0000, leopold.gann@icn.siemens.de wrote:
>Hi,
>
>from where to get that patched ldapmodify binary ? Once, I've got ldapmodify
>while installing the netscape
>directory server (trial version V4.11) and I even used that sometimes in the
>past. Now, I want 
>to use ldapmodify for loading data via LDIF that is specificly defined in
>URL files. Unfortunately, that 
>bounced however with "ldap_add: Operations error". If you could send me a
>patched ldapmodfiy 
>binary that would be great. 
>
>Thanks for your help,
>Leo.
>----------------------------------------------------------------------------
>-----------------------------
>Leopold Gann, Siemens AG, Otto-Hahn-Ring 6, 81730 Munich, Germany
>Email:  Leopold.Gann@icn.siemens.de
>SiemensOfficePhone. :   +49-89-636-46143   ( Wednesday and Friday ) 
>SiemensOfficeFax:       +49-89-636-45860
>HomeOfficePhone:        +43-7742-58115

Comment 5 OpenLDAP project 2014-08-01 21:05:27 UTC
applied