diff options
author | Andrew Bartlett <abartlet@samba.org> | 2012-08-19 15:24:04 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2012-08-20 21:57:46 +1000 |
commit | f9f8a8c3d8bf1b027f149d2753824d9b2867f2ca (patch) | |
tree | 4677f48302508d65bb352802571cca3238e0c1d2 | |
parent | 3ef0e2246b4016b5f8a38f7476bc226c1875bfab (diff) | |
download | samba-f9f8a8c3d8bf1b027f149d2753824d9b2867f2ca.tar.gz samba-f9f8a8c3d8bf1b027f149d2753824d9b2867f2ca.tar.bz2 samba-f9f8a8c3d8bf1b027f149d2753824d9b2867f2ca.zip |
s3-smbd: Push smb_fname into estimate_ea_size
This ensures that we return the ea size of the stream, not the overall file.
This is important as if there is an EA on the main file, the raw.streams
test was failing.
Andrew Bartlett
-rw-r--r-- | source3/smbd/trans2.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index c703d918c6..152ef73c9b 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -490,16 +490,24 @@ static NTSTATUS fill_ea_chained_buffer(TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } -static unsigned int estimate_ea_size(connection_struct *conn, files_struct *fsp, const char *fname) +static unsigned int estimate_ea_size(connection_struct *conn, files_struct *fsp, const struct smb_filename *smb_fname) { size_t total_ea_len = 0; - TALLOC_CTX *mem_ctx = NULL; + TALLOC_CTX *mem_ctx; + NTSTATUS status; + char *fname; if (!lp_ea_support(SNUM(conn))) { return 0; } - mem_ctx = talloc_tos(); + mem_ctx = talloc_stackframe(); + status = get_full_smb_filename(mem_ctx, smb_fname, &fname); + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(mem_ctx); + return 0; + } (void)get_ea_list_from_file(mem_ctx, conn, fsp, fname, &total_ea_len); + TALLOC_FREE(mem_ctx); return total_ea_len; } @@ -1207,7 +1215,7 @@ static void call_trans2open(connection_struct *conn, SSVAL(params,24,0); /* Padding. */ if (flags & 8) { uint32 ea_size = estimate_ea_size(conn, fsp, - fsp->fsp_name->base_name); + smb_fname); SIVAL(params, 26, ea_size); } else { SIVAL(params, 26, 0); @@ -1654,7 +1662,7 @@ static bool smbd_marshall_dir_entry(TALLOC_CTX *ctx, SSVAL(p,20,mode); { unsigned int ea_size = estimate_ea_size(conn, NULL, - smb_fname->base_name); + smb_fname); SIVAL(p,22,ea_size); /* Extended attributes */ } p += 27; @@ -1757,7 +1765,7 @@ static bool smbd_marshall_dir_entry(TALLOC_CTX *ctx, q = p; p += 4; /* q is placeholder for name length. */ { unsigned int ea_size = estimate_ea_size(conn, NULL, - smb_fname->base_name); + smb_fname); SIVAL(p,0,ea_size); /* Extended attributes */ p += 4; } @@ -1859,7 +1867,7 @@ static bool smbd_marshall_dir_entry(TALLOC_CTX *ctx, q = p; p += 4; /* q is placeholder for name length. */ { unsigned int ea_size = estimate_ea_size(conn, NULL, - smb_fname->base_name); + smb_fname); SIVAL(p,0,ea_size); /* Extended attributes */ p +=4; } @@ -1934,7 +1942,7 @@ static bool smbd_marshall_dir_entry(TALLOC_CTX *ctx, q = p; p += 4; /* q is placeholder for name length. */ { unsigned int ea_size = estimate_ea_size(conn, NULL, - smb_fname->base_name); + smb_fname); SIVAL(p,0,ea_size); /* Extended attributes */ p +=4; } @@ -1980,7 +1988,7 @@ static bool smbd_marshall_dir_entry(TALLOC_CTX *ctx, q = p; p += 4; /* q is placeholder for name length */ { unsigned int ea_size = estimate_ea_size(conn, NULL, - smb_fname->base_name); + smb_fname); SIVAL(p,0,ea_size); /* Extended attributes */ p +=4; } @@ -4408,7 +4416,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn, { unsigned int ea_size = estimate_ea_size(conn, fsp, - smb_fname->base_name); + smb_fname); DEBUG(10,("smbd_do_qfilepathinfo: SMB_INFO_QUERY_EA_SIZE\n")); data_size = 26; srv_put_dos_date2(pdata,0,create_time); @@ -4548,7 +4556,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn, case SMB_QUERY_FILE_EA_INFO: { unsigned int ea_size = - estimate_ea_size(conn, fsp, smb_fname->base_name); + estimate_ea_size(conn, fsp, smb_fname); DEBUG(10,("smbd_do_qfilepathinfo: SMB_FILE_EA_INFORMATION\n")); data_size = 4; SIVAL(pdata,0,ea_size); @@ -4610,7 +4618,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn, { int len; unsigned int ea_size = - estimate_ea_size(conn, fsp, smb_fname->base_name); + estimate_ea_size(conn, fsp, smb_fname); DEBUG(10,("smbd_do_qfilepathinfo: SMB_FILE_ALL_INFORMATION\n")); put_long_date_timespec(conn->ts_res,pdata,create_time_ts); put_long_date_timespec(conn->ts_res,pdata+8,atime_ts); |