summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/util.c27
-rw-r--r--source3/rpc_server/srv_lsa_nt.c12
2 files changed, 31 insertions, 8 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 1adda85354..e58f5274df 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -1012,6 +1012,7 @@ BOOL get_mydomname(fstring my_domname)
{
pstring hostname;
char *p;
+ struct hostent *hp;
*hostname = 0;
/* get my host name */
@@ -1023,17 +1024,31 @@ BOOL get_mydomname(fstring my_domname)
/* Ensure null termination. */
hostname[sizeof(hostname)-1] = '\0';
+
p = strchr_m(hostname, '.');
- if (!p)
- return False;
+ if (p) {
+ p++;
+
+ if (my_domname)
+ fstrcpy(my_domname, p);
+ }
- p++;
+ if (!(hp = sys_gethostbyname(hostname))) {
+ return False;
+ }
- if (my_domname)
- fstrcpy(my_domname, p);
+ p = strchr_m(hp->h_name, '.');
- return True;
+ if (p) {
+ p++;
+
+ if (my_domname)
+ fstrcpy(my_domname, p);
+ return True;
+ }
+
+ return False;
}
/****************************************************************************
diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c
index fb6538db39..3581be0181 100644
--- a/source3/rpc_server/srv_lsa_nt.c
+++ b/source3/rpc_server/srv_lsa_nt.c
@@ -1222,6 +1222,7 @@ NTSTATUS _lsa_query_info2(pipes_struct *p, LSA_Q_QUERY_INFO2 *q_u, LSA_R_QUERY_I
char *forest_name = NULL;
DOM_SID *sid = NULL;
GUID guid;
+ fstring dnsdomname;
ZERO_STRUCT(guid);
r_u->status = NT_STATUS_OK;
@@ -1241,8 +1242,15 @@ NTSTATUS _lsa_query_info2(pipes_struct *p, LSA_Q_QUERY_INFO2 *q_u, LSA_R_QUERY_I
case ROLE_DOMAIN_BDC:
nb_name = lp_workgroup();
/* ugly temp hack for these next two */
- dns_name = lp_realm();
- forest_name = lp_realm();
+
+ /* This should be a 'netbios domain -> DNS domain' mapping */
+ dnsdomname[0] = '\0';
+ get_mydomname(dnsdomname);
+ strlower(dnsdomname);
+
+ dns_name = dnsdomname;
+ forest_name = dnsdomname;
+
sid = get_global_sam_sid();
secrets_fetch_domain_guid(lp_workgroup(), &guid);
break;