Changeset 140 for branches/samba-3.0/source/libsmb
- Timestamp:
- Jul 11, 2008, 1:13:42 AM (17 years ago)
- Location:
- branches/samba-3.0/source/libsmb
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.0/source/libsmb/asn1.c
r1 r140 397 397 if (strcmp(id, OID) != 0) { 398 398 data->has_error = True; 399 free(id); 399 400 return False; 400 401 } -
branches/samba-3.0/source/libsmb/cliconnect.c
r134 r140 788 788 /**************************************************************************** 789 789 Do a spnego encrypted session setup. 790 791 user_domain: The shortname of the domain the user/machine is a member of. 792 dest_realm: The realm we're connecting to, if NULL we use our default realm. 790 793 ****************************************************************************/ 791 794 792 795 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user, 793 const char *pass, const char *domain) 794 { 795 char *principal; 796 const char *pass, const char *user_domain, 797 const char * dest_realm) 798 { 799 char *principal = NULL; 796 800 char *OIDs[ASN1_MAX_OIDS]; 797 801 int i; … … 814 818 blob = data_blob(cli->secblob.data+16, cli->secblob.length-16); 815 819 816 /* the server sent us the first part of the SPNEGO exchange in the negprot 817 reply */ 820 /* The server sent us the first part of the SPNEGO exchange in the 821 * negprot reply. It is WRONG to depend on the principal sent in the 822 * negprot reply, but right now we do it. If we don't receive one, 823 * we try to best guess, then fall back to NTLM. */ 818 824 if (!spnego_parse_negTokenInit(blob, OIDs, &principal)) { 819 825 data_blob_free(&blob); … … 833 839 834 840 DEBUG(3,("got principal=%s\n", principal ? principal : "<null>")); 835 836 if (got_kerberos_mechanism && (principal == NULL)) {837 /*838 * It is WRONG to depend on the principal sent in the negprot839 * reply, but right now we do it. So for safety (don't840 * segfault later) disable Kerberos when no principal was841 * sent. -- VL842 */843 DEBUG(1, ("Kerberos mech was offered, but no principal was "844 "sent, disabling Kerberos\n"));845 cli->use_kerberos = False;846 }847 841 848 842 fstrcpy(cli->user_name, user); … … 897 891 } 898 892 899 realm = kerberos_get_default_realm_from_ccache(); 893 if (dest_realm) { 894 realm = SMB_STRDUP(dest_realm); 895 strupper_m(realm); 896 } else { 897 realm = kerberos_get_default_realm_from_ccache(); 898 } 900 899 if (realm && *realm) { 901 900 if (asprintf(&principal, "%s$@%s", … … 914 913 915 914 if (principal) { 916 rc = cli_session_setup_kerberos(cli, principal, domain); 915 rc = cli_session_setup_kerberos(cli, principal, 916 dest_realm); 917 917 if (ADS_ERR_OK(rc) || !cli->fallback_after_kerberos) { 918 918 SAFE_FREE(principal); … … 927 927 ntlmssp: 928 928 929 return ADS_ERROR_NT(cli_session_setup_ntlmssp(cli, user, pass, domain)); 929 return ADS_ERROR_NT(cli_session_setup_ntlmssp(cli, user, pass, 930 user_domain)); 930 931 } 931 932 … … 1010 1011 1011 1012 if (cli->capabilities & CAP_EXTENDED_SECURITY) { 1012 ADS_STATUS status = cli_session_setup_spnego(cli, user, pass, workgroup); 1013 ADS_STATUS status = cli_session_setup_spnego(cli, user, pass, 1014 workgroup, NULL); 1013 1015 if (!ADS_ERR_OK(status)) { 1014 1016 DEBUG(3, ("SPNEGO login failed: %s\n", ads_errstr(status))); … … 1329 1331 SAFE_FREE(cli->outbuf); 1330 1332 SAFE_FREE(cli->inbuf); 1331 cli->outbuf = (char *)SMB_MALLOC(CLI_SAMBA_MAX_LARGE_READX_SIZE+ SAFETY_MARGIN);1332 cli->inbuf = (char *)SMB_MALLOC(CLI_SAMBA_MAX_LARGE_READX_SIZE+ SAFETY_MARGIN);1333 cli->bufsize = CLI_SAMBA_MAX_LARGE_READX_SIZE ;1333 cli->outbuf = (char *)SMB_MALLOC(CLI_SAMBA_MAX_LARGE_READX_SIZE+LARGE_WRITEX_HDR_SIZE+SAFETY_MARGIN); 1334 cli->inbuf = (char *)SMB_MALLOC(CLI_SAMBA_MAX_LARGE_READX_SIZE+LARGE_WRITEX_HDR_SIZE+SAFETY_MARGIN); 1335 cli->bufsize = CLI_SAMBA_MAX_LARGE_READX_SIZE + LARGE_WRITEX_HDR_SIZE; 1334 1336 } 1335 1337 -
branches/samba-3.0/source/libsmb/clierror.c
r124 r140 235 235 {NT_STATUS_ACCESS_DENIED, EACCES}, 236 236 {NT_STATUS_OBJECT_NAME_NOT_FOUND, ENOENT}, 237 {NT_STATUS_OBJECT_PATH_NOT_FOUND, ENOENT}, 237 238 {NT_STATUS_SHARING_VIOLATION, EBUSY}, 238 239 {NT_STATUS_OBJECT_PATH_INVALID, ENOTDIR}, -
branches/samba-3.0/source/libsmb/namequery.c
r1 r140 1429 1429 BOOL done_auto_lookup = False; 1430 1430 int auto_count = 0; 1431 NTSTATUS status; 1432 1433 *ip_list = NULL; 1434 *count = 0; 1431 1435 1432 1436 *ordered = False; … … 1481 1485 if (internal_resolve_name(domain, 0x1C, sitename, ip_list, count, 1482 1486 resolve_order)) { 1483 return NT_STATUS_OK; 1487 status = NT_STATUS_OK; 1488 goto out; 1484 1489 } else { 1485 return NT_STATUS_NO_LOGON_SERVERS; 1490 status = NT_STATUS_NO_LOGON_SERVERS; 1491 goto out; 1486 1492 } 1487 1493 } … … 1498 1504 p = pserver; 1499 1505 while (next_token(&p,name,LIST_SEP,sizeof(name))) { 1500 if ( strequal(name, "*")) {1506 if (!done_auto_lookup && strequal(name, "*")) { 1501 1507 if (internal_resolve_name(domain, 0x1C, sitename, &auto_ip_list, 1502 1508 &auto_count, resolve_order)) … … 1515 1521 if ( done_auto_lookup ) { 1516 1522 DEBUG(4,("get_dc_list: no servers found\n")); 1517 SAFE_FREE(auto_ip_list);1518 return NT_STATUS_NO_LOGON_SERVERS;1523 status = NT_STATUS_NO_LOGON_SERVERS; 1524 goto out; 1519 1525 } 1520 1526 if (internal_resolve_name(domain, 0x1C, sitename, ip_list, count, 1521 1527 resolve_order)) { 1522 return NT_STATUS_OK; 1528 status = NT_STATUS_OK; 1529 goto out; 1523 1530 } else { 1524 return NT_STATUS_NO_LOGON_SERVERS; 1531 status = NT_STATUS_NO_LOGON_SERVERS; 1532 goto out; 1525 1533 } 1526 1534 } … … 1528 1536 if ( (return_iplist = SMB_MALLOC_ARRAY(struct ip_service, num_addresses)) == NULL ) { 1529 1537 DEBUG(3,("get_dc_list: malloc fail !\n")); 1530 SAFE_FREE(auto_ip_list);1531 return NT_STATUS_NO_MEMORY;1538 status = NT_STATUS_NO_MEMORY; 1539 goto out; 1532 1540 } 1533 1541 … … 1586 1594 } 1587 1595 1588 SAFE_FREE(auto_ip_list);1589 1590 1596 /* need to remove duplicates in the list if we have any 1591 1597 explicit password servers */ … … 1607 1613 *count = local_count; 1608 1614 1609 return ( *count != 0 ? NT_STATUS_OK : NT_STATUS_NO_LOGON_SERVERS ); 1615 status = ( *count != 0 ? NT_STATUS_OK : NT_STATUS_NO_LOGON_SERVERS ); 1616 1617 out: 1618 1619 if (!NT_STATUS_IS_OK(status)) { 1620 SAFE_FREE(return_iplist); 1621 *ip_list = NULL; 1622 *count = 0; 1623 } 1624 1625 SAFE_FREE(auto_ip_list); 1626 1627 return status; 1610 1628 } 1611 1629 -
branches/samba-3.0/source/libsmb/smbencrypt.c
r124 r140 183 183 if (domain_byte_len == (size_t)-1) { 184 184 DEBUG(0, ("push_uss2_allocate() for domain returned -1 (probably malloc() failure)\n")); 185 SAFE_FREE(user); 185 186 return False; 186 187 }
Note:
See TracChangeset
for help on using the changeset viewer.