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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? radius_authorize.c

?? vxworks下radius協(xié)議棧 的源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
/* radius_authorize.c *//* Implementations of encryption and decryption of RADIUS attributes if needed. *//* Currently we only encrypt User-Password and decrypt Tunnel-Password			*//* Copyright 1984 - 2000 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history____________________01f,26aug03,snd Changes done to remove compilation warnings01e,22mar02,md  Bug fix - zeroing out the wrong MA when EAP packet is larged01d,15mar02,md  Merge Mark's changes for EAP support01c,04mar02,md  Add support for EAP01b,27feb02,md  Add a fourth parameter to radius_accounting_fill_in_request_authenticator				to authenticate the accounting response from radius server01a,19dec00,md  merged from visual source safe*//************************************************************************//*	Copyright (C) 1993 - 1999 RouterWare, Inc.   						*//*	Unpublished - rights reserved under the Copyright Laws of the		*//*	United States.  Use, duplication, or disclosure by the 				*//*	Government is subject to restrictions as set forth in 				*//*	subparagraph (c)(1)(ii) of the Rights in Technical Data and 		*//*	Computer Software clause at 252.227-7013.							*//*	RouterWare, Inc., 3961 MacArthur Suite 212 Newport Beach, CA 92660	*//************************************************************************/#include <string.h>#include "radius.h"#include <rwutils.h>#ifdef __EAP__#include "radius_message_digest.h"#endif /* __EAP__ *//*****************************************************************************************/static bool do_radius_md5_encryption (BYTE *cptr_identifier, USHORT identifier_length, BYTE *p_secret, USHORT secret_length,	BYTE *p_data, USHORT data_length);static bool do_radius_md5_decryption (BYTE *cptr_identifier, USHORT identifier_length, BYTE *p_secret, USHORT secret_length,	BYTE *p_data, USHORT data_length);#ifdef __EAP__static bool radius_get_message_authenticator_attribute (RADIUS_PACKET *sptr_packet, BYTE* p_buffer,													  RADIUS_LIST_CONTROLLER* p_radius_attribute_list_controller);#endif /* __EAP__ *//*****************************************************************************************//* encrypts all attributes that need encryption - this is user_password only, right now */	enum TEST radius_encrypt_attributes_with_authenticator (RW_CONTAINER* p_attribute_list, BYTE *bptr_authenticator, 	RADIUS_SERVER* p_server){	RW_CONTAINER_ITERATOR attribute_iterator;	RADIUS_ATTRIBUTE_ENTRY *p_attribute;	RADIUS_ATTRIBUTE_ENTRY *sptr_new_attribute;	UINT new_attribute_value_length;	UINT new_attribute_entry_size;	bool encrypted ;	bool attribute_removed ;		encrypted = false;	attribute_iterator = rw_container_create_iterator (p_attribute_list);	rw_container_goto_front (attribute_iterator);		while (rw_container_is_at_end (attribute_iterator) == false)		{		p_attribute = rw_container_at (attribute_iterator);				attribute_removed = false; 		if (p_attribute->type == RADIUS_USER_PASSWORD)			{			if ((p_attribute->length_of_attribute_value % RADIUS_PASSWORD_MODULUS) != 0x00)				{				new_attribute_value_length = p_attribute->length_of_attribute_value + 					(RADIUS_PASSWORD_MODULUS - (p_attribute->length_of_attribute_value % RADIUS_PASSWORD_MODULUS));								new_attribute_entry_size = new_attribute_value_length + sizeof (RADIUS_MESSAGE_ATTRIBUTE_HEADER);								sptr_new_attribute = (RADIUS_ATTRIBUTE_ENTRY *) table_malloc (1, new_attribute_entry_size);				if (sptr_new_attribute == NULL)					{					rw_container_free_iterator (attribute_iterator);										return (FAIL);					}									memset ((BYTE *) sptr_new_attribute, 0, new_attribute_entry_size);								memcpy (sptr_new_attribute, p_attribute, (p_attribute->length_of_attribute_value + 						sizeof (RADIUS_MESSAGE_ATTRIBUTE_HEADER)));								sptr_new_attribute->length_of_attribute_value = (BYTE) new_attribute_value_length;								rw_container_remove (attribute_iterator);				table_free (p_attribute);				attribute_removed = true;								rw_container_add_front (p_attribute_list, (RW_CONTAINER_ITEM*) sptr_new_attribute);				p_attribute = sptr_new_attribute;				}			encrypted = do_radius_md5_encryption (bptr_authenticator, RADIUS_SIZE_OF_AUTHENTICATOR, p_server->bp_secret, 				(USHORT) p_server->secret_length, (BYTE *)&p_attribute->value[0], (USHORT) p_attribute->length_of_attribute_value);					if (encrypted == false)				{				rw_container_free_iterator (attribute_iterator);								return (FAIL);				}			}		if (attribute_removed == false)			{			rw_container_next (attribute_iterator);			}		}	rw_container_free_iterator (attribute_iterator);	return (PASS);} /*****************************************************************************************//* Decrypts all attributes that need encryption - this is tunnel_password only, right now */	enum TEST radius_decrypt_attributes_with_authenticator (RW_CONTAINER* p_attribute_list, BYTE *bptr_authenticator, 	RADIUS_SERVER* p_server){	RW_CONTAINER_ITERATOR attribute_iterator;	RADIUS_ATTRIBUTE_ENTRY *p_attribute;	RADIUS_ATTRIBUTE_ENTRY *sptr_new_attribute;	UINT new_attribute_value_length;	UINT new_attribute_entry_size;	BYTE *bptr_new_authenticator;	UINT new_authenticator_length;	bool decrypted ;#ifdef __EAP__    int headerLen;    int saltPos;    UINT32 vendorId;#endif /* __EAP__ */	decrypted = false;	attribute_iterator = rw_container_create_iterator (p_attribute_list);	rw_container_goto_front (attribute_iterator);		while (rw_container_is_at_end (attribute_iterator) == false)		{		p_attribute = (RADIUS_ATTRIBUTE_ENTRY *)rw_container_at (attribute_iterator);		if (p_attribute->type == RADIUS_TUNNEL_PASSWORD)			{			rw_container_remove (attribute_iterator);			new_authenticator_length = RADIUS_SIZE_OF_AUTHENTICATOR + TUNNEL_PASSWORD_SALT_LENGTH;							bptr_new_authenticator = (BYTE *) table_malloc (1, new_authenticator_length);			if (bptr_new_authenticator == NULL)				{				rw_container_free_iterator (attribute_iterator);							return (FAIL);				}								memset ((BYTE *) bptr_new_authenticator, 0, new_authenticator_length);							memcpy (bptr_new_authenticator, bptr_authenticator, RADIUS_SIZE_OF_AUTHENTICATOR);			memcpy (bptr_new_authenticator + RADIUS_SIZE_OF_AUTHENTICATOR, (BYTE *)&p_attribute->value[TUNNEL_ATTRIBUTE_TAG_LENGTH], TUNNEL_PASSWORD_SALT_LENGTH);			if (((p_attribute->length_of_attribute_value - TUNNEL_PASSWORD_SALT_LENGTH - 				TUNNEL_ATTRIBUTE_TAG_LENGTH) % RADIUS_PASSWORD_MODULUS) == 0x00)				{				decrypted = do_radius_md5_decryption (bptr_new_authenticator, new_authenticator_length, 					p_server->bp_secret, (USHORT) p_server->secret_length, 					(BYTE *)&p_attribute->value[TUNNEL_PASSWORD_SALT_LENGTH + TUNNEL_ATTRIBUTE_TAG_LENGTH], 					(USHORT) p_attribute->length_of_attribute_value - TUNNEL_PASSWORD_SALT_LENGTH - TUNNEL_ATTRIBUTE_TAG_LENGTH);				table_free (bptr_new_authenticator);				if (decrypted == false)					{					rw_container_free_iterator (attribute_iterator);					return (FAIL);					}						new_attribute_value_length = TUNNEL_ATTRIBUTE_TAG_LENGTH + 					(UINT)p_attribute->value[TUNNEL_PASSWORD_SALT_LENGTH + TUNNEL_ATTRIBUTE_TAG_LENGTH];								new_attribute_entry_size = new_attribute_value_length + sizeof (RADIUS_MESSAGE_ATTRIBUTE_HEADER);								sptr_new_attribute = (RADIUS_ATTRIBUTE_ENTRY *) table_malloc (1, new_attribute_entry_size);				if (sptr_new_attribute == NULL)					{					rw_container_free_iterator (attribute_iterator);										return (FAIL);					}				memset ((BYTE *) sptr_new_attribute, 0, new_attribute_entry_size);				sptr_new_attribute->type = p_attribute->type;				sptr_new_attribute->length_of_attribute_value = (BYTE) new_attribute_value_length;								memcpy (&(sptr_new_attribute->value [0]),&(p_attribute->value [0]), TUNNEL_ATTRIBUTE_TAG_LENGTH);				memcpy (&(sptr_new_attribute->value [TUNNEL_ATTRIBUTE_TAG_LENGTH]), 					&(p_attribute->value [TUNNEL_PASSWORD_SALT_LENGTH + TUNNEL_ATTRIBUTE_TAG_LENGTH + 1]), 						new_attribute_value_length - TUNNEL_ATTRIBUTE_TAG_LENGTH);				rw_container_insert (attribute_iterator, (RW_CONTAINER_ITEM*) sptr_new_attribute);				table_free (p_attribute);				sptr_new_attribute = NULL;				}			}#ifdef __EAP__        if (p_attribute->type == RADIUS_VENDOR_SPECIFIC)            {            /* vendor id - 4 bytes */            /* vendor type - 1 byte */            /* vendor length - 1 byte */            /* salt - 2 bytes */            /* key length - 1 byte */            /* key - depend on key length */            headerLen = VENDOR_SPECIFIC_ID_LENGTH +                        VENDOR_TYPE_LENGTH +                        VENDOR_LENGTH;            /* retrieve the vendor ID */            bcopy((BYTE *)&p_attribute->value[0],                  (char *)&vendorId,                  4);            vendorId = ntohl(vendorId);            if (vendorId == VENDOR_ID_CISCO)                {                char sKeyId[] = "leap:session-key=";                /* the Cisco key message has this format:                  *------------------------------------------------------------                 *vendorType | vendorLen |"leap:session-key="|Salt|Key string |                 *------------------------------------------------------------                 */                /* make sure this is a session key message */                if (memcmp((BYTE *)&p_attribute->value[headerLen],                    sKeyId,strlen(sKeyId)))                    {                    /* not a key message */                    rw_container_next (attribute_iterator);                     continue;                    }                /* calculate the Salt position */                saltPos = headerLen + strlen(sKeyId);                }            else if (vendorId == VENDOR_ID_MICROSOFT)                {                /* the Microsoft key message has this format:                  *------------------------------------------------------------                 *vendorType | vendorLen |Salt|           Key string                   *------------------------------------------------------------                 */                /* make sure it is the key types */                if ((p_attribute->value[VENDOR_SPECIFIC_ID_LENGTH] !=                    VENDOR_TYPE_MS_MPPE_SEND_KEY) &&                    (p_attribute->value[VENDOR_SPECIFIC_ID_LENGTH] !=                    VENDOR_TYPE_MS_MPPE_RECV_KEY))                    {                    /* not a key message */		    rw_container_next (attribute_iterator);                    continue;                    }                saltPos = headerLen;                }            else                {                /* not supported for now */                printf("RADIUS: Not supported VendorID\n");		rw_container_next (attribute_iterator);                continue;                }            new_authenticator_length =                RADIUS_SIZE_OF_AUTHENTICATOR +                VENDOR_SALT_LENGTH;            bptr_new_authenticator = (BYTE *) table_malloc (1,                          new_authenticator_length);            if (bptr_new_authenticator == NULL)                {                rw_container_free_iterator (attribute_iterator);                return (FAIL);                }            memset ((BYTE *) bptr_new_authenticator, 0,                  new_authenticator_length);                        /* copy request authenticator */            memcpy (bptr_new_authenticator, bptr_authenticator,                RADIUS_SIZE_OF_AUTHENTICATOR);            /* retrieve the salt value */            bcopy(&p_attribute->value[saltPos],                  bptr_new_authenticator + RADIUS_SIZE_OF_AUTHENTICATOR,                  VENDOR_SALT_LENGTH);            /* check the integrity of the encrypted key string */            if (((p_attribute->length_of_attribute_value - saltPos-                 VENDOR_SALT_LENGTH) %                  RADIUS_PASSWORD_MODULUS) == 0x00)                 {                 decrypted = do_radius_md5_decryption (                      bptr_new_authenticator,                       new_authenticator_length,                       p_server->bp_secret,                       (USHORT) p_server->secret_length,                       (BYTE *)&p_attribute->value[saltPos +                      VENDOR_SALT_LENGTH],                       (USHORT) p_attribute->length_of_attribute_value -                        saltPos - VENDOR_SALT_LENGTH);                 /* after decryption the key string should have                   * key length field + key field + padding                  */                 if (decrypted == false)                     {                     rw_container_free_iterator (attribute_iterator);                     return (FAIL);                     }                         /* new attr len =  header len + real key len */                 new_attribute_value_length = headerLen +                            (UINT)p_attribute->value[saltPos +                             VENDOR_SALT_LENGTH];                 new_attribute_entry_size = new_attribute_value_length +                                   sizeof (RADIUS_MESSAGE_ATTRIBUTE_HEADER);                 sptr_new_attribute = (RADIUS_ATTRIBUTE_ENTRY *)                                 table_malloc (1, new_attribute_entry_size);                 if (sptr_new_attribute == NULL)                     {                     rw_container_free_iterator(attribute_iterator);                     return (FAIL);                     }                 memset ((BYTE *) sptr_new_attribute, 0,                          new_attribute_entry_size);                 sptr_new_attribute->type = p_attribute->type;                 sptr_new_attribute->length_of_attribute_value =                               (BYTE) new_attribute_value_length;                 /* copy original attribute's header */                 memcpy (&(sptr_new_attribute->value [0]),                                   &(p_attribute->value [0]),                                   headerLen);                 /* copy the decrypted key */                 memcpy (&(sptr_new_attribute->value[headerLen]),                         &(p_attribute->value[saltPos +                            VENDOR_SALT_LENGTH +                           VENDOR_KEY_LENGTH]),                         new_attribute_value_length - headerLen);                 /* now set the vendor length field */                 sptr_new_attribute->value[VENDOR_SPECIFIC_ID_LENGTH +							VENDOR_TYPE_LENGTH] =                            new_attribute_value_length -                            VENDOR_SPECIFIC_ID_LENGTH;                 /* remove the original attribute */                 rw_container_remove (attribute_iterator);                  /* insert this newly created attribute */                 rw_container_insert (attribute_iterator,                                (RW_CONTAINER_ITEM*) sptr_new_attribute);                 /* free the memory of the original attribute */                 table_free (p_attribute);                 sptr_new_attribute = NULL;                 }             table_free (bptr_new_authenticator);            }#endif /* __EAP__ */		rw_container_next (attribute_iterator);		}	rw_container_free_iterator (attribute_iterator);	return (PASS);}/*****************************************************************************************//* uses the request authenticator, and the response packet, to authenticate the   response authenticator.  refer to draft rfc for details */enum TEST verify_radius_response_authenticator (RADIUS_PACKET *sptr_rx_packet, BYTE *bptr_authenticator, RADIUS_SERVER* p_server){	BYTE *bptr_authentication_string;	RADIUS_PACKET *sptr_packet;	USHORT packet_length;	USHORT buffer_length;	BYTE md5_result[MD5_RESULT_LENGTH];	packet_length = swap (sptr_rx_packet->header.length);	buffer_length = (USHORT) (packet_length + p_server->secret_length);	bptr_authentication_string = (BYTE *) table_malloc (1, buffer_length);	if (bptr_authentication_string == NULL)		{		return (FAIL);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久久久国产精品日日| 亚洲午夜激情av| 国产99久久久国产精品潘金| 久久久久久亚洲综合| 国产成人一级电影| 自拍偷拍国产精品| 在线视频你懂得一区| 视频一区中文字幕| 欧美电影免费观看高清完整版在线| 精品一区二区av| 欧美国产精品一区| 91麻豆福利精品推荐| 亚洲成a人片在线不卡一二三区| 欧美男生操女生| 极品少妇xxxx精品少妇| 中文av字幕一区| 欧美性大战久久久久久久蜜臀 | 成人免费福利片| 亚洲精品日韩专区silk| 欧美理论片在线| 国产毛片精品一区| 最新不卡av在线| 欧美日韩国产一级片| 国产精品一区二区在线观看不卡| 国产精品成人免费| 欧美群妇大交群中文字幕| 国产一区二区三区免费在线观看| 中文字幕一区二区三区色视频| 欧美美女网站色| 国产一区二区三区精品欧美日韩一区二区三区 | 欧洲精品一区二区三区在线观看| 99精品偷自拍| 午夜a成v人精品| 国产亚洲综合av| 欧美综合一区二区| 国产自产高清不卡| 亚洲天堂免费看| 欧美一区二区美女| 99久久99久久久精品齐齐| 无码av中文一区二区三区桃花岛| 久久久精品天堂| 欧美视频一区二区三区| 国产一区二区不卡在线| 一区二区久久久久| 久久久久久久国产精品影院| 91久久精品一区二区三区| 精品一区二区三区在线观看国产 | 精品日韩在线观看| 97久久精品人人澡人人爽| 裸体一区二区三区| 亚洲视频在线观看一区| 欧美xxxx在线观看| 欧美视频一区二区三区在线观看| 国产很黄免费观看久久| 午夜精品成人在线视频| 久久精品视频一区二区| 在线播放日韩导航| av成人免费在线观看| 久久99深爱久久99精品| 夜夜嗨av一区二区三区四季av| www久久久久| 欧美日韩国产成人在线免费| 成人免费av在线| 久久爱另类一区二区小说| 亚洲一级二级三级| 国产精品视频一二三区 | 欧美日韩国产一区二区三区地区| 粉嫩13p一区二区三区| 日韩成人免费电影| 中文字幕日本乱码精品影院| 久久亚洲二区三区| 欧美高清视频不卡网| 一本色道久久综合亚洲aⅴ蜜桃| 国产精品一区二区x88av| 五月婷婷欧美视频| 亚洲精品成人天堂一二三| 国产日韩欧美a| 欧美成人性福生活免费看| 欧美性色综合网| 色屁屁一区二区| 成人av网址在线观看| 国产在线不卡一卡二卡三卡四卡| 青草av.久久免费一区| 亚洲大尺度视频在线观看| 综合久久久久综合| 久久99精品一区二区三区三区| 偷拍一区二区三区| 一区二区三区高清不卡| 日韩码欧中文字| 中文字幕国产精品一区二区| 久久品道一品道久久精品| 精品少妇一区二区三区免费观看| 欧美精品在线视频| 欧美日韩成人高清| 欧美日韩在线观看一区二区 | 91麻豆.com| aaa欧美色吧激情视频| 成人午夜在线播放| 国产成人在线视频网址| 国产精品乡下勾搭老头1| 国产一区在线看| 另类欧美日韩国产在线| 日本aⅴ免费视频一区二区三区| 亚洲国产精品欧美一二99| 夜夜精品浪潮av一区二区三区| 亚洲精品成人精品456| 一区二区三区鲁丝不卡| 亚洲午夜精品在线| 亚洲电影视频在线| 亚洲h在线观看| 午夜精品久久久久久久| 日韩avvvv在线播放| 美美哒免费高清在线观看视频一区二区 | 国产精品欧美久久久久无广告| 国产亚洲精品中文字幕| 国产午夜亚洲精品午夜鲁丝片| 国产亚洲欧洲一区高清在线观看| 精品成人一区二区三区四区| 在线综合视频播放| 成人免费视频一区| 成人午夜免费视频| 美女脱光内衣内裤视频久久网站 | 欧美韩国日本不卡| 中文字幕中文字幕一区二区| 亚洲人xxxx| 亚洲福利一二三区| 五月激情六月综合| 精品一区二区三区久久久| 国产成人高清在线| 91视频免费播放| 欧美无砖砖区免费| 91精品国产欧美一区二区成人 | 最新热久久免费视频| 樱桃国产成人精品视频| 亚洲国产精品精华液网站| 免费久久99精品国产| 国产一区二区在线电影| 波多野结衣中文字幕一区| 色av一区二区| 在线电影欧美成精品| 欧美成人免费网站| 久久精品一区二区三区av| 国产欧美一区二区三区在线老狼| 中文字幕一区二区三区色视频| 成人激情小说网站| 色域天天综合网| 91精品国产综合久久久久| 日韩欧美国产麻豆| 国产精品视频看| 亚洲精品国产无天堂网2021| 日韩不卡一区二区| 丁香婷婷综合色啪| 一本色道久久综合亚洲aⅴ蜜桃 | 欧美亚洲综合网| 欧美日本一区二区三区四区| 欧美精品一区二区三区在线播放| 国产欧美精品国产国产专区| 亚洲在线视频免费观看| 日韩在线一二三区| 国产成人精品免费一区二区| 91免费视频网| 制服丝袜一区二区三区| 日韩一区二区三区电影| 中文字幕av免费专区久久| 亚洲国产一二三| 麻豆成人免费电影| 波多野结衣中文字幕一区| 欧美三区免费完整视频在线观看| 亚洲精品一区二区三区影院| 久久久久久久久免费| 一区二区三区在线不卡| 美女一区二区视频| 成人免费黄色大片| 日韩一区国产二区欧美三区| 欧美成人性福生活免费看| 亚洲成人午夜影院| 日本一区二区三区在线不卡| 亚洲国产成人高清精品| 狠狠色狠狠色综合日日91app| 一本在线高清不卡dvd| 日韩一区二区麻豆国产| 亚洲欧美怡红院| 亚洲国产成人91porn| 国产91在线看| 欧美精选在线播放| 国产欧美一区视频| 麻豆精品视频在线| jvid福利写真一区二区三区| 欧美成人伊人久久综合网| 中文一区二区在线观看| 午夜av区久久| 99精品久久免费看蜜臀剧情介绍| 日韩一区二区免费视频| 亚洲一二三专区| 精品中文字幕一区二区| 欧美日韩午夜在线| 自拍偷在线精品自拍偷无码专区| 麻豆精品国产传媒mv男同| 欧美私人免费视频| 中文字幕国产一区二区|