summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-08-14 23:15:02 +0000
committerJeremy Allison <jra@samba.org>2003-08-14 23:15:02 +0000
commit1699fadcdb86462c0b36f0479317dc52ae8a263a (patch)
treec247bbc4ce508cde4171bbad96402b429aae851a /source3/smbd
parentb679661d275e7e5ebafb665654cb39a2003b67bc (diff)
downloadsamba-1699fadcdb86462c0b36f0479317dc52ae8a263a.tar.gz
samba-1699fadcdb86462c0b36f0479317dc52ae8a263a.tar.bz2
samba-1699fadcdb86462c0b36f0479317dc52ae8a263a.zip
Fix changing of attributes via setattr. Samba4 test fixes.
Jeremy. (This used to be commit 97e1d5c9573513c9c9be9a709341bda54fbe44be)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/reply.c17
-rw-r--r--source3/smbd/trans2.c16
2 files changed, 23 insertions, 10 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 8df118ab16..35d07d5bf7 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -544,13 +544,18 @@ int reply_setatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
mode = SVAL(inbuf,smb_vwv0);
mtime = make_unix_date3(inbuf+smb_vwv1);
- if (VALID_STAT_OF_DIR(sbuf))
- mode |= aDIR;
- else
- mode &= ~aDIR;
+ if (mode != FILE_ATTRIBUTE_NORMAL) {
+ if (VALID_STAT_OF_DIR(sbuf))
+ mode |= aDIR;
+ else
+ mode &= ~aDIR;
+
+ if (check_name(fname,conn))
+ ok = (file_chmod(conn,fname,mode,NULL) == 0);
+ } else {
+ ok = True;
+ }
- if (check_name(fname,conn))
- ok = (file_chmod(conn,fname,mode,NULL) == 0);
if (ok)
ok = set_filetime(conn,fname,mtime);
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 8adac1930f..efce768177 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1871,6 +1871,9 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
base_name = p+1;
mode = dos_mode(conn,fname,&sbuf);
+ if (!mode)
+ mode = FILE_ATTRIBUTE_NORMAL;
+
fullpathname = fname;
file_size = get_file_size(sbuf);
allocation_size = get_allocation_size(fsp,&sbuf);
@@ -2915,10 +2918,15 @@ size = %.0f, uid = %u, gid = %u, raw perms = 0%o\n",
DEBUG(6,("modtime: %s ", ctime(&tvs.modtime)));
DEBUG(6,("size: %.0f ", (double)size));
- if (S_ISDIR(sbuf.st_mode))
- dosmode |= aDIR;
- else
- dosmode &= ~aDIR;
+ if (dosmode == FILE_ATTRIBUTE_NORMAL)
+ dosmode = 0;
+
+ if (dosmode) {
+ if (S_ISDIR(sbuf.st_mode))
+ dosmode |= aDIR;
+ else
+ dosmode &= ~aDIR;
+ }
DEBUG(6,("dosmode: %x\n" , dosmode));