Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

SecurityServer.cxx 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  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 <rdr/Exception.h>
  23. #include <rfb/Security.h>
  24. #include <rfb/SSecurityNone.h>
  25. #include <rfb/SSecurityStack.h>
  26. #include <rfb/SSecurityPlain.h>
  27. #include <rfb/SSecurityVncAuth.h>
  28. #include <rfb/SSecurityVeNCrypt.h>
  29. #ifdef HAVE_GNUTLS
  30. #include <rfb/SSecurityTLS.h>
  31. #endif
  32. using namespace rdr;
  33. using namespace rfb;
  34. StringParameter SecurityServer::secTypes
  35. ("SecurityTypes",
  36. "Specify which security scheme to use (None, VncAuth, Plain"
  37. #ifdef HAVE_GNUTLS
  38. ", TLSNone, TLSVnc, TLSPlain, X509None, X509Vnc, X509Plain"
  39. #endif
  40. ")",
  41. #ifdef HAVE_GNUTLS
  42. "TLSVnc,VncAuth",
  43. #else
  44. "VncAuth",
  45. #endif
  46. ConfServer);
  47. SSecurity* SecurityServer::GetSSecurity(SConnection* sc, U32 secType)
  48. {
  49. if (!IsSupported(secType))
  50. goto bail;
  51. switch (secType) {
  52. case secTypeNone: return new SSecurityNone(sc);
  53. case secTypeVncAuth: return new SSecurityVncAuth(sc);
  54. case secTypeVeNCrypt: return new SSecurityVeNCrypt(sc, this);
  55. case secTypePlain: return new SSecurityPlain(sc);
  56. #ifdef HAVE_GNUTLS
  57. case secTypeTLSNone:
  58. return new SSecurityStack(sc, secTypeTLSNone, new SSecurityTLS(sc, true));
  59. case secTypeTLSVnc:
  60. return new SSecurityStack(sc, secTypeTLSVnc, new SSecurityTLS(sc, true), new SSecurityVncAuth(sc));
  61. case secTypeTLSPlain:
  62. return new SSecurityStack(sc, secTypeTLSPlain, new SSecurityTLS(sc, true), new SSecurityPlain(sc));
  63. case secTypeX509None:
  64. return new SSecurityStack(sc, secTypeX509None, new SSecurityTLS(sc, false));
  65. case secTypeX509Vnc:
  66. return new SSecurityStack(sc, secTypeX509None, new SSecurityTLS(sc, false), new SSecurityVncAuth(sc));
  67. case secTypeX509Plain:
  68. return new SSecurityStack(sc, secTypeX509Plain, new SSecurityTLS(sc, false), new SSecurityPlain(sc));
  69. #endif
  70. }
  71. bail:
  72. throw Exception("Security type not supported");
  73. }