We now pass the Microsoft SMB2 fileio test with EA's and streams...
authorJeremy Allison <jra@samba.org>
Thu, 17 Sep 2009 16:29:07 +0000 (09:29 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 17 Sep 2009 16:29:07 +0000 (09:29 -0700)
Jeremy.

source3/include/proto.h
source3/smbd/globals.c
source3/smbd/nttrans.c
source3/smbd/smb2_create.c
source3/smbd/trans2.c

index 81cb5ef6e1d719c4f86846ebb581a2c45831d892..1d8a6cd9faf4fd3729a40ebd6cec54b129bf4e6b 100644 (file)
@@ -6572,6 +6572,7 @@ void send_nt_replies(connection_struct *conn,
                     char *params, int paramsize,
                     char *pdata, int datasize);
 void reply_ntcreate_and_X(struct smb_request *req);
+struct ea_list *read_nttrans_ea_list(TALLOC_CTX *ctx, const char *pdata, size_t data_size);
 void reply_ntcancel(struct smb_request *req);
 void reply_ntrename(struct smb_request *req);
 void reply_nttrans(struct smb_request *req);
index f680b763690106dba309bd87b58f4734600a7417..68fa795ba2ac7663a321ba01f219c06a8cc701da 100644 (file)
@@ -95,7 +95,7 @@ time_t last_printer_reload_time = 0;
  for processing.
 ****************************************************************************/
 struct pending_message_list *deferred_open_queue = NULL;
-uint32_t common_flags2 = FLAGS2_LONG_PATH_COMPONENTS|FLAGS2_32_BIT_ERROR_CODES;
+uint32_t common_flags2 = FLAGS2_LONG_PATH_COMPONENTS|FLAGS2_32_BIT_ERROR_CODES|FLAGS2_EXTENDED_ATTRIBUTES;
 
 struct smb_srv_trans_enc_ctx *partial_srv_trans_enc_ctx = NULL;
 struct smb_srv_trans_enc_ctx *srv_trans_enc_ctx = NULL;
index 1b981578e321e563752e19118ce0dee619c7d795..cf955d9651d8585f32938c2daf86b4f88b63581c 100644 (file)
@@ -810,7 +810,7 @@ static NTSTATUS set_sd(files_struct *fsp, uint8 *data, uint32 sd_len,
  Read a list of EA names and data from an incoming data buffer. Create an ea_list with them.
 ****************************************************************************/
 
-static struct ea_list *read_nttrans_ea_list(TALLOC_CTX *ctx, const char *pdata, size_t data_size)
+struct ea_list *read_nttrans_ea_list(TALLOC_CTX *ctx, const char *pdata, size_t data_size)
 {
        struct ea_list *ea_list_head = NULL;
        size_t offset = 0;
index 3090650c3be25d577217699343b635a26374c11e..e0815049a429d18ff39c56653ae1ca0fb94f5f0a 100644 (file)
@@ -450,9 +450,13 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
                                return tevent_req_post(req, ev);
                        }
 
-                       /* TODO */
-                       tevent_req_nterror(req, NT_STATUS_EAS_NOT_SUPPORTED);
-                       return tevent_req_post(req, ev);
+                       ea_list = read_nttrans_ea_list(mem_ctx,
+                               (const char *)exta->data.data, exta->data.length);
+                       if (!ea_list) {
+                               DEBUG(10,("smbd_smb2_create_send: read_ea_name_list failed.\n"));
+                               tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
+                               return tevent_req_post(req, ev);
+                       }
                }
 
                if (mxac) {
index f2c025b6c103e168027f3c41cbac898be1814a32..85eb73749ad443c61bf60e0607b8c383e5ab3696 100644 (file)
@@ -4379,6 +4379,9 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
 
                case 0xFF0F:/*SMB2_INFO_QUERY_ALL_EAS*/
                {
+                       /* This is FileFullEaInformation - 0xF which maps to
+                        * 1015 (decimal) in smbd_do_setfilepathinfo. */
+
                        /* We have data_size bytes to put EA's into. */
                        size_t total_ea_len = 0;
                        struct ea_list *ea_file_list = NULL;
@@ -5655,6 +5658,53 @@ static NTSTATUS smb_info_set_ea(connection_struct *conn,
        return status;
 }
 
+/****************************************************************************
+ Deal with SMB_FILE_FULL_EA_INFORMATION set.
+****************************************************************************/
+
+static NTSTATUS smb_set_file_full_ea_info(connection_struct *conn,
+                               const char *pdata,
+                               int total_data,
+                               files_struct *fsp)
+{
+       struct ea_list *ea_list = NULL;
+       NTSTATUS status;
+
+       if (!fsp) {
+               return NT_STATUS_INVALID_HANDLE;
+       }
+
+       if (!lp_ea_support(SNUM(conn))) {
+               DEBUG(10, ("smb_set_file_full_ea_info - ea_len = %u but "
+                       "EA's not supported.\n",
+                       (unsigned int)total_data));
+               return NT_STATUS_EAS_NOT_SUPPORTED;
+       }
+
+       if (total_data < 10) {
+               DEBUG(10, ("smb_set_file_full_ea_info - ea_len = %u "
+                       "too small.\n",
+                       (unsigned int)total_data));
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       ea_list = read_nttrans_ea_list(talloc_tos(),
+                               pdata,
+                               total_data);
+
+       if (!ea_list) {
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+       status = set_ea(conn, fsp, fsp->fsp_name, ea_list);
+
+       DEBUG(10, ("smb_set_file_full_ea_info on file %s returned %s\n",
+               smb_fname_str_dbg(fsp->fsp_name),
+               nt_errstr(status) ));
+
+       return status;
+}
+
+
 /****************************************************************************
  Deal with SMB_SET_FILE_DISPOSITION_INFO.
 ****************************************************************************/
@@ -7374,6 +7424,15 @@ NTSTATUS smbd_do_setfilepathinfo(connection_struct *conn,
                        break;
                }
 
+               case SMB_FILE_FULL_EA_INFORMATION:
+               {
+                       status = smb_set_file_full_ea_info(conn,
+                                               pdata,
+                                               total_data,
+                                               fsp);
+                       break;
+               }
+
                /* From tridge Samba4 : 
                 * MODE_INFORMATION in setfileinfo (I have no
                 * idea what "mode information" on a file is - it takes a value of 0,