Skip to content
Permalink
Browse files

Merge pull request #2330 from boundlessgeo/master-2_11-auth-system

Authentication configuration system with master password
  • Loading branch information
nyalldawson committed Sep 25, 2015
2 parents caf12e7 + 12de332 commit 228d816b3b36e46ae69da2de4e63aa707d01515e
Showing with 27,407 additions and 374 deletions.
  1. +7 −0 CMakeLists.txt
  2. +1 −0 ci/travis/linux/before_install.sh
  3. +2 −1 ci/travis/osx/before_install.sh
  4. +98 −0 cmake/FindQCA.cmake
  5. +189 −0 cmake/QCAMacros.cmake
  6. +2 −0 cmake_templates/Doxyfile.in
  7. +4 −0 images/images.qrc
  8. +90 −0 images/themes/default/mIconCertificate.svg
  9. +83 −0 images/themes/default/mIconCertificateMissing.svg
  10. +98 −0 images/themes/default/mIconCertificateTrusted.svg
  11. +97 −0 images/themes/default/mIconCertificateUntrusted.svg
  12. +64 −0 mac/cmake/1qt.cmake.in
  13. +3 −0 python/CMakeLists.txt
  14. +147 −0 python/core/auth/qgsauthcertutils.sip
  15. +208 −0 python/core/auth/qgsauthconfig.sip
  16. +23 −0 python/core/auth/qgsauthcrypto.sip
  17. +227 −0 python/core/auth/qgsauthmanager.sip
  18. +57 −0 python/core/auth/qgsauthmethod.sip
  19. +6 −0 python/core/core.sip
  20. +3 −0 python/core/qgsapplication.sip
  21. +6 −0 python/core/qgscredentials.sip
  22. +2 −1 python/core/qgsdataprovider.sip
  23. +10 −4 python/core/qgsdatasourceuri.sip
  24. +2 −1 python/core/qgsgml.sip
  25. +9 −0 python/gui/auth/qgsauthauthoritieseditor.sip
  26. +34 −0 python/gui/auth/qgsauthcertificateinfo.sip
  27. +25 −0 python/gui/auth/qgsauthcertificatemanager.sip
  28. +21 −0 python/gui/auth/qgsauthcerttrustpolicycombobox.sip
  29. +18 −0 python/gui/auth/qgsauthconfigeditor.sip
  30. +13 −0 python/gui/auth/qgsauthconfigselect.sip
  31. +24 −0 python/gui/auth/qgsautheditorwidgets.sip
  32. +10 −0 python/gui/auth/qgsauthidentitieseditor.sip
  33. +35 −0 python/gui/auth/qgsauthimportcertdialog.sip
  34. +36 −0 python/gui/auth/qgsauthimportidentitydialog.sip
  35. +26 −0 python/gui/auth/qgsauthmethodedit.sip
  36. +11 −0 python/gui/auth/qgsauthserverseditor.sip
  37. +91 −0 python/gui/auth/qgsauthsslconfigwidget.sip
  38. +14 −0 python/gui/auth/qgsauthsslerrorsdialog.sip
  39. +12 −0 python/gui/auth/qgsauthsslimportdialog.sip
  40. +11 −0 python/gui/auth/qgsauthtrustedcasdialog.sip
  41. +17 −0 python/gui/gui.sip
  42. +2 −0 python/gui/qgscredentialdialog.sip
  43. +1 −0 src/CMakeLists.txt
  44. +3 −0 src/app/CMakeLists.txt
  45. +12 −0 src/app/main.cpp
  46. +150 −20 src/app/qgisapp.cpp
  47. +10 −0 src/app/qgisapp.h
  48. +3 −0 src/app/qgsabout.cpp
  49. +1 −1 src/app/qgsbrowserdockwidget.cpp
  50. +1 −1 src/app/qgsmaptoolidentifyaction.cpp
  51. +1 −0 src/app/qgsoptions.h
  52. +18 −0 src/auth/CMakeLists.txt
  53. +40 −0 src/auth/basic/CMakeLists.txt
  54. +87 −0 src/auth/basic/qgsauthbasicedit.cpp
  55. +56 −0 src/auth/basic/qgsauthbasicedit.h
  56. +117 −0 src/auth/basic/qgsauthbasicedit.ui
  57. +248 −0 src/auth/basic/qgsauthbasicmethod.cpp
  58. +63 −0 src/auth/basic/qgsauthbasicmethod.h
  59. +40 −0 src/auth/identcert/CMakeLists.txt
  60. +108 −0 src/auth/identcert/qgsauthidentcertedit.cpp
  61. +56 −0 src/auth/identcert/qgsauthidentcertedit.h
  62. +59 −0 src/auth/identcert/qgsauthidentcertedit.ui
  63. +242 −0 src/auth/identcert/qgsauthidentcertmethod.cpp
  64. +59 −0 src/auth/identcert/qgsauthidentcertmethod.h
  65. +40 −0 src/auth/pkipaths/CMakeLists.txt
  66. +231 −0 src/auth/pkipaths/qgsauthpkipathsedit.cpp
  67. +74 −0 src/auth/pkipaths/qgsauthpkipathsedit.h
  68. +167 −0 src/auth/pkipaths/qgsauthpkipathsedit.ui
  69. +242 −0 src/auth/pkipaths/qgsauthpkipathsmethod.cpp
  70. +59 −0 src/auth/pkipaths/qgsauthpkipathsmethod.h
  71. +40 −0 src/auth/pkipkcs12/CMakeLists.txt
  72. +225 −0 src/auth/pkipkcs12/qgsauthpkcs12edit.cpp
  73. +72 −0 src/auth/pkipkcs12/qgsauthpkcs12edit.h
  74. +133 −0 src/auth/pkipkcs12/qgsauthpkcs12edit.ui
  75. +249 −0 src/auth/pkipkcs12/qgsauthpkcs12method.cpp
  76. +59 −0 src/auth/pkipkcs12/qgsauthpkcs12method.h
  77. +22 −0 src/core/CMakeLists.txt
  78. +904 −0 src/core/auth/qgsauthcertutils.cpp
  79. +209 −0 src/core/auth/qgsauthcertutils.h
  80. +454 −0 src/core/auth/qgsauthconfig.cpp
  81. +376 −0 src/core/auth/qgsauthconfig.h
  82. +160 −0 src/core/auth/qgsauthcrypto.cpp
  83. +58 −0 src/core/auth/qgsauthcrypto.h
  84. +3,304 −0 src/core/auth/qgsauthmanager.cpp
  85. +622 −0 src/core/auth/qgsauthmanager.h
  86. +172 −0 src/core/auth/qgsauthmethod.h
  87. +43 −0 src/core/auth/qgsauthmethodmetadata.cpp
  88. +75 −0 src/core/auth/qgsauthmethodmetadata.h
  89. +394 −0 src/core/auth/qgsauthmethodregistry.cpp
  90. +123 −0 src/core/auth/qgsauthmethodregistry.h
  91. +36 −2 src/core/qgsapplication.cpp
  92. +9 −0 src/core/qgsapplication.h
  93. +25 −0 src/core/qgscredentials.cpp
  94. +6 −0 src/core/qgscredentials.h
  95. +15 −2 src/core/qgsdataprovider.h
  96. +39 −5 src/core/qgsdatasourceuri.cpp
  97. +13 −4 src/core/qgsdatasourceuri.h
  98. +15 −2 src/core/qgsgml.cpp
  99. +7 −1 src/core/qgsgml.h
  100. +9 −0 src/core/qgsmaplayer.cpp
  101. +33 −0 src/core/qgsnetworkaccessmanager.cpp
  102. +7 −0 src/core/qgsowsconnection.cpp
  103. +64 −0 src/gui/CMakeLists.txt
  104. +790 −0 src/gui/auth/qgsauthauthoritieseditor.cpp
  105. +136 −0 src/gui/auth/qgsauthauthoritieseditor.h
  106. +929 −0 src/gui/auth/qgsauthcertificateinfo.cpp
  107. +166 −0 src/gui/auth/qgsauthcertificateinfo.h
  108. +56 −0 src/gui/auth/qgsauthcertificatemanager.cpp
  109. +69 −0 src/gui/auth/qgsauthcertificatemanager.h
  110. +121 −0 src/gui/auth/qgsauthcerttrustpolicycombobox.cpp
  111. +64 −0 src/gui/auth/qgsauthcerttrustpolicycombobox.h
  112. +380 −0 src/gui/auth/qgsauthconfigedit.cpp
  113. +90 −0 src/gui/auth/qgsauthconfigedit.h
  114. +293 −0 src/gui/auth/qgsauthconfigeditor.cpp
  115. +112 −0 src/gui/auth/qgsauthconfigeditor.h
  116. +124 −0 src/gui/auth/qgsauthconfigidedit.cpp
  117. +80 −0 src/gui/auth/qgsauthconfigidedit.h
  118. +197 −0 src/gui/auth/qgsauthconfigselect.cpp
  119. +74 −0 src/gui/auth/qgsauthconfigselect.h
  120. +202 −0 src/gui/auth/qgsautheditorwidgets.cpp
  121. +106 −0 src/gui/auth/qgsautheditorwidgets.h
  122. +262 −0 src/gui/auth/qgsauthguiutils.cpp
  123. +83 −0 src/gui/auth/qgsauthguiutils.h
  124. +405 −0 src/gui/auth/qgsauthidentitieseditor.cpp
  125. +103 −0 src/gui/auth/qgsauthidentitieseditor.h
  126. +226 −0 src/gui/auth/qgsauthimportcertdialog.cpp
  127. +96 −0 src/gui/auth/qgsauthimportcertdialog.h
  128. +467 −0 src/gui/auth/qgsauthimportidentitydialog.cpp
  129. +115 −0 src/gui/auth/qgsauthimportidentitydialog.h
  130. +105 −0 src/gui/auth/qgsauthmasterpassresetdialog.cpp
  131. +59 −0 src/gui/auth/qgsauthmasterpassresetdialog.h
  132. +69 −0 src/gui/auth/qgsauthmethodedit.h
  133. +420 −0 src/gui/auth/qgsauthserverseditor.cpp
  134. +101 −0 src/gui/auth/qgsauthserverseditor.h
  135. +501 −0 src/gui/auth/qgsauthsslconfigwidget.cpp
  136. +214 −0 src/gui/auth/qgsauthsslconfigwidget.h
  137. +210 −0 src/gui/auth/qgsauthsslerrorsdialog.cpp
  138. +82 −0 src/gui/auth/qgsauthsslerrorsdialog.h
  139. +462 −0 src/gui/auth/qgsauthsslimportdialog.cpp
  140. +133 −0 src/gui/auth/qgsauthsslimportdialog.h
  141. +331 −0 src/gui/auth/qgsauthtrustedcasdialog.cpp
  142. +101 −0 src/gui/auth/qgsauthtrustedcasdialog.h
  143. +173 −0 src/gui/qgscredentialdialog.cpp
  144. +15 −0 src/gui/qgscredentialdialog.h
  145. +17 −4 src/gui/qgsnewhttpconnection.cpp
  146. +3 −0 src/gui/qgsnewhttpconnection.h
  147. +4 −2 src/plugins/spit/CMakeLists.txt
  148. +5 −2 src/plugins/spit/qgsspit.cpp
  149. +3 −1 src/providers/memory/qgsmemoryprovider.cpp
  150. +1 −1 src/providers/memory/qgsmemoryprovider.h
  151. +2 −0 src/providers/ows/CMakeLists.txt
  152. +4 −0 src/providers/postgres/CMakeLists.txt
  153. +25 −7 src/providers/postgres/qgspgnewconnection.cpp
  154. +2 −0 src/providers/postgres/qgspgnewconnection.h
  155. +10 −5 src/providers/postgres/qgspgsourceselect.cpp
  156. +5 −2 src/providers/postgres/qgspgsourceselect.h
  157. +2 −2 src/providers/postgres/qgspgtablemodel.cpp
  158. +12 −2 src/providers/postgres/qgspostgresconn.cpp
  159. +3 −3 src/providers/postgres/qgspostgresdataitems.cpp
  160. +2 −2 src/providers/postgres/qgspostgresprovider.cpp
  161. +8 −1 src/providers/wcs/CMakeLists.txt
  162. +21 −4 src/providers/wcs/qgswcscapabilities.cpp
  163. +1 −1 src/providers/wcs/qgswcscapabilities.h
  164. +21 −2 src/providers/wcs/qgswcsprovider.cpp
  165. +17 −3 src/providers/wcs/qgswcsprovider.h
  166. +3 −0 src/providers/wfs/CMakeLists.txt
  167. +31 −4 src/providers/wfs/qgswfscapabilities.cpp
  168. +1 −1 src/providers/wfs/qgswfscapabilities.h
  169. +31 −4 src/providers/wfs/qgswfsprovider.cpp
  170. +16 −3 src/providers/wfs/qgswfsprovider.h
  171. +9 −1 src/providers/wms/CMakeLists.txt
  172. +20 −2 src/providers/wms/qgswmscapabilities.cpp
  173. +12 −5 src/providers/wms/qgswmscapabilities.h
  174. +6 −0 src/providers/wms/qgswmsconnection.cpp
  175. +2 −1 src/ui/CMakeLists.txt
  176. +369 −0 src/ui/auth/qgsauthauthoritieseditor.ui
  177. +277 −0 src/ui/auth/qgsauthcertificateinfo.ui
  178. +135 −0 src/ui/auth/qgsauthcertificatemanager.ui
  179. +131 −0 src/ui/auth/qgsauthconfigedit.ui
  180. +227 −0 src/ui/auth/qgsauthconfigeditor.ui
  181. +90 −0 src/ui/auth/qgsauthconfigidedit.ui
  182. +148 −0 src/ui/auth/qgsauthconfigselect.ui
  183. +176 −0 src/ui/auth/qgsautheditorwidgets.ui
  184. +261 −0 src/ui/auth/qgsauthidentitieseditor.ui
  185. +305 −0 src/ui/auth/qgsauthimportcertdialog.ui
  186. +399 −0 src/ui/auth/qgsauthimportidentitydialog.ui
  187. +215 −0 src/ui/auth/qgsauthmasterpassresetdialog.ui
  188. +50 −0 src/ui/auth/qgsauthmethodplugins.ui
  189. +246 −0 src/ui/auth/qgsauthserverseditor.ui
  190. +196 −0 src/ui/auth/qgsauthsslconfigwidget.ui
  191. +281 −0 src/ui/auth/qgsauthsslerrorsdialog.ui
  192. +297 −0 src/ui/auth/qgsauthsslimportdialog.ui
  193. +112 −0 src/ui/auth/qgsauthsslimporterrors.ui
  194. +183 −0 src/ui/auth/qgsauthtrustedcasdialog.ui
  195. +191 −45 src/ui/qgscredentialdialog.ui
  196. +126 −93 src/ui/qgsnewhttpconnectionbase.ui
  197. +25 −0 src/ui/qgsoptionsbase.ui
  198. +135 −126 src/ui/qgspgnewconnectionbase.ui
  199. +1 −0 tests/src/analysis/CMakeLists.txt
  200. +2 −0 tests/src/app/CMakeLists.txt
  201. +4 −0 tests/src/core/CMakeLists.txt
  202. +247 −0 tests/src/core/testqgsauthconfig.cpp
  203. +121 −0 tests/src/core/testqgsauthcrypto.cpp
  204. +2 −0 tests/src/gui/CMakeLists.txt
  205. +2 −0 tests/src/providers/CMakeLists.txt
  206. +1 −0 tests/src/python/CMakeLists.txt
  207. +567 −0 tests/src/python/test_qgsauthsystem.py
  208. BIN tests/testdata/auth_system/certs_keys/cert_heirarchy_8bit.png
  209. +48 −0 tests/testdata/auth_system/certs_keys/chain_issuer2-root2.pem
  210. +72 −0 tests/testdata/auth_system/certs_keys/chain_subissuer-issuer-root.pem
  211. +120 −0 tests/testdata/auth_system/certs_keys/chains_subissuer-issuer-root_issuer2-root2.pem
  212. BIN tests/testdata/auth_system/certs_keys/fra.p12
  213. BIN tests/testdata/auth_system/certs_keys/fra_cert.der
  214. +24 −0 tests/testdata/auth_system/certs_keys/fra_cert.pem
  215. BIN tests/testdata/auth_system/certs_keys/fra_key.der
  216. +15 −0 tests/testdata/auth_system/certs_keys/fra_key.pem
  217. +18 −0 tests/testdata/auth_system/certs_keys/fra_key_w-pass.pem
  218. BIN tests/testdata/auth_system/certs_keys/fra_w-chain.p12
  219. BIN tests/testdata/auth_system/certs_keys/gerardus.p12
  220. BIN tests/testdata/auth_system/certs_keys/gerardus_cert.der
  221. +24 −0 tests/testdata/auth_system/certs_keys/gerardus_cert.pem
  222. BIN tests/testdata/auth_system/certs_keys/gerardus_key.der
  223. +15 −0 tests/testdata/auth_system/certs_keys/gerardus_key.pem
  224. +18 −0 tests/testdata/auth_system/certs_keys/gerardus_key_w-pass.pem
  225. BIN tests/testdata/auth_system/certs_keys/gerardus_w-chain.p12
  226. BIN tests/testdata/auth_system/certs_keys/issuer2_ca_cert.der
  227. +24 −0 tests/testdata/auth_system/certs_keys/issuer2_ca_cert.pem
  228. BIN tests/testdata/auth_system/certs_keys/issuer2_ca_key.der
  229. +15 −0 tests/testdata/auth_system/certs_keys/issuer2_ca_key.pem
  230. BIN tests/testdata/auth_system/certs_keys/issuer_ca_cert.der
  231. +24 −0 tests/testdata/auth_system/certs_keys/issuer_ca_cert.pem
  232. BIN tests/testdata/auth_system/certs_keys/issuer_ca_key.der
  233. +15 −0 tests/testdata/auth_system/certs_keys/issuer_ca_key.pem
  234. BIN tests/testdata/auth_system/certs_keys/localhost_ssl.p12
  235. BIN tests/testdata/auth_system/certs_keys/localhost_ssl_cert.der
  236. +24 −0 tests/testdata/auth_system/certs_keys/localhost_ssl_cert.pem
  237. +15 −0 tests/testdata/auth_system/certs_keys/localhost_ssl_key.pem
  238. +18 −0 tests/testdata/auth_system/certs_keys/localhost_ssl_key_w-pass.pem
  239. BIN tests/testdata/auth_system/certs_keys/localhost_ssl_w-chain.p12
  240. BIN tests/testdata/auth_system/certs_keys/nicholas.p12
  241. BIN tests/testdata/auth_system/certs_keys/nicholas_cert.der
  242. +24 −0 tests/testdata/auth_system/certs_keys/nicholas_cert.pem
  243. BIN tests/testdata/auth_system/certs_keys/nicholas_key.der
  244. +15 −0 tests/testdata/auth_system/certs_keys/nicholas_key.pem
  245. +18 −0 tests/testdata/auth_system/certs_keys/nicholas_key_w-pass.pem
  246. BIN tests/testdata/auth_system/certs_keys/nicholas_w-chain.p12
  247. BIN tests/testdata/auth_system/certs_keys/ptolemy.p12
  248. BIN tests/testdata/auth_system/certs_keys/ptolemy_cert.der
  249. +24 −0 tests/testdata/auth_system/certs_keys/ptolemy_cert.pem
  250. BIN tests/testdata/auth_system/certs_keys/ptolemy_key.der
  251. +15 −0 tests/testdata/auth_system/certs_keys/ptolemy_key.pem
  252. +18 −0 tests/testdata/auth_system/certs_keys/ptolemy_key_w-pass.pem
  253. BIN tests/testdata/auth_system/certs_keys/ptolemy_w-chain.p12
  254. BIN tests/testdata/auth_system/certs_keys/root2_ca_cert.der
  255. +24 −0 tests/testdata/auth_system/certs_keys/root2_ca_cert.pem
  256. BIN tests/testdata/auth_system/certs_keys/root2_ca_key.der
  257. +15 −0 tests/testdata/auth_system/certs_keys/root2_ca_key.pem
  258. BIN tests/testdata/auth_system/certs_keys/root_ca_cert.der
  259. +24 −0 tests/testdata/auth_system/certs_keys/root_ca_cert.pem
  260. +15 −0 tests/testdata/auth_system/certs_keys/root_ca_key.pem
  261. BIN tests/testdata/auth_system/certs_keys/subissuer_ca_cert.der
  262. +24 −0 tests/testdata/auth_system/certs_keys/subissuer_ca_cert.pem
  263. BIN tests/testdata/auth_system/certs_keys/subissuer_ca_key.der
  264. +15 −0 tests/testdata/auth_system/certs_keys/subissuer_ca_key.pem
  265. BIN tests/testdata/auth_system/java_keystore/qgis-test-pki.jks
  266. BIN tests/testdata/auth_system/xca/qgis-certs.xdb
  267. +14 −0 tests/testdata/auth_system/xca/requests/fra.csr
  268. +14 −0 tests/testdata/auth_system/xca/requests/gerardus.csr
  269. +15 −0 tests/testdata/auth_system/xca/requests/issuer2_ca.csr
  270. +15 −0 tests/testdata/auth_system/xca/requests/issuer_ca.csr
  271. +15 −0 tests/testdata/auth_system/xca/requests/localhost_ssl.csr
  272. +14 −0 tests/testdata/auth_system/xca/requests/nicholas.csr
  273. +14 −0 tests/testdata/auth_system/xca/requests/ptolemy.csr
  274. +15 −0 tests/testdata/auth_system/xca/requests/root2_ca.csr
  275. +15 −0 tests/testdata/auth_system/xca/requests/root_ca.csr
  276. +15 −0 tests/testdata/auth_system/xca/requests/subissuer_ca.csr
  277. BIN tests/testdata/auth_system/xca/templates/qgis_test_ca_template.xca
  278. BIN tests/testdata/auth_system/xca/templates/qgis_test_client_template.xca
  279. BIN tests/testdata/auth_system/xca/templates/qgis_test_ssl_server_template.xca
@@ -308,6 +308,13 @@ ENDIF (WITH_TOUCH)
# search for QScintilla2 (C++ lib)
FIND_PACKAGE(QScintilla REQUIRED)

# Master password hash and authentication encryption
FIND_PACKAGE(QCA REQUIRED)
# Check for runtime dependency of qca-ossl plugin
# REQUIRED if unit tests are to be run from build directory
include(QCAMacros)
FIND_QCAOSSL_PLUGIN_CPP(ENABLE_TESTS)

# ModelTest
SET(ENABLE_MODELTEST FALSE CACHE BOOL "Enable QT ModelTest (not for production)")

@@ -11,6 +11,7 @@ sudo apt-get install --force-yes --no-install-recommends --no-install-suggests \
libgdal1-dev libgeos-dev libgeos++-dev libgsl0-dev libpq-dev \
libproj-dev libqscintilla2-dev libqt4-dev \
libqt4-opengl-dev libqt4-sql-sqlite libqtwebkit-dev \
libqca2-dev libqca2-plugin-ossl \
libqwt-dev libspatialindex-dev libspatialite-dev \
libsqlite3-dev lighttpd pkg-config poppler-utils \
pyqt4-dev-tools python python-dev python-qt4 \
@@ -1,6 +1,7 @@
brew tap osgeo/osgeo4mac
brew update
brew install osgeo/osgeo4mac/qgis-28 --without-postgis --without-postgresql --without-grass --without-gpsbabel --only-dependencies
brew install osgeo/osgeo4mac/qgis-28 --without-postgis --without-postgresql --without-grass --without-gpsbabel --only-dependencies
brew install qca
brew install spawn-fcgi
brew install lighttpd
brew install poppler
@@ -0,0 +1,98 @@
# Find QCA (Qt Cryptography Architecture 2+)
# ~~~~~~~~~~~~~~~~
# When run this will define
#
# QCA_FOUND - system has QCA
# QCA_LIBRARY - the QCA library or framework
# QCA_INCLUDE_DIR - the QCA include directory
# QCA_VERSION_STR - e.g. "2.0.3"
#
# Copyright (c) 2006, Michael Larouche, <michael.larouche@kdemail.net>
# Copyright (c) 2014, Larry Shaffer, <larrys (at) dakotacarto (dot) com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.


if(QCA_INCLUDE_DIR AND QCA_LIBRARY)

set(QCA_FOUND TRUE)

else(QCA_INCLUDE_DIR AND QCA_LIBRARY)

find_library(QCA_LIBRARY
NAMES qca qca2
PATHS
${LIB_DIR}
$ENV{LIB}
"$ENV{LIB_DIR}"
/usr/local/lib
)

if(APPLE)
if(QCA_LIBRARY AND QCA_LIBRARY MATCHES "qca(2)?\\.framework")
set(QCA_LIBRARY "${QCA_LIBRARY}" CACHE FILEPATH "QCA framework" FORCE)
set(QCA_INCLUDE_DIR "${QCA_LIBRARY}/Headers" CACHE FILEPATH "QCA framework headers" FORCE)
endif()
endif(APPLE)

find_path(QCA_INCLUDE_DIR
NAMES QtCrypto
PATHS
${LIB_DIR}/include
"$ENV{LIB_DIR}/include"
$ENV{INCLUDE}
/usr/local/include
PATH_SUFFIXES QtCrypto qt4/QtCrypto
)

if(QCA_LIBRARY AND QCA_INCLUDE_DIR)
set(QCA_FOUND TRUE)
endif()

endif(QCA_INCLUDE_DIR AND QCA_LIBRARY)

if(NOT QCA_FOUND)

if(QCA_FIND_REQUIRED)
message(FATAL_ERROR "Could not find QCA")
else()
message(STATUS "Could not find QCA")
endif()

else(NOT QCA_FOUND)

# Check version is valid (>= 2.0.3)
# find_package(QCA 2.0.3) works with 2.1.0+, which has a QcaConfigVersion.cmake, but 2.0.3 does not

# qca_version.h header only available with 2.1.0+
set(_qca_version_h "${QCA_INCLUDE_DIR}/qca_version.h")
if(EXISTS "${_qca_version_h}")
file(STRINGS "${_qca_version_h}" _qca_version_str REGEX "^.*QCA_VERSION_STR +\"[^\"]+\".*$")
string(REGEX REPLACE "^.*QCA_VERSION_STR +\"([^\"]+)\".*$" "\\1" QCA_VERSION_STR "${_qca_version_str}")
else()
# qca_core.h contains hexidecimal version in <= 2.0.3
set(_qca_core_h "${QCA_INCLUDE_DIR}/qca_core.h")
if(EXISTS "${_qca_core_h}")
file(STRINGS "${_qca_core_h}" _qca_version_str REGEX "^#define +QCA_VERSION +0x[0-9a-fA-F]+.*")
string(REGEX REPLACE "^#define +QCA_VERSION +0x([0-9a-fA-F]+)$" "\\1" _qca_version_int "${_qca_version_str}")
if("${_qca_version_int}" STREQUAL "020003")
set(QCA_VERSION_STR "2.0.3")
endif()
endif()
endif()

if(NOT QCA_VERSION_STR)
set(QCA_FOUND FALSE)
if(QCA_FIND_REQUIRED)
message(FATAL_ERROR "Could not find QCA >= 2.0.3")
else()
message(STATUS "Could not find QCA >= 2.0.3")
endif()
else()
if(NOT QCA_FIND_QUIETLY)
message(STATUS "Found QCA: ${QCA_LIBRARY} (${QCA_VERSION_STR})")
endif()
endif()

endif(NOT QCA_FOUND)
@@ -0,0 +1,189 @@
# Macros/functions for finding QCA's qcatool utility and qca-ossl plugin
# ~~~~~~~~~~~~~~~~
# When FIND_QCATOOL is run, will define:
#
# QCATOOL_EXECUTABLE - Path to QCA's qcatool utility
#
# NOTE: FIND_QCAOSSL_PLUGIN_CPP requires Qt and QCA packages to be found
#
# Copyright (c) 2014, Larry Shaffer, <larrys (at) dakotacarto (dot) com>>
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

function(FIND_QCAOSSL_PLUGIN_CPP PLUGIN_REQUIRED)

# requires Qt and QCA packages to be found
if(QT_INCLUDE_DIR AND QT_QTCORE_INCLUDE_DIR AND QT_QTCORE_LIBRARY
AND QCA_INCLUDE_DIR AND QCA_LIBRARY
AND NOT CMAKE_CROSSCOMPILING)

# NOTE: boolean result when compiled executable is run
set(CODE
"
#include <QtCrypto>
#include <QCoreApplication>
int main( int argc, char** argv )
{
QCA::Initializer init;
QCoreApplication app( argc, argv );
if ( !QCA::isSupported( \"cert\", \"qca-ossl\" ) )
{
return 0;
}
return 1;
}
"
)
set(TESTCPP "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/qcaossl.cpp")
file(WRITE ${TESTCPP} "${CODE}")

set(QCA_INCLUDE_DIRECTORIES "-DINCLUDE_DIRECTORIES:STRING=${QT_INCLUDE_DIR};${QT_QTCORE_INCLUDE_DIR};${QCA_INCLUDE_DIR}")
set(QCA_LINK_LIBRARIES "-DLINK_LIBRARIES:STRING=${QT_QTCORE_LIBRARY};${QCA_LIBRARY}")

try_run(RUN_RESULT COMPILE_RESULT
${CMAKE_BINARY_DIR} ${TESTCPP}
CMAKE_FLAGS "${QCA_INCLUDE_DIRECTORIES}" "${QCA_LINK_LIBRARIES}"
COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT
)

set(_msg "QCA OpenSSL plugin not found (run-time/unit-test dependency)")

if(NOT COMPILE_RESULT)
message(STATUS "QCA OpenSSL plugin C++ check failed to compile")
if(${PLUGIN_REQUIRED})
message(STATUS "QCA OpenSSL plugin C++ check compile output:")
message(STATUS "${COMPILE_OUTPUT}")
message(FATAL_ERROR ${_msg})
else()
message(STATUS ${_msg})
endif()
else()
if(NOT RUN_RESULT)
if(${PLUGIN_REQUIRED})
message(FATAL_ERROR ${_msg})
else()
message(STATUS ${_msg})
endif()
else()
message(STATUS "Found QCA OpenSSL plugin")
endif()
endif()

else()
message(STATUS "QtCore/QCA include/lib variables missing or CMake is cross-compiling,")
message(STATUS " skipping QCA OpenSSL plugin C++ check")
endif()

endfunction(FIND_QCAOSSL_PLUGIN_CPP PLUGIN_REQUIRED)


function(FIND_QCATOOL TOOL_REQUIRED)
if(NOT QCATOOL_EXECUTABLE)

if(MSVC)
find_program(QCATOOL_EXECUTABLE NAMES qcatool.exe qcatool2.exe
PATHS
$ENV{LIB_DIR}/bin
$ENV{OSGEO4W_ROOT}/bin
)
else()
find_program(QCATOOL_EXECUTABLE NAMES qcatool qcatool2)
endif()

if(NOT QCATOOL_EXECUTABLE)
set(_msg "QCA's qcatool utility not found - aborting")
if(${TOOL_REQUIRED})
message(FATAL_ERROR ${_msg})
else()
message(STATUS ${_msg})
endif()
endif()

else()

get_filename_component(_qcatool ${QCATOOL_EXECUTABLE} REALPATH)
if(NOT EXISTS "${_qcatool}")
set(_msg "QCA's qcatool utility not found at: ${QCATOOL_EXECUTABLE}")
if(${TOOL_REQUIRED})
message(FATAL_ERROR ${_msg})
else()
message(STATUS ${_msg})
endif()
endif()

endif(NOT QCATOOL_EXECUTABLE)

endfunction(FIND_QCATOOL TOOL_REQUIRED)


function(FIND_QCAOSSL_PLUGIN PLUGIN_REQUIRED)

get_filename_component(_qcatool ${QCATOOL_EXECUTABLE} REALPATH)

if(EXISTS "${_qcatool}")
execute_process(COMMAND "${_qcatool}" plugins OUTPUT_VARIABLE _qca_plugins)
# message(STATUS ${_qca_plugins})

if(NOT "${_qca_plugins}" MATCHES "qca-ossl")
set(_msg "QCA OpenSSL plugin not found (run-time/unit-test dependency)")
if(${PLUGIN_REQUIRED})
message(FATAL_ERROR ${_msg})
else()
message(STATUS ${_msg})
endif()
else()
message(STATUS "Found QCA OpenSSL plugin")
endif()
endif()

endfunction(FIND_QCAOSSL_PLUGIN PLUGIN_REQUIRED)


function(FIND_QCA_PLUGIN_DIR DIR_REQUIRED)

FIND_QCATOOL(1)
get_filename_component(_qcatool ${QCATOOL_EXECUTABLE} REALPATH)

if(EXISTS "${_qcatool}")
execute_process(COMMAND "${_qcatool}" plugins OUTPUT_VARIABLE _qca_plugins)
#message(STATUS ${_qca_plugins})
string(REGEX REPLACE "\n" ";" _qca_plugins_list "${_qca_plugins}")
#message(STATUS "_qca_plugins_list: ${_qca_plugins_list}")

if(NOT "${_qca_plugins}" MATCHES "Available Providers")
set(_msg "QCA plugin directory not found")
if(${DIR_REQUIRED})
message(FATAL_ERROR ${_msg})
else()
message(STATUS ${_msg})
endif()
else()

set(QCA_PLUGIN_DIR)
foreach(_plugin_dir ${_qca_plugins_list})
string(STRIP "${_plugin_dir}" _plugin_dir)
if(EXISTS "${_plugin_dir}" AND IS_DIRECTORY "${_plugin_dir}" AND NOT QCA_PLUGIN_DIR)
file(GLOB qca_dylibs "${_plugin_dir}/crypto/libqca*")
if(qca_dylibs)
set(QCA_PLUGIN_DIR "${_plugin_dir}")
endif()
endif()
endforeach()

if(QCA_PLUGIN_DIR)
set(QCA_PLUGIN_DIR "${QCA_PLUGIN_DIR}" PARENT_SCOPE)
message(STATUS "Found QCA plugin directory: ${QCA_PLUGIN_DIR}")
else()
set(_msg "QCA plugin directory not found")
if(${DIR_REQUIRED})
message(FATAL_ERROR ${_msg})
else()
message(STATUS ${_msg})
endif()
endif()

endif()
endif()

endfunction(FIND_QCA_PLUGIN_DIR DIR_REQUIRED)
@@ -572,6 +572,7 @@ WARN_LOGFILE =

INPUT = @CMAKE_SOURCE_DIR@/doc \
@CMAKE_SOURCE_DIR@/src/core \
@CMAKE_SOURCE_DIR@/src/core/auth \
@CMAKE_SOURCE_DIR@/src/core/composer \
@CMAKE_SOURCE_DIR@/src/core/diagram \
@CMAKE_SOURCE_DIR@/src/core/dxf \
@@ -583,6 +584,7 @@ INPUT = @CMAKE_SOURCE_DIR@/doc \
@CMAKE_SOURCE_DIR@/src/core/raster \
@CMAKE_SOURCE_DIR@/src/core/symbology-ng \
@CMAKE_SOURCE_DIR@/src/gui \
@CMAKE_SOURCE_DIR@/src/gui/auth \
@CMAKE_SOURCE_DIR@/src/gui/attributetable \
@CMAKE_SOURCE_DIR@/src/gui/editorwidgets \
@CMAKE_SOURCE_DIR@/src/gui/editorwidgets/core \
@@ -311,6 +311,10 @@
<file>themes/default/mActionZoomToSelected.svg</file>
<file>themes/default/mIconAtlas.svg</file>
<file>themes/default/mIconAutoPlacementSettings.svg</file>
<file>themes/default/mIconCertificate.svg</file>
<file>themes/default/mIconCertificateMissing.svg</file>
<file>themes/default/mIconCertificateTrusted.svg</file>
<file>themes/default/mIconCertificateUntrusted.svg</file>
<file>themes/default/mIconClear.svg</file>
<file>themes/default/mIconClose.png</file>
<file>themes/default/mIconCollapse.png</file>

0 comments on commit 228d816

Please sign in to comment.
You can’t perform that action at this time.