Changeset 124 for branches/samba-3.0/source/libsmb/cliconnect.c
- Timestamp:
- Mar 12, 2008, 9:08:18 AM (17 years ago)
- File:
-
- 1 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 /*
Note:
See TracChangeset
for help on using the changeset viewer.