[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#2623: unstable/libc-aout gethostbyaddr broken!



Here's the patch to libc5-5.2.18/inet/gethstnmad.c that updates at
least this particular function to bind-4.9.3-REL. If there aren't
plans to update it completely, I'd like to see this much
included. (I'm running right now with the daemons that needed it
static-linked to a libc with this patch, as a test...)

*** gethstnmad.c	1996/04/09 06:55:59	1.1
--- gethstnmad.c	1996/04/09 07:01:59
***************
*** 597,603 ****
--- 597,605 ----
  	int haveanswer, had_error;
  	int toobig = 0;
  	char tbuf[MAXDNAME+1];
+ 	const char *tname;

+ 	tname = qname;
  	host.h_name = NULL;
  	eom = answer->buf + anslen;
  	/*
***************
*** 699,704 ****
--- 701,725 ----
  			buflen -= n;
  			continue;
  		}
+ 		if (qtype == T_PTR && type == T_CNAME) {
+ 			n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf);
+                         if (n < 0) {
+ 				had_error++;
+                                 continue;
+                         }
+                         cp += n;
+                         /* Get canonical name. */
+                         n = strlen(tbuf) + 1;   /* for the \0 */
+                         if (n > buflen) {
+ 				had_error++;
+                                 continue;
+                         }
+                         strcpy(bp, tbuf);
+                         tname = bp;
+                         bp += n;
+                         buflen -= n;
+                         continue;
+                 }
  		if (type != qtype) {
  			syslog(LOG_NOTICE|LOG_AUTH,
  #if NLS
***************
*** 713,719 ****
  		}
  		switch (type) {
  		case T_PTR:
! 			if (strcasecmp(qname, bp) != 0) {
  				syslog(LOG_NOTICE|LOG_AUTH,
  #if NLS
  	       catgets(_libc_cat, NetMiscSet, NetMiscAskedForGot, AskedForGot),
--- 734,740 ----
  		}
  		switch (type) {
  		case T_PTR:
! 			if (strcasecmp(tname, bp) != 0) {
  				syslog(LOG_NOTICE|LOG_AUTH,
  #if NLS
  	       catgets(_libc_cat, NetMiscSet, NetMiscAskedForGot, AskedForGot),



Reply to: