r1215: Intermediate checkin of the new keytab code. I need to make sure I
[tprouty/samba.git] / source / lib / util.c
index 54cbc36772e2233ea2093b28072a7d2e8d3711c3..554f5ee79da30f7ac164dd8f2c74fb1667eaa476 100644 (file)
@@ -2435,6 +2435,21 @@ BOOL unix_wild_match(const char *pattern, const char *string)
        return unix_do_match(p2, s2) == 0;      
 }
 
+/**********************************************************************
+ Converts a name to a fully qalified domain name.
+***********************************************************************/
+                                                                                                                                                   
+void name_to_fqdn(fstring fqdn, 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));
+               fstrcpy(fqdn,hp->h_name);
+       } else {
+               DEBUG(10,("name_to_fqdn: lookup for %s failed.\n", name));
+               fstrcpy(fqdn, name);
+       }
+}
 
 #ifdef __INSURE__