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

Samba Server: updated vendor to 3.6.9

Location:
vendor/current/source3/libsmb
Files:
17 edited

Legend:

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

    r740 r746  
    872872
    873873        status = cli_pull_error((char *)state->inbuf);
     874
     875        cli_set_error(state->cli, status);
    874876
    875877        if (!have_andx_command((char *)state->inbuf, wct_ofs)) {
  • vendor/current/source3/libsmb/cliconnect.c

    r740 r746  
    362362 fail:
    363363        TALLOC_FREE(frame);
    364         if (!NT_STATUS_IS_OK(status)) {
    365                 cli_set_error(cli, status);
    366         }
    367364        return status;
    368365}
     
    599596 fail:
    600597        TALLOC_FREE(frame);
    601         if (!NT_STATUS_IS_OK(status)) {
    602                 cli_set_error(cli, status);
    603         }
    604598        return status;
    605599}
     
    803797 fail:
    804798        TALLOC_FREE(frame);
    805         if (!NT_STATUS_IS_OK(status)) {
    806                 cli_set_error(cli, status);
    807         }
    808799        return status;
    809800}
     
    11711162 fail:
    11721163        TALLOC_FREE(frame);
    1173         if (!NT_STATUS_IS_OK(status)) {
    1174                 cli_set_error(cli, status);
    1175         }
    11761164        return status;
    11771165}
     
    17891777fail:
    17901778        TALLOC_FREE(ev);
    1791         if (!NT_STATUS_IS_OK(status)) {
    1792                 cli_set_error(cli, status);
    1793         }
    17941779        return status;
    17951780}
     
    20131998
    20141999        if (cli->protocol < PROTOCOL_LANMAN1) {
     2000                /*
     2001                 * Ensure cli->server_domain,
     2002                 * cli->server_os and cli->server_type
     2003                 * are valid pointers.
     2004                 */
     2005                cli->server_domain = talloc_strdup(cli, "");
     2006                cli->server_os = talloc_strdup(cli, "");
     2007                cli->server_type = talloc_strdup(cli, "");
     2008                if (cli->server_domain == NULL ||
     2009                                cli->server_os == NULL ||
     2010                                cli->server_type == NULL) {
     2011                        return NT_STATUS_NO_MEMORY;
     2012                }
    20152013                return NT_STATUS_OK;
    20162014        }
     
    21762174fail:
    21772175        TALLOC_FREE(ev);
    2178         if (!NT_STATUS_IS_OK(status)) {
    2179                 cli_set_error(cli, status);
    2180         }
    21812176        return status;
    21822177}
     
    24722467 fail:
    24732468        TALLOC_FREE(frame);
    2474         if (!NT_STATUS_IS_OK(status)) {
    2475                 cli_set_error(cli, status);
    2476         }
    24772469        return status;
    24782470}
     
    25552547fail:
    25562548        TALLOC_FREE(ev);
    2557         if (!NT_STATUS_IS_OK(status)) {
    2558                 cli_set_error(cli, status);
    2559         }
    25602549        return status;
    25612550}
     
    26672656                struct timespec ts;
    26682657                bool negotiated_smb_signing = false;
     2658                DATA_BLOB blob = data_blob_null;
     2659
     2660                if (wct != 0x11) {
     2661                        tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
     2662                        return;
     2663                }
    26692664
    26702665                /* NT protocol */
     
    26872682                if (!(cli->capabilities & CAP_EXTENDED_SECURITY) &&
    26882683                    smb_buflen(inbuf) > 8) {
     2684                        blob = data_blob_const(bytes + 8, num_bytes - 8);
     2685                }
     2686
     2687                if (blob.length > 0) {
    26892688                        ssize_t ret;
    2690                         status = smb_bytes_talloc_string(
    2691                                 cli, (char *)inbuf, &cli->server_domain,
    2692                                 bytes + 8, num_bytes - 8, &ret);
    2693                         if (tevent_req_nterror(req, status)) {
     2689                        char *server_domain = NULL;
     2690
     2691                        ret = clistr_pull_talloc(cli,
     2692                                                 (const char *)inbuf,
     2693                                                 SVAL(inbuf, smb_flg2),
     2694                                                 &server_domain,
     2695                                                 (char *)blob.data,
     2696                                                 blob.length,
     2697                                                 STR_TERMINATE|
     2698                                                 STR_UNICODE|
     2699                                                 STR_NOALIGN);
     2700                        if (ret == -1) {
     2701                                tevent_req_nterror(req, NT_STATUS_NO_MEMORY);
    26942702                                return;
     2703                        }
     2704                        if (server_domain) {
     2705                                cli->server_domain = server_domain;
    26952706                        }
    26962707                }
     
    27412752
    27422753        } else if (cli->protocol >= PROTOCOL_LANMAN1) {
     2754                if (wct != 0x0D) {
     2755                        tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
     2756                        return;
     2757                }
     2758
    27432759                cli->use_spnego = False;
    27442760                cli->sec_mode = SVAL(vwv + 1, 0);
     
    28102826 fail:
    28112827        TALLOC_FREE(frame);
    2812         if (!NT_STATUS_IS_OK(status)) {
    2813                 cli_set_error(cli, status);
    2814         }
    28152828        return status;
    28162829}
  • vendor/current/source3/libsmb/clidgram.c

    r740 r746  
    437437
    438438NTSTATUS nbt_getdc(struct messaging_context *msg_ctx,
     439                   uint32_t timeout_in_seconds,
    439440                   const struct sockaddr_storage *dc_addr,
    440441                   const char *domain_name,
     
    460461                goto fail;
    461462        }
     463        if (!tevent_req_set_endtime(req, ev,
     464                        timeval_current_ofs(timeout_in_seconds, 0))) {
     465                goto fail;
     466        }
    462467        if (!tevent_req_poll_ntstatus(req, ev, &status)) {
    463468                goto fail;
  • vendor/current/source3/libsmb/clidgram.h

    r740 r746  
    3838                        struct netlogon_samlogon_response **samlogon_response);
    3939NTSTATUS nbt_getdc(struct messaging_context *msg_ctx,
     40                   uint32_t timeout_in_seconds,
    4041                   const struct sockaddr_storage *dc_addr,
    4142                   const char *domain_name,
  • 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}
  • vendor/current/source3/libsmb/clifsinfo.c

    r740 r746  
    154154 fail:
    155155        TALLOC_FREE(frame);
    156         if (!NT_STATUS_IS_OK(status)) {
    157                 cli_set_error(cli, status);
    158         }
    159156        return status;
    160157}
     
    259256fail:
    260257        TALLOC_FREE(ev);
    261         if (!NT_STATUS_IS_OK(status)) {
    262                 cli_set_error(cli, status);
    263         }
    264258        return status;
    265259}
     
    358352fail:
    359353        TALLOC_FREE(ev);
    360         if (!NT_STATUS_IS_OK(status)) {
    361                 cli_set_error(cli, status);
    362         }
    363354        return status;
    364355}
  • vendor/current/source3/libsmb/clikrb5.c

    r740 r746  
    489489}
    490490
    491 #if !defined(HAVE_KRB5_LOCATE_KDC)
    492 
    493 /* krb5_locate_kdc is an internal MIT symbol. MIT are not yet willing to commit
    494  * to a public interface for this functionality, so we have to be able to live
    495  * without it if the MIT libraries are hiding their internal symbols.
    496  */
    497 
    498 #if defined(KRB5_KRBHST_INIT)
    499 /* Heimdal */
    500  krb5_error_code smb_krb5_locate_kdc(krb5_context ctx, const krb5_data *realm, struct sockaddr **addr_pp, int *naddrs, int get_masters)
    501 {
    502         krb5_krbhst_handle hnd;
    503         krb5_krbhst_info *hinfo;
    504         krb5_error_code rc;
    505         int num_kdcs, i;
    506         struct sockaddr *sa;
    507         struct addrinfo *ai;
    508 
    509         *addr_pp = NULL;
    510         *naddrs = 0;
    511 
    512         rc = krb5_krbhst_init(ctx, realm->data, KRB5_KRBHST_KDC, &hnd);
    513         if (rc) {
    514                 DEBUG(0, ("smb_krb5_locate_kdc: krb5_krbhst_init failed (%s)\n", error_message(rc)));
    515                 return rc;
    516         }
    517 
    518         for ( num_kdcs = 0; (rc = krb5_krbhst_next(ctx, hnd, &hinfo) == 0); num_kdcs++)
    519                 ;
    520 
    521         krb5_krbhst_reset(ctx, hnd);
    522 
    523         if (!num_kdcs) {
    524                 DEBUG(0, ("smb_krb5_locate_kdc: zero kdcs found !\n"));
    525                 krb5_krbhst_free(ctx, hnd);
    526                 return -1;
    527         }
    528 
    529         sa = SMB_MALLOC_ARRAY( struct sockaddr, num_kdcs );
    530         if (!sa) {
    531                 DEBUG(0, ("smb_krb5_locate_kdc: malloc failed\n"));
    532                 krb5_krbhst_free(ctx, hnd);
    533                 naddrs = 0;
    534                 return -1;
    535         }
    536 
    537         memset(sa, '\0', sizeof(struct sockaddr) * num_kdcs );
    538 
    539         for (i = 0; i < num_kdcs && (rc = krb5_krbhst_next(ctx, hnd, &hinfo) == 0); i++) {
    540 
    541 #if defined(HAVE_KRB5_KRBHST_GET_ADDRINFO)
    542                 rc = krb5_krbhst_get_addrinfo(ctx, hinfo, &ai);
    543                 if (rc) {
    544                         DEBUG(0,("krb5_krbhst_get_addrinfo failed: %s\n", error_message(rc)));
    545                         continue;
    546                 }
    547 #endif
    548                 if (hinfo->ai && hinfo->ai->ai_family == AF_INET)
    549                         memcpy(&sa[i], hinfo->ai->ai_addr, sizeof(struct sockaddr));
    550         }
    551 
    552         krb5_krbhst_free(ctx, hnd);
    553 
    554         *naddrs = num_kdcs;
    555         *addr_pp = sa;
    556         return 0;
    557 }
    558 
    559 #else /* ! defined(KRB5_KRBHST_INIT) */
    560 
    561  krb5_error_code smb_krb5_locate_kdc(krb5_context ctx, const krb5_data *realm,
    562                 struct sockaddr **addr_pp, int *naddrs, int get_masters)
    563 {
    564         DEBUG(0, ("unable to explicitly locate the KDC on this platform\n"));
    565         return KRB5_KDC_UNREACH;
    566 }
    567 
    568 #endif /* KRB5_KRBHST_INIT */
    569 
    570 #else /* ! HAVE_KRB5_LOCATE_KDC */
    571 
    572  krb5_error_code smb_krb5_locate_kdc(krb5_context ctx, const krb5_data *realm,
    573                 struct sockaddr **addr_pp, int *naddrs, int get_masters)
    574 {
    575         return krb5_locate_kdc(ctx, realm, addr_pp, naddrs, get_masters);
    576 }
    577 
    578 #endif /* HAVE_KRB5_LOCATE_KDC */
    579 
    580491#if !defined(HAVE_KRB5_FREE_UNPARSED_NAME)
    581492 void krb5_free_unparsed_name(krb5_context context, char *val)
     
    21082019        }
    21092020
    2110         ret = krb5_cc_store_cred(context, ccache, creds);
    2111         if (ret) {
    2112                 goto done;
    2113         }
    2114 
    21152021        if (out_creds) {
    21162022                *out_creds = creds;
  • vendor/current/source3/libsmb/clilist.c

    r740 r746  
    515515 fail:
    516516        TALLOC_FREE(frame);
    517         if (!NT_STATUS_IS_OK(status)) {
    518                 cli_set_error(cli, status);
    519         }
    520517        return status;
    521518}
     
    844841 fail:
    845842        TALLOC_FREE(frame);
    846         if (!NT_STATUS_IS_OK(status)) {
    847                 cli_set_error(cli, status);
    848         }
    849843        return status;
    850844}
     
    969963 fail:
    970964        TALLOC_FREE(frame);
    971         if (!NT_STATUS_IS_OK(status)) {
    972                 cli_set_error(cli, status);
    973         }
    974965        return status;
    975966}
  • vendor/current/source3/libsmb/clioplock.c

    r740 r746  
    119119 fail:
    120120        TALLOC_FREE(frame);
    121         if (!NT_STATUS_IS_OK(status)) {
    122                 cli_set_error(cli, status);
    123         }
    124121        return status;
    125122}
  • vendor/current/source3/libsmb/clirap.c

    r740 r746  
    690690 fail:
    691691        TALLOC_FREE(frame);
    692         if (!NT_STATUS_IS_OK(status)) {
    693                 cli_set_error(cli, status);
    694         }
    695692        return status;
    696693}
     
    868865 fail:
    869866        TALLOC_FREE(frame);
    870         if (!NT_STATUS_IS_OK(status)) {
    871                 cli_set_error(cli, status);
    872         }
    873867        return status;
    874868}
     
    982976 fail:
    983977        TALLOC_FREE(frame);
    984         if (!NT_STATUS_IS_OK(status)) {
    985                 cli_set_error(cli, status);
    986         }
    987978        return status;
    988979}
     
    12501241 fail:
    12511242        TALLOC_FREE(frame);
    1252         if (!NT_STATUS_IS_OK(status)) {
    1253                 cli_set_error(cli, status);
    1254         }
    12551243        return status;
    12561244}
  • vendor/current/source3/libsmb/clireadwrite.c

    r740 r746  
    134134        SSVAL(state->vwv + 9, 0, 0);
    135135
    136         if ((uint64_t)offset >> 32) {
     136        if (cli->capabilities & CAP_LARGE_FILES) {
    137137                SIVAL(state->vwv + 10, 0,
    138138                      (((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                }
    140147        }
    141148
     
    216223        state->buf = (uint8_t *)smb_base(inbuf) + SVAL(vwv+6, 0);
    217224
    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)
    219226            || ((state->received != 0) && (state->buf < bytes))) {
    220227                DEBUG(5, ("server returned invalid read&x data offset\n"));
     
    681688 fail:
    682689        TALLOC_FREE(frame);
    683         if (!NT_STATUS_IS_OK(status)) {
    684                 cli_set_error(cli, status);
    685         }
    686690        return status;
    687691}
     
    704708                          cli_read_sink, &buf, &ret);
    705709        if (!NT_STATUS_IS_OK(status)) {
    706                 cli_set_error(cli, status);
    707710                return -1;
    708711        }
     
    812815        }
    813816
    814         size = MIN(size, max_write);
     817        state->size = MIN(size, max_write);
    815818
    816819        vwv = state->vwv;
     
    824827        SSVAL(vwv+7, 0, mode);
    825828        SSVAL(vwv+8, 0, 0);
    826         SSVAL(vwv+9, 0, (size>>16));
    827         SSVAL(vwv+10, 0, size);
     829        SSVAL(vwv+9, 0, (state->size>>16));
     830        SSVAL(vwv+10, 0, state->size);
    828831
    829832        SSVAL(vwv+11, 0,
     
    842845        state->iov[0].iov_len = 1;
    843846        state->iov[1].iov_base = CONST_DISCARD(void *, buf);
    844         state->iov[1].iov_len = size;
     847        state->iov[1].iov_len = state->size;
    845848
    846849        subreq = cli_smb_req_create(state, ev, cli, SMBwriteX, 0, wct, vwv,
     
    895898        }
    896899        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        }
    898912        tevent_req_done(req);
    899913}
     
    10451059 fail:
    10461060        TALLOC_FREE(frame);
    1047         if (!NT_STATUS_IS_OK(status)) {
    1048                 cli_set_error(cli, status);
    1049         }
    10501061        return status;
    10511062}
     
    12771288 fail:
    12781289        TALLOC_FREE(frame);
    1279         if (!NT_STATUS_IS_OK(status)) {
    1280                 cli_set_error(cli, status);
    1281         }
    12821290        return status;
    12831291}
  • vendor/current/source3/libsmb/clispnego.c

    r740 r746  
    104104        ASN1_DATA *data;
    105105
     106        for (i = 0; i < ASN1_MAX_OIDS; i++) {
     107                OIDs[i] = NULL;
     108        }
     109
    106110        data = asn1_init(talloc_tos());
    107111        if (data == NULL) {
     
    128132        for (i=0; asn1_tag_remaining(data) > 0 && i < ASN1_MAX_OIDS-1; i++) {
    129133                asn1_read_OID(data,ctx, &OIDs[i]);
     134                if (data->has_error) {
     135                        break;
     136                }
    130137        }
    131138        OIDs[i] = NULL;
     
    251258        ASN1_DATA *data;
    252259        int data_remaining;
     260        *ticket = data_blob_null;
    253261
    254262        data = asn1_init(talloc_tos());
  • vendor/current/source3/libsmb/clitrans.c

    r740 r746  
    209209        switch (cmd) {
    210210        case SMBtrans:
    211                 pad[0] = 0;
    212                 iov[0].iov_base = (void *)pad;
    213                 iov[0].iov_len = 1;
    214                 iov[1].iov_base = (void *)state->pipe_name_conv;
    215                 iov[1].iov_len = state->pipe_name_conv_len;
     211                if (cli_ucs2(state->cli)) {
     212                        pad[0] = 0;
     213                        iov[0].iov_base = (void *)pad;
     214                        iov[0].iov_len = 1;
     215                        param_offset += 1;
     216                        iov += 1;
     217                }
     218                iov[0].iov_base = (void *)state->pipe_name_conv;
     219                iov[0].iov_len = state->pipe_name_conv_len;
    216220                wct = 14 + state->num_setup;
    217                 param_offset += iov[0].iov_len + iov[1].iov_len;
    218                 iov += 2;
     221                param_offset += iov[0].iov_len;
     222                iov += 1;
    219223                break;
    220224        case SMBtrans2:
     
    762766 fail:
    763767        TALLOC_FREE(frame);
    764         if (!NT_STATUS_IS_OK(status)) {
    765                 cli_set_error(cli, status);
    766         }
    767768        return status;
    768769}
  • vendor/current/source3/libsmb/dsgetdcname.c

    r740 r746  
    951951                }
    952952
    953                 status = nbt_getdc(msg_ctx, &dclist[i].ss, domain_name,
     953                status = nbt_getdc(msg_ctx, 10, &dclist[i].ss, domain_name,
    954954                                   NULL, nt_version,
    955955                                   mem_ctx, &nt_version, &dc_name, &r);
  • vendor/current/source3/libsmb/namequery.c

    r740 r746  
    10791079                        "looking for duplicate address/port pairs\n"));
    10801080
    1081         /* one loop to remove duplicates */
     1081        /* One loop to set duplicates to a zero addr. */
    10821082        for ( i=0; i<count; i++ ) {
    10831083                if ( is_zero_addr(&iplist[i].ss)) {
     
    10931093        }
    10941094
    1095         /* one loop to clean up any holes we left */
    1096         /* first ip should never be a zero_ip() */
    1097         for (i = 0; i<count; ) {
    1098                 if (is_zero_addr(&iplist[i].ss) ) {
    1099                         if (i != count-1) {
    1100                                 memmove(&iplist[i], &iplist[i+1],
    1101                                         (count - i - 1)*sizeof(iplist[i]));
     1095        /* Now remove any addresses set to zero above. */
     1096        for (i = 0; i < count; i++) {
     1097                while (i < count &&
     1098                                is_zero_addr(&iplist[i].ss)) {
     1099                        if (count-i-1>0) {
     1100                                memmove(&iplist[i],
     1101                                        &iplist[i+1],
     1102                                        (count-i-1)*sizeof(struct ip_service));
    11021103                        }
    11031104                        count--;
    1104                         continue;
    1105                 }
    1106                 i++;
     1105                }
    11071106        }
    11081107
     
    13401339                in_addr_to_sockaddr_storage(&addr, ip);
    13411340
     1341                if (is_zero_addr(&addr)) {
     1342                        continue;
     1343                }
     1344
    13421345                for (j=0; j<state->num_addrs; j++) {
    13431346                        if (sockaddr_equal(
     
    14771480
    14781481/********************************************************
    1479  convert an array if struct sockaddr_storage to struct ip_service
     1482 Convert an array if struct sockaddr_storage to struct ip_service
    14801483 return false on failure.  Port is set to PORT_NONE;
     1484 pcount is [in/out] - it is the length of ss_list on input,
     1485 and the length of return_iplist on output as we remove any
     1486 zero addresses from ss_list.
    14811487*********************************************************/
    14821488
    14831489static bool convert_ss2service(struct ip_service **return_iplist,
    14841490                const struct sockaddr_storage *ss_list,
    1485                 int count)
     1491                int *pcount)
    14861492{
    14871493        int i;
    1488 
    1489         if ( count==0 || !ss_list )
     1494        int orig_count = *pcount;
     1495        int real_count = 0;
     1496
     1497        if (orig_count==0 || !ss_list )
    14901498                return False;
    14911499
     1500        /* Filter out zero addrs. */
     1501        for ( i=0; i<orig_count; i++ ) {
     1502                if (is_zero_addr(&ss_list[i])) {
     1503                        continue;
     1504                }
     1505                real_count++;
     1506        }
     1507        if (real_count==0) {
     1508                return false;
     1509        }
     1510
    14921511        /* copy the ip address; port will be PORT_NONE */
    1493         if ((*return_iplist = SMB_MALLOC_ARRAY(struct ip_service, count)) ==
     1512        if ((*return_iplist = SMB_MALLOC_ARRAY(struct ip_service, real_count)) ==
    14941513                        NULL) {
    14951514                DEBUG(0,("convert_ip2service: malloc failed "
    1496                         "for %d enetries!\n", count ));
     1515                        "for %d enetries!\n", real_count ));
    14971516                return False;
    14981517        }
    14991518
    1500         for ( i=0; i<count; i++ ) {
    1501                 (*return_iplist)[i].ss   = ss_list[i];
    1502                 (*return_iplist)[i].port = PORT_NONE;
    1503         }
    1504 
     1519        for ( i=0, real_count = 0; i<orig_count; i++ ) {
     1520                if (is_zero_addr(&ss_list[i])) {
     1521                        continue;
     1522                }
     1523                (*return_iplist)[real_count].ss   = ss_list[i];
     1524                (*return_iplist)[real_count].port = PORT_NONE;
     1525                real_count++;
     1526        }
     1527
     1528        *pcount = real_count;
    15051529        return true;
    15061530}
     
    16861710
    16871711        status = NT_STATUS_OK;
    1688         if (!convert_ss2service(return_iplist, ss_list, *return_count))
     1712        if (!convert_ss2service(return_iplist, ss_list, return_count))
    16891713                status = NT_STATUS_INVALID_PARAMETER;
    16901714
     
    17301754                if (convert_ss2service(return_iplist,
    17311755                                       ss_list,
    1732                                        *return_count)) {
     1756                                       return_count)) {
    17331757                        talloc_free(ctx);
    17341758                        return NT_STATUS_OK;
     
    18031827                memcpy(&ss, res->ai_addr, res->ai_addrlen);
    18041828
     1829                if (is_zero_addr(&ss)) {
     1830                        continue;
     1831                }
     1832
    18051833                *return_count += 1;
    18061834
     
    18391867                            int *return_count)
    18401868{
    1841         int                     i, j;
     1869        int                     i;
    18421870        NTSTATUS                status;
    18431871        TALLOC_CTX              *ctx;
     
    18881916
    18891917        for (i=0;i<numdcs;i++) {
    1890                 numaddrs += MAX(dcs[i].num_ips,1);
    1891         }
     1918                if (!dcs[i].ss_s) {
     1919                        numaddrs += 1;
     1920                } else {
     1921                        numaddrs += dcs[i].num_ips;
     1922                }
     1923        }
    18921924
    18931925        if ((*return_iplist = SMB_MALLOC_ARRAY(struct ip_service, numaddrs)) ==
     
    19021934
    19031935        *return_count = 0;
    1904         i = 0;
    1905         j = 0;
    1906         while ( i < numdcs && (*return_count<numaddrs) ) {
    1907                 struct ip_service *r = &(*return_iplist)[*return_count];
    1908 
    1909                 r->port = dcs[i].port;
    1910 
     1936
     1937        for (i = 0; i < numdcs && (*return_count<numaddrs); i++ ) {
    19111938                /* If we don't have an IP list for a name, lookup it up */
    1912 
    19131939                if (!dcs[i].ss_s) {
    1914                         interpret_string_addr(&r->ss, dcs[i].hostname, 0);
    1915                         i++;
    1916                         j = 0;
    1917                 } else {
    1918                         /* use the IP addresses from the SRV sresponse */
    1919 
    1920                         if ( j >= dcs[i].num_ips ) {
    1921                                 i++;
    1922                                 j = 0;
     1940                        /* We need to get all IP addresses here. */
     1941                        struct addrinfo *res = NULL;
     1942                        struct addrinfo *p;
     1943                        int extra_addrs = 0;
     1944
     1945                        if (!interpret_string_addr_internal(&res,
     1946                                                dcs[i].hostname,
     1947                                                0)) {
    19231948                                continue;
    19241949                        }
    1925 
    1926                         r->ss = dcs[i].ss_s[j];
    1927                         j++;
    1928                 }
    1929 
    1930                 /* make sure it is a valid IP.  I considered checking the
    1931                  * negative connection cache, but this is the wrong place
    1932                  * for it. Maybe only as a hack. After think about it, if
    1933                  * all of the IP addresses returned from DNS are dead, what
    1934                  * hope does a netbios name lookup have ? The standard reason
    1935                  * for falling back to netbios lookups is that our DNS server
    1936                  * doesn't know anything about the DC's   -- jerry */
    1937 
    1938                 if (!is_zero_addr(&r->ss)) {
    1939                         (*return_count)++;
     1950                        /* Add in every IP from the lookup. How
     1951                           many is that ? */
     1952                        for (p = res; p; p = p->ai_next) {
     1953                                struct sockaddr_storage ss;
     1954                                memcpy(&ss, p->ai_addr, p->ai_addrlen);
     1955                                if (is_zero_addr(&ss)) {
     1956                                        continue;
     1957                                }
     1958                                extra_addrs++;
     1959                        }
     1960                        if (extra_addrs > 1) {
     1961                                /* We need to expand the return_iplist array
     1962                                   as we only budgeted for one address. */
     1963                                numaddrs += (extra_addrs-1);
     1964                                *return_iplist = SMB_REALLOC_ARRAY(*return_iplist,
     1965                                                struct ip_service,
     1966                                                numaddrs);
     1967                                if (*return_iplist == NULL) {
     1968                                        if (res) {
     1969                                                freeaddrinfo(res);
     1970                                        }
     1971                                        talloc_destroy(ctx);
     1972                                        return NT_STATUS_NO_MEMORY;
     1973                                }
     1974                        }
     1975                        for (p = res; p; p = p->ai_next) {
     1976                                (*return_iplist)[*return_count].port = dcs[i].port;
     1977                                memcpy(&(*return_iplist)[*return_count].ss,
     1978                                                p->ai_addr,
     1979                                                p->ai_addrlen);
     1980                                if (is_zero_addr(&(*return_iplist)[*return_count].ss)) {
     1981                                        continue;
     1982                                }
     1983                                (*return_count)++;
     1984                                /* Should never happen, but still... */
     1985                                if (*return_count>=numaddrs) {
     1986                                        break;
     1987                                }
     1988                        }
     1989                        if (res) {
     1990                                freeaddrinfo(res);
     1991                        }
     1992                } else {
     1993                        /* use all the IP addresses from the SRV sresponse */
     1994                        int j;
     1995                        for (j = 0; j < dcs[i].num_ips; j++) {
     1996                                (*return_iplist)[*return_count].port = dcs[i].port;
     1997                                (*return_iplist)[*return_count].ss = dcs[i].ss_s[j];
     1998                                if (is_zero_addr(&(*return_iplist)[*return_count].ss)) {
     1999                                        continue;
     2000                                }
     2001                                (*return_count)++;
     2002                                /* Should never happen, but still... */
     2003                                if (*return_count>=numaddrs) {
     2004                                        break;
     2005                                }
     2006                        }
    19402007                }
    19412008        }
     
    19942061                        return NT_STATUS_INVALID_PARAMETER;
    19952062                }
     2063                if (is_zero_addr(&(*return_iplist)->ss)) {
     2064                        SAFE_FREE(*return_iplist);
     2065                        return NT_STATUS_UNSUCCESSFUL;
     2066                }
    19962067                *return_count = 1;
    19972068                return NT_STATUS_OK;
     
    20012072
    20022073        if (namecache_fetch(name, name_type, return_iplist, return_count)) {
     2074                *return_count = remove_duplicate_addrs2(*return_iplist,
     2075                                        *return_count );
    20032076                /* This could be a negative response */
    20042077                if (*return_count > 0) {
     
    20752148                                if (!convert_ss2service(return_iplist,
    20762149                                                        ss_list,
    2077                                                         *return_count)) {
     2150                                                        return_count)) {
    20782151                                        status = NT_STATUS_NO_MEMORY;
    20792152                                }
     
    21012174        the iplist when the PDC is down will cause two sets of timeouts. */
    21022175
    2103         if ( *return_count ) {
    2104                 *return_count = remove_duplicate_addrs2(*return_iplist,
    2105                                         *return_count );
    2106         }
     2176        *return_count = remove_duplicate_addrs2(*return_iplist, *return_count );
    21072177
    21082178        /* Save in name cache */
     
    21202190        }
    21212191
    2122         namecache_store(name, name_type, *return_count, *return_iplist);
     2192        if (*return_count) {
     2193                namecache_store(name, name_type, *return_count, *return_iplist);
     2194        }
    21232195
    21242196        /* Display some debugging info */
     
    25832655           explicit password servers */
    25842656
    2585         if (local_count) {
    2586                 local_count = remove_duplicate_addrs2(return_iplist,
    2587                                 local_count );
    2588         }
     2657        local_count = remove_duplicate_addrs2(return_iplist, local_count );
    25892658
    25902659        /* For DC's we always prioritize IPv4 due to W2K3 not
  • vendor/current/source3/libsmb/ntlmssp.c

    r740 r746  
    613613                }
    614614        } else if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_NTLM2) {
    615                 struct MD5Context md5_session_nonce_ctx;
     615                MD5_CTX md5_session_nonce_ctx;
    616616                uint8_t session_nonce[16];
    617617                uint8_t session_nonce_hash[16];
  • vendor/current/source3/libsmb/smb_signing.c

    r740 r746  
    138138        const size_t offset_end_of_sig = (smb_ss_field + 8);
    139139        uint8_t sequence_buf[8];
    140         struct MD5Context md5_ctx;
     140        MD5_CTX md5_ctx;
    141141
    142142        /*
Note: See TracChangeset for help on using the changeset viewer.