But the values we send don't even match up with NTFS allocation values. So
what does getting it right mean?

Here's a patch to reply_ntcreate_and_X that returns the allocation in one of
the fields instead of the file length.

I also found that Windows 2000 returns a weird ntcreate_and_X reply: 42
parameter words PLUS 18 bytes that are not accounted for in the word or
bytes counts. It seems to me that 8 of these extra 18 bytes contain two
access masks (seem to be User and Guest/Everyone-else). I'm guessing these
are something to do with "Simple File Sharing". The access masks here
determine how the file is accessed on the client offline (i.e. what
permissions the user has and what permissions anyone else who accesses the
file on the same client offline has). Win2K/XP tcon_and_X replies also have
these two access masks in the parameter words (the reason why they return 7
words instead of 3).

Finally, I think it would be a good idea to get the client-side-caching
policy patch into 2.2.4. Do you want to take a look at it or should I just
go ahead and check it in?

- Shirish

--- smbd/nttrans.c.orig Mon Apr  8 16:12:24 2002
+++ smbd/nttrans.c Mon Apr  8 18:27:32 2002
@@ -886,9 +886,10 @@
  if(oplock_request && EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type))
   smb_action |= EXTENDED_OPLOCK_GRANTED;

-#if 0
+#define SFS_MASK 1
+#if SFS_MASK
  /* W2K sends back 42 words here ! If we do the same it breaks offline
sync. Go figure... ? JRA. */
- set_message(outbuf,42,0,True);
+ set_message(outbuf,42,18,True);
 #else
  set_message(outbuf,34,0,True);
 #endif
@@ -938,11 +939,19 @@
  p += 8;
  SIVAL(p,0,fmode); /* File Attributes. */
  p += 4;
- SOFF_T(p, 0, file_len);
+ SOFF_T(p,0, SMB_ROUNDUP_ALLOCATION(file_len));
  p += 8;
- SOFF_T(p,0,file_len);
+ SOFF_T(p, 0, file_len);
  p += 12;
  SCVAL(p,0,fsp->is_directory ? 1 : 0);
+
+#if SFS_MASK
+ p = smb_buf(outbuf);
+ p += 6;
+ SIVAL(p, 0, 0x1f01ff); /* Full control for User ? */
+ p += 4;
+ SIVAL(p, 0, 0x1f01ff); /* full control for Guest ? */
+#endif

  DEBUG(5,("reply_ntcreate_and_X: fnum = %d, open name = %s\n", fsp->fnum,
fsp->fsp_name));


----- Original Message -----
From: "Jeremy Allison" <[EMAIL PROTECTED]>
To: "Shirish Kalele" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, April 08, 2002 11:32 PM
Subject: Re: SMB_ROUNDUP


> On Mon, Apr 08, 2002 at 07:12:57PM -0700, Shirish Kalele wrote:
> > Hi,
> >
> > Is there a specific need to roundup the reported allocation size of a
file
> > using SMB_ROUNDUP or SMB_ROUNDUP_ALLOCATION?
> >
> > Samba seems to report the allocation size inconsistently: it uses a
roundup
> > in some places and doesn't use it in other. This is confusing
> > offline-caching clients.
> >
> > Can we do away with the roundups?
>
> No, don't do that. I'm afraid they're essential to the correct
> functioning of some of the trans2 calls (in that some copying
> ops fail is we get it wrong). Can you tell me where
> the inconsistencies are and I can fix them ?
>
> Jeremy.
>


Reply via email to