Changeset 746 for vendor/current/source3/libsmb
- Timestamp:
- Nov 27, 2012, 4:56:06 PM (13 years ago)
- Location:
- vendor/current/source3/libsmb
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/libsmb/async_smb.c
r740 r746 872 872 873 873 status = cli_pull_error((char *)state->inbuf); 874 875 cli_set_error(state->cli, status); 874 876 875 877 if (!have_andx_command((char *)state->inbuf, wct_ofs)) { -
vendor/current/source3/libsmb/cliconnect.c
r740 r746 362 362 fail: 363 363 TALLOC_FREE(frame); 364 if (!NT_STATUS_IS_OK(status)) {365 cli_set_error(cli, status);366 }367 364 return status; 368 365 } … … 599 596 fail: 600 597 TALLOC_FREE(frame); 601 if (!NT_STATUS_IS_OK(status)) {602 cli_set_error(cli, status);603 }604 598 return status; 605 599 } … … 803 797 fail: 804 798 TALLOC_FREE(frame); 805 if (!NT_STATUS_IS_OK(status)) {806 cli_set_error(cli, status);807 }808 799 return status; 809 800 } … … 1171 1162 fail: 1172 1163 TALLOC_FREE(frame); 1173 if (!NT_STATUS_IS_OK(status)) {1174 cli_set_error(cli, status);1175 }1176 1164 return status; 1177 1165 } … … 1789 1777 fail: 1790 1778 TALLOC_FREE(ev); 1791 if (!NT_STATUS_IS_OK(status)) {1792 cli_set_error(cli, status);1793 }1794 1779 return status; 1795 1780 } … … 2013 1998 2014 1999 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 } 2015 2013 return NT_STATUS_OK; 2016 2014 } … … 2176 2174 fail: 2177 2175 TALLOC_FREE(ev); 2178 if (!NT_STATUS_IS_OK(status)) {2179 cli_set_error(cli, status);2180 }2181 2176 return status; 2182 2177 } … … 2472 2467 fail: 2473 2468 TALLOC_FREE(frame); 2474 if (!NT_STATUS_IS_OK(status)) {2475 cli_set_error(cli, status);2476 }2477 2469 return status; 2478 2470 } … … 2555 2547 fail: 2556 2548 TALLOC_FREE(ev); 2557 if (!NT_STATUS_IS_OK(status)) {2558 cli_set_error(cli, status);2559 }2560 2549 return status; 2561 2550 } … … 2667 2656 struct timespec ts; 2668 2657 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 } 2669 2664 2670 2665 /* NT protocol */ … … 2687 2682 if (!(cli->capabilities & CAP_EXTENDED_SECURITY) && 2688 2683 smb_buflen(inbuf) > 8) { 2684 blob = data_blob_const(bytes + 8, num_bytes - 8); 2685 } 2686 2687 if (blob.length > 0) { 2689 2688 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); 2694 2702 return; 2703 } 2704 if (server_domain) { 2705 cli->server_domain = server_domain; 2695 2706 } 2696 2707 } … … 2741 2752 2742 2753 } else if (cli->protocol >= PROTOCOL_LANMAN1) { 2754 if (wct != 0x0D) { 2755 tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); 2756 return; 2757 } 2758 2743 2759 cli->use_spnego = False; 2744 2760 cli->sec_mode = SVAL(vwv + 1, 0); … … 2810 2826 fail: 2811 2827 TALLOC_FREE(frame); 2812 if (!NT_STATUS_IS_OK(status)) {2813 cli_set_error(cli, status);2814 }2815 2828 return status; 2816 2829 } -
vendor/current/source3/libsmb/clidgram.c
r740 r746 437 437 438 438 NTSTATUS nbt_getdc(struct messaging_context *msg_ctx, 439 uint32_t timeout_in_seconds, 439 440 const struct sockaddr_storage *dc_addr, 440 441 const char *domain_name, … … 460 461 goto fail; 461 462 } 463 if (!tevent_req_set_endtime(req, ev, 464 timeval_current_ofs(timeout_in_seconds, 0))) { 465 goto fail; 466 } 462 467 if (!tevent_req_poll_ntstatus(req, ev, &status)) { 463 468 goto fail; -
vendor/current/source3/libsmb/clidgram.h
r740 r746 38 38 struct netlogon_samlogon_response **samlogon_response); 39 39 NTSTATUS nbt_getdc(struct messaging_context *msg_ctx, 40 uint32_t timeout_in_seconds, 40 41 const struct sockaddr_storage *dc_addr, 41 42 const char *domain_name, -
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 } -
vendor/current/source3/libsmb/clifsinfo.c
r740 r746 154 154 fail: 155 155 TALLOC_FREE(frame); 156 if (!NT_STATUS_IS_OK(status)) {157 cli_set_error(cli, status);158 }159 156 return status; 160 157 } … … 259 256 fail: 260 257 TALLOC_FREE(ev); 261 if (!NT_STATUS_IS_OK(status)) {262 cli_set_error(cli, status);263 }264 258 return status; 265 259 } … … 358 352 fail: 359 353 TALLOC_FREE(ev); 360 if (!NT_STATUS_IS_OK(status)) {361 cli_set_error(cli, status);362 }363 354 return status; 364 355 } -
vendor/current/source3/libsmb/clikrb5.c
r740 r746 489 489 } 490 490 491 #if !defined(HAVE_KRB5_LOCATE_KDC)492 493 /* krb5_locate_kdc is an internal MIT symbol. MIT are not yet willing to commit494 * to a public interface for this functionality, so we have to be able to live495 * 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 #endif548 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 580 491 #if !defined(HAVE_KRB5_FREE_UNPARSED_NAME) 581 492 void krb5_free_unparsed_name(krb5_context context, char *val) … … 2108 2019 } 2109 2020 2110 ret = krb5_cc_store_cred(context, ccache, creds);2111 if (ret) {2112 goto done;2113 }2114 2115 2021 if (out_creds) { 2116 2022 *out_creds = creds; -
vendor/current/source3/libsmb/clilist.c
r740 r746 515 515 fail: 516 516 TALLOC_FREE(frame); 517 if (!NT_STATUS_IS_OK(status)) {518 cli_set_error(cli, status);519 }520 517 return status; 521 518 } … … 844 841 fail: 845 842 TALLOC_FREE(frame); 846 if (!NT_STATUS_IS_OK(status)) {847 cli_set_error(cli, status);848 }849 843 return status; 850 844 } … … 969 963 fail: 970 964 TALLOC_FREE(frame); 971 if (!NT_STATUS_IS_OK(status)) {972 cli_set_error(cli, status);973 }974 965 return status; 975 966 } -
vendor/current/source3/libsmb/clioplock.c
r740 r746 119 119 fail: 120 120 TALLOC_FREE(frame); 121 if (!NT_STATUS_IS_OK(status)) {122 cli_set_error(cli, status);123 }124 121 return status; 125 122 } -
vendor/current/source3/libsmb/clirap.c
r740 r746 690 690 fail: 691 691 TALLOC_FREE(frame); 692 if (!NT_STATUS_IS_OK(status)) {693 cli_set_error(cli, status);694 }695 692 return status; 696 693 } … … 868 865 fail: 869 866 TALLOC_FREE(frame); 870 if (!NT_STATUS_IS_OK(status)) {871 cli_set_error(cli, status);872 }873 867 return status; 874 868 } … … 982 976 fail: 983 977 TALLOC_FREE(frame); 984 if (!NT_STATUS_IS_OK(status)) {985 cli_set_error(cli, status);986 }987 978 return status; 988 979 } … … 1250 1241 fail: 1251 1242 TALLOC_FREE(frame); 1252 if (!NT_STATUS_IS_OK(status)) {1253 cli_set_error(cli, status);1254 }1255 1243 return status; 1256 1244 } -
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 } -
vendor/current/source3/libsmb/clispnego.c
r740 r746 104 104 ASN1_DATA *data; 105 105 106 for (i = 0; i < ASN1_MAX_OIDS; i++) { 107 OIDs[i] = NULL; 108 } 109 106 110 data = asn1_init(talloc_tos()); 107 111 if (data == NULL) { … … 128 132 for (i=0; asn1_tag_remaining(data) > 0 && i < ASN1_MAX_OIDS-1; i++) { 129 133 asn1_read_OID(data,ctx, &OIDs[i]); 134 if (data->has_error) { 135 break; 136 } 130 137 } 131 138 OIDs[i] = NULL; … … 251 258 ASN1_DATA *data; 252 259 int data_remaining; 260 *ticket = data_blob_null; 253 261 254 262 data = asn1_init(talloc_tos()); -
vendor/current/source3/libsmb/clitrans.c
r740 r746 209 209 switch (cmd) { 210 210 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; 216 220 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; 219 223 break; 220 224 case SMBtrans2: … … 762 766 fail: 763 767 TALLOC_FREE(frame); 764 if (!NT_STATUS_IS_OK(status)) {765 cli_set_error(cli, status);766 }767 768 return status; 768 769 } -
vendor/current/source3/libsmb/dsgetdcname.c
r740 r746 951 951 } 952 952 953 status = nbt_getdc(msg_ctx, &dclist[i].ss, domain_name,953 status = nbt_getdc(msg_ctx, 10, &dclist[i].ss, domain_name, 954 954 NULL, nt_version, 955 955 mem_ctx, &nt_version, &dc_name, &r); -
vendor/current/source3/libsmb/namequery.c
r740 r746 1079 1079 "looking for duplicate address/port pairs\n")); 1080 1080 1081 /* one loop to remove duplicates*/1081 /* One loop to set duplicates to a zero addr. */ 1082 1082 for ( i=0; i<count; i++ ) { 1083 1083 if ( is_zero_addr(&iplist[i].ss)) { … … 1093 1093 } 1094 1094 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)); 1102 1103 } 1103 1104 count--; 1104 continue; 1105 } 1106 i++; 1105 } 1107 1106 } 1108 1107 … … 1340 1339 in_addr_to_sockaddr_storage(&addr, ip); 1341 1340 1341 if (is_zero_addr(&addr)) { 1342 continue; 1343 } 1344 1342 1345 for (j=0; j<state->num_addrs; j++) { 1343 1346 if (sockaddr_equal( … … 1477 1480 1478 1481 /******************************************************** 1479 convert an array if struct sockaddr_storage to struct ip_service1482 Convert an array if struct sockaddr_storage to struct ip_service 1480 1483 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. 1481 1487 *********************************************************/ 1482 1488 1483 1489 static bool convert_ss2service(struct ip_service **return_iplist, 1484 1490 const struct sockaddr_storage *ss_list, 1485 int count)1491 int *pcount) 1486 1492 { 1487 1493 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 ) 1490 1498 return False; 1491 1499 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 1492 1511 /* 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)) == 1494 1513 NULL) { 1495 1514 DEBUG(0,("convert_ip2service: malloc failed " 1496 "for %d enetries!\n", count ));1515 "for %d enetries!\n", real_count )); 1497 1516 return False; 1498 1517 } 1499 1518 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; 1505 1529 return true; 1506 1530 } … … 1686 1710 1687 1711 status = NT_STATUS_OK; 1688 if (!convert_ss2service(return_iplist, ss_list, *return_count))1712 if (!convert_ss2service(return_iplist, ss_list, return_count)) 1689 1713 status = NT_STATUS_INVALID_PARAMETER; 1690 1714 … … 1730 1754 if (convert_ss2service(return_iplist, 1731 1755 ss_list, 1732 *return_count)) {1756 return_count)) { 1733 1757 talloc_free(ctx); 1734 1758 return NT_STATUS_OK; … … 1803 1827 memcpy(&ss, res->ai_addr, res->ai_addrlen); 1804 1828 1829 if (is_zero_addr(&ss)) { 1830 continue; 1831 } 1832 1805 1833 *return_count += 1; 1806 1834 … … 1839 1867 int *return_count) 1840 1868 { 1841 int i , j;1869 int i; 1842 1870 NTSTATUS status; 1843 1871 TALLOC_CTX *ctx; … … 1888 1916 1889 1917 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 } 1892 1924 1893 1925 if ((*return_iplist = SMB_MALLOC_ARRAY(struct ip_service, numaddrs)) == … … 1902 1934 1903 1935 *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++ ) { 1911 1938 /* If we don't have an IP list for a name, lookup it up */ 1912 1913 1939 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)) { 1923 1948 continue; 1924 1949 } 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 } 1940 2007 } 1941 2008 } … … 1994 2061 return NT_STATUS_INVALID_PARAMETER; 1995 2062 } 2063 if (is_zero_addr(&(*return_iplist)->ss)) { 2064 SAFE_FREE(*return_iplist); 2065 return NT_STATUS_UNSUCCESSFUL; 2066 } 1996 2067 *return_count = 1; 1997 2068 return NT_STATUS_OK; … … 2001 2072 2002 2073 if (namecache_fetch(name, name_type, return_iplist, return_count)) { 2074 *return_count = remove_duplicate_addrs2(*return_iplist, 2075 *return_count ); 2003 2076 /* This could be a negative response */ 2004 2077 if (*return_count > 0) { … … 2075 2148 if (!convert_ss2service(return_iplist, 2076 2149 ss_list, 2077 *return_count)) {2150 return_count)) { 2078 2151 status = NT_STATUS_NO_MEMORY; 2079 2152 } … … 2101 2174 the iplist when the PDC is down will cause two sets of timeouts. */ 2102 2175 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 ); 2107 2177 2108 2178 /* Save in name cache */ … … 2120 2190 } 2121 2191 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 } 2123 2195 2124 2196 /* Display some debugging info */ … … 2583 2655 explicit password servers */ 2584 2656 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 ); 2589 2658 2590 2659 /* For DC's we always prioritize IPv4 due to W2K3 not -
vendor/current/source3/libsmb/ntlmssp.c
r740 r746 613 613 } 614 614 } else if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_NTLM2) { 615 struct MD5Contextmd5_session_nonce_ctx;615 MD5_CTX md5_session_nonce_ctx; 616 616 uint8_t session_nonce[16]; 617 617 uint8_t session_nonce_hash[16]; -
vendor/current/source3/libsmb/smb_signing.c
r740 r746 138 138 const size_t offset_end_of_sig = (smb_ss_field + 8); 139 139 uint8_t sequence_buf[8]; 140 struct MD5Contextmd5_ctx;140 MD5_CTX md5_ctx; 141 141 142 142 /*
Note:
See TracChangeset
for help on using the changeset viewer.