Changeset 746 for vendor/current/source3/libsmb/clifile.c
- Timestamp:
- Nov 27, 2012, 4:56:06 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/libsmb/clifile.c
r740 r746 359 359 fail: 360 360 TALLOC_FREE(frame); 361 if (!NT_STATUS_IS_OK(status)) {362 cli_set_error(cli, status);363 }364 361 return status; 365 362 } … … 504 501 fail: 505 502 TALLOC_FREE(frame); 506 if (!NT_STATUS_IS_OK(status)) {507 cli_set_error(cli, status);508 }509 503 return status; 510 504 } … … 571 565 fail: 572 566 TALLOC_FREE(frame); 573 if (!NT_STATUS_IS_OK(status)) {574 cli_set_error(cli, status);575 }576 567 return status; 577 568 } … … 779 770 fail: 780 771 TALLOC_FREE(frame); 781 if (!NT_STATUS_IS_OK(status)) {782 cli_set_error(cli, status);783 }784 772 return status; 785 773 } … … 913 901 fail: 914 902 TALLOC_FREE(frame); 915 if (!NT_STATUS_IS_OK(status)) {916 cli_set_error(cli, status);917 }918 903 return status; 919 904 } … … 1030 1015 fail: 1031 1016 TALLOC_FREE(frame); 1032 if (!NT_STATUS_IS_OK(status)) {1033 cli_set_error(cli, status);1034 }1035 1017 return status; 1036 1018 } … … 1103 1085 fail: 1104 1086 TALLOC_FREE(frame); 1105 if (!NT_STATUS_IS_OK(status)) {1106 cli_set_error(cli, status);1107 }1108 1087 return status; 1109 1088 } … … 1225 1204 fail: 1226 1205 TALLOC_FREE(frame); 1227 if (!NT_STATUS_IS_OK(status)) {1228 cli_set_error(cli, status);1229 }1230 1206 return status; 1231 1207 } … … 1369 1345 fail: 1370 1346 TALLOC_FREE(frame); 1371 if (!NT_STATUS_IS_OK(status)) {1372 cli_set_error(cli, status);1373 }1374 1347 return status; 1375 1348 } … … 1434 1407 fail: 1435 1408 TALLOC_FREE(frame); 1436 if (!NT_STATUS_IS_OK(status)) {1437 cli_set_error(cli, status);1438 }1439 1409 return status; 1440 1410 } … … 1544 1514 fail: 1545 1515 TALLOC_FREE(frame); 1546 if (!NT_STATUS_IS_OK(status)) {1547 cli_set_error(cli, status);1548 }1549 1516 return status; 1550 1517 } … … 1651 1618 fail: 1652 1619 TALLOC_FREE(frame); 1653 if (!NT_STATUS_IS_OK(status)) {1654 cli_set_error(cli, status);1655 }1656 1620 return status; 1657 1621 } … … 1758 1722 fail: 1759 1723 TALLOC_FREE(frame); 1760 if (!NT_STATUS_IS_OK(status)) {1761 cli_set_error(cli, status);1762 }1763 1724 return status; 1764 1725 } … … 1875 1836 fail: 1876 1837 TALLOC_FREE(frame); 1877 if (!NT_STATUS_IS_OK(status)) {1878 cli_set_error(cli, status);1879 }1880 1838 return status; 1881 1839 } … … 2039 1997 fail: 2040 1998 TALLOC_FREE(frame); 2041 if (!NT_STATUS_IS_OK(status)) {2042 cli_set_error(cli, status);2043 }2044 1999 return status; 2045 2000 } … … 2051 2006 2052 2007 struct cli_open_state { 2008 struct tevent_context *ev; 2009 struct cli_state *cli; 2010 const char *fname; 2053 2011 uint16_t vwv[15]; 2054 2012 uint16_t fnum; 2013 unsigned openfn; 2014 unsigned dos_deny; 2015 uint8_t additional_flags; 2055 2016 struct iovec bytes; 2056 2017 }; 2057 2018 2058 2019 static void cli_open_done(struct tevent_req *subreq); 2020 static void cli_open_ntcreate_done(struct tevent_req *subreq); 2059 2021 2060 2022 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx, … … 2066 2028 struct tevent_req *req, *subreq; 2067 2029 struct cli_open_state *state; 2068 unsigned openfn;2069 unsigned accessmode;2070 uint8_t additional_flags;2071 2030 uint8_t *bytes; 2072 2031 … … 2075 2034 return NULL; 2076 2035 } 2077 2078 openfn = 0; 2036 state->ev = ev; 2037 state->cli = cli; 2038 state->fname = fname; 2039 2079 2040 if (flags & O_CREAT) { 2080 openfn |= (1<<4);2041 state->openfn |= (1<<4); 2081 2042 } 2082 2043 if (!(flags & O_EXCL)) { 2083 2044 if (flags & O_TRUNC) 2084 openfn |= (1<<1);2045 state->openfn |= (1<<1); 2085 2046 else 2086 openfn |= (1<<0);2087 } 2088 2089 accessmode= (share_mode<<4);2047 state->openfn |= (1<<0); 2048 } 2049 2050 state->dos_deny = (share_mode<<4); 2090 2051 2091 2052 if ((flags & O_ACCMODE) == O_RDWR) { 2092 accessmode|= 2;2053 state->dos_deny |= 2; 2093 2054 } else if ((flags & O_ACCMODE) == O_WRONLY) { 2094 accessmode|= 1;2055 state->dos_deny |= 1; 2095 2056 } 2096 2057 2097 2058 #if defined(O_SYNC) 2098 2059 if ((flags & O_SYNC) == O_SYNC) { 2099 accessmode|= (1<<14);2060 state->dos_deny |= (1<<14); 2100 2061 } 2101 2062 #endif /* O_SYNC */ 2102 2063 2103 2064 if (share_mode == DENY_FCB) { 2104 accessmode= 0xFF;2065 state->dos_deny = 0xFF; 2105 2066 } 2106 2067 … … 2109 2070 SSVAL(state->vwv + 1, 0, 0); 2110 2071 SSVAL(state->vwv + 2, 0, 0); /* no additional info */ 2111 SSVAL(state->vwv + 3, 0, accessmode);2072 SSVAL(state->vwv + 3, 0, state->dos_deny); 2112 2073 SSVAL(state->vwv + 4, 0, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN); 2113 2074 SSVAL(state->vwv + 5, 0, 0); 2114 2075 SIVAL(state->vwv + 6, 0, 0); 2115 SSVAL(state->vwv + 8, 0, openfn);2076 SSVAL(state->vwv + 8, 0, state->openfn); 2116 2077 SIVAL(state->vwv + 9, 0, 0); 2117 2078 SIVAL(state->vwv + 11, 0, 0); 2118 2079 SIVAL(state->vwv + 13, 0, 0); 2119 2080 2120 additional_flags = 0;2121 2122 2081 if (cli->use_oplocks) { 2123 2082 /* if using oplocks then ask for a batch oplock via 2124 2083 core and extended methods */ 2125 additional_flags =2084 state->additional_flags = 2126 2085 FLAG_REQUEST_OPLOCK|FLAG_REQUEST_BATCH_OPLOCK; 2127 2086 SSVAL(state->vwv+2, 0, SVAL(state->vwv+2, 0) | 6); … … 2139 2098 state->bytes.iov_len = talloc_get_size(bytes); 2140 2099 2141 subreq = cli_smb_req_create(state, ev, cli, SMBopenX, additional_flags, 2100 subreq = cli_smb_req_create(state, ev, cli, SMBopenX, 2101 state->additional_flags, 2142 2102 15, state->vwv, 1, &state->bytes); 2143 2103 if (subreq == NULL) { … … 2180 2140 uint8_t *inbuf; 2181 2141 NTSTATUS status; 2142 uint32_t access_mask, share_mode, create_disposition, create_options; 2182 2143 2183 2144 status = cli_smb_recv(subreq, state, &inbuf, 3, &wct, &vwv, NULL, 2184 2145 NULL); 2185 2146 TALLOC_FREE(subreq); 2147 2148 if (NT_STATUS_IS_OK(status)) { 2149 state->fnum = SVAL(vwv+2, 0); 2150 tevent_req_done(req); 2151 return; 2152 } 2153 2154 if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) { 2155 tevent_req_nterror(req, status); 2156 return; 2157 } 2158 2159 /* 2160 * For the new shiny OS/X Lion SMB server, try a ntcreate 2161 * fallback. 2162 */ 2163 2164 if (!map_open_params_to_ntcreate(state->fname, state->dos_deny, 2165 state->openfn, &access_mask, 2166 &share_mode, &create_disposition, 2167 &create_options, NULL)) { 2168 tevent_req_nterror(req, NT_STATUS_NOT_SUPPORTED); 2169 return; 2170 } 2171 2172 subreq = cli_ntcreate_send(state, state->ev, state->cli, 2173 state->fname, 0, access_mask, 2174 0, share_mode, create_disposition, 2175 create_options, 0); 2176 if (tevent_req_nomem(subreq, req)) { 2177 return; 2178 } 2179 tevent_req_set_callback(subreq, cli_open_ntcreate_done, req); 2180 } 2181 2182 static void cli_open_ntcreate_done(struct tevent_req *subreq) 2183 { 2184 struct tevent_req *req = tevent_req_callback_data( 2185 subreq, struct tevent_req); 2186 struct cli_open_state *state = tevent_req_data( 2187 req, struct cli_open_state); 2188 NTSTATUS status; 2189 2190 status = cli_ntcreate_recv(subreq, &state->fnum); 2191 TALLOC_FREE(subreq); 2186 2192 if (tevent_req_nterror(req, status)) { 2187 2193 return; 2188 2194 } 2189 state->fnum = SVAL(vwv+2, 0);2190 2195 tevent_req_done(req); 2191 2196 } … … 2240 2245 fail: 2241 2246 TALLOC_FREE(frame); 2242 if (!NT_STATUS_IS_OK(status)) {2243 cli_set_error(cli, status);2244 }2245 2247 return status; 2246 2248 } … … 2358 2360 fail: 2359 2361 TALLOC_FREE(frame); 2360 if (!NT_STATUS_IS_OK(status)) {2361 cli_set_error(cli, status);2362 }2363 2362 return status; 2364 2363 } … … 2476 2475 fail: 2477 2476 TALLOC_FREE(frame); 2478 if (!NT_STATUS_IS_OK(status)) {2479 cli_set_error(cli, status);2480 }2481 2477 return status; 2482 2478 } … … 2538 2534 status = cli_locktype(cli, fnum, offset, len, timeout, 2539 2535 (lock_type == READ_LOCK? 1 : 0)); 2540 cli_set_error(cli, status);2541 2536 return NT_STATUS_IS_OK(status); 2542 2537 } … … 2649 2644 fail: 2650 2645 TALLOC_FREE(frame); 2651 if (!NT_STATUS_IS_OK(status)) {2652 cli_set_error(cli, status);2653 }2654 2646 return status; 2655 2647 } … … 2702 2694 cli->timeout = saved_timeout; 2703 2695 2704 cli_set_error(cli, status);2705 2696 return NT_STATUS_IS_OK(status); 2706 2697 } … … 2817 2808 fail: 2818 2809 TALLOC_FREE(frame); 2819 if (!NT_STATUS_IS_OK(status)) {2820 cli_set_error(cli, status);2821 }2822 2810 return status; 2823 2811 } … … 2991 2979 fail: 2992 2980 TALLOC_FREE(frame); 2993 if (!NT_STATUS_IS_OK(status)) {2994 cli_set_error(cli, status);2995 }2996 2981 return status; 2997 2982 } … … 3058 3043 fail: 3059 3044 TALLOC_FREE(frame); 3060 if (!NT_STATUS_IS_OK(status)) {3061 cli_set_error(cli, status);3062 }3063 3045 return status; 3064 3046 } … … 3212 3194 fail: 3213 3195 TALLOC_FREE(frame); 3214 if (!NT_STATUS_IS_OK(status)) {3215 cli_set_error(cli, status);3216 }3217 3196 return status; 3218 3197 } … … 3361 3340 fail: 3362 3341 TALLOC_FREE(frame); 3363 if (!NT_STATUS_IS_OK(status)) {3364 cli_set_error(cli, status);3365 }3366 3342 return status; 3367 3343 } … … 3476 3452 fail: 3477 3453 TALLOC_FREE(frame); 3478 if (!NT_STATUS_IS_OK(status)) {3479 cli_set_error(cli, status);3480 }3481 3454 return status; 3482 3455 } … … 3602 3575 fail: 3603 3576 TALLOC_FREE(frame); 3604 if (!NT_STATUS_IS_OK(status)) {3605 cli_set_error(cli, status);3606 }3607 3577 return status; 3608 3578 } … … 3724 3694 fail: 3725 3695 TALLOC_FREE(frame); 3726 if (!NT_STATUS_IS_OK(status)) {3727 cli_set_error(cli, status);3728 }3729 3696 return status; 3730 3697 } … … 3838 3805 fail: 3839 3806 TALLOC_FREE(frame); 3840 if (!NT_STATUS_IS_OK(status)) {3841 cli_set_error(cli, status);3842 }3843 3807 return status; 3844 3808 } … … 3995 3959 fail: 3996 3960 TALLOC_FREE(frame); 3997 if (!NT_STATUS_IS_OK(status)) {3998 cli_set_error(cli, status);3999 }4000 3961 return status; 4001 3962 } … … 4324 4285 fail: 4325 4286 TALLOC_FREE(frame); 4326 if (!NT_STATUS_IS_OK(status)) {4327 cli_set_error(cli, status);4328 }4329 4287 return status; 4330 4288 } … … 4553 4511 fail: 4554 4512 TALLOC_FREE(frame); 4555 if (!NT_STATUS_IS_OK(status)) {4556 cli_set_error(cli, status);4557 }4558 4513 return status; 4559 4514 } … … 4614 4569 fail: 4615 4570 TALLOC_FREE(frame); 4616 if (!NT_STATUS_IS_OK(status)) {4617 cli_set_error(cli, status);4618 }4619 4571 return status; 4620 4572 } … … 4722 4674 fail: 4723 4675 TALLOC_FREE(frame); 4724 if (!NT_STATUS_IS_OK(status)) {4725 cli_set_error(cli, status);4726 }4727 4676 return status; 4728 4677 } … … 4786 4735 fail: 4787 4736 TALLOC_FREE(frame); 4788 if (!NT_STATUS_IS_OK(status)) {4789 cli_set_error(cli, status);4790 }4791 4737 return status; 4792 4738 } … … 5071 5017 fail: 5072 5018 TALLOC_FREE(frame); 5073 if (!NT_STATUS_IS_OK(status)) {5074 cli_set_error(cli, status);5075 }5076 5019 return status; 5077 5020 } … … 5203 5146 fail: 5204 5147 TALLOC_FREE(frame); 5205 if (!NT_STATUS_IS_OK(status)) {5206 cli_set_error(cli, status);5207 }5208 5148 return status; 5209 5149 } … … 5285 5225 fail: 5286 5226 TALLOC_FREE(frame); 5287 if (!NT_STATUS_IS_OK(status)) {5288 cli_set_error(cli, status);5289 }5290 5227 return status; 5291 5228 } … … 5320 5257 SIVAL(state->setup + 0, 0, FSCTL_GET_SHADOW_COPY_DATA); 5321 5258 SSVAL(state->setup + 2, 0, fnum); 5322 SCVAL(state->setup + 3, 0, 0); /* isFsctl */5259 SCVAL(state->setup + 3, 0, 1); /* isFsctl */ 5323 5260 SCVAL(state->setup + 3, 1, 0); /* compfilter, isFlags (WSSP) */ 5324 5261 … … 5433 5370 fail: 5434 5371 TALLOC_FREE(frame); 5435 if (!NT_STATUS_IS_OK(status)) {5436 cli_set_error(cli, status);5437 }5438 5372 return status; 5439 5373 }
Note:
See TracChangeset
for help on using the changeset viewer.