libsmbclient smbc_lseek works wrong?

Richard Sharpe rsharpe at
Wed Jan 12 19:22:35 GMT 2005

On Thu, 13 Jan 2005, RandoMan wrote:

> >> Make sure you compile your application with the same flags as
> >> Samba was compiled. off_t is different in size when compiled with 64
> >> bit support enabled.
> RS> Hmmm, actually, I suspect the problem might be related to the protocol.
> RS> While the server keeps state about the client, one thing it does not keep
> RS> is the current offset into the file that the user is up to. That is
> RS> because all requests to read or write a file are accompanied with the
> RS> offset that you want to read from or write to.
> RS> When I wrote the code initially, I didn't think of this aspect.
> RS> I suspect that we will need to update all READ and WRITE requests
> RS> (smbc_read and smbc_write) to update curpos for the file handle after the
> RS> read/write completes.
> Hm, some time ago using samba-3.0.7 I wrote a code for LUFS - it was a
> buggy implementation of smbbrowsefs (because libsmbclient is not
> thread-safe), but smbc_lseek was fine. The only thing is that I used
> Linux Slackware instead with possible other flags of compilation...
> I'll try to dig in this direction...

OK. I must admit to not having looked at the code before making the
statement above :-)

Hmmm, now that I have done so, I see that we are updating the offset.

So, the bug must be elsewhere. Having had a quick look at SVN sources, it
is not obvious what is going wrong.

Richard Sharpe, rsharpe[at], rsharpe[at],

More information about the samba-technical mailing list