Changeset 599 for trunk/server/source3/libsmb/cliconnect.c
- Timestamp:
- Jul 6, 2011, 8:21:13 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/source3/libsmb/cliconnect.c
r590 r599 1057 1057 } 1058 1058 1059 /* If we get a bad principal, try to guess it if 1060 we have a valid host NetBIOS name. 1059 /* We may not be allowed to use the server-supplied SPNEGO principal, or it may not have been supplied to us 1061 1060 */ 1062 if ( strequal(principal, ADS_IGNORE_PRINCIPAL)) {1061 if (!lp_client_use_spnego_principal() || strequal(principal, ADS_IGNORE_PRINCIPAL)) { 1063 1062 TALLOC_FREE(principal); 1064 1063 } … … 1069 1068 cli->desthost)) { 1070 1069 char *realm = NULL; 1071 char *machine = NULL;1072 1070 char *host = NULL; 1073 DEBUG(3,("cli_session_setup_spnego: got a"1074 "bad server principal, trying to guess ...\n"));1071 DEBUG(3,("cli_session_setup_spnego: using target " 1072 "hostname not SPNEGO principal\n")); 1075 1073 1076 1074 host = strchr_m(cli->desthost, '.'); 1077 if (host) {1078 /* We had a '.' in the name. */1079 machine = SMB_STRNDUP(cli->desthost,1080 host - cli->desthost);1081 } else {1082 machine = SMB_STRDUP(cli->desthost);1083 }1084 if (machine == NULL) {1085 return ADS_ERROR_NT(NT_STATUS_NO_MEMORY);1086 }1087 1088 1075 if (dest_realm) { 1089 1076 realm = SMB_STRDUP(dest_realm); … … 1100 1087 1101 1088 if (realm && *realm) { 1102 if (host) { 1103 /* DNS name. */ 1104 principal = talloc_asprintf(talloc_tos(), 1105 "cifs/%s@%s", 1106 cli->desthost, 1107 realm); 1108 } else { 1109 /* NetBIOS name, use machine account. */ 1110 principal = talloc_asprintf(talloc_tos(), 1111 "%s$@%s", 1112 machine, 1113 realm); 1114 } 1089 principal = talloc_asprintf(talloc_tos(), 1090 "cifs/%s@%s", 1091 cli->desthost, 1092 realm); 1115 1093 if (!principal) { 1116 SAFE_FREE(machine);1117 1094 SAFE_FREE(realm); 1118 1095 return ADS_ERROR_NT(NT_STATUS_NO_MEMORY); … … 1122 1099 principal ? principal : "<null>")); 1123 1100 } 1124 SAFE_FREE(machine);1125 1101 SAFE_FREE(realm); 1126 1102 }
Note:
See TracChangeset
for help on using the changeset viewer.