diff options
author | Andrew Bartlett <abartlet@samba.org> | 2004-07-11 06:50:31 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:56:55 -0500 |
commit | 462d27d7e633e368928569f8fbe9e25ab3e72e1c (patch) | |
tree | d05472ef5245b1c816a6067c3efc0fc382f8a423 /source4 | |
parent | a25651cd227e6328c7ba755c60d2b74667dcb4a1 (diff) | |
download | samba-462d27d7e633e368928569f8fbe9e25ab3e72e1c.tar.gz samba-462d27d7e633e368928569f8fbe9e25ab3e72e1c.tar.bz2 samba-462d27d7e633e368928569f8fbe9e25ab3e72e1c.zip |
r1434: Merge this function in from Samba 3.0, but use a mem_ctx rather than
an fstring.
Andrew Bartlett
(This used to be commit e8de8905b2f328395d71afdd73c77301c9366a66)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/util.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source4/lib/util.c b/source4/lib/util.c index 3b23543bfc..3666d6e4e7 100644 --- a/source4/lib/util.c +++ b/source4/lib/util.c @@ -797,6 +797,23 @@ char *myhostname(TALLOC_CTX *mem_ctx) } +/********************************************************************** + Converts a name to a fully qalified domain name. +***********************************************************************/ + +char *name_to_fqdn(TALLOC_CTX *mem_ctx, const char *name) +{ + struct hostent *hp = sys_gethostbyname(name); + if ( hp && hp->h_name && *hp->h_name ) { + DEBUG(10,("name_to_fqdn: lookup for %s -> %s.\n", name, hp->h_name)); + return talloc_strdup(mem_ctx, hp->h_name); + } else { + DEBUG(10,("name_to_fqdn: lookup for %s failed.\n", name)); + return talloc_strdup(mem_ctx, name); + } +} + + /***************************************************************** A useful function for returning a path in the Samba lock directory. *****************************************************************/ |