summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-04-22 07:45:16 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-04-22 07:45:16 +0000
commitc2e997d6a754945284687c99c0ef67acb94c4a37 (patch)
tree2de89af1734caf45973a60e7f4cf213290437dd6 /source3/lib
parentcf86f85b088be7c6ddb8d060e93a7f3040efe342 (diff)
downloadsamba-c2e997d6a754945284687c99c0ef67acb94c4a37.tar.gz
samba-c2e997d6a754945284687c99c0ef67acb94c4a37.tar.bz2
samba-c2e997d6a754945284687c99c0ef67acb94c4a37.zip
Merge from 3.0 - try harder to get our real DNS domain name, and send this
to the client when it asks for our DNS name and forest name. (needed for win2k to trust us as a trusted domain). Andrew Bartlett (This used to be commit 2a1015eb57da7b69caafd1221b871b6bff1af2fb)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util.c27
1 files changed, 21 insertions, 6 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;
}
/****************************************************************************