Merge pull request #1878 from csoler/v0.6-ImprovedGUI_4

[WIP] fixing some GUI bugs
This commit is contained in:
csoler 2020-04-26 15:49:01 +02:00 committed by GitHub
commit 07e71c3ea6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 33 deletions

View file

@ -806,22 +806,22 @@ X509 *AuthSSLimpl::SignX509ReqWithGPG(X509_REQ *req, long /*days*/)
X509_NAME_free(issuer_name); X509_NAME_free(issuer_name);
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
// (does not leak the key creation date to the outside anymore. for more privacy) // (does not leak the key creation date to the outside anymore. for more privacy)
ASN1_TIME_set(X509_get_notBefore(x509), 0); ASN1_TIME_set(X509_get_notBefore(x509), 0);
ASN1_TIME_set(X509_get_notAfter(x509), 0); ASN1_TIME_set(X509_get_notAfter(x509), 0);
#else #else
// NEW code, set validity time between 2010 and 2110 (remember to change it when, if OpenSSL check it by default. ;) ) // NEW code, set validity time between 2010 and 2110 (remember to change it when, if OpenSSL check it by default. ;) )
// (does not leak the key creation date to the outside anymore. for more privacy) // (does not leak the key creation date to the outside anymore. for more privacy)
if (!ASN1_TIME_set_string(X509_getm_notBefore(x509), "20100101000000Z")) if (!ASN1_TIME_set_string(X509_getm_notBefore(x509), "20100101000000Z"))
{ {
RsErr() << __PRETTY_FUNCTION__ << " Set notBefore FAIL" << std::endl; RsErr() << __PRETTY_FUNCTION__ << " Set notBefore FAIL" << std::endl;
return NULL; return NULL;
} }
if (!ASN1_TIME_set_string(X509_getm_notAfter(x509), "21100101000000Z")) if (!ASN1_TIME_set_string(X509_getm_notAfter(x509), "21100101000000Z"))
{ {
RsErr() << __PRETTY_FUNCTION__ << " Set notAfter FAIL" << std::endl; RsErr() << __PRETTY_FUNCTION__ << " Set notAfter FAIL" << std::endl;
return NULL; return NULL;
} }
#endif #endif
if (!X509_set_subject_name(x509, X509_REQ_get_subject_name(req))) if (!X509_set_subject_name(x509, X509_REQ_get_subject_name(req)))

View file

@ -543,10 +543,16 @@ void RsTypeSerializer::RawMemoryWrapper::serial_process(
break; break;
case RsGenericSerializer::DESERIALIZE: case RsGenericSerializer::DESERIALIZE:
{ {
// In case first,second is not properly initialized, we set them to nullptr,0
first = nullptr;
second = 0;
uint32_t serialSize = 0; uint32_t serialSize = 0;
RS_SERIAL_PROCESS(serialSize); RS_SERIAL_PROCESS(serialSize);
if(!ctx.mOk) break; if(!ctx.mOk) break;
ctx.mOk = serialSize <= MAX_SERIALIZED_CHUNK_SIZE; ctx.mOk = (serialSize <= MAX_SERIALIZED_CHUNK_SIZE);
if(!ctx.mOk) if(!ctx.mOk)
{ {
RsErr() << __PRETTY_FUNCTION__ RsErr() << __PRETTY_FUNCTION__
@ -565,25 +571,23 @@ void RsTypeSerializer::RawMemoryWrapper::serial_process(
break; break;
} }
ctx.mOk = ctx.mSize >= ctx.mOffset + serialSize; ctx.mOk = (ctx.mSize >= ctx.mOffset + serialSize);
if(!ctx.mOk) if(!ctx.mOk)
{ {
RsErr() << __PRETTY_FUNCTION__ << std::errc::no_buffer_space RsErr() << __PRETTY_FUNCTION__ << std::errc::no_buffer_space << std::endl;
<< std::endl;
print_stacktrace(); print_stacktrace();
clear(); clear();
break; break;
} }
if(serialSize != second) first = reinterpret_cast<uint8_t*>(malloc(serialSize));
{ second = serialSize;
first = reinterpret_cast<uint8_t*>(realloc(first, serialSize));
second = serialSize; memcpy(first, ctx.mData + ctx.mOffset, serialSize);
} ctx.mOffset += serialSize;
memcpy(first, ctx.mData + ctx.mOffset, second);
ctx.mOffset += second;
break; break;
} }
case RsGenericSerializer::PRINT: break; case RsGenericSerializer::PRINT: break;

View file

@ -166,7 +166,13 @@ class RsTurtleRegExpSearchRequestItem: public RsTurtleFileSearchRequestItem
class RsTurtleGenericSearchRequestItem: public RsTurtleSearchRequestItem class RsTurtleGenericSearchRequestItem: public RsTurtleSearchRequestItem
{ {
public: public:
RsTurtleGenericSearchRequestItem() : RsTurtleSearchRequestItem(RS_TURTLE_SUBTYPE_GENERIC_SEARCH_REQUEST) {} RsTurtleGenericSearchRequestItem()
: RsTurtleSearchRequestItem(RS_TURTLE_SUBTYPE_GENERIC_SEARCH_REQUEST),
service_id(0),
search_data_len(0),
request_type(0),
search_data(nullptr)
{}
virtual ~RsTurtleGenericSearchRequestItem() { clear(); } virtual ~RsTurtleGenericSearchRequestItem() { clear(); }
uint16_t service_id ; // service to search uint16_t service_id ; // service to search
@ -221,7 +227,11 @@ class RsTurtleFTSearchResultItem: public RsTurtleSearchResultItem
class RsTurtleGenericSearchResultItem: public RsTurtleSearchResultItem class RsTurtleGenericSearchResultItem: public RsTurtleSearchResultItem
{ {
public: public:
RsTurtleGenericSearchResultItem() : RsTurtleSearchResultItem(RS_TURTLE_SUBTYPE_GENERIC_SEARCH_RESULT){} RsTurtleGenericSearchResultItem()
: RsTurtleSearchResultItem(RS_TURTLE_SUBTYPE_GENERIC_SEARCH_RESULT),
result_data(nullptr),
result_data_len(0)
{}
virtual ~RsTurtleGenericSearchResultItem() {} virtual ~RsTurtleGenericSearchResultItem() {}
uint32_t count() const { return result_data_len/50 ; } // This is a blind size estimate. We should probably use the actual size to limit search results. uint32_t count() const { return result_data_len/50 ; } // This is a blind size estimate. We should probably use the actual size to limit search results.

View file

@ -42,13 +42,9 @@ std::ostream& operator<<(std::ostream& o, const QModelIndex& i);// defined elsew
const QString RsGxsForumModel::FilterString("filtered"); const QString RsGxsForumModel::FilterString("filtered");
RsGxsForumModel::RsGxsForumModel(QObject *parent) RsGxsForumModel::RsGxsForumModel(QObject *parent)
: QAbstractItemModel(parent) : QAbstractItemModel(parent), mUseChildTS(false),mFilteringEnabled(false),mTreeMode(TREE_MODE_TREE)
{ {
initEmptyHierarchy(mPosts); initEmptyHierarchy(mPosts);
mUseChildTS=false;
mFilteringEnabled=false;
mTreeMode = TREE_MODE_TREE;
} }
void RsGxsForumModel::preMods() void RsGxsForumModel::preMods()

View file

@ -57,6 +57,7 @@ RSPermissionMatrixWidget::RSPermissionMatrixWidget(QWidget *parent)
:QFrame(parent) :QFrame(parent)
{ {
_painter = new QPainter(); _painter = new QPainter();
_current_service_id = 0;
setMouseTracking(true) ; setMouseTracking(true) ;