c语言问题,不是很清楚

ClumsyCoder 2017-11-14 09:16:02

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;
}

这个里面有的函数不清楚,能不能说明一下!
...全文
184 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
归途醉染 2017-11-14
  • 打赏
  • 举报
回复
什么函数也不说....有的函数,请问是什么函数?
陪妳看星星 2017-11-14
  • 打赏
  • 举报
回复
“有的函数”是什么函数...
赵4老师 2017-11-14
  • 打赏
  • 举报
回复
VS IDE中,在不明白的符号上点鼠标右键,选转到定义。
ClumsyCoder 2017-11-14
  • 打赏
  • 举报
回复
抱歉,我确实没注意到, Daemon::IsDebug(); CRijndaelUtil::getDecryptedStr(token); 这两个是什么意思? 头文件里面有 #include "daemon.H" #include "RijndaelHelper.h" 如果我自己查的话又该怎么处理!

65,186

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧