Fix for setatr in clifile.c

derrell at samba.org derrell at samba.org
Tue Apr 26 18:47:03 GMT 2005


"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?

Derrell


More information about the samba-technical mailing list