summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/pap.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-10-26 01:04:02 +0000
committerbrian <brian@FreeBSD.org>1997-10-26 01:04:02 +0000
commit486b8925ecb0d408e403474828e20c1cce8aaec8 (patch)
treecca66974908224bf517868aaafb2e4acd1abe88d /usr.sbin/ppp/pap.c
parent1d2927c9fac7bcfe68bf6ab502c716adc91d6f09 (diff)
downloadFreeBSD-src-486b8925ecb0d408e403474828e20c1cce8aaec8.zip
FreeBSD-src-486b8925ecb0d408e403474828e20c1cce8aaec8.tar.gz
Cosmetic (no functional changes):
o Add missing $Id$s o Move extern decls from .c -> .h files o Staticize o Remove #includes from .h files o style(9)ify includes o bcopy -> memcpy bzero -> memset bcmp -> memcmp index -> strchr rindex -> strrchr o Move timeout.h -> timer.h (making it consistent w/ timer.c) o Add -Wmissing-prototypes
Diffstat (limited to 'usr.sbin/ppp/pap.c')
-rw-r--r--usr.sbin/ppp/pap.c46
1 files changed, 29 insertions, 17 deletions
diff --git a/usr.sbin/ppp/pap.c b/usr.sbin/ppp/pap.c
index 9d9580c..7b24293 100644
--- a/usr.sbin/ppp/pap.c
+++ b/usr.sbin/ppp/pap.c
@@ -18,37 +18,45 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: pap.c,v 1.16 1997/09/27 19:11:41 brian Exp $
+ * $Id: pap.c,v 1.17 1997/10/16 23:55:19 brian Exp $
*
* TODO:
*/
+#include <sys/param.h>
+#include <netinet/in.h>
+
+#include <pwd.h>
+#include <stdio.h>
+#include <string.h>
#include <time.h>
+#include <unistd.h>
+#ifdef __OpenBSD__
+#include <util.h>
+#else
+#include <libutil.h>
+#endif
#include <utmp.h>
-#include <pwd.h>
+
+#include "mbuf.h"
+#include "log.h"
+#include "defs.h"
+#include "timer.h"
#include "fsm.h"
#include "lcp.h"
#include "pap.h"
#include "loadalias.h"
+#include "command.h"
#include "vars.h"
#include "hdlc.h"
#include "lcpproto.h"
#include "phase.h"
#include "auth.h"
-#ifdef __OpenBSD__
-#include "util.h"
-#else
-#include "libutil.h"
-#endif
static char *papcodes[] = {
"???", "REQUEST", "ACK", "NAK"
};
-struct authinfo AuthPapInfo = {
- SendPapChallenge,
-};
-
-void
+static void
SendPapChallenge(int papid)
{
struct fsmheader lh;
@@ -69,17 +77,21 @@ SendPapChallenge(int papid)
lh.id = papid;
lh.length = htons(plen + sizeof(struct fsmheader));
bp = mballoc(plen + sizeof(struct fsmheader), MB_FSM);
- bcopy(&lh, MBUF_CTOP(bp), sizeof(struct fsmheader));
+ memcpy(MBUF_CTOP(bp), &lh, sizeof(struct fsmheader));
cp = MBUF_CTOP(bp) + sizeof(struct fsmheader);
*cp++ = namelen;
- bcopy(VarAuthName, cp, namelen);
+ memcpy(cp, VarAuthName, namelen);
cp += namelen;
*cp++ = keylen;
- bcopy(VarAuthKey, cp, keylen);
+ memcpy(cp, VarAuthKey, keylen);
HdlcOutput(PRI_LINK, PROTO_PAP, bp);
}
+struct authinfo AuthPapInfo = {
+ SendPapChallenge,
+};
+
static void
SendPapCode(int id, int code, char *message)
{
@@ -94,10 +106,10 @@ SendPapCode(int id, int code, char *message)
plen = mlen + 1;
lh.length = htons(plen + sizeof(struct fsmheader));
bp = mballoc(plen + sizeof(struct fsmheader), MB_FSM);
- bcopy(&lh, MBUF_CTOP(bp), sizeof(struct fsmheader));
+ memcpy(MBUF_CTOP(bp), &lh, sizeof(struct fsmheader));
cp = MBUF_CTOP(bp) + sizeof(struct fsmheader);
*cp++ = mlen;
- bcopy(message, cp, mlen);
+ memcpy(cp, message, mlen);
LogPrintf(LogPHASE, "PapOutput: %s\n", papcodes[code]);
HdlcOutput(PRI_LINK, PROTO_PAP, bp);
}
OpenPOWER on IntegriCloud