si_SignonDataStruct* data = nsnull;
SINGSIGN_RememberSignonData (char* URLName, nsVoidArray * signonData){  int passwordCount = 0;  int pswd[3];  si_SignonDataStruct * data;  si_SignonDataStruct * data0;  si_SignonDataStruct * data1;  si_SignonDataStruct * data2;  /* do nothing if signon preference is not enabled */  if (!si_GetSignonRememberingPref()){    return;  }  /* determine how many passwords are in the form and where they are */  for (PRInt32 i=0; i<signonData->Count(); i++) {    data = NS_STATIC_CAST(si_SignonDataStruct*, signonData->ElementAt(i));    if (data->isPassword) {      if (passwordCount < 3 ) {        pswd[passwordCount] = i;      }      passwordCount++;    }  }  /* process the form according to how many passwords it has */  if (passwordCount == 1) {    /* one-password form is a log-in so remember it */    /* obtain the index of the first input field (that is the username) */    PRInt32 j;    for (j=0; j<signonData->Count(); j++) {      data = NS_STATIC_CAST(si_SignonDataStruct*, signonData->ElementAt(j));      if (!data->isPassword) {        break;      }    }    if (j<signonData->Count()) {      data2 = NS_STATIC_CAST(si_SignonDataStruct*, signonData->ElementAt(j));      if (si_OkToSave(URLName, data2->value /* username */)) {        SI_LoadSignonData(PR_TRUE);        si_PutData(URLName, signonData, PR_TRUE);      }    }  } else if (passwordCount == 2) {    /* two-password form is a registration */  } else if (passwordCount == 3) {    /* three-password form is a change-of-password request */    si_SignonDataStruct* data = nsnull;    si_SignonUserStruct* user;    /* make sure all passwords are non-null and 2nd and 3rd are identical */    data0 = NS_STATIC_CAST(si_SignonDataStruct*, signonData->ElementAt(pswd[0]));    data1 = NS_STATIC_CAST(si_SignonDataStruct*, signonData->ElementAt(pswd[1]));    data2 = NS_STATIC_CAST(si_SignonDataStruct*, signonData->ElementAt(pswd[2]));    if (data0->value.Length() == 0 || data1->value.Length() == 0 ||        data2->value.Length() == 0 || data1->value != data2->value) {      return;    }    /* ask user if this is a password change */    si_lock_signon_list();    user = si_GetURLAndUserForChangeForm(data0->value);    /* return if user said no */    if (!user) {      si_unlock_signon_list();      return;    }    /* get to password being saved */    SI_LoadSignonData(PR_TRUE); /* this destroys "user" so we need to recalculate it */    user = si_GetURLAndUserForChangeForm(data0->value);    if (!user) { /* this should never happen but just in case */      si_unlock_signon_list();      return;    }    PRInt32 dataCount = LIST_COUNT(user->signonData_list);    for (PRInt32 k=0; k<dataCount; k++) {      data = NS_STATIC_CAST(si_SignonDataStruct*, user->signonData_list->ElementAt(k));      if (data->isPassword) {        break;      }    }    /*     * if second password is "********" then generate a random     * password for it and use same random value for third password     * as well (Note: this all works because we already know that     * second and third passwords are identical so third password     * must also be "********".  Furthermore si_Randomize() will     * create a random password of exactly eight characters -- the     * same length as "********".)     *//* commenting out because I don't see how such randomizing could ever have worked. *///    si_Randomize(data1->value);//    data2->value = data1->value;    data->value = data1->value;    si_signon_list_changed = PR_TRUE;    si_SaveSignonDataLocked(PR_TRUE);    si_unlock_signon_list();  }}