diff src/protocol.c @ 244:4e69e9b722ae noffle

[svn] * src/database.c,src/protocol.c,src/util.c,src/util.h: The latest IETF article format draft draft-ietf-usefor-article-06.txt recommends that Xref: references contain the FQDN of the server. We were using the host name without the domain. So split the routine used for obtaining the FQDN from protocol.c into util.c, and use it when adding Xrefs.
author bears
date Fri, 15 Mar 2002 10:50:33 +0000
parents 0eaf93997170
children 7a830ce3211e
line wrap: on
line diff
--- a/src/protocol.c	Fri Mar 15 10:49:56 2002 +0000
+++ b/src/protocol.c	Fri Mar 15 10:50:33 2002 +0000
@@ -1,7 +1,7 @@
 /*
   protocol.c
 
-  $Id: protocol.c 340 2001-12-02 19:32:44Z mirkol $
+  $Id: protocol.c 375 2002-03-15 10:50:33Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -10,11 +10,9 @@
 
 #include <stdio.h> 
 #include <ctype.h> 
-#include <netdb.h>
 #include <pwd.h>
 #include <signal.h>
 #include <sys/types.h>
-#include <sys/utsname.h>
 #include <unistd.h>
 #include "common.h"
 #include "configfile.h"
@@ -220,31 +218,13 @@
     return FALSE;
 }
 
-static Bool
-getFQDN( Str result )
-{
-    struct hostent *myHostEnt;
-    struct utsname myName;
-    
-    if ( uname( &myName ) >= 0
-         && ( myHostEnt = gethostbyname( myName.nodename ) ) )
-    {
-        Utl_cpyStr( result, myHostEnt->h_name );
-        return TRUE;
-    }
-    return FALSE;
-}
-
 static void
 getDomain( Str domain, const char *from )
 {
     const char *addTopLevel, *p1, *p2, *p, *domainStart;
     Str myDomain;
 
-    /* get hostname for MsgId from Cfg-File */
-    /* more elaborate testing must be left to upstream server */ 
-    Utl_cpyStr( myDomain, Cfg_hostnameMsgId() );
-    if (  strlen( myDomain ) != 0  || getFQDN( myDomain ) )
+    if ( Utl_getFQDN( myDomain ) )
     {
         p = strstr( myDomain, "." );
         if ( p != NULL )
@@ -334,7 +314,7 @@
     Utl_cpyStr( domain, Cfg_fromDomain() );
 
     if ( strlen( domain ) == 0 )
-	if ( ! getFQDN( domain ) )
+	if ( ! Utl_getFQDN( domain ) )
 	    Utl_catStr( domain, "unknown" );
 
     /* Now get pwd for the username */