[eggheads-patches] PATCH1.5: getmyhostname_fix_1.5.patch

Fabian Knittel fknittel at gmx.de
Mon Oct 23 16:32:05 CST 2000


[ getmyhostname_fix_1.5.patch ]

This patch removes the checks to make sure that we have a fully
qualified domain name from the host detection function in the
server module.

Fabian

--
Fabian Knittel <fknittel at gmx.de> -- http://www.esc-web.de/fabian/
Signed or encrypted mail preferred.    PGP DSA key ID: 0x838B4D20
-------------- next part --------------
diff -urN --exclude-from=/home/fabian/.diffex eggdrop1.5~/doc/UPDATES1.5 eggdrop1.5/doc/UPDATES1.5
--- eggdrop1.5~/doc/UPDATES1.5	Mon Oct 23 22:47:06 2000
+++ eggdrop1.5/doc/UPDATES1.5	Mon Oct 23 22:47:50 2000
@@ -4,6 +4,7 @@
 
 1.5.5
 Found by  Fixed by  What...
+Sup       Fabian    Don't insist on proper domainname during hostname detection.
 Sup       Fabian    Properly call PART bind when removing channel and the bot
                     will therefore leave the channel shortly. Also slightly
                     reworked channel removal.
diff -urN --exclude-from=/home/fabian/.diffex eggdrop1.5~/src/mod/server.mod/server.c eggdrop1.5/src/mod/server.mod/server.c
--- eggdrop1.5~/src/mod/server.mod/server.c	Thu Oct 19 19:25:39 2000
+++ eggdrop1.5/src/mod/server.mod/server.c	Mon Oct 23 22:47:17 2000
@@ -1637,8 +1637,8 @@
  */
 static void getmyhostname(char *s)
 {
-  struct hostent *hp;
-  char *p;
+  struct hostent	*hp;
+  char			*p;
 
   if (hostname[0]) {
     strcpy(s, hostname);
@@ -1657,13 +1657,6 @@
   if (hp == NULL)
     fatal("Hostname self-lookup failed.", 0);
   strcpy(s, hp->h_name);
-  if (strchr(s, '.') != NULL)
-    return;
-  if (hp->h_aliases[0] == NULL)
-    fatal("Can't determine your hostname!", 0);
-  strcpy(s, hp->h_aliases[0]);
-  if (strchr(s, '.') == NULL)
-    fatal("Can't determine your hostname!", 0);
 }
 
 static cmd_t my_ctcps[] =
diff -urN --exclude-from=/home/fabian/.diffex eggdrop1.5~/src/net.c eggdrop1.5/src/net.c
--- eggdrop1.5~/src/net.c	Thu Oct 19 19:25:38 2000
+++ eggdrop1.5/src/net.c	Mon Oct 23 22:47:17 2000
@@ -1062,7 +1062,7 @@
   /* According to the latest RFC, the clients SHOULD be able to handle
    * DNS names that are up to 255 characters long.  This is not broken.
    */
-  char hostname[256], badaddress[16];
+  char hostn[256], badaddress[16];
 
   /* It is disabled HERE so we only have to check in *one* spot! */
   if (!dcc_sanitycheck)
@@ -1075,15 +1075,15 @@
    * where the routines providing our data currently lose interest. I'm
    * using the n-variant in case someone changes that...
    */
-  strncpy(hostname, extracthostname(from), 255);
-  hostname[255] = 0;
-  if (!egg_strcasecmp(hostname, dnsname)) {
+  strncpy(hostn, extracthostname(from), 255);
+  hostn[255] = 0;
+  if (!egg_strcasecmp(hostn, dnsname)) {
     putlog(LOG_DEBUG, "*", "DNS information for submitted IP checks out.");
     return 1;
   }
   if (!strcmp(badaddress, dnsname))
-    putlog(LOG_MISC, "*", "ALERT: (%s!%s) sent a DCC request with bogus IP information of %s port %u!",
-	   nick, from, badaddress, prt);
+    putlog(LOG_MISC, "*", "ALERT: (%s!%s) sent a DCC request with bogus IP "
+	   "information of %s port %u!", nick, from, badaddress, prt);
   else
     return 1; /* <- usually happens when we have 
 		    a user with an unresolved hostmask! */




More information about the Patches mailing list