亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? chap.c

?? vxworks的完整的源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* chap.c - Crytographic Handshake Authentication Protocol *//* Copyright 1995 Wind River Systems, Inc. */#include "copyright_wrs.h"/* * Copyright (c) 1991 Gregory M. Christy. * All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed * by Gregory M. Christy.  The name of the author may not be used to * endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. *//*modification history--------------------01e,30jun95,dzb  removed floating point operation (srand48() and drand48()).01d,16jun95,dzb  header file consolidation.                 changed [UN]TIMEOUT macros to PPP_[UN]TIMEOUT.01c,08jun95,dzb  changed CHAP response messages to be more informative.01b,16jan95,dzb  changed to use PPP specific md5 routines.01a,21dec94,dab  VxWorks port - first WRS version.           +dzb  added: path for ppp header files, WRS copyright, NO_DRAND48.*/#include "vxWorks.h"#include "stdio.h"#include "string.h"#include "sys/types.h"#include "sys/times.h"#include "pppLib.h"static void ChapChallengeTimeout __ARGS((caddr_t));static void ChapResponseTimeout __ARGS((caddr_t));static void ChapReceiveChallenge __ARGS((chap_state *, u_char *, int, int));static void ChapReceiveResponse __ARGS((chap_state *, u_char *, int, int));static void ChapReceiveSuccess __ARGS((chap_state *, u_char *, int, int));static void ChapReceiveFailure __ARGS((chap_state *, u_char *, int, int));static void ChapSendStatus __ARGS((chap_state *, int));static void ChapSendChallenge __ARGS((chap_state *));static void ChapSendResponse __ARGS((chap_state *));static void ChapGenChallenge __ARGS((chap_state *));/* * ChapInit - Initialize a CHAP unit. */voidChapInit(unit)    int unit;{    chap_state *cstate = &ppp_if[unit]->chap;    BZERO((char *)cstate, sizeof(*cstate));    cstate->unit = unit;    cstate->clientstate = CHAPCS_INITIAL;    cstate->serverstate = CHAPSS_INITIAL;    cstate->timeouttime = CHAP_DEFTIMEOUT;    cstate->max_transmits = CHAP_DEFTRANSMITS;    srandom((long) time(NULL));	/* joggle random number generator */}/* * ChapAuthWithPeer - Authenticate us with our peer (start client). * */voidChapAuthWithPeer(unit, our_name, digest)    int unit;    char *our_name;    int digest;{    chap_state *cstate = &ppp_if[unit]->chap;    cstate->resp_name = our_name;    cstate->resp_type = digest;    if (cstate->clientstate == CHAPCS_INITIAL ||	cstate->clientstate == CHAPCS_PENDING) {	/* lower layer isn't up - wait until later */	cstate->clientstate = CHAPCS_PENDING;	return;    }    /*     * We get here as a result of LCP coming up.     * So even if CHAP was open before, we will      * have to re-authenticate ourselves.     */    cstate->clientstate = CHAPCS_LISTEN;}/* * ChapAuthPeer - Authenticate our peer (start server). */voidChapAuthPeer(unit, our_name, digest)    int unit;    char *our_name;    int digest;{    chap_state *cstate = &ppp_if[unit]->chap;      cstate->chal_name = our_name;    cstate->chal_type = digest;    if (cstate->serverstate == CHAPSS_INITIAL ||	cstate->serverstate == CHAPSS_PENDING) {	/* lower layer isn't up - wait until later */	cstate->serverstate = CHAPSS_PENDING;	return;    }    ChapGenChallenge(cstate);    ChapSendChallenge(cstate);		/* crank it up dude! */    cstate->serverstate = CHAPSS_INITIAL_CHAL;}/* * ChapChallengeTimeout - Timeout expired on sending challenge. */static voidChapChallengeTimeout(arg)    caddr_t arg;{    chap_state *cstate = (chap_state *) arg;      /* if we aren't sending challenges, don't worry.  then again we */    /* probably shouldn't be here either */    if (cstate->serverstate != CHAPSS_INITIAL_CHAL &&	cstate->serverstate != CHAPSS_RECHALLENGE)	return;    if (cstate->chal_transmits >= cstate->max_transmits) {	/* give up on peer */	syslog(LOG_ERR, "Peer failed to respond to CHAP challenge");	cstate->serverstate = CHAPSS_BADAUTH;	auth_peer_fail(cstate->unit, CHAP);	return;    }    ChapSendChallenge(cstate);		/* Re-send challenge */}/* * ChapResponseTimeout - Timeout expired on sending response. */static voidChapResponseTimeout(arg)    caddr_t arg;{    chap_state *cstate = (chap_state *) arg;    /* if we aren't sending a response, don't worry. */    if (cstate->clientstate != CHAPCS_RESPONSE)	return;    ChapSendResponse(cstate);		/* re-send response */}/* * ChapRechallenge - Time to challenge the peer again. */static voidChapRechallenge(arg)    caddr_t arg;{    chap_state *cstate = (chap_state *) arg;    /* if we aren't sending a response, don't worry. */    if (cstate->serverstate != CHAPSS_OPEN)	return;    ChapGenChallenge(cstate);    ChapSendChallenge(cstate);    cstate->serverstate = CHAPSS_RECHALLENGE;    if (cstate->chal_interval != 0)	PPP_TIMEOUT(ChapRechallenge, (caddr_t) cstate, cstate->chal_interval);}/* * ChapLowerUp - The lower layer is up. * * Start up if we have pending requests. */voidChapLowerUp(unit)    int unit;{    chap_state *cstate = &ppp_if[unit]->chap;      if (cstate->clientstate == CHAPCS_INITIAL)	cstate->clientstate = CHAPCS_CLOSED;    else if (cstate->clientstate == CHAPCS_PENDING)	cstate->clientstate = CHAPCS_LISTEN;    if (cstate->serverstate == CHAPSS_INITIAL)	cstate->serverstate = CHAPSS_CLOSED;    else if (cstate->serverstate == CHAPSS_PENDING) {	ChapGenChallenge(cstate);	ChapSendChallenge(cstate);	cstate->serverstate = CHAPSS_INITIAL_CHAL;    }}/* * ChapLowerDown - The lower layer is down. * * Cancel all timeouts. */voidChapLowerDown(unit)    int unit;{    chap_state *cstate = &ppp_if[unit]->chap;      /* Timeout(s) pending?  Cancel if so. */    if (cstate->serverstate == CHAPSS_INITIAL_CHAL ||	cstate->serverstate == CHAPSS_RECHALLENGE)	PPP_UNTIMEOUT(ChapChallengeTimeout, (caddr_t) cstate);    else if (cstate->serverstate == CHAPSS_OPEN	     && cstate->chal_interval != 0)	PPP_UNTIMEOUT(ChapRechallenge, (caddr_t) cstate);    if (cstate->clientstate == CHAPCS_RESPONSE)	PPP_UNTIMEOUT(ChapResponseTimeout, (caddr_t) cstate);    cstate->clientstate = CHAPCS_INITIAL;    cstate->serverstate = CHAPSS_INITIAL;}/* * ChapProtocolReject - Peer doesn't grok CHAP. */voidChapProtocolReject(unit)    int unit;{    chap_state *cstate = &ppp_if[unit]->chap;    if (cstate->serverstate != CHAPSS_INITIAL &&	cstate->serverstate != CHAPSS_CLOSED)	auth_peer_fail(unit, CHAP);    if (cstate->clientstate != CHAPCS_INITIAL &&	cstate->clientstate != CHAPCS_CLOSED)	auth_withpeer_fail(unit, CHAP);    ChapLowerDown(unit);		/* shutdown chap */}/* * ChapInput - Input CHAP packet. */voidChapInput(unit, inpacket, packet_len)    int unit;    u_char *inpacket;    int packet_len;{    chap_state *cstate = &ppp_if[unit]->chap;    u_char *inp;    u_char code, id;    int len;      /*     * Parse header (code, id and length).     * If packet too short, drop it.     */    inp = inpacket;    if (packet_len < CHAP_HEADERLEN) {	CHAPDEBUG((LOG_INFO, "ChapInput: rcvd short header."));	return;    }    GETCHAR(code, inp);    GETCHAR(id, inp);    GETSHORT(len, inp);    if (len < CHAP_HEADERLEN) {	CHAPDEBUG((LOG_INFO, "ChapInput: rcvd illegal length."));	return;    }    if (len > packet_len) {	CHAPDEBUG((LOG_INFO, "ChapInput: rcvd short packet."));	return;    }    len -= CHAP_HEADERLEN;      /*     * Action depends on code (as in fact it usually does :-).     */    switch (code) {    case CHAP_CHALLENGE:	ChapReceiveChallenge(cstate, inp, id, len);	break;        case CHAP_RESPONSE:	ChapReceiveResponse(cstate, inp, id, len);	break;        case CHAP_FAILURE:	ChapReceiveFailure(cstate, inp, id, len);	break;    case CHAP_SUCCESS:	ChapReceiveSuccess(cstate, inp, id, len);	break;    default:				/* Need code reject? */	syslog(LOG_WARNING, "Unknown CHAP code (%d) received.", code);	break;    }}/* * ChapReceiveChallenge - Receive Challenge and send Response. */static voidChapReceiveChallenge(cstate, inp, id, len)    chap_state *cstate;    u_char *inp;    int id;    int len;{    int rchallenge_len;    u_char *rchallenge;    int secret_len;    char secret[MAXSECRETLEN];    char rhostname[256];    MD5_CTX mdContext;     CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: Rcvd id %d.", id));    if (cstate->clientstate == CHAPCS_CLOSED ||	cstate->clientstate == CHAPCS_PENDING) {	CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: in state %d",		   cstate->clientstate));	return;    }    if (len < 2) {	CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: rcvd short packet."));	return;    }    GETCHAR(rchallenge_len, inp);    len -= sizeof (u_char) + rchallenge_len;	/* now name field length */    if (len < 0) {	CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: rcvd short packet."));	return;    }    rchallenge = inp;    INCPTR(rchallenge_len, inp);    if (len >= sizeof(rhostname))	len = sizeof(rhostname) - 1;    BCOPY((char *)inp, rhostname, len);    rhostname[len] = '\000';    CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: received name field: %s",	       rhostname));    /* get secret for authenticating ourselves with the specified host */    if (!get_secret(cstate->unit, cstate->resp_name, rhostname,		    secret, &secret_len, 0)) {	secret_len = 0;		/* assume null secret if can't find one */	syslog(LOG_WARNING, "No CHAP secret found for authenticating us to %s",	       rhostname);    }    /* cancel response send timeout if necessary */    if (cstate->clientstate == CHAPCS_RESPONSE)	PPP_UNTIMEOUT(ChapResponseTimeout, (caddr_t) cstate);    cstate->resp_id = id;    cstate->resp_transmits = 0;    /*  generate MD based on negotiated type */    switch (cstate->resp_type) {     case CHAP_DIGEST_MD5:		/* only MD5 is defined for now */	ppp_MD5Init(&mdContext);	ppp_MD5Update(&mdContext, &cstate->resp_id, 1);	ppp_MD5Update(&mdContext, (u_char *) secret, secret_len);	ppp_MD5Update(&mdContext, rchallenge, rchallenge_len);	ppp_MD5Final(&mdContext);	BCOPY((char *)mdContext.digest, (char *)cstate->response,              MD5_SIGNATURE_SIZE);	cstate->resp_length = MD5_SIGNATURE_SIZE;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
97久久人人超碰| 国产91丝袜在线播放| 国产女人18水真多18精品一级做| 91蜜桃网址入口| 久久机这里只有精品| 夜夜精品视频一区二区| 国产精品久久综合| 日韩欧美色电影| 欧美性受极品xxxx喷水| 韩日精品视频一区| 日韩三级视频中文字幕| 日韩欧美在线不卡| 调教+趴+乳夹+国产+精品| 在线视频你懂得一区| 亚洲成人高清在线| 亚洲男帅同性gay1069| 国产欧美久久久精品影院| 久久麻豆一区二区| 日日夜夜一区二区| 亚洲成av人影院| 蜜桃精品视频在线| 国产精品一区二区在线观看不卡 | 日本在线不卡视频| 日韩电影在线免费观看| 另类小说欧美激情| 国产精品亚洲一区二区三区在线| 成人精品视频.| 欧美在线综合视频| 欧美一级一级性生活免费录像| 精品久久久久久久久久久久久久久久久 | 欧美精品黑人性xxxx| 日韩美女一区二区三区四区| 国产亚洲人成网站| 亚洲色图视频免费播放| 亚洲成a人v欧美综合天堂| 美女视频黄 久久| 大美女一区二区三区| 色呦呦国产精品| 91精品视频网| 欧美激情综合在线| 亚洲国产中文字幕| 久草这里只有精品视频| av在线播放一区二区三区| 欧美三级日韩在线| 在线亚洲一区二区| 精品国产亚洲一区二区三区在线观看| 欧美精品一区二区蜜臀亚洲| 国产精品久线在线观看| 久久精品国产亚洲一区二区三区| 亚洲一区中文日韩| 中文字幕亚洲一区二区av在线 | 日韩一级大片在线| 日本一区二区视频在线| 国产91综合网| 国产成人精品一区二区三区四区| 欧美一区二区福利视频| 日韩av午夜在线观看| 欧美精品乱码久久久久久按摩| 五月天欧美精品| 欧美草草影院在线视频| 精彩视频一区二区三区| 精品国产一区二区三区忘忧草| 亚洲欧美另类小说| 五月激情综合网| 欧美日韩一级二级| 136国产福利精品导航| 成人午夜视频网站| 欧美欧美午夜aⅴ在线观看| 麻豆精品精品国产自在97香蕉| 国产老女人精品毛片久久| 色域天天综合网| 日韩一区二区三区在线观看| 中文字幕国产一区| 五月天激情小说综合| 性久久久久久久| 99久久精品国产网站| 欧美日韩视频专区在线播放| 久久久久久久久岛国免费| 亚洲精品成人悠悠色影视| 九九热在线视频观看这里只有精品| 成人av电影在线| 欧美大片在线观看| 亚洲欧洲色图综合| 久久97超碰国产精品超碰| 91影视在线播放| 2022国产精品视频| 婷婷一区二区三区| 成人福利视频在线| 精品电影一区二区| 天堂久久久久va久久久久| 成人一道本在线| 欧美日韩另类国产亚洲欧美一级| 日韩美女啊v在线免费观看| 国产一区二区三区免费观看| 欧美酷刑日本凌虐凌虐| 中文字幕在线不卡国产视频| 韩国精品主播一区二区在线观看| 欧美欧美午夜aⅴ在线观看| 亚洲精品国久久99热| 国产资源在线一区| 666欧美在线视频| 亚洲一区二区四区蜜桃| 不卡一区二区中文字幕| 久久久久久久久岛国免费| 蜜桃久久av一区| 这里只有精品电影| 亚洲一区二区三区免费视频| 成人综合婷婷国产精品久久免费| 国产欧美精品一区二区三区四区| 老司机精品视频导航| 91麻豆精品国产91久久久久久久久 | 丁香啪啪综合成人亚洲小说 | 在线一区二区三区做爰视频网站| 国产精品私人自拍| 国产精品一区免费视频| 久久久久久毛片| 国产一级精品在线| 精品国产在天天线2019| 久久se精品一区精品二区| 日韩精品一区二区三区视频| 日韩av在线发布| 日韩三区在线观看| 日本不卡中文字幕| 久久久久久麻豆| 国产91精品一区二区麻豆网站 | 日日噜噜夜夜狠狠视频欧美人 | 欧美国产视频在线| 成人免费毛片高清视频| 中文字幕av免费专区久久| 不卡一区在线观看| 1024国产精品| 在线免费视频一区二区| 免费人成精品欧美精品| 欧美一区三区四区| 久久99久国产精品黄毛片色诱| 日韩精品一区二区三区在线| 国产在线精品一区二区不卡了| 久久蜜桃av一区精品变态类天堂| 国产一区二区91| 国产午夜精品久久久久久免费视 | 一区二区在线电影| 欧美精品亚洲二区| 黄页网站大全一区二区| 国产三级精品视频| 波多野洁衣一区| 午夜日韩在线观看| 日韩视频免费观看高清完整版| 国产一区在线精品| 亚洲欧美一区二区三区孕妇| 欧美午夜精品电影| 久久草av在线| 国产精品乱人伦中文| 在线亚洲欧美专区二区| 一区二区欧美视频| 欧美日韩久久久一区| 国产一本一道久久香蕉| 亚洲精品一二三| 777a∨成人精品桃花网| 国产成人综合在线| 亚洲高清久久久| 91精品国产黑色紧身裤美女| 丁香婷婷深情五月亚洲| 亚洲国产成人va在线观看天堂| 日韩写真欧美这视频| 国产a区久久久| 亚洲成人一区在线| 久久精品视频在线看| 91蜜桃免费观看视频| 国产精品99久久久久久有的能看 | 欧美精品一区二区三区蜜桃视频| 成人av动漫在线| 秋霞午夜av一区二区三区| 中文字幕不卡的av| 91精品国产综合久久精品性色| 狠狠色丁香久久婷婷综| 亚洲三级在线观看| 日韩你懂的在线播放| 色综合网色综合| 国产美女娇喘av呻吟久久| 一区二区久久久久| 国产午夜亚洲精品不卡| 欧洲另类一二三四区| 91女神在线视频| 国产一区二区不卡在线| 亚洲国产精品精华液网站| 国产精品美女久久久久久2018| 日韩欧美一级在线播放| 欧美在线观看视频在线| 精品一区二区成人精品| 香蕉久久夜色精品国产使用方法 | 欧美三级三级三级| 成人激情午夜影院| 麻豆国产精品视频| 天天综合网 天天综合色| 18欧美乱大交hd1984| 欧美国产一区二区| 久久精品亚洲一区二区三区浴池| 在线不卡免费欧美| 在线观看国产日韩| 99久久精品免费观看|