Ignore:
Timestamp:
Nov 27, 2012, 4:56:06 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated vendor to 3.6.9

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/libsmb/clifile.c

    r740 r746  
    359359 fail:
    360360        TALLOC_FREE(frame);
    361         if (!NT_STATUS_IS_OK(status)) {
    362                 cli_set_error(cli, status);
    363         }
    364361        return status;
    365362}
     
    504501 fail:
    505502        TALLOC_FREE(frame);
    506         if (!NT_STATUS_IS_OK(status)) {
    507                 cli_set_error(cli, status);
    508         }
    509503        return status;
    510504}
     
    571565 fail:
    572566        TALLOC_FREE(frame);
    573         if (!NT_STATUS_IS_OK(status)) {
    574                 cli_set_error(cli, status);
    575         }
    576567        return status;
    577568}
     
    779770 fail:
    780771        TALLOC_FREE(frame);
    781         if (!NT_STATUS_IS_OK(status)) {
    782                 cli_set_error(cli, status);
    783         }
    784772        return status;
    785773}
     
    913901 fail:
    914902        TALLOC_FREE(frame);
    915         if (!NT_STATUS_IS_OK(status)) {
    916                 cli_set_error(cli, status);
    917         }
    918903        return status;
    919904}
     
    10301015 fail:
    10311016        TALLOC_FREE(frame);
    1032         if (!NT_STATUS_IS_OK(status)) {
    1033                 cli_set_error(cli, status);
    1034         }
    10351017        return status;
    10361018}
     
    11031085 fail:
    11041086        TALLOC_FREE(frame);
    1105         if (!NT_STATUS_IS_OK(status)) {
    1106                 cli_set_error(cli, status);
    1107         }
    11081087        return status;
    11091088}
     
    12251204 fail:
    12261205        TALLOC_FREE(frame);
    1227         if (!NT_STATUS_IS_OK(status)) {
    1228                 cli_set_error(cli, status);
    1229         }
    12301206        return status;
    12311207}
     
    13691345 fail:
    13701346        TALLOC_FREE(frame);
    1371         if (!NT_STATUS_IS_OK(status)) {
    1372                 cli_set_error(cli, status);
    1373         }
    13741347        return status;
    13751348}
     
    14341407 fail:
    14351408        TALLOC_FREE(frame);
    1436         if (!NT_STATUS_IS_OK(status)) {
    1437                 cli_set_error(cli, status);
    1438         }
    14391409        return status;
    14401410}
     
    15441514 fail:
    15451515        TALLOC_FREE(frame);
    1546         if (!NT_STATUS_IS_OK(status)) {
    1547                 cli_set_error(cli, status);
    1548         }
    15491516        return status;
    15501517}
     
    16511618 fail:
    16521619        TALLOC_FREE(frame);
    1653         if (!NT_STATUS_IS_OK(status)) {
    1654                 cli_set_error(cli, status);
    1655         }
    16561620        return status;
    16571621}
     
    17581722 fail:
    17591723        TALLOC_FREE(frame);
    1760         if (!NT_STATUS_IS_OK(status)) {
    1761                 cli_set_error(cli, status);
    1762         }
    17631724        return status;
    17641725}
     
    18751836 fail:
    18761837        TALLOC_FREE(frame);
    1877         if (!NT_STATUS_IS_OK(status)) {
    1878                 cli_set_error(cli, status);
    1879         }
    18801838        return status;
    18811839}
     
    20391997 fail:
    20401998        TALLOC_FREE(frame);
    2041         if (!NT_STATUS_IS_OK(status)) {
    2042                 cli_set_error(cli, status);
    2043         }
    20441999        return status;
    20452000}
     
    20512006
    20522007struct cli_open_state {
     2008        struct tevent_context *ev;
     2009        struct cli_state *cli;
     2010        const char *fname;
    20532011        uint16_t vwv[15];
    20542012        uint16_t fnum;
     2013        unsigned openfn;
     2014        unsigned dos_deny;
     2015        uint8_t additional_flags;
    20552016        struct iovec bytes;
    20562017};
    20572018
    20582019static void cli_open_done(struct tevent_req *subreq);
     2020static void cli_open_ntcreate_done(struct tevent_req *subreq);
    20592021
    20602022struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
     
    20662028        struct tevent_req *req, *subreq;
    20672029        struct cli_open_state *state;
    2068         unsigned openfn;
    2069         unsigned accessmode;
    2070         uint8_t additional_flags;
    20712030        uint8_t *bytes;
    20722031
     
    20752034                return NULL;
    20762035        }
    2077 
    2078         openfn = 0;
     2036        state->ev = ev;
     2037        state->cli = cli;
     2038        state->fname = fname;
     2039
    20792040        if (flags & O_CREAT) {
    2080                 openfn |= (1<<4);
     2041                state->openfn |= (1<<4);
    20812042        }
    20822043        if (!(flags & O_EXCL)) {
    20832044                if (flags & O_TRUNC)
    2084                         openfn |= (1<<1);
     2045                        state->openfn |= (1<<1);
    20852046                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);
    20902051
    20912052        if ((flags & O_ACCMODE) == O_RDWR) {
    2092                 accessmode |= 2;
     2053                state->dos_deny |= 2;
    20932054        } else if ((flags & O_ACCMODE) == O_WRONLY) {
    2094                 accessmode |= 1;
     2055                state->dos_deny |= 1;
    20952056        }
    20962057
    20972058#if defined(O_SYNC)
    20982059        if ((flags & O_SYNC) == O_SYNC) {
    2099                 accessmode |= (1<<14);
     2060                state->dos_deny |= (1<<14);
    21002061        }
    21012062#endif /* O_SYNC */
    21022063
    21032064        if (share_mode == DENY_FCB) {
    2104                 accessmode = 0xFF;
     2065                state->dos_deny = 0xFF;
    21052066        }
    21062067
     
    21092070        SSVAL(state->vwv + 1, 0, 0);
    21102071        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);
    21122073        SSVAL(state->vwv + 4, 0, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
    21132074        SSVAL(state->vwv + 5, 0, 0);
    21142075        SIVAL(state->vwv + 6, 0, 0);
    2115         SSVAL(state->vwv + 8, 0, openfn);
     2076        SSVAL(state->vwv + 8, 0, state->openfn);
    21162077        SIVAL(state->vwv + 9, 0, 0);
    21172078        SIVAL(state->vwv + 11, 0, 0);
    21182079        SIVAL(state->vwv + 13, 0, 0);
    21192080
    2120         additional_flags = 0;
    2121 
    21222081        if (cli->use_oplocks) {
    21232082                /* if using oplocks then ask for a batch oplock via
    21242083                   core and extended methods */
    2125                 additional_flags =
     2084                state->additional_flags =
    21262085                        FLAG_REQUEST_OPLOCK|FLAG_REQUEST_BATCH_OPLOCK;
    21272086                SSVAL(state->vwv+2, 0, SVAL(state->vwv+2, 0) | 6);
     
    21392098        state->bytes.iov_len = talloc_get_size(bytes);
    21402099
    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,
    21422102                                    15, state->vwv, 1, &state->bytes);
    21432103        if (subreq == NULL) {
     
    21802140        uint8_t *inbuf;
    21812141        NTSTATUS status;
     2142        uint32_t access_mask, share_mode, create_disposition, create_options;
    21822143
    21832144        status = cli_smb_recv(subreq, state, &inbuf, 3, &wct, &vwv, NULL,
    21842145                              NULL);
    21852146        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
     2182static 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);
    21862192        if (tevent_req_nterror(req, status)) {
    21872193                return;
    21882194        }
    2189         state->fnum = SVAL(vwv+2, 0);
    21902195        tevent_req_done(req);
    21912196}
     
    22402245 fail:
    22412246        TALLOC_FREE(frame);
    2242         if (!NT_STATUS_IS_OK(status)) {
    2243                 cli_set_error(cli, status);
    2244         }
    22452247        return status;
    22462248}
     
    23582360 fail:
    23592361        TALLOC_FREE(frame);
    2360         if (!NT_STATUS_IS_OK(status)) {
    2361                 cli_set_error(cli, status);
    2362         }
    23632362        return status;
    23642363}
     
    24762475 fail:
    24772476        TALLOC_FREE(frame);
    2478         if (!NT_STATUS_IS_OK(status)) {
    2479                 cli_set_error(cli, status);
    2480         }
    24812477        return status;
    24822478}
     
    25382534        status = cli_locktype(cli, fnum, offset, len, timeout,
    25392535                              (lock_type == READ_LOCK? 1 : 0));
    2540         cli_set_error(cli, status);
    25412536        return NT_STATUS_IS_OK(status);
    25422537}
     
    26492644 fail:
    26502645        TALLOC_FREE(frame);
    2651         if (!NT_STATUS_IS_OK(status)) {
    2652                 cli_set_error(cli, status);
    2653         }
    26542646        return status;
    26552647}
     
    27022694        cli->timeout = saved_timeout;
    27032695
    2704         cli_set_error(cli, status);
    27052696        return NT_STATUS_IS_OK(status);
    27062697}
     
    28172808 fail:
    28182809        TALLOC_FREE(frame);
    2819         if (!NT_STATUS_IS_OK(status)) {
    2820                 cli_set_error(cli, status);
    2821         }
    28222810        return status;
    28232811}
     
    29912979 fail:
    29922980        TALLOC_FREE(frame);
    2993         if (!NT_STATUS_IS_OK(status)) {
    2994                 cli_set_error(cli, status);
    2995         }
    29962981        return status;
    29972982}
     
    30583043 fail:
    30593044        TALLOC_FREE(frame);
    3060         if (!NT_STATUS_IS_OK(status)) {
    3061                 cli_set_error(cli, status);
    3062         }
    30633045        return status;
    30643046}
     
    32123194 fail:
    32133195        TALLOC_FREE(frame);
    3214         if (!NT_STATUS_IS_OK(status)) {
    3215                 cli_set_error(cli, status);
    3216         }
    32173196        return status;
    32183197}
     
    33613340 fail:
    33623341        TALLOC_FREE(frame);
    3363         if (!NT_STATUS_IS_OK(status)) {
    3364                 cli_set_error(cli, status);
    3365         }
    33663342        return status;
    33673343}
     
    34763452 fail:
    34773453        TALLOC_FREE(frame);
    3478         if (!NT_STATUS_IS_OK(status)) {
    3479                 cli_set_error(cli, status);
    3480         }
    34813454        return status;
    34823455}
     
    36023575 fail:
    36033576        TALLOC_FREE(frame);
    3604         if (!NT_STATUS_IS_OK(status)) {
    3605                 cli_set_error(cli, status);
    3606         }
    36073577        return status;
    36083578}
     
    37243694 fail:
    37253695        TALLOC_FREE(frame);
    3726         if (!NT_STATUS_IS_OK(status)) {
    3727                 cli_set_error(cli, status);
    3728         }
    37293696        return status;
    37303697}
     
    38383805 fail:
    38393806        TALLOC_FREE(frame);
    3840         if (!NT_STATUS_IS_OK(status)) {
    3841                 cli_set_error(cli, status);
    3842         }
    38433807        return status;
    38443808}
     
    39953959 fail:
    39963960        TALLOC_FREE(frame);
    3997         if (!NT_STATUS_IS_OK(status)) {
    3998                 cli_set_error(cli, status);
    3999         }
    40003961        return status;
    40013962}
     
    43244285 fail:
    43254286        TALLOC_FREE(frame);
    4326         if (!NT_STATUS_IS_OK(status)) {
    4327                 cli_set_error(cli, status);
    4328         }
    43294287        return status;
    43304288}
     
    45534511 fail:
    45544512        TALLOC_FREE(frame);
    4555         if (!NT_STATUS_IS_OK(status)) {
    4556                 cli_set_error(cli, status);
    4557         }
    45584513        return status;
    45594514}
     
    46144569 fail:
    46154570        TALLOC_FREE(frame);
    4616         if (!NT_STATUS_IS_OK(status)) {
    4617                 cli_set_error(cli, status);
    4618         }
    46194571        return status;
    46204572}
     
    47224674 fail:
    47234675        TALLOC_FREE(frame);
    4724         if (!NT_STATUS_IS_OK(status)) {
    4725                 cli_set_error(cli, status);
    4726         }
    47274676        return status;
    47284677}
     
    47864735 fail:
    47874736        TALLOC_FREE(frame);
    4788         if (!NT_STATUS_IS_OK(status)) {
    4789                 cli_set_error(cli, status);
    4790         }
    47914737        return status;
    47924738}
     
    50715017 fail:
    50725018        TALLOC_FREE(frame);
    5073         if (!NT_STATUS_IS_OK(status)) {
    5074                 cli_set_error(cli, status);
    5075         }
    50765019        return status;
    50775020}
     
    52035146 fail:
    52045147        TALLOC_FREE(frame);
    5205         if (!NT_STATUS_IS_OK(status)) {
    5206                 cli_set_error(cli, status);
    5207         }
    52085148        return status;
    52095149}
     
    52855225 fail:
    52865226        TALLOC_FREE(frame);
    5287         if (!NT_STATUS_IS_OK(status)) {
    5288                 cli_set_error(cli, status);
    5289         }
    52905227        return status;
    52915228}
     
    53205257        SIVAL(state->setup + 0, 0, FSCTL_GET_SHADOW_COPY_DATA);
    53215258        SSVAL(state->setup + 2, 0, fnum);
    5322         SCVAL(state->setup + 3, 0, 0); /* isFsctl */
     5259        SCVAL(state->setup + 3, 0, 1); /* isFsctl */
    53235260        SCVAL(state->setup + 3, 1, 0); /* compfilter, isFlags (WSSP) */
    53245261
     
    54335370 fail:
    54345371        TALLOC_FREE(frame);
    5435         if (!NT_STATUS_IS_OK(status)) {
    5436                 cli_set_error(cli, status);
    5437         }
    54385372        return status;
    54395373}
Note: See TracChangeset for help on using the changeset viewer.