summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-04-24 21:53:55 +0200
committerGünther Deschner <gd@samba.org>2008-04-24 22:01:52 +0200
commit051ff45c6041accdf4f74d33db16158a3aa95a4c (patch)
tree6d0108d1e63b2af575931a7bce81e639754f8076 /source3/libsmb
parentb77601a4b7c9d0f472eb51dad1d491d54a6dcbdc (diff)
downloadsamba-051ff45c6041accdf4f74d33db16158a3aa95a4c.tar.gz
samba-051ff45c6041accdf4f74d33db16158a3aa95a4c.tar.bz2
samba-051ff45c6041accdf4f74d33db16158a3aa95a4c.zip
mailslot/dsgetdcname: do what XP does and request nt_version 11.
This allows dsgetdcname to query for a flat, non-dns domain name and come back with all information about the DC (site names, guid, forest, etc.) based on a mailslot reply. The version 11 request is downgraded to version 1 in case we do a query against NT4. Guenther (This used to be commit d8b2ff3c8769e8da9c21dec483e6edb7aa2d00f3)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/dsgetdcname.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c
index af1dc04059..fbc3bda6e4 100644
--- a/source3/libsmb/dsgetdcname.c
+++ b/source3/libsmb/dsgetdcname.c
@@ -777,6 +777,10 @@ static NTSTATUS process_dc_netbios(TALLOC_CTX *mem_ctx,
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;
@@ -798,7 +802,7 @@ static NTSTATUS process_dc_netbios(TALLOC_CTX *mem_ctx,
if (send_getdc_request(mem_ctx, msg_ctx,
&dclist[i].ss, domain_name,
- NULL, 1))
+ NULL, 11))
{
int k;
smb_msleep(100);
@@ -835,6 +839,25 @@ static NTSTATUS process_dc_netbios(TALLOC_CTX *mem_ctx,
make_reply:
+ if (reply && reply->command == NTLOGON_RESPONSE_FROM_PDC2) {
+
+ 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;
+
+ dc_domain_guid = &reply->req.reply2.domain_uuid;
+
+ 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;
+ }
+ }
+
if (flags & DS_IP_REQUIRED) {
char addr[INET6_ADDRSTRLEN];
print_sockaddr(addr, sizeof(addr), &dclist[i].ss);
@@ -849,16 +872,20 @@ static NTSTATUS process_dc_netbios(TALLOC_CTX *mem_ctx,
dc_flags |= NBT_SERVER_PDC | NBT_SERVER_WRITABLE;
}
+ if (dc_forest) {
+ dc_flags |= DS_DNS_FOREST;
+ }
+
return make_domain_controller_info(mem_ctx,
dc_hostname,
dc_address,
dc_address_type,
- NULL,
+ dc_domain_guid,
dc_domain_name,
- NULL,
+ dc_forest,
dc_flags,
- NULL,
- NULL,
+ dc_server_site,
+ dc_client_site,
info);
}