summaryrefslogtreecommitdiff
path: root/source3/smbd/trans2.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-04-05 01:20:32 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:28 -0500
commit77fa234ffc71a62990d37e3d32c9d6733d60c17f (patch)
treea7ddf7d88f5cd98f65635a4b81f0d00ffa4c8325 /source3/smbd/trans2.c
parentd318fe4025755b68f88fd9f0605732ee8b94c57f (diff)
downloadsamba-77fa234ffc71a62990d37e3d32c9d6733d60c17f.tar.gz
samba-77fa234ffc71a62990d37e3d32c9d6733d60c17f.tar.bz2
samba-77fa234ffc71a62990d37e3d32c9d6733d60c17f.zip
r6203: Fix attribute return on creating a directory with nttrans_create.
Fix strange allocation semantics of openX. Jeremy. (This used to be commit da5a8b539d39d2765de22c3e55e9f284992ff966)
Diffstat (limited to 'source3/smbd/trans2.c')
-rw-r--r--source3/smbd/trans2.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index e7f44a6592..f8123bc11a 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -58,14 +58,18 @@ SMB_BIG_UINT get_allocation_size(connection_struct *conn, files_struct *fsp, SMB
{
SMB_BIG_UINT ret;
+ if(S_ISDIR(sbuf->st_mode)) {
+ return 0;
+ }
+
#if defined(HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE)
ret = (SMB_BIG_UINT)STAT_ST_BLOCKSIZE * (SMB_BIG_UINT)sbuf->st_blocks;
#else
ret = (SMB_BIG_UINT)get_file_size(*sbuf);
#endif
- if (!ret && fsp && fsp->initial_allocation_size)
- ret = fsp->initial_allocation_size;
+ if (fsp && fsp->initial_allocation_size)
+ ret = MAX(ret,fsp->initial_allocation_size);
return smb_roundup(conn, ret);
}
@@ -2800,7 +2804,6 @@ static int call_trans2qfilepathinfo(connection_struct *conn, char *inbuf, char *
fullpathname = fname;
file_size = get_file_size(sbuf);
- allocation_size = get_allocation_size(conn,fsp,&sbuf);
if (mode & aDIR) {
/* This is necessary, as otherwise the desktop.ini file in
* this folder is ignored */
@@ -2858,6 +2861,8 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
c_time = get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn)));
+ allocation_size = get_allocation_size(conn,fsp,&sbuf);
+
if (fsp) {
if (fsp->pending_modtime) {
/* the pending modtime overrides the current modtime */
@@ -2870,6 +2875,9 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
/* the pending modtime overrides the current modtime */
sbuf.st_mtime = fsp1->pending_modtime;
}
+ if (fsp1 && fsp1->initial_allocation_size) {
+ allocation_size = get_allocation_size(conn, fsp1, &sbuf);
+ }
}
if (lp_dos_filetime_resolution(SNUM(conn))) {