Fix for setatr in clifile.c
Jeremy Allison
jra at samba.org
Tue Apr 26 18:54:32 GMT 2005
On Tue, Apr 26, 2005 at 02:47:03PM -0400, derrell at samba.org wrote:
> "Satwik Hebbar" <satwikh at calsoftinc.com> writes:
>
> > I was using the cli_setatr function of the smbclient for setting file
> > attributes on a file and the cli_setattrE function for setting timestats
> > on the file. Both the functions were converting times to the dos format
> > before putting them onto the wire. While this works fine for setattrE,
> > setatr, which accepts a time_t value for the last write time for the file,
> > sets the incorrect last write value on the file. This is because setatr
> > expects times in the unix format and when I made that change to the code,
> > it started setting the proper last write time value.
>
> The CIFS spec (draft-leach-cifs-v1-spec-02.html) agrees with the above
> imperically-derived bug find. It appears, though, that the Samba server
> expects a DOS-encoded timestamp, not a Unix timestamp. reply.c:reply_setatr()
> calls make_unix_date3() with the supplied timestamp before setting the file's
> attributes with utime().
>
> Is it possible that this code path has not been exercised in the Samba server,
> such that no one ever noticed that the timestamps are set incorrectly when
> using SMB_COM_SET_INFORMATION (aka SMBsetatr)? Or are different styles of
> timestamps passed at different times, and some more information is required to
> ascertain whether to do the format conversion?
Test this against a W2K3 server. Don't change anything until then. It's unlikely
such an old SMB actually uses a UNIX time_t no matter what the spec says.
Jeremy.
More information about the samba-technical
mailing list