Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

CSecurityStack.cxx 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* Copyright (C) 2005 Martin Koegler
  2. * Copyright (C) 2010 TigerVNC Team
  3. *
  4. * This is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This software is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this software; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  17. * USA.
  18. */
  19. #ifdef HAVE_CONFIG_H
  20. #include <config.h>
  21. #endif
  22. #include <rfb/CSecurityStack.h>
  23. using namespace rfb;
  24. CSecurityStack::CSecurityStack(CConnection* cc, int Type, const char* Name,
  25. CSecurity* s0, CSecurity* s1)
  26. : CSecurity(cc), name(Name), type(Type)
  27. {
  28. state = 0;
  29. state0 = s0;
  30. state1 = s1;
  31. }
  32. CSecurityStack::~CSecurityStack()
  33. {
  34. delete state0;
  35. delete state1;
  36. }
  37. bool CSecurityStack::processMsg()
  38. {
  39. bool res=true;
  40. if (state == 0) {
  41. if (state0)
  42. res = state0->processMsg();
  43. if (!res)
  44. return res;
  45. state++;
  46. }
  47. if (state == 1) {
  48. if(state1)
  49. res = state1->processMsg();
  50. if(!res)
  51. return res;
  52. state++;
  53. }
  54. return res;
  55. }
  56. bool CSecurityStack::isSecure() const
  57. {
  58. if (state0 && state0->isSecure())
  59. return true;
  60. if (state == 1 && state1 && state1->isSecure())
  61. return true;
  62. return false;
  63. }