Fix for setatr in clifile.c
Satwik Hebbar
satwikh at calsoftinc.com
Wed Apr 27 16:38:37 GMT 2005
Yeah, I did note that too. In my case, I have fixed the code in lib/time.c
to do the actual conversion to the dos format. I had started working with
samba-3.0.9 and figured somebody must have fixed that later, but even that
doesnt seem to have been fixed. I will submit a patch on that one too. In
fact, both the unix->dos and dos->unix conversion were simply doing GMT to
localtime conversions and vice-versa.
Anyway, for now, please assume that the conversions I am doing in time.c
are working fine (cos I have done a lot of testing on that code). My
experiment was on a Win2k server.
I did the following :-
Created a file called timepass.txt
Closed the file
Set the read only flag on it and set the last write time to X.
I varied X and tested it.
X = 1114000000 (unix time equiv to Wed Apr 20, 2005 - 17:56:40)
---------------------------------------------------------------
Before my patch in libsmb/clifile.c :-
The file shows (through the right-click -> properties tab) the last write
time as : Thu Jan 25, 2046 3:59:16
Ethereal shows : Not representable or a wrong time depending on the
version (eth dump attached - beforepatch1)
After my patch :-
Both the file and ethereal show the correct values (afterpatch1)
X = 1114999999 (unix time equiv to Mon May 2, 2005 - 07:43:19)
--------------------------------------------------------------
Before the patch :-
The file and ethereal both show Aug 25, 2002, 19:40:18 (beforepatch2)
After :-
Both show the correct times (afterpatch2)
I am attaching the ethereal dumps too. Please take a loot at packet 24 in
the four files.
Derell, I think the current implementation is going to work for the
cli_setatr then as the conversion from unix to dos in time.c never
actually happens in put_dos_date3(). However, this only means that
setattrE is not going to work then and set improper times. I think I
should submit patches for both time.c and clifile.c so that both setattrE
and setatr work properly as they are at my end. Till then, I guess you can
generate the dumps that I produced here.
Let me know how I can send the patches to both the files so you can then
verify that both the functions setattrE and setatr will then work
properly. Do I still open a bug and do that?
Thanks,
Satwik.
On Wed, 27 Apr 2005 09:05:54 -0400, <derrell at samba.org> wrote:
> "Satwik Hebbar" <satwikh at calsoftinc.com> writes:
>
>> My test as against a Win2k server too. Sorry for not mentioning that
>> earlier. In fact, it was ethereal itself that told me the times werent
>> going out properly. The dat I wanted to set was Apr 25, 2005, while
>> ethereal showed it as some date in 2020. When I stopped the conversion
>> in
>> setatr to dos format, both ethereal and the final timestamps were
>> showing
>> proper values.
>
> As it turns out, that conversion to DOS format isn't really much of a
> conversion. All it really does is convert the timestamp from GMT to
> localtime, since (as the comment on lib/time.c:put_dos_date3() says),
> most
> SMBs assume localtime. The conversion should not change the timestamp
> by more
> than a bunch of hours.
>
>> I will repeat my experiment as soon as I get time today and send the
>> ethereal dump too.
>
> I'm interested is hearing about / seeing the results. Thanks.
>
> Derrell
>
--
----------------------------------------------------------------------
When dreaming I'm guided through another world
Time and time again
At sunrise I fight to stay asleep
'Cause I don't want to leave the comfort of this place
'Cause there's a hunger, a longing to escape
From the life I live when I'm awake
----------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: afterpatch1
Type: application/octet-stream
Size: 5890 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20050427/8ec7fe5e/afterpatch1.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: afterpatch2
Type: application/octet-stream
Size: 5890 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20050427/8ec7fe5e/afterpatch2.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: beforepatch1
Type: application/octet-stream
Size: 5890 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20050427/8ec7fe5e/beforepatch1.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: beforepatch2
Type: application/octet-stream
Size: 5890 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20050427/8ec7fe5e/beforepatch2.obj
More information about the samba-technical
mailing list