Changeset 745 for trunk/server/source3/smbd/smb2_find.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/smbd/smb2_find.c
r414 r745 20 20 21 21 #include "includes.h" 22 #include "smbd/smbd.h" 22 23 #include "smbd/globals.h" 23 24 #include "../libcli/smb/smb_common.h" 25 #include "trans2.h" 26 #include "../lib/util/tevent_ntstatus.h" 24 27 25 28 static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx, … … 90 93 } 91 94 95 /* The output header is 8 bytes. */ 96 if (in_output_buffer_length <= 8) { 97 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); 98 } 99 100 DEBUG(10,("smbd_smb2_request_find_done: in_output_buffer_length = %u\n", 101 (unsigned int)in_output_buffer_length )); 102 103 /* Take into account the output header. */ 104 in_output_buffer_length -= 8; 105 92 106 in_file_name_buffer.data = (uint8_t *)req->in.vector[i+2].iov_base; 93 107 in_file_name_buffer.length = in_file_name_length; … … 104 118 if (req->compat_chain_fsp) { 105 119 /* skip check */ 106 } else if (in_file_id_persistent != 0) {120 } else if (in_file_id_persistent != in_file_id_volatile) { 107 121 return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED); 108 122 } … … 172 186 SIVAL(outbody.data, 0x04, 173 187 out_output_buffer.length); /* output buffer length */ 188 189 DEBUG(10,("smbd_smb2_request_find_done: out_output_buffer.length = %u\n", 190 (unsigned int)out_output_buffer.length )); 174 191 175 192 outdyn = out_output_buffer; … … 211 228 char *end_data; 212 229 int last_entry_off = 0; 213 uint64_t off = 0;230 int off = 0; 214 231 uint32_t num = 0; 215 uint32_t dirtype = aHIDDEN | aSYSTEM | aDIR; 216 const char *directory; 232 uint32_t dirtype = FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY; 217 233 bool dont_descend = false; 218 234 bool ask_sharemode = true; … … 253 269 } 254 270 255 directory = fsp->fsp_name->base_name;256 257 271 if (strcmp(in_file_name, "") == 0) { 258 272 tevent_req_nterror(req, NT_STATUS_OBJECT_NAME_INVALID); … … 304 318 305 319 if (in_flags & SMB2_CONTINUE_FLAG_REOPEN) { 306 if (fsp->dptr) { 307 dptr_CloseDir(fsp->dptr); 308 fsp->dptr = NULL; 309 } 320 dptr_CloseDir(fsp); 310 321 } 311 322 … … 321 332 322 333 status = dptr_create(conn, 323 directory, 334 fsp, 335 fsp->fsp_name->base_name, 324 336 false, /* old_handle */ 325 337 false, /* expect_close */ … … 360 372 pdata = (char *)state->out_output_buffer.data; 361 373 base_data = pdata; 362 end_data = pdata + in_output_buffer_length; 374 /* 375 * end_data must include the safety margin as it's what is 376 * used to determine if pushed strings have been truncated. 377 */ 378 end_data = pdata + in_output_buffer_length + DIR_ENTRY_SAFETY_MARGIN - 1; 363 379 last_entry_off = 0; 364 380 off = 0; 365 381 num = 0; 366 382 367 DEBUG(8,("smbd_smb2_find_send: dirpath=<%s> dontdescend=<%s>\n", 368 directory, lp_dontdescend(SNUM(conn)))); 369 if (in_list(directory,lp_dontdescend(SNUM(conn)),conn->case_sensitive)) { 383 DEBUG(8,("smbd_smb2_find_send: dirpath=<%s> dontdescend=<%s>, " 384 "in_output_buffer_length = %u\n", 385 fsp->fsp_name->base_name, lp_dontdescend(SNUM(conn)), 386 (unsigned int)in_output_buffer_length )); 387 if (in_list(fsp->fsp_name->base_name,lp_dontdescend(SNUM(conn)), 388 conn->case_sensitive)) { 370 389 dont_descend = true; 371 390 } … … 380 399 bool out_of_space = false; 381 400 int space_remaining = in_output_buffer_length - off; 401 402 SMB_ASSERT(space_remaining >= 0); 382 403 383 404 ok = smbd_dirptr_lanman2_entry(state, … … 402 423 NULL); 403 424 404 off = PTR_DIFF(pdata, base_data);425 off = (int)PTR_DIFF(pdata, base_data); 405 426 406 427 if (!ok) {
Note:
See TracChangeset
for help on using the changeset viewer.