mirror of
https://onedev.site.tesses.net/tesses-framework
synced 2026-02-08 07:45:46 +00:00
Fix TessesFramework for CrossLang
This commit is contained in:
@@ -25,7 +25,7 @@ jobs:
|
|||||||
name: Build Docker Image
|
name: Build Docker Image
|
||||||
dockerfile: Dockerfile.run
|
dockerfile: Dockerfile.run
|
||||||
output: !RegistryOutput
|
output: !RegistryOutput
|
||||||
tags: onedev.site.tesses.net/tesses-framework/tesses-framework:latest
|
tags: onedev.site.tesses.net/tesses-framework/tesses-framework:latest onedev.site.tesses.net/tesses-framework/tesses-framework:@commit_hash@
|
||||||
registryLogins:
|
registryLogins:
|
||||||
- registryUrl: '@server_url@'
|
- registryUrl: '@server_url@'
|
||||||
userName: '@job_token@'
|
userName: '@job_token@'
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ src/Filesystem/NullFilesystem.cpp
|
|||||||
src/Filesystem/MountableFilesystem.cpp
|
src/Filesystem/MountableFilesystem.cpp
|
||||||
src/Filesystem/FSHelpers.cpp
|
src/Filesystem/FSHelpers.cpp
|
||||||
src/Filesystem/TempFS.cpp
|
src/Filesystem/TempFS.cpp
|
||||||
src/Crypto/ClientTLSStream.cpp
|
src/Crypto/MbedTLS/ClientTLSStream.cpp
|
||||||
src/Crypto/MbedHelpers.cpp
|
src/Crypto/MbedTLS/Crypto.cpp
|
||||||
src/Args.cpp
|
src/Args.cpp
|
||||||
src/TF_Init.cpp
|
src/TF_Init.cpp
|
||||||
src/HiddenField.cpp
|
src/HiddenField.cpp
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ namespace Tesses::Framework::Crypto
|
|||||||
{
|
{
|
||||||
class ClientTLSStream : public Tesses::Framework::Streams::Stream {
|
class ClientTLSStream : public Tesses::Framework::Streams::Stream {
|
||||||
void* privateData;
|
void* privateData;
|
||||||
static int strm_send(void* ctx,const unsigned char* buf,size_t len);
|
|
||||||
static int strm_recv(void* ctx,unsigned char* buf,size_t len);
|
|
||||||
public:
|
public:
|
||||||
static std::string GetCertChain();
|
static std::string GetCertChain();
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ namespace Tesses::Framework::Filesystem
|
|||||||
static std::vector<std::string> SplitPath(std::string path);
|
static std::vector<std::string> SplitPath(std::string path);
|
||||||
std::vector<std::string> path;
|
std::vector<std::string> path;
|
||||||
VFSPath();
|
VFSPath();
|
||||||
VFSPath(const char* path) : VFSPath((std::string)path)
|
|
||||||
{}
|
|
||||||
VFSPath(std::vector<std::string> path);
|
VFSPath(std::vector<std::string> path);
|
||||||
VFSPath(std::string path);
|
VFSPath(std::string path);
|
||||||
VFSPath(VFSPath p, std::string subent);
|
VFSPath(VFSPath p, std::string subent);
|
||||||
@@ -61,9 +60,17 @@ namespace Tesses::Framework::Filesystem
|
|||||||
VFSPath MakeRelative(VFSPath toMakeRelativeTo) const;
|
VFSPath MakeRelative(VFSPath toMakeRelativeTo) const;
|
||||||
};
|
};
|
||||||
VFSPath operator/(VFSPath p, VFSPath p2);
|
VFSPath operator/(VFSPath p, VFSPath p2);
|
||||||
|
VFSPath operator/(VFSPath p, std::string p2);
|
||||||
|
VFSPath operator/(std::string p, VFSPath p2);
|
||||||
VFSPath operator+(VFSPath p, VFSPath p2);
|
VFSPath operator+(VFSPath p, VFSPath p2);
|
||||||
|
VFSPath operator+(VFSPath p, std::string p2);
|
||||||
|
VFSPath operator+(std::string p, VFSPath p2);
|
||||||
bool operator==(VFSPath p,VFSPath p2);
|
bool operator==(VFSPath p,VFSPath p2);
|
||||||
bool operator!=(VFSPath p,VFSPath p2);
|
bool operator!=(VFSPath p,VFSPath p2);
|
||||||
|
bool operator==(std::string p,VFSPath p2);
|
||||||
|
bool operator!=(std::string p,VFSPath p2);
|
||||||
|
bool operator==(VFSPath p,std::string p2);
|
||||||
|
bool operator!=(VFSPath p,std::string p2);
|
||||||
class VFSPathEnumeratorData {
|
class VFSPathEnumeratorData {
|
||||||
public:
|
public:
|
||||||
VFSPathEnumeratorData(std::function<bool(VFSPath&)> moveNext, std::function<void()> destroy)
|
VFSPathEnumeratorData(std::function<bool(VFSPath&)> moveNext, std::function<void()> destroy)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#include "Filesystem/MemoryFilesystem.hpp"
|
#include "Filesystem/MemoryFilesystem.hpp"
|
||||||
#include "Filesystem/FSHelpers.hpp"
|
#include "Filesystem/FSHelpers.hpp"
|
||||||
#include "Crypto/ClientTLSStream.hpp"
|
#include "Crypto/ClientTLSStream.hpp"
|
||||||
#include "Crypto/MbedHelpers.hpp"
|
#include "Crypto/Crypto.hpp"
|
||||||
#include "Lazy.hpp"
|
#include "Lazy.hpp"
|
||||||
#include "Mail/Smtp.hpp"
|
#include "Mail/Smtp.hpp"
|
||||||
#include "HiddenField.hpp"
|
#include "HiddenField.hpp"
|
||||||
|
|||||||
@@ -10,12 +10,16 @@ else()
|
|||||||
set(PKGCONFIG_DEPS "")
|
set(PKGCONFIG_DEPS "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(TESSESFRAMEWORK_ENABLE_STATIC)
|
||||||
configure_file(tessesframework_static.pc.in tessesframework_static.pc @ONLY)
|
configure_file(tessesframework_static.pc.in tessesframework_static.pc @ONLY)
|
||||||
install(FILES
|
install(FILES
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/tessesframework_static.pc
|
${CMAKE_CURRENT_BINARY_DIR}/tessesframework_static.pc
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TESSESFRAMEWORK_ENABLE_SHARED)
|
||||||
configure_file(tessesframework.pc.in tessesframework.pc @ONLY)
|
configure_file(tessesframework.pc.in tessesframework.pc @ONLY)
|
||||||
install(FILES
|
install(FILES
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/tessesframework.pc
|
${CMAKE_CURRENT_BINARY_DIR}/tessesframework.pc
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
|
endif()
|
||||||
@@ -41,7 +41,20 @@ namespace Tesses::Framework::Crypto
|
|||||||
mbedtls_ssl_free(&ssl);
|
mbedtls_ssl_free(&ssl);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
static int strm_send(void* ctx,const unsigned char* buf,size_t len)
|
||||||
|
{
|
||||||
|
auto priv = static_cast<ClientTLSPrivateData*>(ctx);
|
||||||
|
return (int)priv->strm->Write(buf, len);
|
||||||
|
|
||||||
|
}
|
||||||
|
static int strm_recv(void* ctx,unsigned char* buf,size_t len)
|
||||||
|
{
|
||||||
|
auto priv = static_cast<ClientTLSPrivateData*>(ctx);
|
||||||
|
return (int)priv->strm->Read(buf, len);
|
||||||
|
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string ClientTLSStream::GetCertChain()
|
std::string ClientTLSStream::GetCertChain()
|
||||||
{
|
{
|
||||||
#if defined(TESSESFRAMEWORK_ENABLE_MBED)
|
#if defined(TESSESFRAMEWORK_ENABLE_MBED)
|
||||||
@@ -88,16 +101,7 @@ namespace Tesses::Framework::Crypto
|
|||||||
int ret=0;
|
int ret=0;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
|
||||||
psa_status_t status = psa_crypto_init();
|
|
||||||
if (status != PSA_SUCCESS) {
|
|
||||||
mbedtls_fprintf(stderr, "Failed to initialize PSA Crypto implementation: %d\n",
|
|
||||||
(int) status);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
if ((ret = mbedtls_ctr_drbg_seed(&data->ctr_drbg, mbedtls_entropy_func, &data->entropy,
|
if ((ret = mbedtls_ctr_drbg_seed(&data->ctr_drbg, mbedtls_entropy_func, &data->entropy,
|
||||||
(const unsigned char *) pers,
|
(const unsigned char *) pers,
|
||||||
strlen(pers))) != 0)
|
strlen(pers))) != 0)
|
||||||
@@ -209,24 +213,7 @@ namespace Tesses::Framework::Crypto
|
|||||||
return (size_t)0;
|
return (size_t)0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
int ClientTLSStream::strm_send(void* ctx,const unsigned char* buf,size_t len)
|
|
||||||
{
|
|
||||||
#if defined(TESSESFRAMEWORK_ENABLE_MBED)
|
|
||||||
auto priv = static_cast<ClientTLSPrivateData*>(ctx);
|
|
||||||
return (int)priv->strm->Write(buf, len);
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
int ClientTLSStream::strm_recv(void* ctx,unsigned char* buf,size_t len)
|
|
||||||
{
|
|
||||||
#if defined(TESSESFRAMEWORK_ENABLE_MBED)
|
|
||||||
auto priv = static_cast<ClientTLSPrivateData*>(ctx);
|
|
||||||
return (int)priv->strm->Read(buf, len);
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
bool ClientTLSStream::CanRead()
|
bool ClientTLSStream::CanRead()
|
||||||
{
|
{
|
||||||
#if defined(TESSESFRAMEWORK_ENABLE_MBED)
|
#if defined(TESSESFRAMEWORK_ENABLE_MBED)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "TessesFramework/Crypto/MbedHelpers.hpp"
|
#include "TessesFramework/Crypto/Crypto.hpp"
|
||||||
|
|
||||||
#if defined(TESSESFRAMEWORK_ENABLE_MBED)
|
#if defined(TESSESFRAMEWORK_ENABLE_MBED)
|
||||||
#include <mbedtls/sha1.h>
|
#include <mbedtls/sha1.h>
|
||||||
@@ -107,11 +107,18 @@ namespace Tesses::Framework::Filesystem
|
|||||||
{
|
{
|
||||||
return VFSPathEnumeratorItterator();
|
return VFSPathEnumeratorItterator();
|
||||||
}
|
}
|
||||||
VFSPath operator/(VFSPath p, VFSPath p2)
|
VFSPath operator/(VFSPath p, VFSPath p2)
|
||||||
|
{
|
||||||
|
return VFSPath(p,p2);
|
||||||
|
}
|
||||||
|
VFSPath operator/(VFSPath p, std::string p2)
|
||||||
|
{
|
||||||
|
return VFSPath(p,p2);
|
||||||
|
}
|
||||||
|
VFSPath operator/(std::string p, VFSPath p2)
|
||||||
{
|
{
|
||||||
return VFSPath(p,p2);
|
return VFSPath(p,p2);
|
||||||
}
|
}
|
||||||
|
|
||||||
VFSPath operator+(VFSPath p, VFSPath p2)
|
VFSPath operator+(VFSPath p, VFSPath p2)
|
||||||
{
|
{
|
||||||
VFSPath pout;
|
VFSPath pout;
|
||||||
@@ -139,7 +146,14 @@ namespace Tesses::Framework::Filesystem
|
|||||||
|
|
||||||
return pout;
|
return pout;
|
||||||
}
|
}
|
||||||
|
VFSPath operator+(VFSPath p, std::string p2)
|
||||||
|
{
|
||||||
|
return p + VFSPath(p2);
|
||||||
|
}
|
||||||
|
VFSPath operator+(std::string p, VFSPath p2)
|
||||||
|
{
|
||||||
|
return VFSPath(p) + p2;
|
||||||
|
}
|
||||||
bool operator==(VFSPath p,VFSPath p2)
|
bool operator==(VFSPath p,VFSPath p2)
|
||||||
{
|
{
|
||||||
if(p.relative != p2.relative) return false;
|
if(p.relative != p2.relative) return false;
|
||||||
@@ -157,6 +171,22 @@ namespace Tesses::Framework::Filesystem
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
bool operator==(std::string p,VFSPath p2)
|
||||||
|
{
|
||||||
|
return VFSPath(p) == p2;
|
||||||
|
}
|
||||||
|
bool operator!=(std::string p,VFSPath p2)
|
||||||
|
{
|
||||||
|
return VFSPath(p) != p2;
|
||||||
|
}
|
||||||
|
bool operator==(VFSPath p,std::string p2)
|
||||||
|
{
|
||||||
|
return p == VFSPath(p2);
|
||||||
|
}
|
||||||
|
bool operator!=(VFSPath p,std::string p2)
|
||||||
|
{
|
||||||
|
return p != VFSPath(p2);
|
||||||
|
}
|
||||||
VFSPath VFS::ReadLink(VFSPath path)
|
VFSPath VFS::ReadLink(VFSPath path)
|
||||||
{
|
{
|
||||||
return VFSPath("/");
|
return VFSPath("/");
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "TessesFramework/Http/HttpClient.hpp"
|
#include "TessesFramework/Http/HttpClient.hpp"
|
||||||
#include "TessesFramework/Crypto/ClientTLSStream.hpp"
|
#include "TessesFramework/Crypto/ClientTLSStream.hpp"
|
||||||
#include "TessesFramework/Crypto/MbedHelpers.hpp"
|
#include "TessesFramework/Crypto/Crypto.hpp"
|
||||||
#include "TessesFramework/Streams/NetworkStream.hpp"
|
#include "TessesFramework/Streams/NetworkStream.hpp"
|
||||||
#include "TessesFramework/TextStreams/StreamWriter.hpp"
|
#include "TessesFramework/TextStreams/StreamWriter.hpp"
|
||||||
#include "TessesFramework/TextStreams/StreamReader.hpp"
|
#include "TessesFramework/TextStreams/StreamReader.hpp"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "TessesFramework/Http/ContentDisposition.hpp"
|
#include "TessesFramework/Http/ContentDisposition.hpp"
|
||||||
#include "TessesFramework/Streams/BufferedStream.hpp"
|
#include "TessesFramework/Streams/BufferedStream.hpp"
|
||||||
#include "TessesFramework/Http/HttpStream.hpp"
|
#include "TessesFramework/Http/HttpStream.hpp"
|
||||||
#include "TessesFramework/Crypto/MbedHelpers.hpp"
|
#include "TessesFramework/Crypto/Crypto.hpp"
|
||||||
#include "TessesFramework/Threading/Mutex.hpp"
|
#include "TessesFramework/Threading/Mutex.hpp"
|
||||||
#include "TessesFramework/Common.hpp"
|
#include "TessesFramework/Common.hpp"
|
||||||
#include "TessesFramework/TextStreams/StdIOWriter.hpp"
|
#include "TessesFramework/TextStreams/StdIOWriter.hpp"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "TessesFramework/Mail/Smtp.hpp"
|
#include "TessesFramework/Mail/Smtp.hpp"
|
||||||
#include "TessesFramework/Crypto/MbedHelpers.hpp"
|
#include "TessesFramework/Crypto/Crypto.hpp"
|
||||||
#include "TessesFramework/Streams/MemoryStream.hpp"
|
#include "TessesFramework/Streams/MemoryStream.hpp"
|
||||||
#include "TessesFramework/TextStreams/StreamWriter.hpp"
|
#include "TessesFramework/TextStreams/StreamWriter.hpp"
|
||||||
#include "TessesFramework/Http/HttpUtils.hpp"
|
#include "TessesFramework/Http/HttpUtils.hpp"
|
||||||
|
|||||||
@@ -613,7 +613,7 @@ CreateProcessW(
|
|||||||
}
|
}
|
||||||
if(!this->workingDirectory.empty())
|
if(!this->workingDirectory.empty())
|
||||||
Tesses::Framework::Filesystem::VFSPath::SetAbsoluteCurrentDirectory(this->workingDirectory);
|
Tesses::Framework::Filesystem::VFSPath::SetAbsoluteCurrentDirectory(this->workingDirectory);
|
||||||
execve(this->name.c_str(),argv,envp);
|
execvpe(this->name.c_str(),argv,envp);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
p->pid = pid;
|
p->pid = pid;
|
||||||
|
|||||||
Reference in New Issue
Block a user