Allow set attributes on a stream fnum to be redirected to the base filename.
[tprouty/samba.git] / source3 / smbd / trans2.c
index cea066e97ff453477c73b55a20dac645f4f8f1e6..433b8a008d0594e30b60a61299f9f107df880704 100644 (file)
@@ -4972,6 +4972,7 @@ NTSTATUS smb_set_file_time(connection_struct *conn,
 ****************************************************************************/
 
 static NTSTATUS smb_set_file_dosmode(connection_struct *conn,
+                               files_struct *fsp,
                                const char *fname,
                                SMB_STRUCT_STAT *psbuf,
                                uint32 dosmode)
@@ -4980,6 +4981,14 @@ static NTSTATUS smb_set_file_dosmode(connection_struct *conn,
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
        }
 
+       if (fsp) {
+               if (fsp->base_fsp) {
+                       fname = fsp->base_fsp->fsp_name;
+               } else {
+                       fname = fsp->fsp_name;
+               }
+       }
+               
        if (dosmode) {
                if (S_ISDIR(psbuf->st_mode)) {
                        dosmode |= aDIR;
@@ -5628,7 +5637,8 @@ static NTSTATUS smb_set_posix_lock(connection_struct *conn,
                                                        POSIX_LOCK,
                                                        blocking_lock,
                                                        &status,
-                                                       &block_smbpid);
+                                                       &block_smbpid,
+                                                       NULL);
 
                if (br_lck && blocking_lock && ERROR_WAS_LOCK_DENIED(status)) {
                        /*
@@ -5722,12 +5732,11 @@ static NTSTATUS smb_set_file_basic_info(connection_struct *conn,
 
        /* Set the attributes */
        dosmode = IVAL(pdata,32);
-       status = smb_set_file_dosmode(conn, fname, psbuf, dosmode);
+       status = smb_set_file_dosmode(conn, fsp, fname, psbuf, dosmode);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
 
-
        /* access time */
        ft.atime = interpret_long_date(pdata+8);