Changeset 740 for vendor/current/source3/smbd/reply.c
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/smbd/reply.c
r587 r740 26 26 27 27 #include "includes.h" 28 #include "system/filesys.h" 29 #include "printing.h" 30 #include "smbd/smbd.h" 28 31 #include "smbd/globals.h" 32 #include "fake_file.h" 33 #include "rpc_client/rpc_client.h" 34 #include "../librpc/gen_ndr/ndr_spoolss_c.h" 35 #include "rpc_client/cli_spoolss.h" 36 #include "rpc_client/init_spoolss.h" 37 #include "rpc_server/rpc_ncacn_np.h" 38 #include "libcli/security/security.h" 39 #include "libsmb/nmblib.h" 40 #include "auth.h" 41 #include "smbprofile.h" 29 42 30 43 /**************************************************************************** … … 323 336 files_struct *fsp) 324 337 { 325 if ( !(fsp) || !(conn)) {338 if ((fsp == NULL) || (conn == NULL)) { 326 339 reply_nterror(req, NT_STATUS_INVALID_HANDLE); 327 340 return False; 328 341 } 329 if (( (conn) != (fsp)->conn) || req->vuid != (fsp)->vuid) {342 if ((conn != fsp->conn) || (req->vuid != fsp->vuid)) { 330 343 reply_nterror(req, NT_STATUS_INVALID_HANDLE); 331 344 return False; … … 344 357 return False; 345 358 } 346 if ( (fsp)->is_directory) {359 if (fsp->is_directory) { 347 360 reply_nterror(req, NT_STATUS_INVALID_DEVICE_REQUEST); 348 361 return False; 349 362 } 350 if ( (fsp)->fh->fd == -1) {363 if (fsp->fh->fd == -1) { 351 364 reply_nterror(req, NT_STATUS_ACCESS_DENIED); 352 365 return False; 353 366 } 354 (fsp)->num_smb_operations++;367 fsp->num_smb_operations++; 355 368 return True; 356 369 } … … 387 400 } 388 401 389 /**************************************************************************** 390 Check if we have a correct fsp. Replacement for the FSP_BELONGS_CONN macro 391 ****************************************************************************/ 392 393 bool fsp_belongs_conn(connection_struct *conn, struct smb_request *req, 394 files_struct *fsp) 395 { 396 if ((fsp) && (conn) && ((conn)==(fsp)->conn) 397 && (req->vuid == (fsp)->vuid)) { 398 return True; 399 } 400 401 reply_nterror(req, NT_STATUS_INVALID_HANDLE); 402 return False; 403 } 404 405 static bool netbios_session_retarget(const char *name, int name_type) 402 static bool netbios_session_retarget(struct smbd_server_connection *sconn, 403 const char *name, int name_type) 406 404 { 407 405 char *trim_name; … … 417 415 uint8_t outbuf[10]; 418 416 419 if (get_socket_port(s mbd_server_fd()) != 139) {417 if (get_socket_port(sconn->sock) != 139) { 420 418 return false; 421 419 } … … 459 457 if (p != NULL) { 460 458 *p++ = '\0'; 461 sscanf(p, "%x", &retarget_type); 459 if (sscanf(p, "%x", &retarget_type) != 1) { 460 goto fail; 461 } 462 462 } 463 463 … … 480 480 *(uint16_t *)(outbuf+8) = htons(retarget_port); 481 481 482 if (!srv_send_smb(s mbd_server_fd(), (char *)outbuf, false, 0, false,482 if (!srv_send_smb(sconn, (char *)outbuf, false, 0, false, 483 483 NULL)) { 484 484 exit_server_cleanly("netbios_session_regarget: srv_send_smb " … … 493 493 494 494 /**************************************************************************** 495 Reply to a (netbios-level) special message. 495 Reply to a (netbios-level) special message. 496 496 ****************************************************************************/ 497 497 498 void reply_special( char *inbuf, size_t inbuf_size)498 void reply_special(struct smbd_server_connection *sconn, char *inbuf, size_t inbuf_size) 499 499 { 500 500 int msg_type = CVAL(inbuf,0); 501 501 int msg_flags = CVAL(inbuf,1); 502 struct smbd_server_connection *sconn = smbd_server_conn;503 502 /* 504 503 * We only really use 4 bytes of the outbuf, but for the smb_setlen … … 533 532 if (name_len1 <= 0 || name_len1 > inbuf_size - 4) { 534 533 DEBUG(0,("Invalid name length in session request\n")); 535 return;534 break; 536 535 } 537 536 name_len2 = name_len((unsigned char *)(inbuf+4+name_len1),inbuf_size - 4 - name_len1); 538 537 if (name_len2 <= 0 || name_len2 > inbuf_size - 4 - name_len1) { 539 538 DEBUG(0,("Invalid name length in session request\n")); 540 return;539 break; 541 540 } 542 541 … … 548 547 if (name_type1 == -1 || name_type2 == -1) { 549 548 DEBUG(0,("Invalid name type in session request\n")); 550 return;549 break; 551 550 } 552 551 … … 554 553 name1, name_type1, name2, name_type2)); 555 554 556 if (netbios_session_retarget( name1, name_type1)) {555 if (netbios_session_retarget(sconn, name1, name_type1)) { 557 556 exit_server_cleanly("retargeted client"); 557 } 558 559 /* 560 * Windows NT/2k uses "*SMBSERVER" and XP uses 561 * "*SMBSERV" arrggg!!! 562 */ 563 if (strequal(name1, "*SMBSERVER ") 564 || strequal(name1, "*SMBSERV ")) { 565 fstrcpy(name1, sconn->client_id.addr); 558 566 } 559 567 … … 579 587 } 580 588 581 reload_services( True);589 reload_services(sconn->msg_ctx, sconn->sock, True); 582 590 reopen_logs(); 583 591 … … 606 614 msg_type, msg_flags)); 607 615 608 srv_send_smb(s mbd_server_fd(), outbuf, false, 0, false, NULL);616 srv_send_smb(sconn, outbuf, false, 0, false, NULL); 609 617 return; 610 618 } … … 627 635 DATA_BLOB password_blob; 628 636 TALLOC_CTX *ctx = talloc_tos(); 629 struct smbd_server_connection *sconn = smbd_server_conn;637 struct smbd_server_connection *sconn = req->sconn; 630 638 631 639 START_PROFILE(SMBtcon); … … 703 711 const char *p, *q; 704 712 uint16 tcon_flags; 705 struct smbd_server_connection *sconn = smbd_server_conn;713 struct smbd_server_connection *sconn = req->sconn; 706 714 707 715 START_PROFILE(SMBtconX); … … 828 836 perm2 = FILE_ALL_ACCESS; 829 837 } else { 830 perm1 = CAN_WRITE(conn) ? 831 SHARE_ALL_ACCESS : 832 SHARE_READ_ONLY; 838 perm1 = conn->share_access; 833 839 } 834 840 … … 944 950 return; 945 951 } 946 SSVAL(p,0,fsp->rap_print_jobid); /* Job number */ 952 /* Job number */ 953 if (fsp->print_file) { 954 SSVAL(p, 0, fsp->print_file->rap_jobid); 955 } else { 956 SSVAL(p, 0, 0); 957 } 947 958 srvstr_push((char *)req->outbuf, req->flags2, p+2, 948 959 global_myname(), 15, … … 1096 1107 under WfWg - weird! */ 1097 1108 if (*fname == '\0') { 1098 mode = aHIDDEN | aDIR;1109 mode = FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY; 1099 1110 if (!CAN_WRITE(conn)) { 1100 mode |= aRONLY;1111 mode |= FILE_ATTRIBUTE_READONLY; 1101 1112 } 1102 1113 size = 0; … … 1137 1148 ZERO_STRUCT(write_time_ts); 1138 1149 fileid = vfs_file_id_from_sbuf(conn, &smb_fname->st); 1139 get_file_infos(fileid, NULL, &write_time_ts);1150 get_file_infos(fileid, 0, NULL, &write_time_ts); 1140 1151 if (!null_timespec(write_time_ts)) { 1141 1152 update_stat_ex_mtime(&smb_fname->st, write_time_ts); … … 1144 1155 1145 1156 mtime = convert_timespec_to_time_t(smb_fname->st.st_ex_mtime); 1146 if (mode & aDIR) {1157 if (mode & FILE_ATTRIBUTE_DIRECTORY) { 1147 1158 size = 0; 1148 1159 } … … 1245 1256 if (mode != FILE_ATTRIBUTE_NORMAL) { 1246 1257 if (VALID_STAT_OF_DIR(smb_fname->st)) 1247 mode |= aDIR;1258 mode |= FILE_ATTRIBUTE_DIRECTORY; 1248 1259 else 1249 mode &= ~ aDIR;1260 mode &= ~FILE_ATTRIBUTE_DIRECTORY; 1250 1261 1251 1262 if (file_set_dosmode(conn, smb_fname, mode, NULL, … … 1382 1393 bool ask_sharemode = lp_parm_bool(SNUM(conn), "smbd", "search ask sharemode", true); 1383 1394 struct dptr_struct *dirptr = NULL; 1384 struct smbd_server_connection *sconn = smbd_server_conn;1395 struct smbd_server_connection *sconn = req->sconn; 1385 1396 1386 1397 START_PROFILE(SMBsearch); … … 1416 1427 p += 2; 1417 1428 1418 /* dirtype &= ~ aDIR; */1429 /* dirtype &= ~FILE_ATTRIBUTE_DIRECTORY; */ 1419 1430 1420 1431 if (status_len == 0) { … … 1456 1467 1457 1468 nt_status = dptr_create(conn, 1469 NULL, /* fsp */ 1458 1470 directory, 1459 1471 True, … … 1507 1519 dptr_init_search_op(dirptr); 1508 1520 1509 if ((dirtype&0x1F) == aVOLID) {1521 if ((dirtype&0x1F) == FILE_ATTRIBUTE_VOLUME) { 1510 1522 char buf[DIR_STRUCT_SIZE]; 1511 1523 memcpy(buf,status,21); 1512 1524 if (!make_dir_struct(ctx,buf,"???????????",volume_label(SNUM(conn)), 1513 0, aVOLID,0,!allow_long_path_components)) {1525 0,FILE_ATTRIBUTE_VOLUME,0,!allow_long_path_components)) { 1514 1526 reply_nterror(req, NT_STATUS_NO_MEMORY); 1515 1527 goto out; … … 1649 1661 bool path_contains_wcard = False; 1650 1662 TALLOC_CTX *ctx = talloc_tos(); 1651 struct smbd_server_connection *sconn = smbd_server_conn;1663 struct smbd_server_connection *sconn = req->sconn; 1652 1664 1653 1665 START_PROFILE(SMBfclose); … … 1714 1726 uint32 create_disposition; 1715 1727 uint32 create_options = 0; 1728 uint32_t private_flags = 0; 1716 1729 NTSTATUS status; 1717 1730 bool ask_sharemode = lp_parm_bool(SNUM(conn), "smbd", "search ask sharemode", true); … … 1757 1770 OPENX_FILE_EXISTS_OPEN, &access_mask, 1758 1771 &share_mode, &create_disposition, 1759 &create_options )) {1772 &create_options, &private_flags)) { 1760 1773 reply_force_doserror(req, ERRDOS, ERRbadaccess); 1761 1774 goto out; … … 1774 1787 oplock_request, /* oplock_request */ 1775 1788 0, /* allocation_size */ 1789 private_flags, 1776 1790 NULL, /* sd */ 1777 1791 NULL, /* ea_list */ … … 1797 1811 1798 1812 ZERO_STRUCT(write_time_ts); 1799 get_file_infos(fsp->file_id, NULL, &write_time_ts);1813 get_file_infos(fsp->file_id, 0, NULL, &write_time_ts); 1800 1814 if (!null_timespec(write_time_ts)) { 1801 1815 update_stat_ex_mtime(&smb_fname->st, write_time_ts); … … 1805 1819 mtime = convert_timespec_to_time_t(smb_fname->st.st_ex_mtime); 1806 1820 1807 if (fattr & aDIR) {1821 if (fattr & FILE_ATTRIBUTE_DIRECTORY) { 1808 1822 DEBUG(3,("attempt to open a directory %s\n", 1809 1823 fsp_str_dbg(fsp))); … … 1873 1887 uint32 create_disposition; 1874 1888 uint32 create_options = 0; 1889 uint32_t private_flags = 0; 1875 1890 TALLOC_CTX *ctx = talloc_tos(); 1876 1891 … … 1930 1945 &access_mask, &share_mode, 1931 1946 &create_disposition, 1932 &create_options)) { 1947 &create_options, 1948 &private_flags)) { 1933 1949 reply_force_doserror(req, ERRDOS, ERRbadaccess); 1934 1950 goto out; … … 1947 1963 oplock_request, /* oplock_request */ 1948 1964 0, /* allocation_size */ 1965 private_flags, 1949 1966 NULL, /* sd */ 1950 1967 NULL, /* ea_list */ … … 1976 1993 goto out; 1977 1994 } 1978 smb_fname->st.st_ex_size = 1979 SMB_VFS_GET_ALLOC_SIZE(conn, fsp, &smb_fname->st); 1980 } 1981 1982 fattr = dos_mode(conn, smb_fname); 1983 mtime = convert_timespec_to_time_t(smb_fname->st.st_ex_mtime); 1984 if (fattr & aDIR) { 1995 status = vfs_stat_fsp(fsp); 1996 if (!NT_STATUS_IS_OK(status)) { 1997 close_file(req, fsp, ERROR_CLOSE); 1998 reply_nterror(req, status); 1999 goto out; 2000 } 2001 } 2002 2003 fattr = dos_mode(conn, fsp->fsp_name); 2004 mtime = convert_timespec_to_time_t(fsp->fsp_name->st.st_ex_mtime); 2005 if (fattr & FILE_ATTRIBUTE_DIRECTORY) { 1985 2006 close_file(req, fsp, ERROR_CLOSE); 1986 2007 reply_nterror(req, NT_STATUS_ACCESS_DENIED); … … 2029 2050 srv_put_dos_date3((char *)req->outbuf,smb_vwv4,mtime); 2030 2051 } 2031 SIVAL(req->outbuf,smb_vwv6,(uint32) smb_fname->st.st_ex_size);2052 SIVAL(req->outbuf,smb_vwv6,(uint32)fsp->fsp_name->st.st_ex_size); 2032 2053 SSVAL(req->outbuf,smb_vwv8,GET_OPENX_MODE(deny_mode)); 2033 2054 SSVAL(req->outbuf,smb_vwv11,smb_action); 2034 2055 2035 2056 if (open_flags & EXTENDED_RESPONSE_REQUIRED) { 2036 SIVAL(req->outbuf, smb_vwv15, S TD_RIGHT_ALL_ACCESS);2057 SIVAL(req->outbuf, smb_vwv15, SEC_STD_ALL); 2037 2058 } 2038 2059 … … 2050 2071 void reply_ulogoffX(struct smb_request *req) 2051 2072 { 2052 struct smbd_server_connection *sconn = smbd_server_conn;2073 struct smbd_server_connection *sconn = req->sconn; 2053 2074 user_struct *vuser; 2054 2075 … … 2065 2086 open by this user */ 2066 2087 if ((vuser != NULL) && (lp_security() != SEC_SHARE)) { 2067 file_close_user( req->vuid);2088 file_close_user(sconn, req->vuid); 2068 2089 } 2069 2090 … … 2138 2159 } 2139 2160 2140 if (fattr & aVOLID) {2161 if (fattr & FILE_ATTRIBUTE_VOLUME) { 2141 2162 DEBUG(0,("Attempt to create file (%s) with volid set - " 2142 2163 "please report this\n", … … 2164 2185 oplock_request, /* oplock_request */ 2165 2186 0, /* allocation_size */ 2187 0, /* private_flags */ 2166 2188 NULL, /* sd */ 2167 2189 NULL, /* ea_list */ … … 2292 2314 oplock_request, /* oplock_request */ 2293 2315 0, /* allocation_size */ 2316 0, /* private_flags */ 2294 2317 NULL, /* sd */ 2295 2318 NULL, /* ea_list */ … … 2357 2380 uint16 dirtype) 2358 2381 { 2359 uint32 fmode;2360 2361 2382 if (!CAN_WRITE(conn)) { 2362 2383 return NT_STATUS_MEDIA_WRITE_PROTECTED; 2363 2384 } 2364 2385 2365 fmode = dos_mode(conn, fsp->fsp_name); 2366 if ((fmode & ~dirtype) & (aHIDDEN | aSYSTEM)) { 2367 return NT_STATUS_NO_SUCH_FILE; 2386 if ((dirtype & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) != 2387 (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) { 2388 /* Only bother to read the DOS attribute if we might deny the 2389 rename on the grounds of attribute missmatch. */ 2390 uint32_t fmode = dos_mode(conn, fsp->fsp_name); 2391 if ((fmode & ~dirtype) & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) { 2392 return NT_STATUS_NO_SUCH_FILE; 2393 } 2368 2394 } 2369 2395 … … 2425 2451 2426 2452 if (dirtype & FILE_ATTRIBUTE_NORMAL) { 2427 dirtype = aDIR|aARCH|aRONLY;2428 } 2429 2430 dirtype &= ( aDIR|aARCH|aRONLY|aHIDDEN|aSYSTEM);2453 dirtype = FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_READONLY; 2454 } 2455 2456 dirtype &= (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM); 2431 2457 if (!dirtype) { 2432 2458 return NT_STATUS_NO_SUCH_FILE; … … 2434 2460 2435 2461 if (!dir_check_ftype(conn, fattr, dirtype)) { 2436 if (fattr & aDIR) {2462 if (fattr & FILE_ATTRIBUTE_DIRECTORY) { 2437 2463 return NT_STATUS_FILE_IS_A_DIRECTORY; 2438 2464 } … … 2465 2491 2466 2492 /* Can't delete a directory. */ 2467 if (fattr & aDIR) {2493 if (fattr & FILE_ATTRIBUTE_DIRECTORY) { 2468 2494 return NT_STATUS_FILE_IS_A_DIRECTORY; 2469 2495 } … … 2471 2497 2472 2498 #if 0 /* JRATEST */ 2473 else if (dirtype & aDIR) /* Asked for a directory and it isn't. */2499 else if (dirtype & FILE_ATTRIBUTE_DIRECTORY) /* Asked for a directory and it isn't. */ 2474 2500 return NT_STATUS_OBJECT_NAME_INVALID; 2475 2501 #endif /* JRATEST */ … … 2492 2518 0, /* oplock_request */ 2493 2519 0, /* allocation_size */ 2520 0, /* private_flags */ 2494 2521 NULL, /* sd */ 2495 2522 NULL, /* ea_list */ … … 2514 2541 2515 2542 /* The set is across all open files on this dev/inode pair. */ 2516 if (!set_delete_on_close(fsp, True, &conn->se rver_info->utok)) {2543 if (!set_delete_on_close(fsp, True, &conn->session_info->utok)) { 2517 2544 close_file(req, fsp, NORMAL_CLOSE); 2518 2545 return NT_STATUS_ACCESS_DENIED; … … 2571 2598 */ 2572 2599 TALLOC_FREE(smb_fname->base_name); 2573 smb_fname->base_name = talloc_asprintf(smb_fname, 2574 "%s/%s", 2575 fname_dir, 2576 fname_mask); 2600 if (ISDOT(fname_dir)) { 2601 /* Ensure we use canonical names on open. */ 2602 smb_fname->base_name = talloc_asprintf(smb_fname, 2603 "%s", 2604 fname_mask); 2605 } else { 2606 smb_fname->base_name = talloc_asprintf(smb_fname, 2607 "%s/%s", 2608 fname_dir, 2609 fname_mask); 2610 } 2577 2611 if (!smb_fname->base_name) { 2578 2612 status = NT_STATUS_NO_MEMORY; … … 2600 2634 char *talloced = NULL; 2601 2635 2602 if ((dirtype & SAMBA_ATTRIBUTES_MASK) == aDIR) {2636 if ((dirtype & SAMBA_ATTRIBUTES_MASK) == FILE_ATTRIBUTE_DIRECTORY) { 2603 2637 status = NT_STATUS_OBJECT_NAME_INVALID; 2604 2638 goto out; … … 2659 2693 2660 2694 TALLOC_FREE(smb_fname->base_name); 2661 smb_fname->base_name = 2662 talloc_asprintf(smb_fname, "%s/%s", 2663 fname_dir, dname); 2695 if (ISDOT(fname_dir)) { 2696 /* Ensure we use canonical names on open. */ 2697 smb_fname->base_name = 2698 talloc_asprintf(smb_fname, "%s", 2699 dname); 2700 } else { 2701 smb_fname->base_name = 2702 talloc_asprintf(smb_fname, "%s/%s", 2703 fname_dir, dname); 2704 } 2664 2705 2665 2706 if (!smb_fname->base_name) { … … 2792 2833 ****************************************************************************/ 2793 2834 2794 static ssize_t fake_sendfile(files_struct *fsp, SMB_OFF_T startpos, 2795 size_t nread) 2835 ssize_t fake_sendfile(files_struct *fsp, SMB_OFF_T startpos, size_t nread) 2796 2836 { 2797 2837 size_t bufsize; … … 2829 2869 } 2830 2870 2831 if (write_data(smbd_server_fd(),buf,cur_read) != cur_read) { 2871 if (write_data(fsp->conn->sconn->sock, buf, cur_read) 2872 != cur_read) { 2873 char addr[INET6_ADDRSTRLEN]; 2874 /* 2875 * Try and give an error message saying what 2876 * client failed. 2877 */ 2878 DEBUG(0, ("write_data failed for client %s. " 2879 "Error %s\n", 2880 get_peer_addr(fsp->conn->sconn->sock, addr, 2881 sizeof(addr)), 2882 strerror(errno))); 2832 2883 SAFE_FREE(buf); 2833 2884 return -1; … … 2841 2892 } 2842 2893 2843 #if defined(WITH_SENDFILE)2844 2894 /**************************************************************************** 2845 2895 Deal with the case of sendfile reading less bytes from the file than … … 2847 2897 ****************************************************************************/ 2848 2898 2849 staticvoid sendfile_short_send(files_struct *fsp,2899 void sendfile_short_send(files_struct *fsp, 2850 2900 ssize_t nread, 2851 2901 size_t headersize, … … 2890 2940 2891 2941 to_write = MIN(SHORT_SEND_BUFSIZE, smb_maxcnt - nread); 2892 if (write_data(smbd_server_fd(), buf, to_write) != to_write) { 2942 if (write_data(fsp->conn->sconn->sock, buf, to_write) 2943 != to_write) { 2944 char addr[INET6_ADDRSTRLEN]; 2945 /* 2946 * Try and give an error message saying what 2947 * client failed. 2948 */ 2949 DEBUG(0, ("write_data failed for client %s. " 2950 "Error %s\n", 2951 get_peer_addr( 2952 fsp->conn->sconn->sock, addr, 2953 sizeof(addr)), 2954 strerror(errno))); 2893 2955 exit_server_cleanly("sendfile_short_send: " 2894 "write_data failed");2956 "write_data failed"); 2895 2957 } 2896 2958 nread += to_write; … … 2899 2961 } 2900 2962 } 2901 #endif /* defined WITH_SENDFILE */2902 2963 2903 2964 /**************************************************************************** … … 2905 2966 ****************************************************************************/ 2906 2967 2907 static void reply_readbraw_error( void)2968 static void reply_readbraw_error(struct smbd_server_connection *sconn) 2908 2969 { 2909 2970 char header[4]; 2971 2910 2972 SIVAL(header,0,0); 2911 if (write_data(smbd_server_fd(),header,4) != 4) { 2973 2974 smbd_lock_socket(sconn); 2975 if (write_data(sconn->sock,header,4) != 4) { 2976 char addr[INET6_ADDRSTRLEN]; 2977 /* 2978 * Try and give an error message saying what 2979 * client failed. 2980 */ 2981 DEBUG(0, ("write_data failed for client %s. " 2982 "Error %s\n", 2983 get_peer_addr(sconn->sock, addr, sizeof(addr)), 2984 strerror(errno))); 2985 2912 2986 fail_readraw(); 2913 2987 } 2988 smbd_unlock_socket(sconn); 2914 2989 } 2915 2990 … … 2925 3000 ssize_t mincount) 2926 3001 { 3002 struct smbd_server_connection *sconn = req->sconn; 2927 3003 char *outbuf = NULL; 2928 3004 ssize_t ret=0; 2929 3005 2930 #if defined(WITH_SENDFILE)2931 3006 /* 2932 3007 * We can only use sendfile on a non-chained packet … … 2938 3013 if ( !req_is_in_chain(req) && (nread > 0) && (fsp->base_fsp == NULL) && 2939 3014 (fsp->wcp == NULL) && 2940 lp_use_sendfile(SNUM(conn), smbd_server_conn->smb1.signing_state) ) {3015 lp_use_sendfile(SNUM(conn), req->sconn->smb1.signing_state) ) { 2941 3016 ssize_t sendfile_read = -1; 2942 3017 char header[4]; … … 2946 3021 header_blob = data_blob_const(header, 4); 2947 3022 2948 if ((sendfile_read = SMB_VFS_SENDFILE(smbd_server_fd(), fsp, 2949 &header_blob, startpos, nread)) == -1) { 3023 sendfile_read = SMB_VFS_SENDFILE(sconn->sock, fsp, 3024 &header_blob, startpos, 3025 nread); 3026 if (sendfile_read == -1) { 2950 3027 /* Returning ENOSYS means no data at all was sent. 2951 3028 * Do this as a normal read. */ … … 3001 3078 3002 3079 normal_readbraw: 3003 #endif3004 3080 3005 3081 outbuf = TALLOC_ARRAY(NULL, char, nread+4); … … 3007 3083 DEBUG(0,("send_file_readbraw: TALLOC_ARRAY failed for size %u.\n", 3008 3084 (unsigned)(nread+4))); 3009 reply_readbraw_error( );3085 reply_readbraw_error(sconn); 3010 3086 return; 3011 3087 } … … 3023 3099 3024 3100 _smb_setlen(outbuf,ret); 3025 if (write_data(smbd_server_fd(),outbuf,4+ret) != 4+ret) 3101 if (write_data(sconn->sock, outbuf, 4+ret) != 4+ret) { 3102 char addr[INET6_ADDRSTRLEN]; 3103 /* 3104 * Try and give an error message saying what 3105 * client failed. 3106 */ 3107 DEBUG(0, ("write_data failed for client %s. " 3108 "Error %s\n", 3109 get_peer_addr(fsp->conn->sconn->sock, addr, 3110 sizeof(addr)), 3111 strerror(errno))); 3112 3026 3113 fail_readraw(); 3114 } 3027 3115 3028 3116 TALLOC_FREE(outbuf); … … 3036 3124 { 3037 3125 connection_struct *conn = req->conn; 3126 struct smbd_server_connection *sconn = req->sconn; 3038 3127 ssize_t maxcount,mincount; 3039 3128 size_t nread = 0; … … 3045 3134 START_PROFILE(SMBreadbraw); 3046 3135 3047 if (srv_is_signing_active(s mbd_server_conn) ||3136 if (srv_is_signing_active(sconn) || 3048 3137 is_encrypted_packet(req->inbuf)) { 3049 3138 exit_server_cleanly("reply_readbraw: SMB signing/sealing is active - " … … 3052 3141 3053 3142 if (req->wct < 8) { 3054 reply_readbraw_error(); 3143 reply_readbraw_error(sconn); 3144 END_PROFILE(SMBreadbraw); 3145 return; 3146 } 3147 3148 if (sconn->smb1.echo_handler.trusted_fde) { 3149 DEBUG(2,("SMBreadbraw rejected with NOT_SUPPORTED because of " 3150 "'async smb echo handler = yes'\n")); 3151 reply_readbraw_error(sconn); 3055 3152 END_PROFILE(SMBreadbraw); 3056 3153 return; … … 3080 3177 "- cache prime?\n", 3081 3178 (int)SVAL(req->vwv+0, 0))); 3082 reply_readbraw_error( );3179 reply_readbraw_error(sconn); 3083 3180 END_PROFILE(SMBreadbraw); 3084 3181 return; … … 3091 3188 DEBUG(3,("reply_readbraw: fnum %d not readable.\n", 3092 3189 (int)SVAL(req->vwv+0, 0))); 3093 reply_readbraw_error( );3190 reply_readbraw_error(sconn); 3094 3191 END_PROFILE(SMBreadbraw); 3095 3192 return; … … 3118 3215 "64 bit offsets.\n", 3119 3216 (unsigned int)IVAL(req->vwv+8, 0) )); 3120 reply_readbraw_error( );3217 reply_readbraw_error(sconn); 3121 3218 END_PROFILE(SMBreadbraw); 3122 3219 return; … … 3129 3226 "readraw offset (%.0f) !\n", 3130 3227 (double)startpos )); 3131 reply_readbraw_error( );3228 reply_readbraw_error(sconn); 3132 3229 END_PROFILE(SMBreadbraw); 3133 3230 return; … … 3141 3238 maxcount = MIN(65535,maxcount); 3142 3239 3143 init_strict_lock_struct(fsp, (uint 32)req->smbpid,3240 init_strict_lock_struct(fsp, (uint64_t)req->smbpid, 3144 3241 (uint64_t)startpos, (uint64_t)maxcount, READ_LOCK, 3145 3242 &lock); 3146 3243 3147 3244 if (!SMB_VFS_STRICT_LOCK(conn, fsp, &lock)) { 3148 reply_readbraw_error( );3245 reply_readbraw_error(sconn); 3149 3246 END_PROFILE(SMBreadbraw); 3150 3247 return; … … 3201 3298 struct byte_range_lock *br_lck = NULL; 3202 3299 char *p = NULL; 3203 struct smbd_server_connection *sconn = smbd_server_conn;3300 struct smbd_server_connection *sconn = req->sconn; 3204 3301 3205 3302 START_PROFILE(SMBlockread); … … 3241 3338 */ 3242 3339 3243 br_lck = do_lock( smbd_messaging_context(),3340 br_lck = do_lock(req->sconn->msg_ctx, 3244 3341 fsp, 3245 req->smbpid,3342 (uint64_t)req->smbpid, 3246 3343 (uint64_t)numtoread, 3247 3344 (uint64_t)startpos, … … 3311 3408 files_struct *fsp; 3312 3409 struct lock_struct lock; 3313 struct smbd_server_connection *sconn = smbd_server_conn;3410 struct smbd_server_connection *sconn = req->sconn; 3314 3411 3315 3412 START_PROFILE(SMBread); … … 3354 3451 data = smb_buf(req->outbuf) + 3; 3355 3452 3356 init_strict_lock_struct(fsp, (uint 32)req->smbpid,3453 init_strict_lock_struct(fsp, (uint64_t)req->smbpid, 3357 3454 (uint64_t)startpos, (uint64_t)numtoread, READ_LOCK, 3358 3455 &lock); … … 3436 3533 } 3437 3534 3438 init_strict_lock_struct(fsp, (uint 32)req->smbpid,3535 init_strict_lock_struct(fsp, (uint64_t)req->smbpid, 3439 3536 (uint64_t)startpos, (uint64_t)smb_maxcnt, READ_LOCK, 3440 3537 &lock); … … 3455 3552 } 3456 3553 3457 #if defined(WITH_SENDFILE)3458 3554 /* 3459 3555 * We can only use sendfile on a non-chained packet … … 3465 3561 !is_encrypted_packet(req->inbuf) && (fsp->base_fsp == NULL) && 3466 3562 (fsp->wcp == NULL) && 3467 lp_use_sendfile(SNUM(conn), smbd_server_conn->smb1.signing_state) ) {3563 lp_use_sendfile(SNUM(conn), req->sconn->smb1.signing_state) ) { 3468 3564 uint8 headerbuf[smb_size + 12 * 2]; 3469 3565 DATA_BLOB header; … … 3480 3576 setup_readX_header(req, (char *)headerbuf, smb_maxcnt); 3481 3577 3482 if ((nread = SMB_VFS_SENDFILE(smbd_server_fd(), fsp, &header, startpos, smb_maxcnt)) == -1) { 3578 nread = SMB_VFS_SENDFILE(req->sconn->sock, fsp, &header, 3579 startpos, smb_maxcnt); 3580 if (nread == -1) { 3483 3581 /* Returning ENOSYS means no data at all was sent. 3484 3582 Do this as a normal read. */ … … 3546 3644 normal_read: 3547 3645 3548 #endif3549 3550 3646 if ((smb_maxcnt & 0xFF0000) > 0x10000) { 3551 3647 uint8 headerbuf[smb_size + 2*12]; … … 3555 3651 3556 3652 /* Send out the header. */ 3557 if (write_data( smbd_server_fd(), (char *)headerbuf,3653 if (write_data(req->sconn->sock, (char *)headerbuf, 3558 3654 sizeof(headerbuf)) != sizeof(headerbuf)) { 3655 3656 char addr[INET6_ADDRSTRLEN]; 3657 /* 3658 * Try and give an error message saying what 3659 * client failed. 3660 */ 3661 DEBUG(0, ("write_data failed for client %s. " 3662 "Error %s\n", 3663 get_peer_addr(req->sconn->sock, addr, 3664 sizeof(addr)), 3665 strerror(errno))); 3666 3559 3667 DEBUG(0,("send_file_readX: write_data failed for file " 3560 3668 "%s (%s). Terminating\n", fsp_str_dbg(fsp), … … 3655 3763 } 3656 3764 /* We currently don't do this on signed or sealed data. */ 3657 if (srv_is_signing_active( smbd_server_conn) ||3765 if (srv_is_signing_active(req->sconn) || 3658 3766 is_encrypted_packet(req->inbuf)) { 3659 3767 reply_nterror(req, NT_STATUS_NOT_SUPPORTED); … … 3698 3806 } 3699 3807 3700 if (!big_readX && 3701 schedule_aio_read_and_X(conn, req, fsp, startpos, smb_maxcnt)) { 3702 goto out; 3703 } 3704 3808 if (!big_readX) { 3809 NTSTATUS status = schedule_aio_read_and_X(conn, 3810 req, 3811 fsp, 3812 startpos, 3813 smb_maxcnt); 3814 if (NT_STATUS_IS_OK(status)) { 3815 /* Read scheduled - we're done. */ 3816 goto out; 3817 } 3818 if (!NT_STATUS_EQUAL(status, NT_STATUS_RETRY)) { 3819 /* Real error - report to client. */ 3820 END_PROFILE(SMBreadX); 3821 reply_nterror(req, status); 3822 return; 3823 } 3824 /* NT_STATUS_RETRY - fall back to sync read. */ 3825 } 3826 3827 smbd_lock_socket(req->sconn); 3705 3828 send_file_readX(conn, req, fsp, startpos, smb_maxcnt); 3829 smbd_unlock_socket(req->sconn); 3706 3830 3707 3831 out: … … 3722 3846 memcpy(req->outbuf, old_outbuf, smb_size); 3723 3847 TALLOC_FREE(old_outbuf); 3848 } 3849 3850 /**************************************************************************** 3851 Read 4 bytes of a smb packet and return the smb length of the packet. 3852 Store the result in the buffer. This version of the function will 3853 never return a session keepalive (length of zero). 3854 Timeout is in milliseconds. 3855 ****************************************************************************/ 3856 3857 static NTSTATUS read_smb_length(int fd, char *inbuf, unsigned int timeout, 3858 size_t *len) 3859 { 3860 uint8_t msgtype = SMBkeepalive; 3861 3862 while (msgtype == SMBkeepalive) { 3863 NTSTATUS status; 3864 3865 status = read_smb_length_return_keepalive(fd, inbuf, timeout, 3866 len); 3867 if (!NT_STATUS_IS_OK(status)) { 3868 char addr[INET6_ADDRSTRLEN]; 3869 /* Try and give an error message 3870 * saying what client failed. */ 3871 DEBUG(0, ("read_fd_with_timeout failed for " 3872 "client %s read error = %s.\n", 3873 get_peer_addr(fd,addr,sizeof(addr)), 3874 nt_errstr(status))); 3875 return status; 3876 } 3877 3878 msgtype = CVAL(inbuf, 0); 3879 } 3880 3881 DEBUG(10,("read_smb_length: got smb length of %lu\n", 3882 (unsigned long)len)); 3883 3884 return NT_STATUS_OK; 3724 3885 } 3725 3886 … … 3752 3913 SCVAL(req->inbuf,smb_com,SMBwritec); 3753 3914 3754 if (srv_is_signing_active( smbd_server_conn)) {3915 if (srv_is_signing_active(req->sconn)) { 3755 3916 END_PROFILE(SMBwritebraw); 3756 3917 exit_server_cleanly("reply_writebraw: SMB signing is active - " … … 3760 3921 if (req->wct < 12) { 3761 3922 reply_nterror(req, NT_STATUS_INVALID_PARAMETER); 3923 error_to_writebrawerr(req); 3924 END_PROFILE(SMBwritebraw); 3925 return; 3926 } 3927 3928 if (req->sconn->smb1.echo_handler.trusted_fde) { 3929 DEBUG(2,("SMBwritebraw rejected with NOT_SUPPORTED because of " 3930 "'async smb echo handler = yes'\n")); 3931 reply_nterror(req, NT_STATUS_NOT_SUPPORTED); 3762 3932 error_to_writebrawerr(req); 3763 3933 END_PROFILE(SMBwritebraw); … … 3802 3972 } 3803 3973 3804 init_strict_lock_struct(fsp, (uint32)req->smbpid, 3805 (uint64_t)startpos, (uint64_t)tcount, WRITE_LOCK, 3806 &lock); 3807 3808 if (!SMB_VFS_STRICT_LOCK(conn, fsp, &lock)) { 3809 reply_nterror(req, NT_STATUS_FILE_LOCK_CONFLICT); 3810 error_to_writebrawerr(req); 3811 END_PROFILE(SMBwritebraw); 3812 return; 3974 if (!fsp->print_file) { 3975 init_strict_lock_struct(fsp, (uint64_t)req->smbpid, 3976 (uint64_t)startpos, (uint64_t)tcount, WRITE_LOCK, 3977 &lock); 3978 3979 if (!SMB_VFS_STRICT_LOCK(conn, fsp, &lock)) { 3980 reply_nterror(req, NT_STATUS_FILE_LOCK_CONFLICT); 3981 error_to_writebrawerr(req); 3982 END_PROFILE(SMBwritebraw); 3983 return; 3984 } 3813 3985 } 3814 3986 … … 3846 4018 SSVALS(buf,smb_vwv0,0xFFFF); 3847 4019 show_msg(buf); 3848 if (!srv_send_smb( smbd_server_fd(),4020 if (!srv_send_smb(req->sconn, 3849 4021 buf, 3850 4022 false, 0, /* no signing */ … … 3856 4028 3857 4029 /* Now read the raw data into the buffer and write it */ 3858 status = read_smb_length( smbd_server_fd(), buf, SMB_SECONDARY_WAIT,4030 status = read_smb_length(req->sconn->sock, buf, SMB_SECONDARY_WAIT, 3859 4031 &numtowrite); 3860 4032 if (!NT_STATUS_IS_OK(status)) { … … 3880 4052 } 3881 4053 3882 status = read_data( smbd_server_fd(), buf+4, numtowrite);4054 status = read_data(req->sconn->sock, buf+4, numtowrite); 3883 4055 3884 4056 if (!NT_STATUS_IS_OK(status)) { 3885 DEBUG(0,("reply_writebraw: Oversize secondary write " 3886 "raw read failed (%s). Terminating\n", 3887 nt_errstr(status))); 4057 char addr[INET6_ADDRSTRLEN]; 4058 /* Try and give an error message 4059 * saying what client failed. */ 4060 DEBUG(0, ("reply_writebraw: Oversize secondary write " 4061 "raw read failed (%s) for client %s. " 4062 "Terminating\n", nt_errstr(status), 4063 get_peer_addr(req->sconn->sock, addr, 4064 sizeof(addr)))); 3888 4065 exit_server_cleanly("secondary writebraw failed"); 3889 4066 } … … 3924 4101 (int)total_written)); 3925 4102 3926 SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); 4103 if (!fsp->print_file) { 4104 SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); 4105 } 3927 4106 3928 4107 /* We won't return a status if write through is not selected - this … … 3938 4117 * JRA. 3939 4118 */ 3940 if (!send_keepalive( smbd_server_fd())) {4119 if (!send_keepalive(req->sconn->sock)) { 3941 4120 exit_server_cleanly("reply_writebraw: send of " 3942 4121 "keepalive failed"); … … 3948 4127 3949 4128 strict_unlock: 3950 SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); 4129 if (!fsp->print_file) { 4130 SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); 4131 } 3951 4132 3952 4133 END_PROFILE(SMBwritebraw); … … 3998 4179 data = (const char *)req->buf + 3; 3999 4180 4000 if ( numtowrite) {4001 init_strict_lock_struct(fsp, (uint 32)req->smbpid,4181 if (!fsp->print_file && numtowrite > 0) { 4182 init_strict_lock_struct(fsp, (uint64_t)req->smbpid, 4002 4183 (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK, 4003 4184 &lock); … … 4038 4219 } 4039 4220 4040 if (numtowrite ) {4041 status = do_unlock( smbd_messaging_context(),4221 if (numtowrite && !fsp->print_file) { 4222 status = do_unlock(req->sconn->msg_ctx, 4042 4223 fsp, 4043 req->smbpid,4224 (uint64_t)req->smbpid, 4044 4225 (uint64_t)numtowrite, 4045 4226 (uint64_t)startpos, … … 4060 4241 4061 4242 strict_unlock: 4062 if (numtowrite ) {4243 if (numtowrite && !fsp->print_file) { 4063 4244 SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); 4064 4245 } … … 4119 4300 data = (const char *)req->buf + 3; 4120 4301 4121 init_strict_lock_struct(fsp, (uint32)req->smbpid, 4122 (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK, 4123 &lock); 4124 4125 if (!SMB_VFS_STRICT_LOCK(conn, fsp, &lock)) { 4126 reply_nterror(req, NT_STATUS_FILE_LOCK_CONFLICT); 4127 END_PROFILE(SMBwrite); 4128 return; 4302 if (!fsp->print_file) { 4303 init_strict_lock_struct(fsp, (uint64_t)req->smbpid, 4304 (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK, 4305 &lock); 4306 4307 if (!SMB_VFS_STRICT_LOCK(conn, fsp, &lock)) { 4308 reply_nterror(req, NT_STATUS_FILE_LOCK_CONFLICT); 4309 END_PROFILE(SMBwrite); 4310 return; 4311 } 4129 4312 } 4130 4313 … … 4184 4367 4185 4368 strict_unlock: 4186 SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); 4369 if (!fsp->print_file) { 4370 SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); 4371 } 4187 4372 4188 4373 END_PROFILE(SMBwrite); … … 4198 4383 1 /* pad byte */) 4199 4384 4200 bool is_valid_writeX_buffer(const uint8_t *inbuf) 4385 bool is_valid_writeX_buffer(struct smbd_server_connection *sconn, 4386 const uint8_t *inbuf) 4201 4387 { 4202 4388 size_t numtowrite; … … 4204 4390 unsigned int doff = 0; 4205 4391 size_t len = smb_len_large(inbuf); 4206 struct smbd_server_connection *sconn = smbd_server_conn;4207 4392 4208 4393 if (is_encrypted_packet(inbuf)) { … … 4293 4478 char *data; 4294 4479 NTSTATUS status; 4480 int saved_errno = 0; 4295 4481 4296 4482 START_PROFILE(SMBwriteX); … … 4387 4573 } 4388 4574 4389 init_strict_lock_struct(fsp, (uint32)req->smbpid,4390 (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,4391 &lock);4392 4393 if (!SMB_VFS_STRICT_LOCK(conn, fsp, &lock)) {4394 reply_nterror(req, NT_STATUS_FILE_LOCK_CONFLICT);4395 END_PROFILE(SMBwriteX);4396 return;4397 }4398 4399 4575 /* X/Open SMB protocol says that, unlike SMBwrite 4400 4576 if the length is zero then NO truncation is … … 4405 4581 nwritten = 0; 4406 4582 } else { 4407 4408 if ((req->unread_bytes == 0) && 4409 schedule_aio_write_and_X(conn, req, fsp, data, startpos, 4410 numtowrite)) { 4411 goto strict_unlock; 4583 if (req->unread_bytes == 0) { 4584 status = schedule_aio_write_and_X(conn, 4585 req, 4586 fsp, 4587 data, 4588 startpos, 4589 numtowrite); 4590 4591 if (NT_STATUS_IS_OK(status)) { 4592 /* write scheduled - we're done. */ 4593 goto out; 4594 } 4595 if (!NT_STATUS_EQUAL(status, NT_STATUS_RETRY)) { 4596 /* Real error - report to client. */ 4597 reply_nterror(req, status); 4598 goto out; 4599 } 4600 /* NT_STATUS_RETRY - fall through to sync write. */ 4601 } 4602 4603 init_strict_lock_struct(fsp, (uint64_t)req->smbpid, 4604 (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK, 4605 &lock); 4606 4607 if (!SMB_VFS_STRICT_LOCK(conn, fsp, &lock)) { 4608 reply_nterror(req, NT_STATUS_FILE_LOCK_CONFLICT); 4609 goto out; 4412 4610 } 4413 4611 4414 4612 nwritten = write_file(req,fsp,data,startpos,numtowrite); 4613 saved_errno = errno; 4614 4615 SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); 4415 4616 } 4416 4617 4417 4618 if(nwritten < 0) { 4418 reply_nterror(req, map_nt_error_from_unix( errno));4419 goto strict_unlock;4619 reply_nterror(req, map_nt_error_from_unix(saved_errno)); 4620 goto out; 4420 4621 } 4421 4622 4422 4623 if((nwritten == 0) && (numtowrite != 0)) { 4423 4624 reply_nterror(req, NT_STATUS_DISK_FULL); 4424 goto strict_unlock;4625 goto out; 4425 4626 } 4426 4627 … … 4442 4643 fsp_str_dbg(fsp), nt_errstr(status))); 4443 4644 reply_nterror(req, status); 4444 goto strict_unlock; 4445 } 4446 4447 SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); 4645 goto out; 4646 } 4448 4647 4449 4648 END_PROFILE(SMBwriteX); … … 4451 4650 return; 4452 4651 4453 strict_unlock: 4454 SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); 4455 4652 out: 4456 4653 END_PROFILE(SMBwriteX); 4457 4654 return; … … 4598 4795 START_PROFILE(SMBexit); 4599 4796 4600 file_close_pid(req->s mbpid, req->vuid);4797 file_close_pid(req->sconn, req->smbpid, req->vuid); 4601 4798 4602 4799 reply_outbuf(req, 0, 0); … … 4631 4828 */ 4632 4829 4633 if (!fsp || (fsp->conn != conn) || (fsp->vuid != req->vuid)) {4830 if (!check_fsp_open(conn, req, fsp)) { 4634 4831 reply_nterror(req, NT_STATUS_INVALID_HANDLE); 4635 4832 END_PROFILE(SMBclose); … … 4721 4918 data = (const char *)req->buf + 1; 4722 4919 4723 if ( numtowrite) {4724 init_strict_lock_struct(fsp, (uint 32)req->smbpid,4920 if (!fsp->print_file) { 4921 init_strict_lock_struct(fsp, (uint64_t)req->smbpid, 4725 4922 (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK, 4726 4923 &lock); … … 4767 4964 4768 4965 strict_unlock: 4769 if (numtowrite ) {4966 if (numtowrite && !fsp->print_file) { 4770 4967 SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); 4771 4968 } … … 4811 5008 fsp->fh->fd, fsp->fnum, (double)offset, (double)count)); 4812 5009 4813 br_lck = do_lock( smbd_messaging_context(),5010 br_lck = do_lock(req->sconn->msg_ctx, 4814 5011 fsp, 4815 req->smbpid,5012 (uint64_t)req->smbpid, 4816 5013 count, 4817 5014 offset, … … 4866 5063 offset = (uint64_t)IVAL(req->vwv+3, 0); 4867 5064 4868 status = do_unlock( smbd_messaging_context(),5065 status = do_unlock(req->sconn->msg_ctx, 4869 5066 fsp, 4870 req->smbpid,5067 (uint64_t)req->smbpid, 4871 5068 count, 4872 5069 offset, … … 4968 5165 4969 5166 show_msg((char *)req->outbuf); 4970 if (!srv_send_smb( smbd_server_fd(),5167 if (!srv_send_smb(req->sconn, 4971 5168 (char *)req->outbuf, 4972 5169 true, req->seqnum+1, … … 5016 5213 5017 5214 /* Open for exclusive use, write only. */ 5018 status = print_ fsp_open(req, conn, NULL, req->vuid, fsp);5215 status = print_spool_open(fsp, NULL, req->vuid); 5019 5216 5020 5217 if (!NT_STATUS_IS_OK(status)) { … … 5124 5321 5125 5322 { 5126 print_queue_struct *queue = NULL; 5127 print_status_struct status; 5128 int count = print_queue_status(SNUM(conn), &queue, &status); 5129 int num_to_get = ABS(max_count); 5130 int first = (max_count>0?start_index:start_index+max_count+1); 5131 int i; 5132 5133 if (first >= count) 5134 num_to_get = 0; 5135 else 5136 num_to_get = MIN(num_to_get,count-first); 5137 5138 5139 for (i=first;i<first+num_to_get;i++) { 5323 TALLOC_CTX *mem_ctx = talloc_tos(); 5324 NTSTATUS status; 5325 WERROR werr; 5326 const char *sharename = lp_servicename(SNUM(conn)); 5327 struct rpc_pipe_client *cli = NULL; 5328 struct dcerpc_binding_handle *b = NULL; 5329 struct policy_handle handle; 5330 struct spoolss_DevmodeContainer devmode_ctr; 5331 union spoolss_JobInfo *info; 5332 uint32_t count; 5333 uint32_t num_to_get; 5334 uint32_t first; 5335 uint32_t i; 5336 5337 ZERO_STRUCT(handle); 5338 5339 status = rpc_pipe_open_interface(conn, 5340 &ndr_table_spoolss.syntax_id, 5341 conn->session_info, 5342 &conn->sconn->client_id, 5343 conn->sconn->msg_ctx, 5344 &cli); 5345 if (!NT_STATUS_IS_OK(status)) { 5346 DEBUG(0, ("reply_printqueue: " 5347 "could not connect to spoolss: %s\n", 5348 nt_errstr(status))); 5349 reply_nterror(req, status); 5350 goto out; 5351 } 5352 b = cli->binding_handle; 5353 5354 ZERO_STRUCT(devmode_ctr); 5355 5356 status = dcerpc_spoolss_OpenPrinter(b, mem_ctx, 5357 sharename, 5358 NULL, devmode_ctr, 5359 SEC_FLAG_MAXIMUM_ALLOWED, 5360 &handle, 5361 &werr); 5362 if (!NT_STATUS_IS_OK(status)) { 5363 reply_nterror(req, status); 5364 goto out; 5365 } 5366 if (!W_ERROR_IS_OK(werr)) { 5367 reply_nterror(req, werror_to_ntstatus(werr)); 5368 goto out; 5369 } 5370 5371 werr = rpccli_spoolss_enumjobs(cli, mem_ctx, 5372 &handle, 5373 0, /* firstjob */ 5374 0xff, /* numjobs */ 5375 2, /* level */ 5376 0, /* offered */ 5377 &count, 5378 &info); 5379 if (!W_ERROR_IS_OK(werr)) { 5380 reply_nterror(req, werror_to_ntstatus(werr)); 5381 goto out; 5382 } 5383 5384 if (max_count > 0) { 5385 first = start_index; 5386 } else { 5387 first = start_index + max_count + 1; 5388 } 5389 5390 if (first >= count) { 5391 num_to_get = first; 5392 } else { 5393 num_to_get = first + MIN(ABS(max_count), count - first); 5394 } 5395 5396 for (i = first; i < num_to_get; i++) { 5140 5397 char blob[28]; 5141 5398 char *p = blob; 5142 5143 srv_put_dos_date2(p,0,queue[i].time); 5144 SCVAL(p,4,(queue[i].status==LPQ_PRINTING?2:3)); 5145 SSVAL(p,5, queue[i].job); 5146 SIVAL(p,7,queue[i].size); 5147 SCVAL(p,11,0); 5399 time_t qtime = spoolss_Time_to_time_t(&info[i].info2.submitted); 5400 int qstatus; 5401 uint16_t qrapjobid = pjobid_to_rap(sharename, 5402 info[i].info2.job_id); 5403 5404 if (info[i].info2.status == JOB_STATUS_PRINTING) { 5405 qstatus = 2; 5406 } else { 5407 qstatus = 3; 5408 } 5409 5410 srv_put_dos_date2(p, 0, qtime); 5411 SCVAL(p, 4, qstatus); 5412 SSVAL(p, 5, qrapjobid); 5413 SIVAL(p, 7, info[i].info2.size); 5414 SCVAL(p, 11, 0); 5148 5415 srvstr_push(blob, req->flags2, p+12, 5149 queue[i].fs_user, 16, STR_ASCII);5416 info[i].info2.notify_name, 16, STR_ASCII); 5150 5417 5151 5418 if (message_push_blob( … … 5154 5421 blob, sizeof(blob))) == -1) { 5155 5422 reply_nterror(req, NT_STATUS_NO_MEMORY); 5156 END_PROFILE(SMBsplretq); 5157 return; 5423 goto out; 5158 5424 } 5159 5425 } … … 5167 5433 } 5168 5434 5169 SAFE_FREE(queue); 5170 5171 DEBUG(3,("%d entries returned in queue\n",count)); 5435 5436 DEBUG(3, ("%u entries returned in queue\n", 5437 (unsigned)count)); 5438 5439 out: 5440 if (b && is_valid_policy_hnd(&handle)) { 5441 dcerpc_spoolss_ClosePrinter(b, mem_ctx, &handle, &werr); 5442 } 5443 5172 5444 } 5173 5445 … … 5202 5474 } 5203 5475 5204 if (! CAN_PRINT(conn)) {5476 if (!fsp->print_file) { 5205 5477 reply_nterror(req, NT_STATUS_ACCESS_DENIED); 5206 5478 END_PROFILE(SMBsplwr); … … 5224 5496 data = (const char *)req->buf + 3; 5225 5497 5226 if (write_file(req,fsp,data, -1,numtowrite) != numtowrite) {5498 if (write_file(req,fsp,data,(SMB_OFF_T)-1,numtowrite) != numtowrite) { 5227 5499 reply_nterror(req, map_nt_error_from_unix(errno)); 5228 5500 END_PROFILE(SMBsplwr); … … 5316 5588 files_struct *fsp = NULL; 5317 5589 int info = 0; 5318 struct smbd_server_connection *sconn = smbd_server_conn;5590 struct smbd_server_connection *sconn = req->sconn; 5319 5591 5320 5592 START_PROFILE(SMBrmdir); … … 5361 5633 0, /* oplock_request */ 5362 5634 0, /* allocation_size */ 5635 0, /* private_flags */ 5363 5636 NULL, /* sd */ 5364 5637 NULL, /* ea_list */ … … 5382 5655 } 5383 5656 5384 if (!set_delete_on_close(fsp, true, &conn->se rver_info->utok)) {5657 if (!set_delete_on_close(fsp, true, &conn->session_info->utok)) { 5385 5658 close_file(req, fsp, ERROR_CLOSE); 5386 5659 reply_nterror(req, NT_STATUS_ACCESS_DENIED); … … 5538 5811 static void rename_open_files(connection_struct *conn, 5539 5812 struct share_mode_lock *lck, 5813 uint32_t orig_name_hash, 5540 5814 const struct smb_filename *smb_fname_dst) 5541 5815 { … … 5543 5817 bool did_rename = False; 5544 5818 NTSTATUS status; 5545 5546 for(fsp = file_find_di_first(lck->id); fsp; 5819 uint32_t new_name_hash; 5820 5821 for(fsp = file_find_di_first(conn->sconn, lck->id); fsp; 5547 5822 fsp = file_find_di_next(fsp)) { 5548 5823 /* fsp_name is a relative path under the fsp. To change this for other … … 5553 5828 continue; 5554 5829 } 5830 if (fsp->name_hash != orig_name_hash) { 5831 continue; 5832 } 5555 5833 DEBUG(10, ("rename_open_files: renaming file fnum %d " 5556 5834 "(file_id %s) from %s -> %s\n", fsp->fnum, … … 5561 5839 if (NT_STATUS_IS_OK(status)) { 5562 5840 did_rename = True; 5841 new_name_hash = fsp->name_hash; 5563 5842 } 5564 5843 } … … 5571 5850 5572 5851 /* Send messages to all smbd's (not ourself) that the name has changed. */ 5573 rename_share_filename(smbd_messaging_context(), lck, conn->connectpath, 5852 rename_share_filename(conn->sconn->msg_ctx, lck, conn->connectpath, 5853 orig_name_hash, new_name_hash, 5574 5854 smb_fname_dst); 5575 5855 … … 5681 5961 if (!NT_STATUS_IS_OK(status)) { 5682 5962 goto out; 5683 }5684 5685 /* Ensure the dst smb_fname contains a '/' */5686 if(strrchr_m(smb_fname_dst->base_name,'/') == 0) {5687 char * tmp;5688 tmp = talloc_asprintf(smb_fname_dst, "./%s",5689 smb_fname_dst->base_name);5690 if (!tmp) {5691 status = NT_STATUS_NO_MEMORY;5692 goto out;5693 }5694 TALLOC_FREE(smb_fname_dst->base_name);5695 smb_fname_dst->base_name = tmp;5696 5963 } 5697 5964 … … 5711 5978 5712 5979 /* 5713 * Get the last component of the destination name. Note that 5714 * we guarantee that destination name contains a '/' character 5715 * above. 5980 * Get the last component of the destination name. 5716 5981 */ 5717 5982 last_slash = strrchr_m(smb_fname_dst->base_name, '/'); 5718 fname_dst_lcomp_base_mod = talloc_strdup(ctx, last_slash + 1); 5983 if (last_slash) { 5984 fname_dst_lcomp_base_mod = talloc_strdup(ctx, last_slash + 1); 5985 } else { 5986 fname_dst_lcomp_base_mod = talloc_strdup(ctx, smb_fname_dst->base_name); 5987 } 5719 5988 if (!fname_dst_lcomp_base_mod) { 5720 5989 status = NT_STATUS_NO_MEMORY; … … 5742 6011 * original. 5743 6012 */ 5744 *last_slash = '\0'; /* Truncate at the '/' */ 5745 tmp = talloc_asprintf(smb_fname_dst, 6013 if (last_slash) { 6014 *last_slash = '\0'; /* Truncate at the '/' */ 6015 tmp = talloc_asprintf(smb_fname_dst, 5746 6016 "%s/%s", 5747 6017 smb_fname_dst->base_name, 5748 6018 smb_fname_orig_lcomp->base_name); 6019 } else { 6020 tmp = talloc_asprintf(smb_fname_dst, 6021 "%s", 6022 smb_fname_orig_lcomp->base_name); 6023 } 5749 6024 if (tmp == NULL) { 5750 6025 status = NT_STATUS_NO_MEMORY; … … 5819 6094 struct file_id fileid = vfs_file_id_from_sbuf(conn, 5820 6095 &smb_fname_dst->st); 5821 files_struct *dst_fsp = file_find_di_first(fileid); 6096 files_struct *dst_fsp = file_find_di_first(conn->sconn, 6097 fileid); 5822 6098 /* The file can be open when renaming a stream */ 5823 6099 if (dst_fsp && !new_is_stream) { … … 5885 6161 smb_fname_dst); 5886 6162 5887 rename_open_files(conn, lck, smb_fname_dst);6163 rename_open_files(conn, lck, fsp->name_hash, smb_fname_dst); 5888 6164 5889 6165 /* … … 6000 6276 */ 6001 6277 TALLOC_FREE(smb_fname_src->base_name); 6002 smb_fname_src->base_name = talloc_asprintf(smb_fname_src, 6003 "%s/%s", 6004 fname_src_dir, 6005 fname_src_mask); 6278 if (ISDOT(fname_src_dir)) { 6279 /* Ensure we use canonical names on open. */ 6280 smb_fname_src->base_name = talloc_asprintf(smb_fname_src, 6281 "%s", 6282 fname_src_mask); 6283 } else { 6284 smb_fname_src->base_name = talloc_asprintf(smb_fname_src, 6285 "%s/%s", 6286 fname_src_dir, 6287 fname_src_mask); 6288 } 6006 6289 if (!smb_fname_src->base_name) { 6007 6290 status = NT_STATUS_NO_MEMORY; 6008 6291 goto out; 6009 }6010 6011 /* Ensure dst fname contains a '/' also */6012 if(strrchr_m(smb_fname_dst->base_name, '/') == 0) {6013 char *tmp;6014 tmp = talloc_asprintf(smb_fname_dst, "./%s",6015 smb_fname_dst->base_name);6016 if (!tmp) {6017 status = NT_STATUS_NO_MEMORY;6018 goto out;6019 }6020 TALLOC_FREE(smb_fname_dst->base_name);6021 smb_fname_dst->base_name = tmp;6022 6292 } 6023 6293 … … 6074 6344 0, /* oplock_request */ 6075 6345 0, /* allocation_size */ 6346 0, /* private_flags */ 6076 6347 NULL, /* sd */ 6077 6348 NULL, /* ea_list */ … … 6136 6407 /* Quick check for "." and ".." */ 6137 6408 if (ISDOT(dname) || ISDOTDOT(dname)) { 6138 if (attrs & aDIR) {6409 if (attrs & FILE_ATTRIBUTE_DIRECTORY) { 6139 6410 sysdir_entry = True; 6140 6411 } else { … … 6161 6432 6162 6433 TALLOC_FREE(smb_fname_src->base_name); 6163 smb_fname_src->base_name = talloc_asprintf(smb_fname_src, 6164 "%s/%s", 6165 fname_src_dir, 6166 dname); 6434 if (ISDOT(fname_src_dir)) { 6435 /* Ensure we use canonical names on open. */ 6436 smb_fname_src->base_name = talloc_asprintf(smb_fname_src, 6437 "%s", 6438 dname); 6439 } else { 6440 smb_fname_src->base_name = talloc_asprintf(smb_fname_src, 6441 "%s/%s", 6442 fname_src_dir, 6443 dname); 6444 } 6167 6445 if (!smb_fname_src->base_name) { 6168 6446 status = NT_STATUS_NO_MEMORY; … … 6212 6490 0, /* oplock_request */ 6213 6491 0, /* allocation_size */ 6492 0, /* private_flags */ 6214 6493 NULL, /* sd */ 6215 6494 NULL, /* ea_list */ … … 6283 6562 struct smb_filename *smb_fname_src = NULL; 6284 6563 struct smb_filename *smb_fname_dst = NULL; 6564 bool stream_rename = false; 6285 6565 6286 6566 START_PROFILE(SMBmv); … … 6307 6587 goto out; 6308 6588 } 6589 6590 if (!lp_posix_pathnames()) { 6591 /* The newname must begin with a ':' if the 6592 name contains a ':'. */ 6593 if (strchr_m(name, ':')) { 6594 if (newname[0] != ':') { 6595 reply_nterror(req, NT_STATUS_INVALID_PARAMETER); 6596 goto out; 6597 } 6598 stream_rename = true; 6599 } 6600 } 6309 6601 6310 6602 status = filename_convert(ctx, … … 6344 6636 } 6345 6637 6638 if (stream_rename) { 6639 /* smb_fname_dst->base_name must be the same as 6640 smb_fname_src->base_name. */ 6641 TALLOC_FREE(smb_fname_dst->base_name); 6642 smb_fname_dst->base_name = talloc_strdup(smb_fname_dst, 6643 smb_fname_src->base_name); 6644 if (!smb_fname_dst->base_name) { 6645 reply_nterror(req, NT_STATUS_NO_MEMORY); 6646 goto out; 6647 } 6648 } 6649 6346 6650 DEBUG(3,("reply_mv : %s -> %s\n", smb_fname_str_dbg(smb_fname_src), 6347 6651 smb_fname_str_dbg(smb_fname_dst))); … … 6432 6736 NULL, NULL, 6433 6737 &new_create_disposition, 6738 NULL, 6434 6739 NULL)) { 6435 6740 status = NT_STATUS_INVALID_PARAMETER; … … 6451 6756 INTERNAL_OPEN_ONLY, /* oplock_request */ 6452 6757 0, /* allocation_size */ 6758 0, /* private_flags */ 6453 6759 NULL, /* sd */ 6454 6760 NULL, /* ea_list */ … … 6479 6785 INTERNAL_OPEN_ONLY, /* oplock_request */ 6480 6786 0, /* allocation_size */ 6787 0, /* private_flags */ 6481 6788 NULL, /* sd */ 6482 6789 NULL, /* ea_list */ … … 6489 6796 } 6490 6797 6491 if ((ofun&3) == 1) { 6492 if(SMB_VFS_LSEEK(fsp2,0,SEEK_END) == -1) { 6493 DEBUG(0,("copy_file: error - vfs lseek returned error %s\n", strerror(errno) )); 6494 /* 6495 * Stop the copy from occurring. 6496 */ 6497 ret = -1; 6498 smb_fname_src->st.st_ex_size = 0; 6798 if (ofun & OPENX_FILE_EXISTS_OPEN) { 6799 ret = SMB_VFS_LSEEK(fsp2, 0, SEEK_END); 6800 if (ret == -1) { 6801 DEBUG(0, ("error - vfs lseek returned error %s\n", 6802 strerror(errno))); 6803 status = map_nt_error_from_unix(errno); 6804 close_file(NULL, fsp1, ERROR_CLOSE); 6805 close_file(NULL, fsp2, ERROR_CLOSE); 6806 goto out; 6499 6807 } 6500 6808 } … … 6503 6811 if (smb_fname_src->st.st_ex_size) { 6504 6812 ret = vfs_transfer_file(fsp1, fsp2, smb_fname_src->st.st_ex_size); 6813 } else { 6814 ret = 0; 6505 6815 } 6506 6816 … … 6680 6990 */ 6681 6991 TALLOC_FREE(smb_fname_src->base_name); 6682 smb_fname_src->base_name = talloc_asprintf(smb_fname_src, 6683 "%s/%s", 6684 fname_src_dir, 6685 fname_src_mask); 6992 if (ISDOT(fname_src_dir)) { 6993 /* Ensure we use canonical names on open. */ 6994 smb_fname_src->base_name = talloc_asprintf(smb_fname_src, 6995 "%s", 6996 fname_src_mask); 6997 } else { 6998 smb_fname_src->base_name = talloc_asprintf(smb_fname_src, 6999 "%s/%s", 7000 fname_src_dir, 7001 fname_src_mask); 7002 } 6686 7003 if (!smb_fname_src->base_name) { 6687 7004 reply_nterror(req, NT_STATUS_NO_MEMORY); … … 6791 7108 /* Get the src smb_fname struct setup. */ 6792 7109 TALLOC_FREE(smb_fname_src->base_name); 6793 smb_fname_src->base_name = 6794 talloc_asprintf(smb_fname_src, "%s/%s", 6795 fname_src_dir, dname); 7110 if (ISDOT(fname_src_dir)) { 7111 /* Ensure we use canonical names on open. */ 7112 smb_fname_src->base_name = 7113 talloc_asprintf(smb_fname_src, "%s", 7114 dname); 7115 } else { 7116 smb_fname_src->base_name = 7117 talloc_asprintf(smb_fname_src, "%s/%s", 7118 fname_src_dir, dname); 7119 } 6796 7120 6797 7121 if (!smb_fname_src->base_name) { … … 6876 7200 ****************************************************************************/ 6877 7201 6878 uint 32get_lock_pid(const uint8_t *data, int data_offset,7202 uint64_t get_lock_pid(const uint8_t *data, int data_offset, 6879 7203 bool large_file_format) 6880 7204 { 6881 7205 if(!large_file_format) 6882 return (uint 32)SVAL(data,SMB_LPID_OFFSET(data_offset));7206 return (uint64_t)SVAL(data,SMB_LPID_OFFSET(data_offset)); 6883 7207 else 6884 return (uint 32)SVAL(data,SMB_LARGE_LPID_OFFSET(data_offset));7208 return (uint64_t)SVAL(data,SMB_LARGE_LPID_OFFSET(data_offset)); 6885 7209 } 6886 7210 … … 7033 7357 (double)e->offset, 7034 7358 (double)e->count, 7035 (unsigned int)e->smb pid,7359 (unsigned int)e->smblctx, 7036 7360 fsp_str_dbg(fsp))); 7037 7361 … … 7041 7365 } 7042 7366 7043 status = do_unlock( smbd_messaging_context(),7367 status = do_unlock(req->sconn->msg_ctx, 7044 7368 fsp, 7045 e->smb pid,7369 e->smblctx, 7046 7370 e->count, 7047 7371 e->offset, … … 7068 7392 struct smbd_lock_element *e = &locks[i]; 7069 7393 7070 DEBUG(10,("smbd_do_locking: lock start=%.0f, len=%.0f for pid"7071 "% u, file %s timeout = %d\n",7394 DEBUG(10,("smbd_do_locking: lock start=%.0f, len=%.0f for smblctx " 7395 "%llu, file %s timeout = %d\n", 7072 7396 (double)e->offset, 7073 7397 (double)e->count, 7074 (unsigned int)e->smbpid,7398 (unsigned long long)e->smblctx, 7075 7399 fsp_str_dbg(fsp), 7076 7400 (int)timeout)); … … 7109 7433 return the right error. */ 7110 7434 7111 blr = blocking_lock_cancel (fsp,7112 e->smb pid,7435 blr = blocking_lock_cancel_smb1(fsp, 7436 e->smblctx, 7113 7437 e->offset, 7114 7438 e->count, … … 7124 7448 /* Remove a matching pending lock. */ 7125 7449 status = do_lock_cancel(fsp, 7126 e->smb pid,7450 e->smblctx, 7127 7451 e->count, 7128 7452 e->offset, … … 7133 7457 bool defer_lock = false; 7134 7458 struct byte_range_lock *br_lck; 7135 uint 32_t block_smbpid;7136 7137 br_lck = do_lock( smbd_messaging_context(),7459 uint64_t block_smblctx; 7460 7461 br_lck = do_lock(req->sconn->msg_ctx, 7138 7462 fsp, 7139 e->smb pid,7463 e->smblctx, 7140 7464 e->count, 7141 7465 e->offset, … … 7144 7468 blocking_lock, 7145 7469 &status, 7146 &block_smb pid,7470 &block_smblctx, 7147 7471 NULL); 7148 7472 … … 7167 7491 * Replacement for do_lock_spin(). JRA. */ 7168 7492 7169 if (br_lck && lp_blocking_locks(SNUM(conn)) && 7493 if (!req->sconn->using_smb2 && 7494 br_lck && lp_blocking_locks(SNUM(conn)) && 7170 7495 lp_lock_spin_time() && !blocking_lock && 7171 7496 NT_STATUS_EQUAL((status), … … 7187 7512 timeout, 7188 7513 i, 7189 e->smb pid,7514 e->smblctx, 7190 7515 e->brltype, 7191 7516 WINDOWS_LOCK, 7192 7517 e->offset, 7193 7518 e->count, 7194 block_smb pid)) {7519 block_smblctx)) { 7195 7520 TALLOC_FREE(br_lck); 7196 7521 *async = true; … … 7224 7549 struct smbd_lock_element *e = &locks[i]; 7225 7550 7226 do_unlock( smbd_messaging_context(),7551 do_unlock(req->sconn->msg_ctx, 7227 7552 fsp, 7228 e->smb pid,7553 e->smblctx, 7229 7554 e->count, 7230 7555 e->offset, … … 7391 7716 of smb_unlkrng structs */ 7392 7717 for(i = 0; i < (int)num_ulocks; i++) { 7393 ulocks[i].smb pid= get_lock_pid(data, i, large_file_format);7718 ulocks[i].smblctx = get_lock_pid(data, i, large_file_format); 7394 7719 ulocks[i].count = get_lock_count(data, i, large_file_format); 7395 7720 ulocks[i].offset = get_lock_offset(data, i, large_file_format, &err); … … 7413 7738 7414 7739 for(i = 0; i < (int)num_locks; i++) { 7415 locks[i].smb pid= get_lock_pid(data, i, large_file_format);7740 locks[i].smblctx = get_lock_pid(data, i, large_file_format); 7416 7741 locks[i].count = get_lock_count(data, i, large_file_format); 7417 7742 locks[i].offset = get_lock_offset(data, i, large_file_format, &err); … … 7648 7973 convert_timespec_to_time_t(fsp->fsp_name->st.st_ex_mtime)); 7649 7974 7650 if (mode & aDIR) {7975 if (mode & FILE_ATTRIBUTE_DIRECTORY) { 7651 7976 SIVAL(req->outbuf, smb_vwv6, 0); 7652 7977 SIVAL(req->outbuf, smb_vwv8, 0);
Note:
See TracChangeset
for help on using the changeset viewer.