Fix merges

ryzomclassic-develop
kaetemi 5 years ago
parent c57c9a1cf6
commit 0bae206bb2

@ -279,8 +279,8 @@ private:
struct CMCFileEntry struct CMCFileEntry
{ {
char *Name; // Normal case (the search is done by using nlstricmp) char *Name; // Normal case (the search is done by using nlstricmp)
uint32 idPath : 20; // Path (not with file at the end) - look in the SSMpath (1048576 different path allowed) uint32 idPath : 16; // Path (not with file at the end) - look in the SSMpath (65536 different path allowed)
uint32 idExt : 11; // real extension of the file if remapped - look in the SSMext (2048 different extension allowed) uint32 idExt : 15; // real extension of the file if remapped - look in the SSMext (32768 different extension allowed)
uint32 Remapped : 1; // true if the file is remapped uint32 Remapped : 1; // true if the file is remapped
}; };

@ -92,6 +92,11 @@ struct CHashKey
return HashKeyString == v.HashKeyString; return HashKeyString == v.HashKeyString;
} }
bool operator!=(const CHashKey &v) const
{
return !(*this == v);
}
// this string is always 20 bytes long and is the code in binary format (can't print it directly) // this string is always 20 bytes long and is the code in binary format (can't print it directly)
std::string HashKeyString; std::string HashKeyString;
}; };

@ -4646,6 +4646,7 @@ NLMISC_COMMAND (setSalt, "Set Salt", "<dev_eid> <salt>")
return true; return true;
} }
#ifdef RYZOM_FORGE
// !!! Deprecated !!! // !!! Deprecated !!!
NLMISC_COMMAND (webAddCommandsIds, "Add ids of commands will be run from webig", "<user id> <bot_name> <web_app_url> <indexes>") NLMISC_COMMAND (webAddCommandsIds, "Add ids of commands will be run from webig", "<user id> <bot_name> <web_app_url> <indexes>")
{ {
@ -4688,6 +4689,7 @@ NLMISC_COMMAND (webDelCommandsIds, "Del ids of commands", "<user id> <web_app_ur
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=deleted", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=deleted", getSalt());
return true; return true;
} }
#endif
CInventoryPtr getInv(CCharacter *c, const string &inv) CInventoryPtr getInv(CCharacter *c, const string &inv)
{ {
@ -4717,6 +4719,7 @@ CInventoryPtr getInv(CCharacter *c, const string &inv)
return inventoryPtr; return inventoryPtr;
} }
#ifdef RYZOM_FORGE
NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url> <index> <command> <hmac> [<new_check=0|1|2|3>] [<next_step=0|1>] [<send_url=0|1|2>]") NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url> <index> <command> <hmac> [<new_check=0|1|2|3>] [<next_step=0|1>] [<send_url=0|1|2>]")
{ {
@ -4757,7 +4760,8 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
uint32 iindex; uint32 iindex;
NLMISC::fromString(index, iindex); NLMISC::fromString(index, iindex);
string command = args[3]; string command = args[3];
string hmac = args[4]; std::string hmac = args[4];
NLMISC::CHashKey hmacBin = NLMISC::CHashKey(hmac);
vector<string> infos; vector<string> infos;
CGameItemPtr item; CGameItemPtr item;
@ -4785,9 +4789,9 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
string checksumRowId = web_app_url + toString(c->getLastConnectedDate()) + index + command + toString(c->getEntityRowId().getIndex()); string checksumRowId = web_app_url + toString(c->getLastConnectedDate()) + index + command + toString(c->getEntityRowId().getIndex());
string realhmacEid = getHMacSHA1((uint8*)&checksumEid[0], checksumEid.size(), (uint8*)&salt[0], salt.size()).toString(); NLMISC::CHashKey realhmacEid = NLMISC::getHMacSHA1((uint8*)&checksumEid[0], checksumEid.size(), (uint8*)&salt[0], salt.size());
string realhmacRowId = getHMacSHA1((uint8*)&checksumRowId[0], checksumRowId.size(), (uint8*)&salt[0], salt.size()).toString(); NLMISC::CHashKey realhmacRowId = NLMISC::getHMacSHA1((uint8*)&checksumRowId[0], checksumRowId.size(), (uint8*)&salt[0], salt.size());
if (realhmacEid != hmac && realhmacRowId != hmac && command != "is_valid_index") if (realhmacEid != hmacBin && realhmacRowId != hmacBin && command != "is_valid_index")
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_auth", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_auth", getSalt());
@ -6765,6 +6769,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
return true; return true;
} }
#endif
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
ENTITY_VARIABLE (PriviledgePVP, "Priviledge Pvp Mode") ENTITY_VARIABLE (PriviledgePVP, "Priviledge Pvp Mode")

@ -3739,7 +3739,7 @@ void CCharacter::setTargetBotchatProgramm( CEntityBase * target, const CEntityId
string defaultSalt = toString(getLastConnectedDate()); string defaultSalt = toString(getLastConnectedDate());
nlinfo(defaultSalt.c_str()); nlinfo(defaultSalt.c_str());
nlinfo(url.c_str()); nlinfo(url.c_str());
string control = "&hmac="+getHMacSHA1((uint8*)&url[0], (uint32)url.size(), (uint8*)&defaultSalt[0], (uint32)defaultSalt.size()).toString(); string control = "&hmac="+NLMISC::getHMacSHA1((uint8*)&url[0], (uint32)url.size(), (uint8*)&defaultSalt[0], (uint32)defaultSalt.size()).toString();
params[0].Literal= url+control; params[0].Literal= url+control;
@ -13891,12 +13891,12 @@ void CCharacter::sendUrl(const string &url, const string &salt)
string control; string control;
if (!salt.empty()) if (!salt.empty())
{ {
control = "&hmac="+getHMacSHA1((uint8*)&url[0], (uint32)url.size(), (uint8*)&salt[0], (uint32)salt.size()).toString(); control = "&hmac="+NLMISC::getHMacSHA1((uint8*)&url[0], (uint32)url.size(), (uint8*)&salt[0], (uint32)salt.size()).toString();
} }
else else
{ {
string defaultSalt = toString(getLastConnectedDate()); string defaultSalt = toString(getLastConnectedDate());
control = "&hmac="+getHMacSHA1((uint8*)&url[0], (uint32)url.size(), (uint8*)&defaultSalt[0], (uint32)defaultSalt.size()).toString(); control = "&hmac="+NLMISC::getHMacSHA1((uint8*)&url[0], (uint32)url.size(), (uint8*)&defaultSalt[0], (uint32)defaultSalt.size()).toString();
} }
nlinfo(url.c_str()); nlinfo(url.c_str());
@ -13967,7 +13967,7 @@ string CCharacter::getCustomMissionText(const string &missionName)
return ""; return "";
} }
#ifdef RYZOM_FORGE
// !!! Deprecated !!! // !!! Deprecated !!!
void CCharacter::addWebCommandCheck(const string &url, const string &data, const string &salt) void CCharacter::addWebCommandCheck(const string &url, const string &data, const string &salt)
{ {
@ -14076,11 +14076,12 @@ uint CCharacter::checkWebCommand(const string &url, const string &data, const st
if (slot == INVENTORIES::NbBagSlots) if (slot == INVENTORIES::NbBagSlots)
return slot; return slot;
string checksum = url + data + getId().toString(); string checksum = url + data + getId().toString();
string realhmac = getHMacSHA1((uint8*)&checksum[0], (uint32)checksum.size(), (uint8*)&salt[0], (uint32)salt.size()).toString(); string realhmac = NLMISC::getHMacSHA1((uint8*)&checksum[0], (uint32)checksum.size(), (uint8*)&salt[0], (uint32)salt.size()).toString();
if (realhmac == hmac) if (realhmac == hmac)
return slot; return slot;
return INVENTORIES::NbBagSlots; return INVENTORIES::NbBagSlots;
} }
#endif
//----------------------------------------------- //-----------------------------------------------

@ -1696,6 +1696,7 @@ public:
/// validate dynamic mission step sending url /// validate dynamic mission step sending url
void validateDynamicMissionStep(const std::string &url); void validateDynamicMissionStep(const std::string &url);
#ifdef RYZOM_FORGE
/// add web command validation check /// add web command validation check
void addWebCommandCheck(const std::string &url, const std::string &data, const std::string &salt); void addWebCommandCheck(const std::string &url, const std::string &data, const std::string &salt);
@ -1704,6 +1705,7 @@ public:
/// validate web command. Return web command item index in bag if command is valid or INVENTORIES::NbBagSlots if not /// validate web command. Return web command item index in bag if command is valid or INVENTORIES::NbBagSlots if not
uint checkWebCommand(const std::string &url, const std::string &data, const std::string &hmac, const std::string &salt); uint checkWebCommand(const std::string &url, const std::string &data, const std::string &hmac, const std::string &salt);
#endif
/// get the available phrases /// get the available phrases
void getAvailablePhrasesList(const std::string &brickFilter, std::vector<NLMISC::CSheetId> &selectedPhrases, EGSPD::CPeople::TPeople people = EGSPD::CPeople::Common, bool bypassBrickRequirements = false, bool includeNonRolemasterBricks = true ); void getAvailablePhrasesList(const std::string &brickFilter, std::vector<NLMISC::CSheetId> &selectedPhrases, EGSPD::CPeople::TPeople people = EGSPD::CPeople::Common, bool bypassBrickRequirements = false, bool includeNonRolemasterBricks = true );

Loading…
Cancel
Save