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

--HG--
branch : develop
hg/compatibility-develop
kervala 7 years ago
parent 8c4cf11534
commit bea0240cbb

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

Loading…
Cancel
Save