#include <wx/filefn.h>
#include <wx/fileconf.h>
+#if defined(__WIN32__)
+#include <cryptuiapi.h>
+#include "common/win32ssl.h"
+#endif
+
#include "carddav/carddav.h"
#include "common/dirs.h"
#include "common/svrblist.h"
UseSSL);
CardDAVConn.SetupResultBools(&ServerResult, &ServerAction);
+#if defined(__WIN32__)
+
+ BOOL ModifiedCertificateData = FALSE;
+
+#endif
+
// Verify SSL trust first before doing anything.
if (UseSSL == TRUE){
// SSL certificate message.
// Setup the data to be sent in the wxPostEvent command.
-
- // TODO: Port to OS X.
int SSLResult;
}
}
-
+
+#elif defined(__WIN32__)
+
+ CRYPTUI_VIEWCERTIFICATE_STRUCTW CertificateData = BuildCertificateData(&CardDAVConn, (HWND)this->GetHandle());
+
+ if (!CryptUIDlgViewCertificate(&CertificateData, &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: ") + CardDAVConn.GetErrorMessage() + wxString::Format(wxT(" (%i)\n%s"), sslcode, CardDAVConn.GetErrorBuffer().mb_str()));
+ return;
+
+ }
+
#else
frmInvalidSSLCertificate *frmICPtr = new frmInvalidSSLCertificate(this);
std::thread ConnTest(&CardDAV::Connect, &CardDAVConn);
ConnTest.join();
-
+
+#if defined(__WIN32__)
+ if (ServerResult == FALSE && ModifiedCertificateData == FALSE){
+#else
if (ServerResult == FALSE){
+#endif
lblServerConnResult->SetLabel(_("Failed"));
lblConnectionResultText->SetLabel(_("An error occured whilst connnecting: ") + CardDAVConn.GetErrorMessage());
lblServerConnResult->SetLabel(_("Connected"));
}
-
+
if (CardDAVConn.CanDoSSL() == TRUE){
-
+
lblServerSSLResult->SetLabel(_("Used"));
-
+
} else {
lblServerSSLResult->SetLabel(_("Not Used"));
default:
lblServerSSLValid->SetLabel(_("Unable to verify"));
}
-
+
+#elif defined(__WIN32__)
+
+ if (ModifiedCertificateData == TRUE){
+ lblServerSSLValid->SetLabel(_("Verified (user)"));
+ } else {
+ lblServerSSLValid->SetLabel(_("Verified"));
+ }
+
#else
if (CardDAVConn.SSLVerify() == TRUE && CardDAVConn.CanDoSSL() == TRUE){
wxString XestiaABDirectory;
wxString AccountSettingsFile;
//wxFile ASFile;
- wxString RandomNumberSuffix = wxString::Format(wxT("%i"), rand() % 32767);
+
+ srand(time(0));
+ int RandomNumber = rand() % 32767;
+ wxString RandomNumberSuffix = wxString::Format(wxT("%i"), RandomNumber);
bool DirectoryCreated = FALSE;
#if defined(__HAIKU__)