Changeset d932cb369c8c7f2d18dd1310a3729834040ea4d3
- Timestamp:
- 02/14/09 16:23:59 (4 years ago)
- Author:
- Armin Burgmeier <armin@…>
- Parents:
- 4c745f3d1d18e682c548c17d59430a68ef85955a
- Children:
- 07e49776a394a41e8274c44947bedb7e3d0d441e
- git-committer:
- Armin Burgmeier <armin@arbur.net> / 2009-02-14T16:23:59Z+0100
- Message:
-
Added /etc/ssl/certs/ca-certificates.crt as default trust file
2009-02-14 Armin Burgmeier <armin@…>
- code/util/config.hpp:
- code/util/config.cpp: Added ParentEntry::has_value().
- code/core/preferences.cpp: Added /etc/ssl/certs/ca-certificates.crt
as default value for the trust-file, if the file exists.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r4c745f3
|
rd932cb3
|
|
| | 1 | 2009-02-14 Armin Burgmeier <armin@arbur.net> |
| | 2 | |
| | 3 | * code/util/config.hpp: |
| | 4 | * code/util/config.cpp: Added ParentEntry::has_value(). |
| | 5 | |
| | 6 | * code/core/preferences.cpp: Added /etc/ssl/certs/ca-certificates.crt |
| | 7 | as default value for the trust-file, if the file exists. |
| | 8 | |
| 1 | 9 | 2009-02-03 Armin Burgmeier <armin@arbur.net> |
| 2 | 10 | |
-
|
r6b79c69
|
rd932cb3
|
|
| 110 | 110 | |
| 111 | 111 | Gobby::Preferences::Security::Security(Config::ParentEntry& entry): |
| 112 | | trust_file(entry.get_value<std::string>("trust-file", "")), |
| | 112 | trust_file(entry.get_value<std::string>("trust-file")), |
| 113 | 113 | policy(static_cast<InfXmppConnectionSecurityPolicy>( |
| 114 | 114 | entry.get_value<int>("policy", static_cast<int>( |
| 115 | 115 | INF_XMPP_CONNECTION_SECURITY_BOTH_PREFER_TLS)))) |
| 116 | 116 | { |
| | 117 | // Load default trust-file. As this accesses the filesystem, only do |
| | 118 | // it when we really need it, i.e. when starting Gobby the first time. |
| | 119 | if(!entry.has_value("trust-file")) |
| | 120 | { |
| | 121 | #ifdef G_OS_WIN32 |
| | 122 | gchar* package_directory = |
| | 123 | g_win32_get_package_installation_directory_of_module( |
| | 124 | NULL); |
| | 125 | |
| | 126 | trust_file = Glib::build_filename( |
| | 127 | Glib::build_filename(package_directory, "certs"), |
| | 128 | "ca-certificates.crt"); |
| | 129 | |
| | 130 | g_free(package_directory); |
| | 131 | #else |
| | 132 | // This seems to be the default location for both |
| | 133 | // Debian and Gentoo. I don't know about other distributions. |
| | 134 | // Maybe they need a distro-patch for this. |
| | 135 | const std::string DEFAULT_TRUST_FILE = |
| | 136 | "/etc/ssl/certs/ca-certificates.crt"; |
| | 137 | if(Glib::file_test(DEFAULT_TRUST_FILE, |
| | 138 | Glib::FILE_TEST_IS_REGULAR)) |
| | 139 | { |
| | 140 | trust_file = DEFAULT_TRUST_FILE; |
| | 141 | } |
| | 142 | #endif |
| | 143 | } |
| 117 | 144 | } |
| 118 | 145 | |
-
|
r6b79c69
|
rd932cb3
|
|
| 141 | 141 | } |
| 142 | 142 | |
| | 143 | bool Gobby::Config::ParentEntry::has_value(const Glib::ustring& name) |
| | 144 | { |
| | 145 | return get_value_child(name) != NULL; |
| | 146 | } |
| | 147 | |
| 143 | 148 | Gobby::Config::ParentEntry& Gobby::Config::ParentEntry:: |
| 144 | 149 | operator[](const Glib::ustring& name) |
-
|
r6b79c69
|
rd932cb3
|
|
| 44 | 44 | public: |
| 45 | 45 | Entry(const Glib::ustring& name); |
| 46 | | virtual ~Entry() {} // compiler complains without |
| | 46 | virtual ~Entry() {} |
| 47 | 47 | |
| 48 | 48 | /** @brief Saves this entry into the given element. |
| … |
… |
|
| 202 | 202 | get_value_child(const Glib::ustring& name) const; |
| 203 | 203 | |
| | 204 | /** @brief: Returns whether there is a child ValueEntry with |
| | 205 | * the given name. |
| | 206 | */ |
| | 207 | bool has_value(const Glib::ustring& name); |
| | 208 | |
| 204 | 209 | /** @brief Returns the value from the child with the given |
| 205 | 210 | * name. |