bug 39653, describe obscure/encrypt choice better to reduce our liability, r=dp

git-svn-id: svn://10.0.0.236/trunk@70766 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
morse%netscape.com
2000-05-24 23:22:15 +00:00
parent e1384a377c
commit d8a3f73756
5 changed files with 347 additions and 299 deletions

View File

@@ -24,6 +24,7 @@
#define alphabetize 1
#include "singsign.h"
#include "wallet.h"
#ifdef XP_MAC
#include "prpriv.h" /* for NewNamedMonitor */
@@ -45,8 +46,7 @@
#include "nsIURL.h"
#include "nsIDOMHTMLDocument.h"
#include "prmem.h"
#include "prprf.h"
#include "nsVoidArray.h"
#include "prprf.h"
#include "nsXPIDLString.h"
static NS_DEFINE_IID(kIPrefServiceIID, NS_IPREF_IID);
@@ -83,212 +83,6 @@ si_SaveSignonDataInKeychain();
#define USERNAMEFIELD "\\=username=\\"
#define PASSWORDFIELD "\\=password=\\"
/*************************************
* Externs to Routines in Wallet.cpp *
*************************************/
extern nsresult Wallet_ProfileDirectory(nsFileSpec& dirSpec);
extern PRUnichar * Wallet_Localize(char * genericString);
/***********
* Dialogs *
***********/
extern PRBool Wallet_ConfirmYN(PRUnichar * szMessage);
PRIVATE PRBool
si_ConfirmYN(PRUnichar * szMessage) {
return Wallet_ConfirmYN(szMessage);
}
#define YES_BUTTON 0
#define NO_BUTTON 1
#define NEVER_BUTTON 2
extern PRInt32 Wallet_3ButtonConfirm(PRUnichar * szMessage);
PRIVATE PRInt32
si_3ButtonConfirm(PRUnichar * szMessage) {
return Wallet_3ButtonConfirm(szMessage);
}
// This will go away once select is passed a prompter interface
#include "nsAppShellCIDs.h" // TODO remove later
PRIVATE PRBool
si_SelectDialog(const PRUnichar* szMessage, PRUnichar** pList, PRInt32* pCount) {
if (si_UserHasBeenSelected) {
/* a user was already selected for this form, use same one again */
*pCount = 0; /* last user selected is now at head of list */
return PR_TRUE;
}
nsresult rv;
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv);
if (NS_FAILED(rv)) {
return PR_FALSE;
}
PRInt32 selectedIndex;
PRBool rtnValue;
PRUnichar * title_string = Wallet_Localize("SelectUserTitleLine");
rv = dialog->Select( title_string, szMessage, *pCount, NS_CONST_CAST(const PRUnichar**, pList), &selectedIndex, &rtnValue );
Recycle(title_string);
*pCount = selectedIndex;
si_UserHasBeenSelected = PR_TRUE;
return rtnValue;
}
nsresult
si_CheckGetPassword
(PRUnichar ** password,
const PRUnichar * szMessage,
PRBool* checkValue)
{
nsresult res;
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
if (NS_FAILED(res)) {
return res;
}
PRInt32 buttonPressed = 1; /* in case user exits dialog by clickin X */
PRUnichar * prompt_string = Wallet_Localize("PromptForPassword");
PRUnichar * check_string = Wallet_Localize("SaveThisValue");
res = dialog->UniversalDialog(
NULL, /* title message */
prompt_string, /* title text in top line of window */
szMessage, /* this is the main message */
check_string, /* This is the checkbox message */
NULL, /* first button text, becomes OK by default */
NULL, /* second button text, becomes CANCEL by default */
NULL, /* third button text */
NULL, /* fourth button text */
NULL, /* first edit field label */
NULL, /* second edit field label */
password, /* first edit field initial and final value */
NULL, /* second edit field initial and final value */
NULL, /* icon: question mark by default */
checkValue, /* initial and final value of checkbox */
2, /* number of buttons */
1, /* number of edit fields */
1, /* is first edit field a password field */
&buttonPressed);
Recycle(prompt_string);
Recycle(check_string);
if (NS_FAILED(res)) {
return res;
}
if (buttonPressed == 0) {
return NS_OK;
} else {
return NS_ERROR_FAILURE; /* user pressed cancel */
}
}
nsresult
si_CheckGetData
(PRUnichar ** data,
const PRUnichar * szMessage,
PRBool* checkValue)
{
nsresult res;
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
if (NS_FAILED(res)) {
return res;
}
PRInt32 buttonPressed = 1; /* in case user exits dialog by clickin X */
PRUnichar * prompt_string = Wallet_Localize("PromptForData");
PRUnichar * check_string = Wallet_Localize("SaveThisValue");
res = dialog->UniversalDialog(
NULL, /* title message */
prompt_string, /* title text in top line of window */
szMessage, /* this is the main message */
check_string, /* This is the checkbox message */
NULL, /* first button text, becomes OK by default */
NULL, /* second button text, becomes CANCEL by default */
NULL, /* third button text */
NULL, /* fourth button text */
NULL, /* first edit field label */
NULL, /* second edit field label */
data, /* first edit field initial and final value */
NULL, /* second edit field initial and final value */
NULL, /* icon: question mark by default */
checkValue, /* initial and final value of checkbox */
2, /* number of buttons */
1, /* number of edit fields */
0, /* is first edit field a password field */
&buttonPressed);
Recycle(prompt_string);
Recycle(check_string);
if (NS_FAILED(res)) {
return res;
}
if (buttonPressed == 0) {
return NS_OK;
} else {
return NS_ERROR_FAILURE; /* user pressed cancel */
}
}
nsresult
si_CheckGetUsernamePassword
(PRUnichar ** username,
PRUnichar ** password,
const PRUnichar * szMessage,
PRBool* checkValue)
{
nsresult res;
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
if (NS_FAILED(res)) {
return res;
}
PRInt32 buttonPressed = 1; /* in case user exits dialog by clickin X */
PRUnichar * prompt_string = Wallet_Localize("PromptForPassword");
PRUnichar * check_string = Wallet_Localize("SaveTheseValues");
PRUnichar * user_string = Wallet_Localize("UserName");
PRUnichar * password_string = Wallet_Localize("Password");
res = dialog->UniversalDialog(
NULL, /* title message */
prompt_string, /* title text in top line of window */
szMessage, /* this is the main message */
check_string, /* This is the checkbox message */
NULL, /* first button text, becomes OK by default */
NULL, /* second button text, becomes CANCEL by default */
NULL, /* third button text */
NULL, /* fourth button text */
user_string, /* first edit field label */
password_string, /* second edit field label */
username, /* first edit field initial and final value */
password, /* second edit field initial and final value */
NULL, /* icon: question mark by default */
checkValue, /* initial and final value of checkbox */
2, /* number of buttons */
2, /* number of edit fields */
0, /* is first edit field a password field */
&buttonPressed);
Recycle(prompt_string);
Recycle(check_string);
Recycle(user_string);
Recycle(password_string);
if (NS_FAILED(res)) {
return res;
}
if (buttonPressed == 0) {
return NS_OK;
} else {
return NS_ERROR_FAILURE; /* user pressed cancel */
}
}
/******************
* Key Management *
******************/
@@ -344,8 +138,6 @@ si_unlock_signon_list(void) {
* Preference Utility Functions *
********************************/
typedef int (*PR_CALLBACK PrefChangedFunc) (const char *, void *);
PUBLIC void
SI_RegisterCallback(const char* domain, PrefChangedFunc callback, void* instance_data) {
nsresult ret;
@@ -515,8 +307,6 @@ si_GetSignonRememberingPref(void) {
#endif
}
extern char* Wallet_RandomName(char* suffix);
PUBLIC void
SI_InitSignonFileName() {
SI_GetCharPref(pref_SignonFileName, &signonFileName);
@@ -527,6 +317,213 @@ SI_InitSignonFileName() {
}
/***********
* Dialogs *
***********/
PRIVATE PRBool
si_ConfirmYN(PRUnichar * szMessage) {
return Wallet_ConfirmYN(szMessage);
}
PRIVATE PRInt32
si_3ButtonConfirm(PRUnichar * szMessage) {
return Wallet_3ButtonConfirm(szMessage);
}
// This will go away once select is passed a prompter interface
#include "nsAppShellCIDs.h" // TODO remove later
PRIVATE PRBool
si_SelectDialog(const PRUnichar* szMessage, PRUnichar** pList, PRInt32* pCount) {
if (si_UserHasBeenSelected) {
/* a user was already selected for this form, use same one again */
*pCount = 0; /* last user selected is now at head of list */
return PR_TRUE;
}
nsresult rv;
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv);
if (NS_FAILED(rv)) {
return PR_FALSE;
}
PRInt32 selectedIndex;
PRBool rtnValue;
PRUnichar * title_string = Wallet_Localize("SelectUserTitleLine");
rv = dialog->Select( title_string, szMessage, *pCount, NS_CONST_CAST(const PRUnichar**, pList), &selectedIndex, &rtnValue );
Recycle(title_string);
*pCount = selectedIndex;
si_UserHasBeenSelected = PR_TRUE;
return rtnValue;
}
nsresult
si_CheckGetPassword
(PRUnichar ** password,
const PRUnichar * szMessage,
PRBool* checkValue)
{
nsresult res;
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
if (NS_FAILED(res)) {
return res;
}
PRInt32 buttonPressed = 1; /* in case user exits dialog by clickin X */
PRUnichar * prompt_string = Wallet_Localize("PromptForPassword");
PRUnichar * check_string;
if (SI_GetBoolPref(pref_Crypto, PR_FALSE)) {
check_string = Wallet_Localize("SaveThisValueEncrypted");
} else {
check_string = Wallet_Localize("SaveThisValueObscured");
}
res = dialog->UniversalDialog(
NULL, /* title message */
prompt_string, /* title text in top line of window */
szMessage, /* this is the main message */
check_string, /* This is the checkbox message */
NULL, /* first button text, becomes OK by default */
NULL, /* second button text, becomes CANCEL by default */
NULL, /* third button text */
NULL, /* fourth button text */
NULL, /* first edit field label */
NULL, /* second edit field label */
password, /* first edit field initial and final value */
NULL, /* second edit field initial and final value */
NULL, /* icon: question mark by default */
checkValue, /* initial and final value of checkbox */
2, /* number of buttons */
1, /* number of edit fields */
1, /* is first edit field a password field */
&buttonPressed);
Recycle(prompt_string);
Recycle(check_string);
if (NS_FAILED(res)) {
return res;
}
if (buttonPressed == 0) {
return NS_OK;
} else {
return NS_ERROR_FAILURE; /* user pressed cancel */
}
}
nsresult
si_CheckGetData
(PRUnichar ** data,
const PRUnichar * szMessage,
PRBool* checkValue)
{
nsresult res;
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
if (NS_FAILED(res)) {
return res;
}
PRInt32 buttonPressed = 1; /* in case user exits dialog by clickin X */
PRUnichar * prompt_string = Wallet_Localize("PromptForData");
PRUnichar * check_string;
if (SI_GetBoolPref(pref_Crypto, PR_FALSE)) {
check_string = Wallet_Localize("SaveThisValueEncrypted");
} else {
check_string = Wallet_Localize("SaveThisValueObscured");
}
res = dialog->UniversalDialog(
NULL, /* title message */
prompt_string, /* title text in top line of window */
szMessage, /* this is the main message */
check_string, /* This is the checkbox message */
NULL, /* first button text, becomes OK by default */
NULL, /* second button text, becomes CANCEL by default */
NULL, /* third button text */
NULL, /* fourth button text */
NULL, /* first edit field label */
NULL, /* second edit field label */
data, /* first edit field initial and final value */
NULL, /* second edit field initial and final value */
NULL, /* icon: question mark by default */
checkValue, /* initial and final value of checkbox */
2, /* number of buttons */
1, /* number of edit fields */
0, /* is first edit field a password field */
&buttonPressed);
Recycle(prompt_string);
Recycle(check_string);
if (NS_FAILED(res)) {
return res;
}
if (buttonPressed == 0) {
return NS_OK;
} else {
return NS_ERROR_FAILURE; /* user pressed cancel */
}
}
nsresult
si_CheckGetUsernamePassword
(PRUnichar ** username,
PRUnichar ** password,
const PRUnichar * szMessage,
PRBool* checkValue)
{
nsresult res;
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
if (NS_FAILED(res)) {
return res;
}
PRInt32 buttonPressed = 1; /* in case user exits dialog by clickin X */
PRUnichar * prompt_string = Wallet_Localize("PromptForPassword");
PRUnichar * user_string = Wallet_Localize("UserName");
PRUnichar * password_string = Wallet_Localize("Password");
PRUnichar * check_string;
if (SI_GetBoolPref(pref_Crypto, PR_FALSE)) {
check_string = Wallet_Localize("SaveTheseValuesEncrypted");
} else {
check_string = Wallet_Localize("SaveTheseValuesObscured");
}
res = dialog->UniversalDialog(
NULL, /* title message */
prompt_string, /* title text in top line of window */
szMessage, /* this is the main message */
check_string, /* This is the checkbox message */
NULL, /* first button text, becomes OK by default */
NULL, /* second button text, becomes CANCEL by default */
NULL, /* third button text */
NULL, /* fourth button text */
user_string, /* first edit field label */
password_string, /* second edit field label */
username, /* first edit field initial and final value */
password, /* second edit field initial and final value */
NULL, /* icon: question mark by default */
checkValue, /* initial and final value of checkbox */
2, /* number of buttons */
2, /* number of edit fields */
0, /* is first edit field a password field */
&buttonPressed);
Recycle(prompt_string);
Recycle(check_string);
Recycle(user_string);
Recycle(password_string);
if (NS_FAILED(res)) {
return res;
}
if (buttonPressed == 0) {
return NS_OK;
} else {
return NS_ERROR_FAILURE; /* user pressed cancel */
}
}
/********************
* Utility Routines *
********************/
@@ -643,12 +640,6 @@ si_Randomize(nsAutoString& password) {
// don't understand why linker doesn't let me call Wallet_Encrypt and Wallet_Decrypt
// directly but it doesn't. Need to introduce Wallet_Enctrypt2 and Wallet_Decrypt2 instead.
extern nsresult
Wallet_Encrypt2 (nsAutoString text, nsAutoString& crypt);
extern nsresult
Wallet_Decrypt2 (nsAutoString crypt, nsAutoString& text);
nsresult
si_Encrypt (nsAutoString text, nsAutoString& crypt) {
return Wallet_Encrypt2(text, crypt);
@@ -1411,6 +1402,9 @@ si_PutData(const char * passwordRealm, nsVoidArray * signonData, PRBool save) {
*/
PRInt32 userCount = LIST_COUNT(url->signonUser_list);
for (PRInt32 i2=0; i2<userCount; i2++) {
if (!save) {
break; /* otherwise we could be asked for master password when loading signon data */
}
user = NS_STATIC_CAST(si_SignonUserStruct*, url->signonUser_list->ElementAt(i2));
PRInt32 j = 0;
PRInt32 dataCount = LIST_COUNT(user->signonData_list);
@@ -1549,14 +1543,6 @@ si_PutData(const char * passwordRealm, nsVoidArray * signonData, PRBool save) {
* Managing the Signon Files *
*****************************/
#define HEADER_VERSION "#2c"
extern void
Wallet_UTF8Put(nsOutputFileStream strm, PRUnichar c);
extern PRUnichar
Wallet_UTF8Get(nsInputFileStream strm);
#define BUFFER_SIZE 4096
/*
@@ -1876,7 +1862,13 @@ si_OkToSave(char *passwordRealm, nsAutoString userName) {
return PR_FALSE;
}
PRUnichar * message = Wallet_Localize("WantToSavePassword?");
PRUnichar * message;
if (SI_GetBoolPref(pref_Crypto, PR_FALSE)) {
message = Wallet_Localize("WantToSavePasswordEncrypted?");
} else {
message = Wallet_Localize("WantToSavePasswordObscured?");
}
PRInt32 button = si_3ButtonConfirm(message);
if (button == NEVER_BUTTON) {
si_PutReject(strippedRealm, userName, PR_TRUE);
@@ -2381,9 +2373,6 @@ SI_FindValueInArgs(nsAutoString results, nsAutoString name) {
return value.ToNewUnicode();
}
extern void
Wallet_SignonViewerReturn (nsAutoString results);
PUBLIC void
SINGSIGN_SignonViewerReturn (nsAutoString results) {
si_SignonURLStruct *url;

View File

@@ -31,6 +31,8 @@
#include "ntypes.h"
#include "nsString.h"
#include "nsVoidArray.h"
class nsIPrompt;
XP_BEGIN_PROTOS
@@ -72,6 +74,36 @@ SINGSIGN_StorePassword
extern nsresult
SINGSIGN_HaveData(const char* passwordRealm, const PRUnichar *userName, PRBool *retval);
typedef int (*PR_CALLBACK PrefChangedFunc) (const char *, void *);
extern void
SI_RegisterCallback(const char* domain, PrefChangedFunc callback, void* instance_data);
extern PRBool
SI_GetBoolPref(const char * prefname, PRBool defaultvalue);
extern void
SI_SetBoolPref(const char * prefname, PRBool prefvalue);
extern void
SI_SetCharPref(const char * prefname, const char * prefvalue);
extern void
SI_GetCharPref(const char * prefname, char** aPrefvalue);
extern void SI_InitSignonFileName();
extern PRBool
SI_InSequence(nsAutoString sequence, int number);
extern PRUnichar*
SI_FindValueInArgs(nsAutoString results, nsAutoString name);
extern PRBool
SINGSIGN_ReencryptAll();
extern void
SINGSIGN_RememberSignonData (char* URLName, nsVoidArray * signonData);
XP_END_PROTOS

View File

@@ -26,6 +26,8 @@
#define AutoCapture
#include "wallet.h"
#include "singsign.h"
#include "nsNetUtil.h"
#include "nsIServiceManager.h"
@@ -51,7 +53,6 @@
#include "prprf.h"
#include "nsIProfile.h"
#include "nsIContent.h"
#include "nsVoidArray.h"
#include "nsIWalletService.h"
@@ -97,23 +98,7 @@ PRLogModuleInfo* gWalletLog = nsnull;
/* The following data and procedures are for preference */
/********************************************************/
typedef int (*PR_CALLBACK PrefChangedFunc) (const char *, void *);
extern void
SI_RegisterCallback(const char* domain, PrefChangedFunc callback, void* instance_data);
extern PRBool
SI_GetBoolPref(const char * prefname, PRBool defaultvalue);
extern void
SI_SetBoolPref(const char * prefname, PRBool prefvalue);
extern void
SI_SetCharPref(const char * prefname, const char * prefvalue);
extern void
SI_GetCharPref(const char * prefname, char** aPrefvalue);
static const char *pref_Caveat = "wallet.caveat";
#ifdef AutoCapture
static const char *pref_captureForms = "wallet.captureForms";
static const char *pref_enabled = "wallet.enabled";
@@ -735,6 +720,15 @@ Wallet_Localize(char* genericString) {
}
v = ptrv;
nsCRT::free(ptrv);
/* convert # to newlines */
PRUint32 i;
for (i=0; i<v.Length(); i++) {
if (v.CharAt(i) == '#') {
v.SetCharAt('\n', i);
}
}
return v.ToNewUnicode();
}
@@ -798,10 +792,6 @@ Wallet_ConfirmYN(PRUnichar * szMessage) {
return (buttonPressed == 0);
}
#define YES_BUTTON 0
#define NO_BUTTON 1
#define NEVER_BUTTON 2
PUBLIC PRInt32
Wallet_3ButtonConfirm(PRUnichar * szMessage)
{
@@ -990,18 +980,14 @@ wallet_CryptSetup() {
return NS_OK;
}
#include "nsIPref.h"
#define PREFIX "~"
#include "plbase64.h"
PRIVATE nsresult EncryptString (const char * text, char *& crypt) {
/* use SecretDecoderRing if encryption pref is set */
PRBool prefvalue = PR_FALSE;
nsresult rv;
NS_WITH_SERVICE(nsIPref, prefs, "component://netscape/preferences", &rv);
if (NS_SUCCEEDED(rv) &&
NS_SUCCEEDED(prefs->GetBoolPref("wallet.crypto", &prefvalue)) &&
prefvalue) {
if (SI_GetBoolPref(pref_Crypto, PR_FALSE)) {
rv = wallet_CryptSetup();
if (NS_SUCCEEDED(rv)) {
rv = gSecretDecoderRing->EncryptString(text, &crypt);
@@ -1013,9 +999,6 @@ PRIVATE nsresult EncryptString (const char * text, char *& crypt) {
}
/* otherwise do our own obscuring using Base64 encoding */
#define PREFIX "~"
char * crypt0 = PL_Base64Encode((const char *)text, 0, NULL);
if (!crypt0) {
return NS_ERROR_FAILURE;
@@ -1030,6 +1013,15 @@ PRIVATE nsresult EncryptString (const char * text, char *& crypt) {
}
crypt[PL_strlen(PREFIX) + PL_strlen(crypt0)] = '\0';
Recycle(crypt0);
/* test for first obscuring ever and give caveat if so */
if (!SI_GetBoolPref(pref_Caveat, PR_FALSE)) {
SI_SetBoolPref(pref_Caveat, PR_TRUE);
PRUnichar * message = Wallet_Localize("Caveat");
Wallet_Alert(message);
Recycle(message);
}
return NS_OK;
}
@@ -1514,8 +1506,6 @@ PUBLIC nsresult Wallet_ResourceDirectory(nsFileSpec& dirSpec) {
return res;
}
extern void SI_InitSignonFileName();
PUBLIC char *
Wallet_RandomName(char* suffix)
{
@@ -1528,8 +1518,6 @@ Wallet_RandomName(char* suffix)
return PL_strdup(name);
}
#define HEADER_VERSION "#2c"
/*
* get a line from a file
* return -1 if end of file reached
@@ -1884,7 +1872,10 @@ wallet_GetHostFile(nsIURI * url) {
}
urlName.AppendWithConversion(file);
nsCRT::free(file);
return urlName;
nsAutoString retString;
urlName.Left(retString, urlName.FindChar('?')); /* strip off query string */
return retString;
}
/*
@@ -1930,20 +1921,18 @@ PRInt32 FieldToValue(
for (PRInt32 i=0; i<count; i++) {
ptr1 = NS_STATIC_CAST(wallet_Sublist*, itemList2->ElementAt(i));
/* skip over values found previously */
/* note: a returned index of -1 means not-found. So we will use the
* negative even numbers (-2, -4, -6) to designate found as a concatenation
* where -2 means first value of each concatenation, -4 means second value, etc.
*/
PRInt32 index3 = 0;
for (PRInt32 j=0; j>index; j -= 2) {
if (!wallet_ReadFromList
(ptr1->item, value2, dummy, wallet_SchemaToValue_list, PR_TRUE, index3)) {
break;
}
}
/* skip over values found previously */
/* note: a returned index of -1 means not-found. So we will use the
* negative even numbers (-2, -4, -6) to designate found as a concatenation
* where -2 means first value of each concatenation, -4 means second value, etc.
*/
PRInt32 index3 = 0;
for (PRInt32 j=0; j>index; j -= 2) {
if (!wallet_ReadFromList
(ptr1->item, value2, dummy, wallet_SchemaToValue_list, PR_TRUE, index3)) {
break;
}
}
if (wallet_ReadFromList
(ptr1->item, value2, dummy, wallet_SchemaToValue_list, PR_TRUE, index3)) {
@@ -2465,12 +2454,6 @@ WLLT_GetPrefillListForViewer(nsAutoString& aPrefillList)
aPrefillList = buffer;
}
extern PRBool
SI_InSequence(nsAutoString sequence, int number);
extern PRUnichar*
SI_FindValueInArgs(nsAutoString results, nsAutoString name);
PRIVATE void
wallet_FreeURL(wallet_MapElement *url) {
@@ -2810,9 +2793,6 @@ PUBLIC void
WLLT_ReencryptAll() {
}
extern PRBool
SINGSIGN_ReencryptAll();
MODULE_PRIVATE int PR_CALLBACK
wallet_ReencryptAll(const char * newpref, void * data) {
PRUnichar * message;
@@ -2863,6 +2843,20 @@ if (!changingPassword) {
if (!SINGSIGN_ReencryptAll()) {
goto fail;
}
/* force a rewriting of prefs.js to make sure pref_Crypto got updated
*
* Note: In the event of a crash after changing this pref (either way), the user
* could get misled as to what state his storage was in. If the crash occurred
* after changing to encrypted, he could think he was encrypting in the future (because
* he remembered changed to encypting at one time) but his new values are only being
* obscurred. If the crash occurred after changing to obscured, later on he might
* think his store was encrypted (because he checked the pref panel and that's what
* it told him) whereas some of the earlier values are actually obscured and so not
* protected. For both these reasons, we force this rewriting of the prefs file now.
*/
SI_SetBoolPref(pref_Crypto, SI_GetBoolPref(pref_Crypto, PR_TRUE));
// message = Wallet_Localize("Converted");
// Wallet_Alert(message);
// Recycle(message);
@@ -2870,7 +2864,7 @@ if (!changingPassword) {
return 0; /* this is PREF_NOERROR but we no longer include prefapi.h */
fail:
/* toggle the pref back to its previous value */
SI_SetBoolPref("wallet.crypto", !SI_GetBoolPref("wallet.crypto", PR_TRUE));
SI_SetBoolPref(pref_Crypto, !SI_GetBoolPref(pref_Crypto, PR_TRUE));
/* alert the user to the failure */
message = Wallet_Localize("NotConverted");
@@ -2882,7 +2876,7 @@ fail:
PUBLIC void
WLLT_InitReencryptCallback() {
SI_RegisterCallback("wallet.crypto", wallet_ReencryptAll, NULL);
SI_RegisterCallback(pref_Crypto, wallet_ReencryptAll, NULL);
}
/*
@@ -3173,9 +3167,6 @@ wallet_ClearStopwatch();
}
}
extern void
SINGSIGN_RememberSignonData (char* URLName, nsVoidArray * signonData);
PUBLIC void
WLLT_RequestToCapture(nsIPresShell* shell) {
/* starting with the present shell, get each form element and put them on a list */

View File

@@ -32,11 +32,18 @@
#include "ntypes.h"
#include "nsIPresShell.h"
#include "nsString.h"
#include "nsIURL.h"
#include "nsIKeyedStreamGenerator.h"
#include "nsFileSpec.h"
XP_BEGIN_PROTOS
#define HEADER_VERSION "#2c"
#define YES_BUTTON 0
#define NO_BUTTON 1
#define NEVER_BUTTON 2
static const char *pref_Crypto = "wallet.crypto";
extern void
WLLT_ChangePassword();
@@ -85,6 +92,31 @@ Wallet_Encrypt (nsAutoString text, nsAutoString& crypt);
extern nsresult
Wallet_Decrypt (nsAutoString crypt, nsAutoString& text);
extern nsresult Wallet_ProfileDirectory(nsFileSpec& dirSpec);
extern PRUnichar * Wallet_Localize(char * genericString);
extern char* Wallet_RandomName(char* suffix);
extern PRBool Wallet_ConfirmYN(PRUnichar * szMessage);
extern PRInt32 Wallet_3ButtonConfirm(PRUnichar * szMessage);
extern nsresult
Wallet_Encrypt2 (nsAutoString text, nsAutoString& crypt);
extern nsresult
Wallet_Decrypt2 (nsAutoString crypt, nsAutoString& text);
extern void
Wallet_UTF8Put(nsOutputFileStream strm, PRUnichar c);
extern PRUnichar
Wallet_UTF8Get(nsInputFileStream strm);
extern void
Wallet_SignonViewerReturn (nsAutoString results);
XP_END_PROTOS
#endif /* !_WALLET_H */

View File

@@ -19,7 +19,8 @@
#
IncorrectKey_TryAgain? = Master password incorrect. Do you want to try again?
WantToCaptureForm? = Do you want to remember the values you filled in?
WantToSavePassword? = Do you want to remember your user name and password?
WantToSavePasswordObscured? = Do you want to remember your user name and password?##Stored values are not password protected.
WantToSavePasswordEncrypted? = Do you want to remember your user name and password?##Stored values are password protected.
#translator's note: # in following line will be converted to linefeed by program
firstPassword = A master password will be used to protect sensitive single-signon information stored on your hard drive. Future releases will strongly encrypt this data for maximum protection.##Select a master password.#(Leave fields blank if you don't want to use a master password).#
password = Enter your master password.
@@ -39,8 +40,10 @@ Never = Never for this site
Confirm = Confirm
PromptForPassword = Password
PromptForData = User Name
SaveTheseValues = Remember these values
SaveThisValue = Remember this value
SaveTheseValuesObscured = Remember these values. Stored values are not password protected.
SaveTheseValuesEncrypted = Remember these values. Stored values are password protected.
SaveThisValueObscured = Remember this value. Stored values are not password protected.
SaveThisValueEncrypted = Remember this value. Stored values are password protected.
UserName = User Name
Password = Password
SelectUserTitleLine = Select User
@@ -53,3 +56,4 @@ NotConverted = Unable to convert stored data.
PasswordNotChanged = Unable to change the password that protects your sensitive information.
PasswordExpired = Your sensitive information is now locked.
PasswordNotExpired = Unable to lock your sensitive information.
Caveat = Saving Sensitive Information##Your personal information (passwords, etc) will be saved by the browser so you won't need to reenter this information in the future.##By default, your personal information is stored in a file that is difficult but not impossible for an unauthorized person to read. If you wish to provide better security, you can make the file be password protected. This may be desirable, for example, if other people have access to your computer.##However, such improved security requires you to choose a password that you will be asked to provide from time to time. Thus it is slightly less convenient.##If you want to use improved security for your stored personal information, choose Preferences from the Edit menu, open the Advanced category, and select Forms and Passwords.