static Bool CheckResponse(rfbClientPtr cl, int numPasswords,
                          char *passwdFullControl, char *passwdViewOnly,
                          CARD8 *response)
{
  Bool ok = FALSE;
  CARD8 encryptedChallenge1[CHALLENGESIZE];
  CARD8 encryptedChallenge2[CHALLENGESIZE];

  memcpy(encryptedChallenge1, cl->authChallenge, CHALLENGESIZE);
  vncEncryptBytes(encryptedChallenge1, passwdFullControl);
  memcpy(encryptedChallenge2, cl->authChallenge, CHALLENGESIZE);
  vncEncryptBytes(encryptedChallenge2,
                  (numPasswords == 2) ? passwdViewOnly : passwdFullControl);

  /* Delete the passwords from memory */
  memset(passwdFullControl, 0, MAXPWLEN + 1);
  memset(passwdViewOnly, 0, MAXPWLEN + 1);

  if (memcmp(encryptedChallenge1, response, CHALLENGESIZE) == 0) {
    rfbLog("Full-control authentication enabled for %s\n", cl->host);
    ok = TRUE;
    cl->viewOnly = FALSE;

  } else if (memcmp(encryptedChallenge2, response, CHALLENGESIZE) == 0) {
    rfbLog("View-only authentication enabled for %s\n", cl->host);
    ok = TRUE;
    cl->viewOnly = TRUE;
  }

  return ok;
}
static Bool CheckResponse(rfbClientPtr cl, int numPasswords,
                          char *passwdFullControl, char *passwdViewOnly,
                          CARD8 *response)
{
  Bool ok = FALSE;
  CARD8 encryptedChallenge1[CHALLENGESIZE];
  CARD8 encryptedChallenge2[CHALLENGESIZE];

  memcpy(encryptedChallenge1, cl->authChallenge, CHALLENGESIZE);
  vncEncryptBytes(encryptedChallenge1, passwdFullControl);
  memcpy(encryptedChallenge2, cl->authChallenge, CHALLENGESIZE);
  vncEncryptBytes(encryptedChallenge2,
                  (numPasswords == 2) ? passwdViewOnly : passwdFullControl);

   
  memset(passwdFullControl, 0, MAXPWLEN + 1);
  memset(passwdViewOnly, 0, MAXPWLEN + 1);

  if (memcmp(encryptedChallenge1, response, CHALLENGESIZE) == 0) {
    rfbLog("Full-control authentication enabled for %s\n", cl->host);
    ok = TRUE;
    cl->viewOnly = FALSE;

  } else if (memcmp(encryptedChallenge2, response, CHALLENGESIZE) == 0) {
    rfbLog("View-only authentication enabled for %s\n", cl->host);
    ok = TRUE;
    cl->viewOnly = TRUE;
  }

  return ok;
}