Fixed: Escape password and login to prevent errors with special characters (such as | or &)

--HG--
branch : develop
This commit is contained in:
kervala 2017-11-05 19:11:27 +01:00
parent 8c4cf11534
commit bea0240cbb

View file

@ -897,9 +897,9 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
contentPrefix += "set STARTUPPATH=%~4\n";
contentPrefix += toString("set UPGRADE_FILE=%%ROOTPATH%%\\%s\n", UpgradeBatchFilename.c_str());
contentPrefix += "\n";
contentPrefix += "set LOGIN=%5\n";
contentPrefix += "set PASSWORD=%6\n";
contentPrefix += "set SHARDID=%7\n";
contentPrefix += "set LOGIN=%~5\n";
contentPrefix += "set PASSWORD=%~6\n";
contentPrefix += "set SHARDID=%~7\n";
#else
contentPrefix += "#!/bin/sh\n";
contentPrefix += "export RYZOM_CLIENT=\"$1\"\n";
@ -908,9 +908,9 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
contentPrefix += "export STARTUPPATH=\"$4\"\n";
contentPrefix += toString("export UPGRADE_FILE=$ROOTPATH/%s\n", UpgradeBatchFilename.c_str());
contentPrefix += "\n";
contentPrefix += "LOGIN=$5\n";
contentPrefix += "PASSWORD=$6\n";
contentPrefix += "SHARDID=$7\n";
contentPrefix += "LOGIN=\"$5\"\n";
contentPrefix += "PASSWORD=\"$6\"\n";
contentPrefix += "SHARDID=\"$7\"\n";
#endif
contentPrefix += "\n";
@ -932,7 +932,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
if (wantRyzomRestart)
{
// client shouldn't be in memory anymore else it couldn't be overwritten
contentSuffix += toString("start \"\" /D \"%%STARTUPPATH%%\" \"%%RYZOM_CLIENT%%\" %s %%LOGIN%% %%PASSWORD%% %%SHARDID%%\n", additionalParams.c_str());
contentSuffix += toString("start \"\" /D \"%%STARTUPPATH%%\" \"%%RYZOM_CLIENT%%\" %s \"%%LOGIN%%\ \"%%PASSWORD%%\" \"%%SHARDID%%\"\n", additionalParams.c_str());
}
#else
if (wantRyzomRestart)
@ -955,9 +955,9 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
// launch new client
#ifdef NL_OS_MAC
// use exec command under OS X
contentSuffix += toString("exec \"$RYZOM_CLIENT\" %s $LOGIN $PASSWORD $SHARDID\n", additionalParams.c_str());
contentSuffix += toString("exec \"$RYZOM_CLIENT\" %s \"$LOGIN\" \"$PASSWORD\" \"$SHARDID\"\n", additionalParams.c_str());
#else
contentSuffix += toString("\"$RYZOM_CLIENT\" %s $LOGIN $PASSWORD $SHARDID &\n", additionalParams.c_str());
contentSuffix += toString("\"$RYZOM_CLIENT\" %s \"$LOGIN\" \"$PASSWORD\" \"$SHARDID\" &\n", additionalParams.c_str());
#endif
}
#endif