auth.c (50479) | auth.c (54912) |
---|---|
1/* 2 * PPP Secret Key Module 3 * 4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 5 * 6 * Copyright (C) 1994, Internet Initiative Japan, Inc. All rights reserverd. 7 * 8 * Redistribution and use in source and binary forms are permitted 9 * provided that the above copyright notice and this paragraph are 10 * duplicated in all such forms and that any documentation, 11 * advertising materials, and other materials related to such 12 * distribution and use acknowledge that the software was developed 13 * by the Internet Initiative Japan, Inc. The name of the 14 * IIJ may not be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19 * | 1/* 2 * PPP Secret Key Module 3 * 4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 5 * 6 * Copyright (C) 1994, Internet Initiative Japan, Inc. All rights reserverd. 7 * 8 * Redistribution and use in source and binary forms are permitted 9 * provided that the above copyright notice and this paragraph are 10 * duplicated in all such forms and that any documentation, 11 * advertising materials, and other materials related to such 12 * distribution and use acknowledge that the software was developed 13 * by the Internet Initiative Japan, Inc. The name of the 14 * IIJ may not be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19 * |
20 * $FreeBSD: head/usr.sbin/ppp/auth.c 50479 1999-08-28 01:35:59Z peter $ | 20 * $FreeBSD: head/usr.sbin/ppp/auth.c 54912 1999-12-20 20:29:47Z brian $ |
21 * 22 * TODO: 23 * o Implement check against with registered IP addresses. 24 */ 25#include <sys/param.h> 26#include <netinet/in.h> 27#include <netinet/in_systm.h> 28#include <netinet/ip.h> --- 293 unchanged lines hidden (view full) --- 322 timer_Stop(&authp->authtimer); 323} 324 325struct mbuf * 326auth_ReadHeader(struct authinfo *authp, struct mbuf *bp) 327{ 328 int len; 329 | 21 * 22 * TODO: 23 * o Implement check against with registered IP addresses. 24 */ 25#include <sys/param.h> 26#include <netinet/in.h> 27#include <netinet/in_systm.h> 28#include <netinet/ip.h> --- 293 unchanged lines hidden (view full) --- 322 timer_Stop(&authp->authtimer); 323} 324 325struct mbuf * 326auth_ReadHeader(struct authinfo *authp, struct mbuf *bp) 327{ 328 int len; 329 |
330 len = mbuf_Length(bp); | 330 len = m_length(bp); |
331 if (len >= sizeof authp->in.hdr) { 332 bp = mbuf_Read(bp, (u_char *)&authp->in.hdr, sizeof authp->in.hdr); 333 if (len >= ntohs(authp->in.hdr.length)) 334 return bp; 335 authp->in.hdr.length = htons(0); 336 log_Printf(LogWARN, "auth_ReadHeader: Short packet (%d > %d) !\n", 337 ntohs(authp->in.hdr.length), len); 338 } else { 339 authp->in.hdr.length = htons(0); 340 log_Printf(LogWARN, "auth_ReadHeader: Short packet header (%d > %d) !\n", 341 (int)(sizeof authp->in.hdr), len); 342 } 343 | 331 if (len >= sizeof authp->in.hdr) { 332 bp = mbuf_Read(bp, (u_char *)&authp->in.hdr, sizeof authp->in.hdr); 333 if (len >= ntohs(authp->in.hdr.length)) 334 return bp; 335 authp->in.hdr.length = htons(0); 336 log_Printf(LogWARN, "auth_ReadHeader: Short packet (%d > %d) !\n", 337 ntohs(authp->in.hdr.length), len); 338 } else { 339 authp->in.hdr.length = htons(0); 340 log_Printf(LogWARN, "auth_ReadHeader: Short packet header (%d > %d) !\n", 341 (int)(sizeof authp->in.hdr), len); 342 } 343 |
344 mbuf_Free(bp); | 344 m_freem(bp); |
345 return NULL; 346} 347 348struct mbuf * 349auth_ReadName(struct authinfo *authp, struct mbuf *bp, int len) 350{ 351 if (len > sizeof authp->in.name - 1) 352 log_Printf(LogWARN, "auth_ReadName: Name too long (%d) !\n", len); 353 else { | 345 return NULL; 346} 347 348struct mbuf * 349auth_ReadName(struct authinfo *authp, struct mbuf *bp, int len) 350{ 351 if (len > sizeof authp->in.name - 1) 352 log_Printf(LogWARN, "auth_ReadName: Name too long (%d) !\n", len); 353 else { |
354 int mlen = mbuf_Length(bp); | 354 int mlen = m_length(bp); |
355 356 if (len > mlen) 357 log_Printf(LogWARN, "auth_ReadName: Short packet (%d > %d) !\n", 358 len, mlen); 359 else { 360 bp = mbuf_Read(bp, (u_char *)authp->in.name, len); 361 authp->in.name[len] = '\0'; 362 return bp; 363 } 364 } 365 366 *authp->in.name = '\0'; | 355 356 if (len > mlen) 357 log_Printf(LogWARN, "auth_ReadName: Short packet (%d > %d) !\n", 358 len, mlen); 359 else { 360 bp = mbuf_Read(bp, (u_char *)authp->in.name, len); 361 authp->in.name[len] = '\0'; 362 return bp; 363 } 364 } 365 366 *authp->in.name = '\0'; |
367 mbuf_Free(bp); | 367 m_freem(bp); |
368 return NULL; 369} | 368 return NULL; 369} |