Changeset 124 for branches/samba-3.0/source/libsmb
- Timestamp:
- Mar 12, 2008, 9:08:18 AM (17 years ago)
- Location:
- branches/samba-3.0/source/libsmb
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.0/source/libsmb/cliconnect.c
r62 r124 41 41 }; 42 42 43 static const char *star_smbserver_name = "*SMBSERVER"; 44 43 45 /** 44 46 * Set the user session key for a connection … … 629 631 data_blob_free(&negTokenTarg); 630 632 data_blob_free(&session_key_krb5); 631 ADS_ERROR_NT(cli_nt_error(cli));633 return ADS_ERROR_NT(cli_nt_error(cli)); 632 634 } 633 635 … … 862 864 } 863 865 864 rc = cli_session_setup_kerberos(cli, principal, domain); 865 if (ADS_ERR_OK(rc) || !cli->fallback_after_kerberos) { 866 /* If we get a bad principal, try to guess it if 867 we have a valid host NetBIOS name. 868 */ 869 if (strequal(principal, ADS_IGNORE_PRINCIPAL)) { 866 870 SAFE_FREE(principal); 867 return rc; 871 } 872 if (principal == NULL && 873 !is_ipaddress(cli->desthost) && 874 !strequal(star_smbserver_name, 875 cli->desthost)) { 876 char *realm = NULL; 877 char *machine = NULL; 878 char *host = NULL; 879 DEBUG(3,("cli_session_setup_spnego: got a " 880 "bad server principal, trying to guess ...\n")); 881 882 host = strchr_m(cli->desthost, '.'); 883 if (host) { 884 machine = SMB_STRNDUP(cli->desthost, 885 host - cli->desthost); 886 } else { 887 machine = SMB_STRDUP(cli->desthost); 888 } 889 if (machine == NULL) { 890 return ADS_ERROR_NT(NT_STATUS_NO_MEMORY); 891 } 892 893 realm = kerberos_get_default_realm_from_ccache(); 894 if (realm && *realm) { 895 if (asprintf(&principal, "%s$@%s", 896 machine, realm) < 0) { 897 SAFE_FREE(machine); 898 SAFE_FREE(realm); 899 return ADS_ERROR_NT(NT_STATUS_NO_MEMORY); 900 } 901 DEBUG(3,("cli_session_setup_spnego: guessed " 902 "server principal=%s\n", 903 principal ? principal : "<null>")); 904 } 905 SAFE_FREE(machine); 906 SAFE_FREE(realm); 907 } 908 909 if (principal) { 910 rc = cli_session_setup_kerberos(cli, principal, domain); 911 if (ADS_ERR_OK(rc) || !cli->fallback_after_kerberos) { 912 SAFE_FREE(principal); 913 return rc; 914 } 868 915 } 869 916 } … … 1413 1460 1414 1461 /* reasonable default hostname */ 1415 if (!host) host = "*SMBSERVER";1462 if (!host) host = star_smbserver_name; 1416 1463 1417 1464 fstrcpy(cli->desthost, host); … … 1528 1575 goto again; 1529 1576 } 1530 if (strcmp(called.name, "*SMBSERVER")) {1531 make_nmb_name(&called , "*SMBSERVER", 0x20);1577 if (strcmp(called.name, star_smbserver_name)) { 1578 make_nmb_name(&called , star_smbserver_name, 0x20); 1532 1579 goto again; 1533 1580 } … … 1653 1700 1654 1701 if(is_ipaddress(desthost)) { 1655 make_nmb_name(&called, "*SMBSERVER", 0x20);1702 make_nmb_name(&called, star_smbserver_name, 0x20); 1656 1703 } else { 1657 1704 make_nmb_name(&called, desthost, 0x20); … … 1662 1709 struct nmb_name smbservername; 1663 1710 1664 make_nmb_name(&smbservername , "*SMBSERVER", 0x20);1711 make_nmb_name(&smbservername, star_smbserver_name, 0x20); 1665 1712 1666 1713 /* -
branches/samba-3.0/source/libsmb/clierror.c
r39 r124 470 470 SIVAL(cli->inbuf, smb_rcls, NT_STATUS_V(status)); 471 471 } 472 473 /* Reset an error. */ 474 475 void cli_reset_error(struct cli_state *cli) 476 { 477 if (SVAL(cli->inbuf,smb_flg2) & FLAGS2_32_BIT_ERROR_CODES) { 478 SIVAL(cli->inbuf, smb_rcls, NT_STATUS_V(NT_STATUS_OK)); 479 } else { 480 SCVAL(cli->inbuf,smb_rcls,0); 481 SSVAL(cli->inbuf,smb_err,0); 482 } 483 } -
branches/samba-3.0/source/libsmb/clikrb5.c
r44 r124 337 337 data_blob_free(&auth_data_wrapped); 338 338 339 if ( !got_auth_data_pac) {340 continue;339 if (got_auth_data_pac) { 340 return true; 341 341 } 342 342 } … … 364 364 got_auth_data_pac = unwrap_pac(mem_ctx, &auth_data_wrapped, auth_data); 365 365 data_blob_free(&auth_data_wrapped); 366 367 if ( !got_auth_data_pac) {368 continue;366 367 if (got_auth_data_pac) { 368 return true; 369 369 } 370 370 } -
branches/samba-3.0/source/libsmb/clilist.c
r22 r124 248 248 &rdata, &data_len) && 249 249 cli_is_dos_error(cli)) { 250 /* we need to work around a Win95 bug - sometimes250 /* We need to work around a Win95 bug - sometimes 251 251 it gives ERRSRV/ERRerror temprarily */ 252 252 uint8 eclass; … … 257 257 258 258 cli_dos_error(cli, &eclass, &ecode); 259 260 /* 261 * OS/2 might return "no more files", 262 * which just tells us, that searchcount is zero 263 * in this search. 264 * Guenter Kukkukk <linux@kukkukk.com> 265 */ 266 267 if (eclass == ERRDOS && ecode == ERRnofiles) { 268 ff_searchcount = 0; 269 cli_reset_error(cli); 270 break; 271 } 272 259 273 if (eclass != ERRSRV || ecode != ERRerror) 260 274 break; -
branches/samba-3.0/source/libsmb/clitrans.c
r39 r124 96 96 } 97 97 98 /* Note we're in a trans state. Save the sequence99 * numbers for replies. */100 client_set_trans_sign_state_on(cli, mid);101 102 98 if (this_ldata < ldata || this_lparam < lparam) { 103 99 /* receive interim response */ 104 100 if (!cli_receive_smb(cli) || cli_is_error(cli)) { 105 client_set_trans_sign_state_off(cli, mid);106 101 return(False); 107 102 } … … 145 140 show_msg(cli->outbuf); 146 141 if (!cli_send_smb(cli)) { 147 client_set_trans_sign_state_off(cli, mid);148 142 return False; 149 143 } … … 324 318 out: 325 319 326 client_set_trans_sign_state_off(cli, SVAL(cli->inbuf,smb_mid));327 320 return ret; 328 321 } … … 392 385 } 393 386 394 /* Note we're in a trans state. Save the sequence395 * numbers for replies. */396 client_set_trans_sign_state_on(cli, mid);397 398 387 if (this_ldata < ldata || this_lparam < lparam) { 399 388 /* receive interim response */ 400 389 if (!cli_receive_smb(cli) || cli_is_error(cli)) { 401 client_set_trans_sign_state_off(cli, mid);402 390 return(False); 403 391 } … … 441 429 442 430 if (!cli_send_smb(cli)) { 443 client_set_trans_sign_state_off(cli, mid);444 431 return False; 445 432 } … … 641 628 out: 642 629 643 client_set_trans_sign_state_off(cli, SVAL(cli->inbuf,smb_mid));644 630 return ret; 645 631 } -
branches/samba-3.0/source/libsmb/nmblib.c
r1 r124 703 703 return(NULL); 704 704 705 ZERO_STRUCTP(p); /* initialize for possible padding */ 706 705 707 p->next = NULL; 706 708 p->prev = NULL; -
branches/samba-3.0/source/libsmb/smb_signing.c
r1 r124 27 27 uint16 mid; 28 28 uint32 reply_seq_num; 29 BOOL can_delete; /* Set to False in trans state. */30 29 }; 31 30 … … 44 43 for (t = *list; t; t = t->next) { 45 44 if (t->mid == mid) { 46 return False; 45 DLIST_REMOVE(*list, t); 46 SAFE_FREE(t); 47 break; 47 48 } 48 49 } … … 53 54 t->mid = mid; 54 55 t->reply_seq_num = reply_seq_num; 55 t->can_delete = True;56 56 57 57 /* … … 80 80 DEBUG(10,("get_sequence_for_reply: found seq = %u mid = %u\n", 81 81 (unsigned int)t->reply_seq_num, (unsigned int)t->mid )); 82 if (t->can_delete) { 83 DLIST_REMOVE(*list, t); 84 SAFE_FREE(t); 85 } 86 return True; 87 } 88 } 89 return False; 90 } 91 92 static BOOL set_sequence_can_delete_flag(struct outstanding_packet_lookup **list, uint16 mid, BOOL can_delete_entry) 93 { 94 struct outstanding_packet_lookup *t; 95 96 for (t = *list; t; t = t->next) { 97 if (t->mid == mid) { 98 t->can_delete = can_delete_entry; 82 DLIST_REMOVE(*list, t); 83 SAFE_FREE(t); 99 84 return True; 100 85 } … … 605 590 606 591 /*********************************************************** 607 Enter trans/trans2/nttrans state.608 ************************************************************/609 610 BOOL client_set_trans_sign_state_on(struct cli_state *cli, uint16 mid)611 {612 struct smb_sign_info *si = &cli->sign_info;613 struct smb_basic_signing_context *data = (struct smb_basic_signing_context *)si->signing_context;614 615 if (!si->doing_signing) {616 return True;617 }618 619 if (!data) {620 return False;621 }622 623 if (!set_sequence_can_delete_flag(&data->outstanding_packet_list, mid, False)) {624 return False;625 }626 627 return True;628 }629 630 /***********************************************************631 Leave trans/trans2/nttrans state.632 ************************************************************/633 634 BOOL client_set_trans_sign_state_off(struct cli_state *cli, uint16 mid)635 {636 uint32 reply_seq_num;637 struct smb_sign_info *si = &cli->sign_info;638 struct smb_basic_signing_context *data = (struct smb_basic_signing_context *)si->signing_context;639 640 if (!si->doing_signing) {641 return True;642 }643 644 if (!data) {645 return False;646 }647 648 if (!set_sequence_can_delete_flag(&data->outstanding_packet_list, mid, True)) {649 return False;650 }651 652 /* Now delete the stored mid entry. */653 if (!get_sequence_for_reply(&data->outstanding_packet_list, mid, &reply_seq_num)) {654 return False;655 }656 657 return True;658 }659 660 /***********************************************************661 592 SMB signing - Server implementation - send the MAC. 662 593 ************************************************************/ -
branches/samba-3.0/source/libsmb/smbencrypt.c
r1 r124 445 445 This prevents username swapping during the auth exchange 446 446 */ 447 if (!ntv2_owf_gen(nt_hash, user, domain, True, ntlm_v2_hash)) {447 if (!ntv2_owf_gen(nt_hash, user, domain, False, ntlm_v2_hash)) { 448 448 return False; 449 449 } -
branches/samba-3.0/source/libsmb/trusts_util.c
r1 r124 42 42 43 43 if (cli->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) { 44 uint32 neg_flags = NETLOGON_NEG_ AUTH2_FLAGS;44 uint32 neg_flags = NETLOGON_NEG_SELECT_AUTH2_FLAGS; 45 45 46 46 result = rpccli_netlogon_setup_creds(cli, -
branches/samba-3.0/source/libsmb/unexpected.c
r1 r124 60 60 len = build_packet(buf, p); 61 61 62 ZERO_STRUCT(key); /* needed for potential alignment */ 63 62 64 key.packet_type = p->packet_type; 63 65 key.timestamp = p->timestamp; … … 81 83 { 82 84 struct unexpected_key key; 85 86 if (kbuf.dsize != sizeof(key)) { 87 tdb_delete(ttdb, kbuf); 88 } 83 89 84 90 memcpy(&key, kbuf.dptr, sizeof(key)); … … 120 126 struct unexpected_key key; 121 127 struct packet_struct *p; 128 129 if (kbuf.dsize != sizeof(key)) { 130 return 0; 131 } 122 132 123 133 memcpy(&key, kbuf.dptr, sizeof(key));
Note:
See TracChangeset
for help on using the changeset viewer.