Changeset 746 for vendor/current/source3/libsmb/clireadwrite.c
- Timestamp:
- Nov 27, 2012, 4:56:06 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/libsmb/clireadwrite.c
r740 r746 134 134 SSVAL(state->vwv + 9, 0, 0); 135 135 136 if ( (uint64_t)offset >> 32) {136 if (cli->capabilities & CAP_LARGE_FILES) { 137 137 SIVAL(state->vwv + 10, 0, 138 138 (((uint64_t)offset)>>32) & 0xffffffff); 139 wct += 2; 139 wct = 12; 140 } else { 141 if ((((uint64_t)offset) & 0xffffffff00000000LL) != 0) { 142 DEBUG(10, ("cli_read_andx_send got large offset where " 143 "the server does not support it\n")); 144 tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); 145 return tevent_req_post(req, ev); 146 } 140 147 } 141 148 … … 216 223 state->buf = (uint8_t *)smb_base(inbuf) + SVAL(vwv+6, 0); 217 224 218 if (trans_oob(smb_len (inbuf), SVAL(vwv+6, 0), state->received)225 if (trans_oob(smb_len_large(inbuf), SVAL(vwv+6, 0), state->received) 219 226 || ((state->received != 0) && (state->buf < bytes))) { 220 227 DEBUG(5, ("server returned invalid read&x data offset\n")); … … 681 688 fail: 682 689 TALLOC_FREE(frame); 683 if (!NT_STATUS_IS_OK(status)) {684 cli_set_error(cli, status);685 }686 690 return status; 687 691 } … … 704 708 cli_read_sink, &buf, &ret); 705 709 if (!NT_STATUS_IS_OK(status)) { 706 cli_set_error(cli, status);707 710 return -1; 708 711 } … … 812 815 } 813 816 814 s ize = MIN(size, max_write);817 state->size = MIN(size, max_write); 815 818 816 819 vwv = state->vwv; … … 824 827 SSVAL(vwv+7, 0, mode); 825 828 SSVAL(vwv+8, 0, 0); 826 SSVAL(vwv+9, 0, (s ize>>16));827 SSVAL(vwv+10, 0, s ize);829 SSVAL(vwv+9, 0, (state->size>>16)); 830 SSVAL(vwv+10, 0, state->size); 828 831 829 832 SSVAL(vwv+11, 0, … … 842 845 state->iov[0].iov_len = 1; 843 846 state->iov[1].iov_base = CONST_DISCARD(void *, buf); 844 state->iov[1].iov_len = s ize;847 state->iov[1].iov_len = state->size; 845 848 846 849 subreq = cli_smb_req_create(state, ev, cli, SMBwriteX, 0, wct, vwv, … … 895 898 } 896 899 state->written = SVAL(vwv+2, 0); 897 state->written |= SVAL(vwv+4, 0)<<16; 900 if (state->size > UINT16_MAX) { 901 /* 902 * It is important that we only set the 903 * high bits only if we asked for a large write. 904 * 905 * OS/2 print shares get this wrong and may send 906 * invalid values. 907 * 908 * See bug #5326. 909 */ 910 state->written |= SVAL(vwv+4, 0)<<16; 911 } 898 912 tevent_req_done(req); 899 913 } … … 1045 1059 fail: 1046 1060 TALLOC_FREE(frame); 1047 if (!NT_STATUS_IS_OK(status)) {1048 cli_set_error(cli, status);1049 }1050 1061 return status; 1051 1062 } … … 1277 1288 fail: 1278 1289 TALLOC_FREE(frame); 1279 if (!NT_STATUS_IS_OK(status)) {1280 cli_set_error(cli, status);1281 }1282 1290 return status; 1283 1291 }
Note:
See TracChangeset
for help on using the changeset viewer.