while (ExitLoop == FALSE){
- ConnHandle.SetUploadMode(TRUE);
- ConnHandle.SetupData(wxT("PUT"), StringURLIter->second, StringDataIter->second);
- ConnHandle.SetEditMode(EditMode);
- ConnHandle.ProcessData();
-
- int ErrorCode = ConnHandle.GetResultCode();
+ // Verify that we have a trusted SSL connection first.
+ int ErrorCode = ConnHandle.SSLVerifyTest();
+
if (ErrorCode != CURLE_OK){
if (ErrorCode == CURLE_SSL_CACERT ||
frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetTrustObject());
+
+ }
+
+#elif defined(__WIN32__)
+
+ BOOL ModifiedCertificateData;
+ CRYPTUI_VIEWCERTIFICATE_STRUCTW CertificateData = BuildCertificateData(&ConnHandle, (HWND)frmMainPtrGet->GetHandle());
+
+ if (!CryptUIDlgViewCertificate(&CertificateData, &ModifiedCertificateData)){
+ wxMessageBox(_("An error occured while trying to open the certificate dialog."), _("Error opening Certificate Information dialog"));
+ }
+
+ if (ModifiedCertificateData == FALSE){
+
+ frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 1, ConnHandle.GetCertificateContextPointer());
+ iter->second = 2;
+ break;
+
+ } else {
+
+ frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateContextPointer());
+
}
+
#else
// Setup the data to be sent in the wxPostEvent command.
#if defined(__APPLE__)
frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetTrustObject());
-
+
+#elif defined(__WIN32__)
+
+ frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateContextPointer());
+
#else
frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateData());
#endif
+ ConnHandle.SetUploadMode(TRUE);
+ ConnHandle.SetupData(wxT("PUT"), StringURLIter->second, StringDataIter->second);
+ ConnHandle.SetEditMode(EditMode);
+ ConnHandle.ProcessData();
+
+ int ErrorCode = ConnHandle.GetResultCode();
+
+ if (ErrorCode != CURLE_OK){
+
+ iter->second = 4;
+ break;
+
+ }
+
// Add contact to the ETag DB.
ConnHandle.GetServerETagValueThread();
ETagDBPtr->AddETag(ContactFilename, ETagServer, ETagServer);
iter->second = 4;
- CardDAVIter->second = NULL;
break;
}
bool ExitLoop = FALSE;
while (ExitLoop == FALSE){
-
- ConnHandle.SetUploadMode(TRUE);
- ConnHandle.SetupData(wxT("PUT"), StringURLIter->second, StringDataIter->second);
- ConnHandle.SetEditMode(EditMode);
- ConnHandle.GetServerETagValueThread();
- ETagServer = ConnHandle.ETagValueResult();
-
- int ErrorCode = ConnHandle.GetResultCode();
+
+ int ErrorCode = ConnHandle.SSLVerifyTest();
if (ErrorCode != CURLE_OK){
frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetTrustObject());
}
+
+#elif defined(__WIN32__)
+
+ BOOL ModifiedCertificateData;
+ CRYPTUI_VIEWCERTIFICATE_STRUCTW CertificateData = BuildCertificateData(&ConnHandle, (HWND)frmMainPtrGet->GetHandle());
+
+ if (!CryptUIDlgViewCertificate(&CertificateData, &ModifiedCertificateData)){
+ wxMessageBox(_("An error occured while trying to open the certificate dialog."), _("Error opening Certificate Information dialog"));
+ }
+
+ if (ModifiedCertificateData == FALSE){
+
+ frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 1, ConnHandle.GetCertificateContextPointer());
+ iter->second = 2;
+ break;
+
+ } else {
+
+ frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateContextPointer());
+
+ }
+
#else
// Setup the data to be sent in the wxPostEvent command.
#if defined(__APPLE__)
frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetTrustObject());
-
+
+#elif defined(__WIN32__)
+
+ frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateContextPointer());
+
#else
frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateData());
#endif
+ ConnHandle.SetUploadMode(TRUE);
+ ConnHandle.SetupData(wxT("PUT"), StringURLIter->second, StringDataIter->second);
+ ConnHandle.SetEditMode(EditMode);
+ ConnHandle.GetServerETagValueThread();
+ ETagServer = ConnHandle.ETagValueResult();
+
+ int ErrorCode = ConnHandle.GetResultCode();
+
+ if (ErrorCode != CURLE_OK){
+ iter->second = 2;
+ break;
+ }
+
// Compare the ETag with the Server ETag.
if (ETagOriginal != ETagServer){
while (ExitLoop == FALSE){
- ConnHandle.SetUploadMode(FALSE);
- ConnHandle.SetupData(wxT("DELETE"), ContactFilename, wxT(""));
- ConnHandle.ProcessData();
- SSLCertCollection certcol = ConnHandle.GetCertificateData();
-
- // Check if any errors have occured whilst getting the data.
-
- int ErrorCode = ConnHandle.GetResultCode();
-
+ int ErrorCode = ConnHandle.SSLVerifyTest();
+
if (ErrorCode != CURLE_OK){
if (ErrorCode == CURLE_SSL_CACERT ||
frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetTrustObject());
}
+
+#elif defined(__WIN32__)
+
+ BOOL ModifiedCertificateData;
+ CRYPTUI_VIEWCERTIFICATE_STRUCTW CertificateData = BuildCertificateData(&ConnHandle, (HWND)frmMainPtrGet->GetHandle());
+
+ if (!CryptUIDlgViewCertificate(&CertificateData, &ModifiedCertificateData)){
+ wxMessageBox(_("An error occured while trying to open the certificate dialog."), _("Error opening Certificate Information dialog"));
+ }
+
+ if (ModifiedCertificateData == FALSE){
+
+ frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 1, ConnHandle.GetCertificateContextPointer());
+ iter->second = 2;
+ break;
+
+ } else {
+
+ frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateContextPointer());
+
+ }
+
#else
// Setup the data to be sent in the wxPostEvent command.
#if defined(__APPLE__)
frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetTrustObject());
-
+
+#elif defined(__WIN32__)
+
+ frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateContextPointer());
+
#else
frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateData());
#endif
+ ConnHandle.SetUploadMode(FALSE);
+ ConnHandle.SetupData(wxT("DELETE"), ContactFilename, wxT(""));
+ ConnHandle.ProcessData();
+ SSLCertCollection certcol = ConnHandle.GetCertificateData();
+
+ // Check if any errors have occured whilst getting the data.
+
+ int ErrorCode = ConnHandle.GetResultCode();
+
+ if (ErrorCode != CURLE_OK){
+ iter->second = 2;
+ break;
+ }
ETagDBPtr->RemoveETag(ContactFilename);
wxMessageBox(_("An error occured while trying to open the certificate dialog."), _("Error opening Certificate Information dialog"));
}
+ if (ModifiedCertificateData == FALSE){
+
+ frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 1, ConnHandle.GetCertificateContextPointer());
+ iter->second = 2;
+ break;
+
+ } else {
+
+ frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateContextPointer());
+
+ }
#else
// Setup the data to be sent in the wxPostEvent command.
#if defined(__APPLE__)
frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetTrustObject());
-
+
+#elif defined(__WIN32__)
+
+ frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateContextPointer());
+
#else
frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateData());
bool ContinueProcess = AccDir.GetFirst(&AccDirFilename, wxEmptyString, wxDIR_DEFAULT);
ServerContactList = ConnHandle.GetContactList(SyncTokenLoad.ToUTF8());
+
+ int ErrorCode = ConnHandle.GetResultCode();
+
+ if (ErrorCode != CURLE_OK){
+
+ iter->second = 4;
+ break;
+
+ }
+
SSLCertCollection certcol = ConnHandle.GetCertificateData();
// Create a pointer for the std::map<wxString,FileSyncData>.