<ClCompile Include="..\..\source\actmgr\frmActivityMgr-tasks.cpp" />
<ClCompile Include="..\..\source\actmgr\frmActivityMgr.cpp" />
<ClCompile Include="..\..\source\AppXestiaAddrBk.cpp" />
- <ClCompile Include="..\..\source\carddav\carddav-connect.cpp" />
- <ClCompile Include="..\..\source\carddav\carddav-contactlist.cpp" />
- <ClCompile Include="..\..\source\carddav\carddav-defaultadrurl.cpp" />
- <ClCompile Include="..\..\source\carddav\carddav-processdata.cpp" />
- <ClCompile Include="..\..\source\carddav\carddav-servercontact.cpp" />
- <ClCompile Include="..\..\source\carddav\carddav-serveretag.cpp" />
- <ClCompile Include="..\..\source\carddav\carddav-sslverify.cpp" />
- <ClCompile Include="..\..\source\carddav\carddav.cpp" />
+ <ClCompile Include="..\..\source\carddav2\carddav2.cpp" />
<ClCompile Include="..\..\source\common\base64.cpp" />
<ClCompile Include="..\..\source\common\defaults.cpp" />
<ClCompile Include="..\..\source\common\dirs.cpp" />
<ClCompile Include="..\..\source\common\timers.cpp" />
<ClCompile Include="..\..\source\common\uuid.cpp" />
<ClCompile Include="..\..\source\common\win32ssl.cpp" />
+ <ClCompile Include="..\..\source\connobject\ConnectionObject.cpp" />
<ClCompile Include="..\..\source\contacteditor\cdo\ContactDataObject.cpp" />
<ClCompile Include="..\..\source\contacteditor\frmContactEditor-Business.cpp" />
<ClCompile Include="..\..\source\contacteditor\frmContactEditor-Calendar.cpp" />
<ClCompile Include="..\..\source\frmEditAccount.cpp" />
<ClCompile Include="..\..\source\frmInvalidSSLCertificate.cpp" />
<ClCompile Include="..\..\source\frmMain.cpp" />
+ <ClCompile Include="..\..\source\frmNewAccount-CardDAV2.cpp" />
<ClCompile Include="..\..\source\frmNewAccount.cpp" />
<ClCompile Include="..\..\source\frmPreferences.cpp" />
<ClCompile Include="..\..\source\frmSSLCertificate.cpp" />
<ClCompile Include="..\..\source\common\base64.cpp">
<Filter>Resource Files\Source Files</Filter>
</ClCompile>
- <ClCompile Include="..\..\source\carddav\carddav.cpp">
- <Filter>Resource Files\Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\source\carddav\carddav-connect.cpp">
- <Filter>Resource Files\Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\source\carddav\carddav-contactlist.cpp">
- <Filter>Resource Files\Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\source\carddav\carddav-defaultadrurl.cpp">
- <Filter>Resource Files\Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\source\carddav\carddav-processdata.cpp">
- <Filter>Resource Files\Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\source\carddav\carddav-servercontact.cpp">
- <Filter>Resource Files\Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\source\carddav\carddav-serveretag.cpp">
- <Filter>Resource Files\Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\source\carddav\carddav-sslverify.cpp">
- <Filter>Resource Files\Source Files</Filter>
- </ClCompile>
<ClCompile Include="..\..\source\contacteditor\cdo\ContactDataObject.cpp">
<Filter>Resource Files\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\search\XABSearchPanel.cpp">
<Filter>Resource Files\Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\..\source\connobject\ConnectionObject.cpp">
+ <Filter>Resource Files\Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\source\carddav2\carddav2.cpp">
+ <Filter>Resource Files\Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\source\frmNewAccount-CardDAV2.cpp">
+ <Filter>Resource Files\Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="xestiaab.rc">
// Setup all of the task details.
ETagDB *ETagDBPtr = ETagTmrPtr->GetPointer(AccountDir);
-
+
CardDAV2 *ConnObject = new CardDAV2(AccountAddress.ToStdString(), AccountPort, AccountUsername.ToStdString(), AccountPassword.ToStdString(), AccountSSL, AccountPrefix.ToStdString(), AccountDir.ToStdString());
ConnObject->SetupConnectionObject();
#elif defined(__WIN32__)
- frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateContextPointer());
+ frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnObjectIter->second->BuildSSLCollection());
#else
#elif defined(__WIN32__)
- frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateContextPointer());
+ frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnObjectIter->second->BuildSSLCollection());
#else
#elif defined(__WIN32__)
- frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateContextPointer());
+ frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnObjectIter->second->BuildSSLCollection());
#else
const struct curl_tlssessioninfo *TLSInfo;
CURLcode TLSCode;
- CURL *Connection = GetConnectionObject();
- TLSCode = curl_easy_getinfo(Connection, CURLINFO_TLS_SSL_PTR, &TLSInfo);
+ TLSCode = curl_easy_getinfo(ConnectionSession, CURLINFO_TLS_SSL_PTR, &TLSInfo);
if (TLSInfo->internals != nullptr && TLSCode == CURLE_OK){
curl_slist_free_all(HeaderList);
HeaderList = nullptr;
}
+
+#if defined(__WIN32__)
+
+ CertFreeCertificateContext(CertificateData);
+
+#endif
}
#elif defined(__WIN32__)
+PCCERT_CONTEXT CardDAV2::BuildSSLCollection(){
+
+ return CertificateData;
+
+}
+
#else
SSLCertCollectionString CardDAV2::BuildSSLCollection(){
curl_easy_setopt(ConnectionSession, CURLOPT_USERPWD, ":");
}
+#if !defined(__WIN32__)
+
if (EnableSSLBypass == true){
curl_easy_setopt(ConnectionSession, CURLOPT_SSL_VERIFYHOST, 0);
curl_easy_setopt(ConnectionSession, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(ConnectionSession, CURLOPT_SSL_VERIFYHOST, 2);
curl_easy_setopt(ConnectionSession, CURLOPT_SSL_VERIFYPEER, 1);
}
+
+#endif
if (TestMode == false && ServerAccount.size() > 0){
public:
using ConnectionObject::ConnectionObject;
-
+
// Destructor.
~CardDAV2();
#if defined(__APPLE__)
#elif defined(__WIN32__)
+
+ PCCERT_CONTEXT BuildSSLCollection();
+
#else
SSLCertCollectionString BuildSSLCollection();
#if defined(__APPLE__)
#elif defined(__WIN32__)
+
+ PCCERT_CONTEXT CertificateData;
+
#else
bool EnableSSLBypass = false;
#endif
AccountDir.append("\\");
if (ServerCert == true){
- AccountDir.append(wxT("server.crt"));
+ AccountDir.append("server.crt");
}
#elif defined(__APPLE__)
#include "win32ssl.h"
-CRYPTUI_VIEWCERTIFICATE_STRUCTW BuildCertificateData(CardDAV *CardDAVConnection, HWND WindowHandle){
+CRYPTUI_VIEWCERTIFICATE_STRUCTW BuildCertificateData(ConnectionObject *ConnectionObjectData, HWND WindowHandle){
- PCCERT_CONTEXT CertificateContext = CardDAVConnection->GetCertificateContextPointer();
+ PCCERT_CONTEXT CertificateContext = ConnectionObjectData->BuildSSLCollection();
HCERTSTORE CertificateStore = CertificateContext->hCertStore;
CRYPTUI_VIEWCERTIFICATE_STRUCTW CertificateData = { 0 };
CertificateData.hwndParent = WindowHandle;
#include <cryptuiapi.h>
#include <sspi.h>
-#include "../carddav/carddav.h"
+#include "../connobject/ConnectionObject.h"
-CRYPTUI_VIEWCERTIFICATE_STRUCTW BuildCertificateData(CardDAV *CardDAVConnection, HWND WindowHandle);
+CRYPTUI_VIEWCERTIFICATE_STRUCTW BuildCertificateData(ConnectionObject *ConnectionObjectData, HWND WindowHandle);
CRYPTUI_VIEWCERTIFICATE_STRUCTW BuildCertificateData(PCCERT_CONTEXT CertificateContext, HWND WindowHandle);
#endif
\ No newline at end of file
#include <iostream>
#include "../common/sslcertstructs.h"
+#if defined (__WIN32__)
+#include <Windows.h>
+#include <basetsd.h>
+#include <winapifamily.h>
+#include <security.h>
+#include <schannel.h>
+#include <cryptuiapi.h>
+#include <sspi.h>
+#endif
+
enum COConnectResult {
COCONNECT_UNITTESTFAIL = -1,
COCONNECT_OK,
public:
ConnectionObject(std::string ServerAddress, int ServerPort, std::string ServerUser, std::string ServerPass, bool ServerSSL);
ConnectionObject(std::string ServerAddress, int ServerPort, std::string ServerUser, std::string ServerPass, bool ServerSSL, std::string ServerPrefix, std::string ServerAccount);
-
+
// Virtual functions to be setup by the inheriting classes.
- virtual void SetupConnectionObject() { };
+ virtual void SetupConnectionObject() = 0;
//virtual ~ConnectionObject() {};
- virtual bool IsTaskCompleted() {};
+ virtual bool IsTaskCompleted() = 0;
- virtual COConnectResult Connect(bool DoAuthentication) {};
- virtual void BypassSSLVerification(bool EnableBypass) {};
+ virtual COConnectResult Connect(bool DoAuthentication) = 0;
+ virtual void BypassSSLVerification(bool EnableBypass) = 0;
- virtual COServerResponse GetDefaultPrefix(std::string *ServerPrefix) {};
- virtual COServerResponse AddContact(std::string Location, std::string Data) {};
- virtual COServerResponse EditContact(std::string Location, std::string Data) {};
- virtual COServerResponse DeleteContact(std::string Location) {};
- virtual COServerResponse GetServerEntityTagValue(std::string Location) {};
- virtual COServerResponse GetContact(std::string Location, std::string *PageData) {};
- virtual COContactList GetContactList(std::string SyncToken) {};
+ virtual COServerResponse GetDefaultPrefix(std::string *ServerPrefix) = 0;
+ virtual COServerResponse AddContact(std::string Location, std::string Data) = 0;
+ virtual COServerResponse EditContact(std::string Location, std::string Data) = 0;
+ virtual COServerResponse DeleteContact(std::string Location) = 0;
+ virtual COServerResponse GetServerEntityTagValue(std::string Location) = 0;
+ virtual COServerResponse GetContact(std::string Location, std::string *PageData) = 0;
+ virtual COContactList GetContactList(std::string SyncToken) = 0;
- virtual bool CanDoProcessing() {};
- virtual bool CanDoSSL() {};
- virtual COSSLVerified SSLVerify() {};
- virtual bool AbleToLogin() {};
- virtual bool HasValidResponse() {};
- virtual bool IsSelfSigned() {};
- virtual std::string GetErrorMessage() {};
+ virtual bool CanDoProcessing() = 0;
+ virtual bool CanDoSSL() = 0;
+ virtual COSSLVerified SSLVerify() = 0;
+ virtual bool AbleToLogin() = 0;
+ virtual bool HasValidResponse() = 0;
+ virtual bool IsSelfSigned() = 0;
+ virtual std::string GetErrorMessage() = 0;
// OS specific functions.
#if defined(__APPLE__)
#elif defined(__WIN32__)
+
+ virtual PCCERT_CONTEXT BuildSSLCollection() = 0;
+
#else
- virtual SSLCertCollectionString BuildSSLCollection() {};
+ virtual SSLCertCollectionString BuildSSLCollection() = 0;
#endif
if (TestConnection.SSLVerify() == COSSL_UNABLETOVERIFY){
#if defined(__APPLE__)
#elif defined(__WIN32__)
+
+ BOOL ModifiedCertificateData = false;
+
+ CRYPTUI_VIEWCERTIFICATE_STRUCTW CertificateDialogData = BuildCertificateData(&TestConnection, (HWND)this->GetHandle());
+
+ if (!CryptUIDlgViewCertificate(&CertificateDialogData, &ModifiedCertificateData)){
+ wxMessageBox(_("An error occured while trying to open the certificate dialog."), _("Error opening Certificate Information dialog"));
+ }
+
+ if (ModifiedCertificateData = false){
+
+ lblServerConnResult->SetLabel(_("Failed"));
+ lblServerResponse->SetLabel(_("Not applicable"));
+ lblServerSSLResult->SetLabel(_("Used"));
+ lblServerSSLValid->SetLabel(_("No"));
+ lblConnectionResultText->SetLabel(_("An error occured whilst connnecting: ") + TestConnection.GetErrorMessage());
+ return;
+
+ }
+
#else
// Connect again and fetch SSL certificate information.