mirror of
https://github.com/samba-team/samba.git
synced 2025-01-29 21:47:30 +03:00
fns for retrieving dns host name and domain name (get rid of lp_realm hacks).
(This used to be commit 456813308d8542211183f9655b7fe598144f7bfc)
This commit is contained in:
parent
d9f51cd143
commit
ce397dbf04
@ -974,6 +974,62 @@ BOOL get_myname(char *my_name)
|
||||
return(True);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Get my own name, including domain.
|
||||
****************************************************************************/
|
||||
|
||||
BOOL get_myfullname(char *my_name)
|
||||
{
|
||||
pstring hostname;
|
||||
|
||||
*hostname = 0;
|
||||
|
||||
/* get my host name */
|
||||
if (gethostname(hostname, sizeof(hostname)) == -1) {
|
||||
DEBUG(0,("gethostname failed\n"));
|
||||
return False;
|
||||
}
|
||||
|
||||
/* Ensure null termination. */
|
||||
hostname[sizeof(hostname)-1] = '\0';
|
||||
|
||||
if (my_name)
|
||||
fstrcpy(my_name, hostname);
|
||||
return True;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Get my own domain name.
|
||||
****************************************************************************/
|
||||
|
||||
BOOL get_mydomname(char *my_domname)
|
||||
{
|
||||
pstring hostname;
|
||||
char *p;
|
||||
|
||||
*hostname = 0;
|
||||
/* get my host name */
|
||||
if (gethostname(hostname, sizeof(hostname)) == -1) {
|
||||
DEBUG(0,("gethostname failed\n"));
|
||||
return False;
|
||||
}
|
||||
|
||||
/* Ensure null termination. */
|
||||
hostname[sizeof(hostname)-1] = '\0';
|
||||
|
||||
p = strchr_m(hostname, '.');
|
||||
|
||||
if (!p)
|
||||
return False;
|
||||
|
||||
p++;
|
||||
|
||||
if (my_domname)
|
||||
fstrcpy(my_domname, p);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Interpret a protocol description string, with a default.
|
||||
****************************************************************************/
|
||||
|
Loading…
x
Reference in New Issue
Block a user