diff options
author | Günther Deschner <gd@samba.org> | 2008-05-07 18:57:43 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-05-09 14:59:19 +0200 |
commit | 9be17e2187a93633b23761fc2f6f0b40c94db809 (patch) | |
tree | b28b84c22ca70f8e00ff657fbb3ef09d4b02b692 /source3/libsmb/dsgetdcname.c | |
parent | 926cc828973c1f0dc6b72b23552dc1b7028a3c97 (diff) | |
download | samba-9be17e2187a93633b23761fc2f6f0b40c94db809.tar.gz samba-9be17e2187a93633b23761fc2f6f0b40c94db809.tar.xz samba-9be17e2187a93633b23761fc2f6f0b40c94db809.zip |
dsgetdcname: mailslot replies are identical to the cldap ones, use cldap everywhere.
Guenther
(This used to be commit fe904ee77a7fec1674e9db660978c40c17897f77)
Diffstat (limited to 'source3/libsmb/dsgetdcname.c')
-rw-r--r-- | source3/libsmb/dsgetdcname.c | 79 |
1 files changed, 19 insertions, 60 deletions
diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c index b64f340456..a21fc9a217 100644 --- a/source3/libsmb/dsgetdcname.c +++ b/source3/libsmb/dsgetdcname.c @@ -925,18 +925,10 @@ static NTSTATUS process_dc_netbios(TALLOC_CTX *mem_ctx, enum nbt_name_type name_type = NBT_NAME_LOGON; int i; - const char *dc_hostname, *dc_domain_name; - const char *dc_address; - uint32_t dc_address_type; - uint32_t dc_flags = 0; const char *dc_name = NULL; - const char *dc_forest = NULL; - const char *dc_server_site = NULL; - const char *dc_client_site = NULL; - struct GUID *dc_domain_guid = NULL; fstring tmp_dc_name; struct messaging_context *msg_ctx = msg_context(mem_ctx); - struct nbt_ntlogon_packet *reply = NULL; + union nbt_cldap_netlogon *reply = NULL; uint32_t nt_version = NETLOGON_VERSION_1 | NETLOGON_VERSION_5 | NETLOGON_VERSION_5EX_WITH_IP; @@ -968,12 +960,10 @@ static NTSTATUS process_dc_netbios(TALLOC_CTX *mem_ctx, if (receive_getdc_response(mem_ctx, &dclist[i].ss, domain_name, + &nt_version, &dc_name, &reply)) { namecache_store(dc_name, NBT_NAME_SERVER, 1, &ip_list); - dc_hostname = dc_name; - dc_domain_name = talloc_strdup_upper(mem_ctx, domain_name); - NT_STATUS_HAVE_NO_MEMORY(dc_domain_name); goto make_reply; } smb_msleep(1500); @@ -986,65 +976,34 @@ static NTSTATUS process_dc_netbios(TALLOC_CTX *mem_ctx, &dclist[i].ss, tmp_dc_name)) { - dc_hostname = tmp_dc_name; - dc_domain_name = talloc_strdup_upper(mem_ctx, domain_name); - namecache_store(tmp_dc_name, NBT_NAME_SERVER, 1, &ip_list); - goto make_reply; - } - } + struct nbt_cldap_netlogon_1 logon1; - return NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND; + reply = TALLOC_ZERO_P(mem_ctx, union nbt_cldap_netlogon); + NT_STATUS_HAVE_NO_MEMORY(reply); - make_reply: + ZERO_STRUCT(logon1); - if (reply && reply->command == NTLOGON_RESPONSE_FROM_PDC2) { + nt_version = NETLOGON_VERSION_1; - dc_flags |= reply->req.reply2.server_type; - dc_forest = reply->req.reply2.forest; - dc_server_site = reply->req.reply2.server_site; - dc_client_site = reply->req.reply2.client_site; + logon1.nt_version = nt_version; + logon1.pdc_name = tmp_dc_name; + logon1.domain_name = talloc_strdup_upper(mem_ctx, domain_name); + NT_STATUS_HAVE_NO_MEMORY(logon1.domain_name); - dc_domain_guid = &reply->req.reply2.domain_uuid; + reply->logon1 = logon1; - if (flags & DS_RETURN_DNS_NAME) { - dc_domain_name = reply->req.reply2.dns_domain; - dc_hostname = reply->req.reply2.pdc_dns_name; - dc_flags |= DS_DNS_DOMAIN | DS_DNS_CONTROLLER; - } else if (flags & DS_RETURN_FLAT_NAME) { - dc_domain_name = reply->req.reply2.domain; - dc_hostname = reply->req.reply2.pdc_name; - } - } + namecache_store(tmp_dc_name, NBT_NAME_SERVER, 1, &ip_list); - if (flags & DS_IP_REQUIRED) { - char addr[INET6_ADDRSTRLEN]; - print_sockaddr(addr, sizeof(addr), &dclist[i].ss); - dc_address = talloc_asprintf(mem_ctx, "\\\\%s", addr); - dc_address_type = DS_ADDRESS_TYPE_INET; - } else { - dc_address = talloc_asprintf(mem_ctx, "\\\\%s", dc_hostname); - dc_address_type = DS_ADDRESS_TYPE_NETBIOS; + goto make_reply; + } } - if (flags & DS_PDC_REQUIRED) { - dc_flags |= NBT_SERVER_PDC | NBT_SERVER_WRITABLE; - } + return NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND; - if (dc_forest) { - dc_flags |= DS_DNS_FOREST; - } + make_reply: - return make_domain_controller_info(mem_ctx, - dc_hostname, - dc_address, - dc_address_type, - dc_domain_guid, - dc_domain_name, - dc_forest, - dc_flags, - dc_server_site, - dc_client_site, - info); + return make_dc_info_from_cldap_reply(mem_ctx, flags, &dclist[i].ss, + nt_version, reply, info); } /**************************************************************** |