c语言问题,不是很清楚

ClumsyCoder ClumsyCoder 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

static bool verifyToken(const char * token, std::string &strout)
{
ws_config& conf = getConfig();
if(!conf.authen) {
if(Daemon::IsDebug()) {
std::cout << "Token authen is disabled!" << std::endl;
}
return true;
}
if(NULL == token || '\0' == *token) {
std::cerr << "Token is null or empty!" << std::endl;
strout = "Token is null or empty!";
return false;
}
std::string str = CRijndaelUtil::getDecryptedStr(token);
unsigned int found = str.find_first_of(CRijndaelUtil::getDelimitStr());
if(found != std::string::npos) {
if(!conf.dbauthen) {
if(Daemon::IsDebug()) {
std::cout << "Token database authen is disabled!" << std::endl;
}
return true;
}
std::string name = str.substr(0, found);
std::string pwd = str.substr(found + CRijndaelUtil::getDelimitStr().size());
// retrieve user's password from database.
std::string pwdindb;
if(getDbUserPwd(pwdindb, name, conf.host.c_str(), conf.username.c_str(), conf.password.c_str(),
conf.dbname.c_str(), conf.port, conf.timeout)) {
if(pwdindb == CMiscUtil::getMD5(pwd)) {
if(Daemon::IsDebug()) {
std::cout << "Token database authentication success!" << std::endl;
}
return true;
} else {
std::cerr << "Password is not correct!" << std::endl;
strout = "Password is not correct!";
}
} else {
std::cerr << "Failed to read password from database!" << std::endl;
strout = "Failed to read password from database!";
}
} else {
std::cerr << "Invalid token format!" << std::endl;
strout = "Invalid token format!";
return false;
}
return false;
}

这个里面有的函数不清楚,能不能说明一下!
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
ClumsyCoder
C++ 语言 65,213 成员 250,513 内容