[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Bug: fragmented tcp stream not accepted (ITS#235)



At 03:09 PM 7/22/99 GMT, David.Olivier@univ-lyon2.fr wrote:
>Full_Name: David Olivier
>Version: 1.2.3
>OS: Solaris 2.6
>URL: ftp://ftp.openldap.org/incoming/
>Submission from: (NULL) (159.84.44.142)
>
>
>I've puzzled over this quite some time and finally decided it's a bug in slapd.
>
>My would-be ldap client does not work. slapd closes connection immediately after
>receiving the bindRequest.
>
>The bindRequest I send is minimal:
>
>30 0c 02 01 01 60 07 02 01 02 04 00 80 00

That looks fine.

>I've even gone to sniffing it off the network to check that this is what I
>actually send.

>What I see on the network is that these bytes are sent by my client in three
>separate tcp frames:
>
> first frame: 30
>second frame: 0c
> third frame: 02 01 01 60 07 02 01 02 04 00 80 00
>
>If I send it in just one frame, with the following Java code:
>
>    byte[] b = {
>     (byte) 0x30, (byte) 0x0c,
>      (byte) 0x02, (byte) 0x01, (byte) 0x01,
>      (byte) 0x60, (byte) 0x07,
>       (byte) 0x02, (byte) 0x01, (byte) 0x02,
>       (byte) 0x04, (byte) 0x00,
>       (byte) 0x80, (byte) 0x00
>    };
>    output.write(b); // in C, write(fildes, b, 14);
>
>it works. But if I send slapd the same bytes, in three frames:
>
>    byte[] b = {
>     (byte) 0x30, (byte) 0x0c,
>      (byte) 0x02, (byte) 0x01, (byte) 0x01,
>      (byte) 0x60, (byte) 0x07,
>       (byte) 0x02, (byte) 0x01, (byte) 0x02,
>       (byte) 0x04, (byte) 0x00,
>       (byte) 0x80, (byte) 0x00
>    };
>    output.write(b, 0, 1);  // C: write(fildes, b, 1);
>    output.write(b, 1, 1);  // C: write(fildes, b+1, 1);
>    output.write(b, 2, 12); // C: write(fildes, b+2, 12);
>
>slapd closes the connection (after receiving the third frame, says snoop).

It shouldn't....

>(To reproduce this you might need to add a sleep between the sends.)

I wrote the following program:

char buf[] =
{
0x30, 0x0c,
0x02, 0x01, 0x01, 0x60, 0x07, 0x02, 0x01, 0x02, 0x04, 0x00, 0x80, 0x00
};

main(int argc, char *argv[]) {
    write( 1, &buf[0], 1);
    sleep(10);
    write( 1, &buf[1], 1);
    sleep(10);
    write( 1, &buf[2], 12);

    exit(0);
}

When the output is redirected to the server (using Juergen Nickelsen
socket(1) program), I see the behavior you describe when running
against OPENLDAP_REL_ENG_1_2 (1.2.4+)... however, -devel reacts
as expected.

Reviewing the CVS logs, I see that Bart fixed it in revision 1.20
of liblber/io.c.  However, the changes have not been ported to
release engineering branch.  I'll put it on the LONG todo list...
(It will likely be some time before I look into further).

http://www.openldap.org/devel/cvsweb.cgi/libraries/liblber/io.c