svn commit: samba r7025 - in branches/SAMBA_3_0/source: lib tdb

Jeremy Allison jra at samba.org
Fri May 27 17:38:55 GMT 2005


On Fri, May 27, 2005 at 12:54:12PM -0400, derrell at samba.org wrote:
> This change to lib/util_sock.c that I checked in (r7025) should be sanity
> checked.  I asked a few people to sanity check it a couple of weeks ago, but I
> got feedback only from tridge.  I've been using this for a couple of weeks
> with no problem, but since it is at the very core of samba functionality,
> others should concur that it doesn't break anything.

It doesn't look right. You're using read_socket_data(), which has
some very definate properties.

Firstly, it has only 3 possible returns :

1). 0. In this case smb_read_error gets set to EOF.

2). -1. In this case smb_read_error gets set to READ_ERROR.
Also, as read_socket_data() calls sys_read() within a loop
then it's possible we had a partial read which could then
be lost. This is a bug in read_socket_data() I think.

3). N. N is *guarenteed* to be the number of bytes asked for,
due to read_socket_data() calling sys_read() in a loop.

Note that in no case can it return a partial read, making all
the extra code you added meaningless.

The real problem is within read_socket_data() I think. Please
revert this change and let's rethink this.

Jeremy.


More information about the samba-cvs mailing list