/[cvs]/ccvs/src/server.c
ViewVC logotype

Diff of /ccvs/src/server.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.437 by dprice, Sun Sep 4 05:16:00 2005 UTC revision 1.438 by dprice, Sun Sep 4 15:25:25 2005 UTC
# Line 48  static int cvs_gssapi_wrapping; Line 48  static int cvs_gssapi_wrapping;
48    
49  extern char *server_hostname;  extern char *server_hostname;
50    
 # include <netdb.h>  
   
51  # ifdef HAVE_WINSOCK_H  # ifdef HAVE_WINSOCK_H
52  #   include <winsock.h>  #   include <winsock.h>
53  # endif  # endif
# Line 587  isSamePath (const char *path1_in, const Line 585  isSamePath (const char *path1_in, const
585    
586    
587    
588    /* From GNULIB lib/canon-host.c.  */
589    extern char *canon_host (char const *host);
590    
591  /* Return true if OTHERHOST resolves to this host in the DNS.  /* Return true if OTHERHOST resolves to this host in the DNS.
592   *   *
593   * GLOBALS   * GLOBALS
# Line 600  isSamePath (const char *path1_in, const Line 601  isSamePath (const char *path1_in, const
601  static inline bool  static inline bool
602  isThisHost (const char *otherhost)  isThisHost (const char *otherhost)
603  {  {
604      struct hostent *hinfo;      char *fqdno;
605        char *fqdns;
606        bool retval;
607    
608      /* As an optimization, check the literal strings before looking up      /* As an optimization, check the literal strings before looking up
609       * OTHERHOST in the DNS.       * OTHERHOST in the DNS.
# Line 608  isThisHost (const char *otherhost) Line 611  isThisHost (const char *otherhost)
611      if (!strcasecmp (server_hostname, otherhost))      if (!strcasecmp (server_hostname, otherhost))
612          return true;          return true;
613    
614      if (!(hinfo = gethostbyname (otherhost)))      fqdno = canon_host (otherhost);
615  #ifdef HAVE_HSTRERROR      if (!fqdno)
616          error (1, 0, "Name lookup failed for `%s': %s",          error (1, 0, "Name lookup failed for `%s'", otherhost);
617                 otherhost, hstrerror (h_errno));      fqdns = canon_host (server_hostname);
618  #else      if (!fqdno)
619          error (1, 0, "Name lookup failed for `%s': h_error=%d",          error (1, 0, "Name lookup failed for `%s'", server_hostname);
620                 otherhost, h_errno);  
621  #endif      retval = !strcasecmp (fqdns, fqdno);
622    
623      return !strcasecmp (server_hostname, hinfo->h_name);      free (fqdno);
624        free (fqdns);
625        return retval;
626  }  }
627    
628    
# Line 7437  error 0 kerberos: %s\n", krb_get_err_tex Line 7442  error 0 kerberos: %s\n", krb_get_err_tex
7442  static void  static void
7443  gserver_authenticate_connection (void)  gserver_authenticate_connection (void)
7444  {  {
7445      struct hostent *hp;      char *hn;
7446      gss_buffer_desc tok_in, tok_out;      gss_buffer_desc tok_in, tok_out;
7447      char buf[1024];      char buf[1024];
7448      char *credbuf;      char *credbuf;
# Line 7448  gserver_authenticate_connection (void) Line 7453  gserver_authenticate_connection (void)
7453      int nbytes;      int nbytes;
7454      gss_OID mechid;      gss_OID mechid;
7455    
7456      hp = gethostbyname (server_hostname);      hn = canon_host (server_hostname);
7457      if (hp == NULL)      if (hn == NULL)
7458          error (1, 0, "can't get canonical hostname");          error (1, 0, "can't get canonical hostname");
7459    
7460      sprintf (buf, "cvs@%s", hp->h_name);      sprintf (buf, "cvs@%s", hn);
7461        free (hn);
7462      tok_in.value = buf;      tok_in.value = buf;
7463      tok_in.length = strlen (buf);      tok_in.length = strlen (buf);
7464    

Legend:
Removed from v.1.437  
changed lines
  Added in v.1.438

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26