コード例 #1
0
ファイル: ssl_openssl.cpp プロジェクト: Seldom/miranda-ng
static void ReportSslError(SECURITY_STATUS scRet, int line, bool = false)
{
	TCHAR szMsgBuf[256];
	switch (scRet) {
	case 0:
	case ERROR_NOT_READY:
		return;

	case SEC_E_INVALID_TOKEN:
		_tcsncpy_s(szMsgBuf, TranslateT("Client cannot decode host message. Possible causes: host does not support SSL or requires not existing security package"), _TRUNCATE);
		break;

	case CERT_E_CN_NO_MATCH:
	case SEC_E_WRONG_PRINCIPAL:
		_tcsncpy_s(szMsgBuf, TranslateT("Host we are connecting to is not the one certificate was issued for"), _TRUNCATE);
		break;

	default:
		FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, scRet, LANG_USER_DEFAULT, szMsgBuf, _countof(szMsgBuf), NULL);
	}

	TCHAR szMsgBuf2[512];
	mir_sntprintf(szMsgBuf2, _T("SSL connection failure (%x %u): %s"), scRet, line, szMsgBuf);

	char* szMsg = Utf8EncodeT(szMsgBuf2);
	SslLog(szMsg);
	mir_free(szMsg);

	SetLastError(scRet);
	PUShowMessageT(szMsgBuf2, SM_WARNING);
}
コード例 #2
0
ファイル: filexferdlg.cpp プロジェクト: gloria8023/miranda-ng
void FillSendData(FileDlgData *dat, DBEVENTINFO& dbei)
{
	dbei.cbSize = sizeof(dbei);
	dbei.szModule = GetContactProto(dat->hContact);
	dbei.eventType = EVENTTYPE_FILE;
	dbei.flags = DBEF_SENT;
	dbei.timestamp = time(NULL);
	char *szFileNames = Utf8EncodeT(dat->szFilenames), *szMsg = Utf8EncodeT(dat->szMsg);
	dbei.flags |= DBEF_UTF;

	dbei.cbBlob = int(sizeof(DWORD) + mir_strlen(szFileNames) + mir_strlen(szMsg) + 2);
	dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
	*(PDWORD)dbei.pBlob = 0;
	mir_strcpy((char*)dbei.pBlob + sizeof(DWORD), szFileNames);
	mir_strcpy((char*)dbei.pBlob + sizeof(DWORD) + mir_strlen(szFileNames) + 1, szMsg);

	mir_free(szFileNames), mir_free(szMsg);
}