Date: Fri, 11 Oct 1996 09:16:43 +0900 From: NAKAMURA Motonori <motonori@econ.kyoto-u.ac.jp> To: bugs@freebsd.org Subject: patches for PPP Message-ID: <19961011091643Y/motonori@econ.kyoto-u.ac.jp>
index | next in thread | raw e-mail
Hello,
I send some patches for /usr/sbin/ppp derived from iij-ppp by tony-o
because the ppp software is not supported no longer by the original
author, and some improvement have been done by FBSD group, I think.
If there is more appropriate person to send this type of report,
please let me know.
Well, there are two bugs in the ppp software about malloc()
and a core is dumped on BSDOS 2.1. But may not be dumped
with FBSD.
1. Room to calculate MD5 for CHAP negotiation is shorter than
required. a core is not dumped at first connecting time and
dumped at second or third time. (patch I)
2. A routine for "show route" refers out of allocated space.
Values pointed by "lp" should be read as CHAR, I think.
there is also no free() for disallocation. (patch II)
Here is also a patch for an improvement: In current imprementation,
even if PPP connection is disconnected by time out, prompt of
interactive mode does not change from "PPP>" to "ppp>" to
indicate the disconnection on a terminal.
So I modified the code to do that. (patch III)
Regards,
---
Faculty of Economics, Kyoto University, Kyoto, 606-01 JAPAN
Motonori NAKAMURA E-mail: <motonori@econ.kyoto-u.ac.jp>
=== patch I ===
*** chap.c.orig Sun May 12 06:03:00 1996
--- chap.c Fri Oct 11 06:34:19 1996
***************
*** 147,153 ****
}
name = VarAuthName;
namelen = strlen(VarAuthName);
! argp = malloc(1 + valsize + namelen);
digest = argp;
*digest++ = 16; /* value size */
ap = answer;
--- 147,153 ----
}
name = VarAuthName;
namelen = strlen(VarAuthName);
! argp = malloc(1 + valsize + namelen + 16);
digest = argp;
*digest++ = 16; /* value size */
ap = answer;
***************
*** 169,174 ****
--- 169,175 ----
ap += namelen;
/* Send answer to the peer */
ChapOutput(CHAP_RESPONSE, chp->id, argp, namelen + 17);
+ free(argp);
break;
case CHAP_RESPONSE:
if (keyp) {
=== patch II ===
*** route.c.orig Sun Oct 6 09:01:00 1996
--- route.c Fri Oct 11 06:33:50 1996
***************
*** 198,207 ****
--- 198,209 ----
#if (BSD >= 199306)
if (sysctl(mib, 6, sp, &needed, NULL, 0) < 0) {
perror("sysctl-getroute");
+ free(sp);
return(1);
}
#else
if (getkerninfo(KINFO_RT_DUMP, sp, &needed, 0) < 0)
+ free(sp);
return(1);
#endif
ep = sp + needed;
***************
*** 226,236 ****
#endif
wp = (u_char *)(lp + 1);
mask = 0;
! for (nb = *lp; nb > 4; nb--) {
mask <<= 8;
mask |= *wp++;
}
! for (nb = 8 - *lp; nb > 0; nb--)
mask <<= 8;
}
}
--- 228,238 ----
#endif
wp = (u_char *)(lp + 1);
mask = 0;
! for (nb = *(char *)lp; nb > 4; nb--) {
mask <<= 8;
mask |= *wp++;
}
! for (nb = 8 - *(char *)lp; nb > 0; nb--)
mask <<= 8;
}
}
***************
*** 238,244 ****
p_flags(rtm->rtm_flags & (RTF_UP|RTF_GATEWAY|RTF_HOST), "%-6.6s ");
printf("(%d)\n", rtm->rtm_index);
}
!
return(1);
}
--- 240,246 ----
p_flags(rtm->rtm_flags & (RTF_UP|RTF_GATEWAY|RTF_HOST), "%-6.6s ");
printf("(%d)\n", rtm->rtm_index);
}
! free(sp);
return(1);
}
=== patch III ===
*** command.c.orig Mon Oct 7 08:27:00 1996
--- command.c Fri Oct 11 06:37:59 1996
***************
*** 480,495 ****
return(val);
}
void
! Prompt(flag)
! int flag;
{
char *pconnect, *pauth;
if (!(mode & MODE_INTER))
return;
! if (flag) printf("\n");
if ( VarLocalAuth == LOCAL_AUTH )
pauth = " ON ";
--- 480,499 ----
return(val);
}
+ int aft_cmd = 1;
+
void
! Prompt()
{
char *pconnect, *pauth;
if (!(mode & MODE_INTER))
return;
! if (!aft_cmd)
! printf("\n");
! else
! aft_cmd = 0;
if ( VarLocalAuth == LOCAL_AUTH )
pauth = " ON ";
*** ../iij-ppp.FBSD/main.c Mon Oct 7 02:36:00 1996
--- main.c Fri Oct 11 06:52:31 1996
***************
*** 61,66 ****
--- 61,67 ----
extern int SelectSystem();
extern void DecodeCommand(), Prompt();
+ extern int aft_cmd;
extern int IsInteractive();
extern struct in_addr ifnetmask;
static void DoLoop(void);
***************
*** 455,460 ****
--- 456,462 ----
if ((mode & (MODE_INTER|MODE_AUTO)) == MODE_INTER) {
TtyCommandMode(1);
fprintf(stderr, "Packet mode.\r\n");
+ aft_cmd = 1;
}
}
***************
*** 483,488 ****
--- 485,491 ----
#endif
if (!TermMode) {
n = read(netfd, linebuff, sizeof(linebuff)-1);
+ aft_cmd = 1;
if (n > 0) {
DecodeCommand(linebuff, n, 1);
} else {
***************
*** 644,649 ****
--- 647,653 ----
if (mode & MODE_DIRECT) {
modem = OpenModem(mode);
LogPrintf(LOG_PHASE_BIT, "Packet mode enabled\n");
+ fflush(stderr);
PacketMode();
} else if (mode & MODE_DEDICATED) {
if (!modem)
*** ../iij-ppp.FBSD/lcp.c Sun May 12 06:03:00 1996
--- lcp.c Fri Oct 11 06:45:43 1996
***************
*** 379,384 ****
--- 390,396 ----
StopAllTimers();
OsLinkdown();
NewPhase(PHASE_TERMINATE);
+ Prompt(1);
}
void
***************
*** 663,668 ****
--- 678,689 ----
}
break;
}
+ #if 1 /* to avoid inf. loop */
+ if (length == 0) {
+ LogPrintf(LOG_LCP, "LCP size zero\n");
+ break;
+ }
+ #endif
plen -= length;
cp += length;
}
=== END ===
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19961011091643Y/motonori>
