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

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

?? des_auth.c

?? 基于nucleus實時操作系統的webserver源代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/************************************************************************
*                                                                          
*    CopyrIght (c)  1993 - 2001 Accelerated Technology, Inc.               
*                                                                          
* PROPRIETARY RIGHTS of Accelerated Technology are involved in the subject 
* matter of this material.  All manufacturing, reproduction, use and sales 
* rights pertaining to this subject matter are governed by the license     
* agreement.  The recipient of this software implicity accepts the terms   
* of the license.                                                          
*                                                                          
*************************************************************************/

/************************************************************************
*                                                                       
* FILE NAME                                             VERSION          
*                                                                       
*       des_auth.c - DES Authentication                   1.5      
*                                                                       
* COMPONENT                                             
*                
*       Nucleus WebServ                                                                       
*                                                                       
* DESCRIPTION          
*
*       This file links the java application with the actual
*       encryption process.
*                                                                       
* DATA STRUCTURES                                                       
*
*       None                                                                       
*                                                                       
* FUNCTIONS                                                             
*                                                                       
*       DES_Auth_Initialize
*       DES_Rand
*       DES_Send_Url
*       DES_New_Key
*       DES_Auth_Add
*       DES_Auth_Del
*       DES_Auth_Add_Entry
*       DES_Auth_Delete_Entry
*       DES_Send_Auth_Salt
*       DES_Make_New_Salt                                                        
*                                                                       
* DEPENDENCIES                                                          
*                          
*       nu_websrv.h
*       auth.h                                             
*                                                                       
************************************************************************/

#include "webserv/inc/nu_websr.h"
#include "net/inc/netevent.h"

#ifdef   WS_AUTH_PLUGIN
#include "webserv/inc/wpw_auth.h"


static INT         DES_Rand(WS_REQUEST * req);
static INT         DES_Send_Url(WS_REQUEST * req);
static INT         DES_New_Key(WS_REQUEST * req);
static INT         DES_Auth_Add(WS_REQUEST * req);
static INT         DES_Auth_Del(WS_REQUEST * req);
static INT16       DES_Auth_Delete_Entry(CHAR *user_id, CHAR *password);
static INT16       DES_Auth_Add_Entry(CHAR *user_id, CHAR *password);
static VOID        DES_Send_Auth_Salt(WS_REQUEST * req);
static VOID        DES_Make_New_Salt(CHAR * salt);

extern NU_MEMORY_POOL  System_Memory;
extern WS_SERVER WS_Master_Server; /* declare space for the master server structure */
extern struct WPW_AUTH_NODE WPW_Table[];

CHAR * DES_Key_String[9] = {"12345678"}; /*  Contains the static key */
WPW_INFO_LIST  DES_Pw_List_Info;
INT     DES_Little_Endian = 0;

UINT8 DES_Reg[WPW_SRG_SIZE]={
    0,1,1,0,1,0,0,1,1,0,0,1,1,1,0,1,1,0,0,1,1,1,0,1,0,0,1,1,0,0,1,1,
    0,1,0,1,0,1,1,0,0,0,1,0,1,1,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,1,
    1,0,1,1,0,0,1,1,0,1,0,1,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,0,1,0,1,0,
    1,1,1,0,0,1,1,0,0,1,1,0,0,0,1,1,1,0,0,1,0,0,1,0,1,0,1,0,1,0,0,0};

/************************************************************************
*                                                                       
* FUNCTION                                                              
*                                                                       
*       DES_Auth_Initialize                                                        
*                                                                       
* DESCRIPTION                                                           
*       
*
*                                                                
* INPUTS                                                                
*                                                                       
*       None.                                                            
*                                                                       
* OUTPUTS                                                               
*                                                                       
*       None.                                                            
*                                                                       
************************************************************************/
VOID DES_Auth_Initialize()
{
    WPW_INFO_NODE   *apwlist_info;
    INT             i;
    WS_SERVER       *p;

    /* Endian Test */    
    CHAR            list1[4];
    UNSIGNED        cmp_value = 0x10203040ul;
    VOID            *cmp1,
                    *cmp2;
    /* 
     * The following tests if this is a big or little endian
     * machine.  The global is set for use in the encryption
     * process.
     */
    list1[0] = (CHAR)0x10;
    list1[1] = (CHAR)0x20;
    list1[2] = (CHAR)0x40;
    list1[3] = (CHAR)0x80;

    cmp1 = list1;
    cmp2 = &cmp_value;

    if(((char *)cmp1)[0] == ((char *)cmp2)[0])
        DES_Little_Endian = NU_FALSE;
    else
        DES_Little_Endian = NU_TRUE;
    /* End endian test */
    
    p = &WS_Master_Server; 
    
    /*  Register All plug-ins used for authentication */
    HTTP_Register_Plugin(DES_Rand,"ps_rand");
    HTTP_Register_Plugin(DES_Send_Url,"ps_sendurl");
    HTTP_Register_Plugin(DES_New_Key,"auth_newkey");
    HTTP_Register_Plugin(DES_Auth_Del,"auth_del");
    HTTP_Register_Plugin(DES_Auth_Add,"auth_add");

    /*  Initailize Linked List for password structure */
    for (i = 0; WPW_Table[i].wpw_user_id[0]; i++)
    {
        if (NU_Allocate_Memory (&System_Memory, (VOID **)&apwlist_info,
                            sizeof (WPW_INFO_NODE),
                            NU_NO_SUSPEND) != NU_SUCCESS)
        {
            return;
        }

        /* Setup the User Id name */
        strcpy(apwlist_info->wpw_user, WPW_Table[i].wpw_user_id);

        /* Setup the Password */
        strcpy(apwlist_info->wpw_password, WPW_Table[i].wpw_password);
        
        /* Add this host to the list. */
        DLL_Enqueue((tqe_t *) &DES_Pw_List_Info, (tqe_t *) apwlist_info);
    }

    /*  Add the crypto key to the server */
    HTTP_Auth_Control(p, WS_A_CREDS, DES_Key_String);

    /*  Add the authentication Universal Resource Locator to login.htm */
    HTTP_Auth_Control(p, WS_A_AUTH_URI, WS_AUTH_SCREEN_URI);
    /*  Set the Authentication State to in process */
    p->ws_master.ws_auth_state = 1;
    
    /*  Enable Authentication  */
    HTTP_Auth_Control(p, WS_A_ENABLE, NU_NULL);
}

/************************************************************************
*                                                                       
* FUNCTION                                                              
*                                                                       
*       DES_Rand                                                          
*                                                                       
* DESCRIPTION                                                           
*                                                                       
*       This plugin is called in the authentiction process a 32          
*       byte random number is created the random number is               
*       encrypted with the encryption key and sent to the client         
*       as a hex ascii string.                                           
*                                                                       
* INPUTS                                                                
*                                                                       
*       *env                                                              
*       *req                                                              
*                                                                       
* OUTPUTS                                                               
*                                                                       
*       NU_SUCCESS
*                                                                       
************************************************************************/
static INT DES_Rand(WS_REQUEST *req)
{
    DES_Send_Auth_Salt(req);
    return(WS_REQ_PROCEED);
}

/************************************************************************
*                                                                       
* FUNCTION                                                              
*                                                                       
*       DES_Send_Url                                                       
*                                                                       
* DESCRIPTION                                                           
*        
*                                                               
*                                                                       
* INPUTS                                                                
*                                                                       
*       *env                                                              
*       *req                                                              
*                                                                       
* OUTPUTS                                                               
*                                                                       
*       NU_SUCCESS
*                                                                       
************************************************************************/
static INT DES_Send_Url(WS_REQUEST * req)
{
    CHAR            success[250];
    CHAR            fail[250];
    WPW_INFO_NODE   *apwlist;
    UINT8           cypher_a[17];
    UINT8           cypher_b[17];
    UINT8           xor_mask[17];
    CHAR            temp[10];
    INT             i;
    INT16           found = 0;
    CHAR            *s;
    WS_SERVER       *p;
    
    UTL_Zero(success,250);
    UTL_Zero(fail,250);

    p = &WS_Master_Server; 

    /* get the VALUE string from the POST request */
    s = HTTP_Token_Value_by_Name("VALUE", req);

#ifdef NU_WEBSERV_DEBUG
    printf("VALUE= %s\n",s);
#endif

    /* convert the user ( cypher_a)
     * and the passwd ( cypher_b)
     * and the mask ( xor_mask) 
     * to binary
     */ 

    HTTP_Packed_Hex_To_Bin((CHAR *)cypher_a, s, 32);
    HTTP_Packed_Hex_To_Bin((CHAR *)cypher_b, s + 32, 32);
    HTTP_Packed_Hex_To_Bin((CHAR *)xor_mask, s + 64, 32);
#ifdef NU_WEBSERV_DEBUG
    printf("cypher_a = %s\n", cypher_a);
    printf("cypher_b = %s\n", cypher_b);
    printf("xor_mask = %s\n", xor_mask);
#endif

#ifdef NU_WEBSERV_DEBUG
    printf("KEY = %s\n", req->ws_server->ws_master.ws_key);
#endif

    /* decrypt each string */

    ENC_Decrypt((CHAR *)req->ws_server->ws_master.ws_key,(CHAR *)xor_mask,2);
    ENC_Decrypt((CHAR *)req->ws_server->ws_master.ws_key,(CHAR *)cypher_a,2);
    ENC_Decrypt((CHAR *)req->ws_server->ws_master.ws_key,(CHAR *)cypher_b,2);
#ifdef NU_WEBSERV_DEBUG
    printf("cypher_a = %s\n", cypher_a);
    printf("cypher_b = %s\n", cypher_b);
    printf("xor_mask = %s\n", xor_mask);
#endif

    /* XOR our decrypted user and passwd with the 
     * decrypted salt
     */

    for(i=0; i<16; i++)
    {
        cypher_a[i] ^= xor_mask[i];
        cypher_b[i] ^= xor_mask[i];
    }

    cypher_a[16]=0;                                 /* make sure there is a null */
    cypher_b[16]=0;                                 /* in case we decrypt to garbage */

#ifdef NU_WEBSERV_DEBUG
    printf("string 1:%s\n",cypher_a);
    printf("string 2:%s\n",cypher_b);
#endif

    /*  Traverse through Pw list structure to see if user is verified. */
    for(apwlist = DES_Pw_List_Info.wpw_list_head ; apwlist ; apwlist = apwlist->wpw_list_next)
    {
        if(strncmp((CHAR *)apwlist->wpw_user,(CHAR *)cypher_a,strlen(apwlist->wpw_user)) == 0 )
        {
            if(strncmp((CHAR *)apwlist->wpw_password,(CHAR *)cypher_b,strlen(apwlist->wpw_password))==0)
            {
                found++;
                break;
            }
        }
    }

    if(found)
    {
        /*  Enable Authentication  */
        HTTP_Auth_Control(p, WS_A_ENABLE, NU_NULL);
        
        /*  Add the authenticated IP address */
        HTTP_Auth_Control(p, WS_A_AUTH_ADD, req->ws_ip);

        /*
         * Send to the Java applet the Redirection Ip address. 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人精品亚洲777人妖| 午夜一区二区三区在线观看| 91精品国产91久久综合桃花 | 国产一区二区三区国产| 日韩电影在线一区二区| 亚洲va在线va天堂| 日韩极品在线观看| 久久成人久久鬼色| 国产黄色91视频| 国产成人免费视频一区| 国产成人aaa| 一本大道av伊人久久综合| 91偷拍与自偷拍精品| 91久久人澡人人添人人爽欧美| 99久久国产免费看| 欧美性极品少妇| 欧美一区二区三区爱爱| 26uuu另类欧美| 亚洲天堂中文字幕| 亚洲图片欧美视频| 另类人妖一区二区av| 国产精品一区二区三区网站| 99视频在线精品| 欧美精品18+| 亚洲精品一区二区三区香蕉| 国产精品久久久久永久免费观看 | 99这里只有精品| 欧洲国内综合视频| 精品日韩av一区二区| 中文字幕不卡在线| 天天综合天天做天天综合| 久久 天天综合| 色综合久久久网| 欧美α欧美αv大片| 亚洲欧美日韩中文字幕一区二区三区| 一区二区三区四区亚洲| 极品少妇xxxx精品少妇| 91女人视频在线观看| 欧美一区二区免费| 日韩一区日韩二区| 精东粉嫩av免费一区二区三区| 大胆欧美人体老妇| 欧美福利电影网| 国产精品国产三级国产| 老司机精品视频导航| 日本韩国一区二区三区| 精品免费视频一区二区| 亚洲午夜激情av| 色偷偷久久一区二区三区| 亚洲综合一区二区三区| 麻豆精品国产91久久久久久| 99久久99久久精品国产片果冻| 日韩欧美在线综合网| 亚洲欧美日韩国产另类专区| 综合av第一页| av亚洲精华国产精华精华| 亚洲精品欧美激情| 欧美浪妇xxxx高跟鞋交| 国产最新精品精品你懂的| 国产精品网曝门| 欧美性感一区二区三区| 狠狠色综合播放一区二区| 国产女人18水真多18精品一级做| 99久久婷婷国产综合精品电影| 伊人开心综合网| 亚洲精品在线网站| 91蝌蚪porny九色| 日本三级亚洲精品| 中文字幕一区二区视频| 欧美日韩二区三区| 成人理论电影网| 午夜精品久久久久久久久| 久久精品日韩一区二区三区| 欧美午夜片在线观看| 国产自产v一区二区三区c| 亚洲激情在线激情| 久久香蕉国产线看观看99| 色拍拍在线精品视频8848| 激情文学综合丁香| 亚洲成人动漫在线免费观看| 国产网红主播福利一区二区| 欧美日韩在线精品一区二区三区激情| 黄页网站大全一区二区| 亚洲午夜激情网站| 国产精品不卡在线观看| 日韩欧美一区电影| 在线精品亚洲一区二区不卡| 福利电影一区二区| 另类欧美日韩国产在线| 亚洲成人久久影院| 18欧美亚洲精品| 久久久久久99久久久精品网站| 欧美三级在线播放| 99精品桃花视频在线观看| 国产福利一区二区三区在线视频| 视频一区二区中文字幕| 亚洲在线中文字幕| 中文字幕亚洲在| 亚洲国产精品精华液2区45| 日韩精品在线一区| 欧美女孩性生活视频| 日本高清无吗v一区| av成人老司机| 成人网在线播放| 国产成人av在线影院| 国产在线不卡视频| 激情综合色综合久久综合| 日韩国产欧美在线视频| 香蕉久久一区二区不卡无毒影院| 亚洲乱码国产乱码精品精98午夜| 国产精品国产三级国产aⅴ原创| 久久综合久色欧美综合狠狠| 欧美大度的电影原声| 日韩精品一区二区三区四区视频| 91精品国产综合久久蜜臀| 欧美日韩免费高清一区色橹橹 | 欧美日韩dvd在线观看| 欧美中文字幕亚洲一区二区va在线| 91在线视频播放| 色婷婷亚洲综合| 欧美性大战久久久久久久蜜臀| 在线免费一区三区| 777a∨成人精品桃花网| 日韩女优电影在线观看| 精品国产成人系列| 欧美国产成人精品| 亚洲欧美视频一区| 偷拍与自拍一区| 免费观看日韩av| 国产一区二区三区日韩| 成人av午夜电影| 欧美最新大片在线看| 欧美精品三级在线观看| 日韩一卡二卡三卡四卡| 久久久久97国产精华液好用吗| 国产日韩欧美精品在线| 亚洲精品自拍动漫在线| 三级欧美在线一区| 国产一区二区三区免费在线观看| 成人午夜电影小说| 欧美久久久影院| 精品国产一区二区三区av性色| 国产片一区二区| 亚洲成人资源在线| 国产一区二区在线电影| 99re这里只有精品视频首页| 欧美高清一级片在线| 久久久蜜臀国产一区二区| 亚洲美女免费在线| 久久国产视频网| 99精品欧美一区二区蜜桃免费 | 久久综合色婷婷| 一区二区三区欧美| 极品美女销魂一区二区三区免费| 91麻豆视频网站| 精品裸体舞一区二区三区| 亚洲欧美另类图片小说| 蜜桃视频在线观看一区二区| av在线播放成人| 日韩欧美一区二区视频| 亚洲视频综合在线| 紧缚奴在线一区二区三区| 欧美亚洲愉拍一区二区| 国产性天天综合网| 水野朝阳av一区二区三区| 国产99久久久国产精品| 91精品国产品国语在线不卡| 亚洲嫩草精品久久| 国产成人精品亚洲777人妖 | 日日摸夜夜添夜夜添国产精品| 国产精品中文字幕一区二区三区| 欧美日韩视频一区二区| 中文字幕一区二区在线观看| 国产一区久久久| 日韩欧美黄色影院| 午夜激情久久久| 色婷婷综合在线| 中文字幕欧美区| 紧缚捆绑精品一区二区| 日韩视频免费观看高清完整版| 夜夜揉揉日日人人青青一国产精品| 国产夫妻精品视频| 欧美本精品男人aⅴ天堂| 婷婷久久综合九色综合伊人色| 92精品国产成人观看免费| 日本一区二区免费在线| 久久国产精品99精品国产| 91.com视频| 天天av天天翘天天综合网| 色综合久久久久久久久| 中文字幕电影一区| 国产91精品久久久久久久网曝门| 欧美成人一区二区| 久久不见久久见中文字幕免费| 91精品国产综合久久久久久漫画| 亚洲国产精品久久不卡毛片| 欧美日韩激情一区二区| 亚洲丶国产丶欧美一区二区三区| 欧美综合在线视频| 亚洲国产aⅴ天堂久久|