Samba 2.0.6, MKS' touch.exe, and file/dir time stamps

H.-P. Ermert ermert at snafu.de
Thu Nov 25 23:00:18 GMT 1999


samba at samba.org wrote:

Hi Jeremy, hi Don!

I changed the source of smbd/dosmode.c but this did not change the
behaviour
in my case.
 
Then I looked for any differences between smbd 2.0.5a and 2.0.6 
because 2.0.5a produces correct file times here.
 
I found a difference in smbd/trans2.c line 2355 :

trans2.c in 2.0.5a:
      /* write time + changed time, combined. */ 
      tvs.modtime=MAX(interpret_long_date(pdata+16),
                      interpret_long_date(pdata+24));

trans2.c in 2.0.6:  
      /* write time + changed time, combined. */ 
      tvs.modtime=MIN(interpret_long_date(pdata+16),
                      interpret_long_date(pdata+24));

After replacing MIN in the new (2.0.6) file by MAX the filetime after a
touch 
or when copying a file seems to be ok.
I did no further testing and did not go into further details, hope you
can check if this is the correct place to fix the problem. I will
observe
the new behaviour after the patch.

Regards 
  Peter
 

> 
> Date:   Wed, 24 Nov 1999 14:16:51 -0800
> From:   Jeremy Allison <jeremy at valinux.com>
> To:     don_mccall at hp.com
> Subject: Re: Samba 2.0.6, MKS' touch.exe, and file/dir time stamps
> Message-ID: <383C63D3.34D97EE8 at valinux.com>
> MIME-Version: 1.0
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> 
> don_mccall at hp.com wrote:
> >
> > Hi Peter, et. al;
> > I can reproduce this behavior with the standard NT 4.0 touch command (that you
> > can pull from the NT 4.0 ResourceKit CD) from the command prompt if I map a
> > network drive to my Samba 2.05b HP-UX 11.0 server.  But interestingly enough, I
> > did a "touch *" in the directory in question, and ONE file DID reflect the new
> > time, the other didn't.
> > Looking at the debug file for samba, I found the reason why:
> >
> > [1999/11/24 15:04:49, 4] smbd/dosmode.c:(251)
> >   set_filetime(anothertestbydon.txt) failed: Not owner
> >
> > Turns out that I was comming in as 'nobody'; I only had one file in the
> > directory I was using to test your problem on, so I did a drag and drop copy of
> > this file (anothertestbydon.txt) and it was called "Copy of
> > anothertestbydon.txt".  Of course, since I had just CREATED this copy, 'nobody'
> > owned it. the original file was owned by another user.  When I did a "touch *"
> > the file I 'owned' changed timestamp, and the original one did not.
> > Perhaps your issue is related?  By the way, I took a netmon trace of the
> > success and failure, and did not see where the reply to the SetFilePathInfo
> > transact2 smb (which is the smb that the NT client sent to request the date
> > change in response to the 'touch' command) in the failing case differed with
> > the one that succeeded - neither returned any error information, which jives
> > with your finding that the command comes back clean, even though the timestamp
> > remains unchanged.
> > Try using smbstatus to see what username you are attached to, and what unix
> > user that maps to, and then see whether changing the ownership on one of the
> > files you are doing a touch on makes a difference...
> > Sorry I ran out of time to investigate if this is reasonable behavior, but I
> > did a quick test by 'touching' a file on an NT 4.0 server share which I did not
> > own, and the timestamp on THAT file did change...
> > Hope this helps,
> > Don
> 
> There's a missing "return False" statement in smbd/dosmode.c
> 
> Try the following patch (should apply cleanly to 2.0.5a and
> 2.0.6) and see if this fixes the problem.
> 
> Regards,
> 
>         Jeremy Allison,
>         Samba Team.
> 
> -------------------------cut here-------------------------------------
> Index: smbd/dosmode.c
> ===================================================================
> RCS file: /data/cvs/samba/source/smbd/dosmode.c,v
> retrieving revision 1.6.2.2
> diff -u -r1.6.2.2 dosmode.c
> --- dosmode.c   1999/06/14 22:25:48     1.6.2.2
> +++ dosmode.c   1999/11/24 21:16:34
> @@ -249,9 +249,8 @@
> 
>    if (file_utime(conn, fname, &times)) {
>      DEBUG(4,("set_filetime(%s) failed: %s\n",fname,strerror(errno)));
> +    return False;
>    }
> 
>    return(True);
>  }
> -
> -
> -------------------------cut here-------------------------------------
--
Ing. Buero Ermert, Dipl. Inform Hanns-Peter Ermert, 10715 Berlin
email: Hanns-Peter.Ermert at alcatel.de / Alcatel SEL AG,ZIT/B/S2
12099 Berlin,Colditzstrasse 34-36


More information about the samba mailing list