Constantin Kaplinsky | 47ed8d3 | 2004-10-08 09:43:57 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved. |
| 2 | * |
| 3 | * This is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * This software is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this software; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 16 | * USA. |
| 17 | */ |
| 18 | |
| 19 | // |
| 20 | // SSecurityFactoryStandard - implementation of the SSecurityFactory |
| 21 | // interface. |
| 22 | // |
| 23 | // Server implementations must define an instance of a |
| 24 | // VncAuthPasswdParameter-based class somewhere. Any class based on |
| 25 | // VncAuthPasswdParameter will automatically register itself as the |
| 26 | // password parameter to be used by the Standard factory. |
| 27 | // |
| 28 | // Two implementations are provided here: |
| 29 | // |
| 30 | // VncAuthPasswdConfigParameter - reads the password from the Binary |
| 31 | // parameter "Password". |
| 32 | // VncAuthPasswdFileParameter - reads the password from the file named |
| 33 | // in the String parameter "PasswordFile". |
| 34 | // |
| 35 | // This factory supports only the "None" and "VncAuth" security types. |
| 36 | // |
| 37 | |
| 38 | #ifndef __RFB_SSECURITYFACTORY_STANDARD_H__ |
| 39 | #define __RFB_SSECURITYFACTORY_STANDARD_H__ |
| 40 | |
| 41 | #include <rfb/SSecurityVncAuth.h> |
| 42 | #include <rfb/Configuration.h> |
| 43 | #include <rfb/util.h> |
| 44 | |
| 45 | namespace rfb { |
| 46 | |
| 47 | class VncAuthPasswdParameter : public VncAuthPasswdGetter { |
| 48 | public: |
| 49 | VncAuthPasswdParameter(); |
| 50 | virtual ~VncAuthPasswdParameter() {} |
| 51 | }; |
| 52 | |
| 53 | class SSecurityFactoryStandard : public SSecurityFactory { |
| 54 | public: |
| 55 | virtual SSecurity* getSSecurity(int secType, bool noAuth); |
| 56 | static VncAuthPasswdParameter* vncAuthPasswd; |
| 57 | }; |
| 58 | |
| 59 | class VncAuthPasswdConfigParameter : public VncAuthPasswdParameter { |
| 60 | public: |
| 61 | VncAuthPasswdConfigParameter(); |
| 62 | virtual char* getVncAuthPasswd(); |
| 63 | protected: |
| 64 | BinaryParameter passwdParam; |
| 65 | }; |
| 66 | |
| 67 | class VncAuthPasswdFileParameter : public VncAuthPasswdParameter { |
| 68 | public: |
| 69 | VncAuthPasswdFileParameter(); |
| 70 | virtual char* getVncAuthPasswd(); |
| 71 | StringParameter param; |
| 72 | }; |
| 73 | |
| 74 | } |
| 75 | #endif |