fix string fu in auth smtp password prompt, was using tmp var that could get freed up, patch by neil@parkwaycc.co.uk/dwitte@stanford.edu, r/sr=me 90507

This commit is contained in:
bienvenu%nventure.com 2003-10-30 16:21:09 +00:00
Родитель 57d8a01c3b
Коммит 9051645d49
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -1709,9 +1709,10 @@ nsSmtpProtocol::GetPassword(char **aPassword)
rv = smtpServer->GetUsername(getter_Copies(username));
NS_ENSURE_SUCCESS(rv, rv);
NS_ConvertASCIItoUCS2 usernameUTF16(username);
const PRUnichar *formatStrings[] =
{
NS_ConvertASCIItoUCS2(username).get(),
usernameUTF16.get(),
nsnull // this will be overwritten in some cases.
};
@ -1719,12 +1720,14 @@ nsSmtpProtocol::GetPassword(char **aPassword)
rv = prefBranch->GetBoolPref(prefName.get(), &hideHostnameForPassword);
// for certain redirector types, we don't want to show the
// hostname to the user when prompting for password
nsAutoString hostnameUTF16;
if (!hideHostnameForPassword)
{
nsXPIDLCString hostname;
rv = smtpServer->GetHostname(getter_Copies(hostname));
NS_ENSURE_SUCCESS(rv, rv);
formatStrings[1] = NS_ConvertASCIItoUCS2(hostname).get();
CopyASCIItoUTF16(hostname, hostnameUTF16);
formatStrings[1] = hostnameUTF16.get();
}
rv = PromptForPassword(smtpServer, smtpUrl, formatStrings, aPassword);
NS_ENSURE_SUCCESS(rv,rv);