From 71b6fee0a6b24b94b636f9ecc033f66ee080159b Mon Sep 17 00:00:00 2001 From: Florian Hoss Date: Wed, 20 Apr 2022 19:54:46 +0200 Subject: [PATCH] all working as expected --- .../arduino/lib/Firewall/esp32Storage.cpp | 31 ++----------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/SourceCode/arduino/lib/Firewall/esp32Storage.cpp b/SourceCode/arduino/lib/Firewall/esp32Storage.cpp index 9f02b4a..3681987 100644 --- a/SourceCode/arduino/lib/Firewall/esp32Storage.cpp +++ b/SourceCode/arduino/lib/Firewall/esp32Storage.cpp @@ -4,31 +4,6 @@ namespace firewall { Storage::Storage() { - store_settings_value("amount_of_rules", 21); - log_i("Amount: %i", retrieve_settings_value("amount_of_rules")); - - firewall_rule_t *rule_ptr = (firewall_rule_t *)malloc(sizeof(firewall_rule_t)); - rule_ptr->key = 0; - strcpy(rule_ptr->source, "192.168.0.12"); - strcpy(rule_ptr->destination, "192.168.0.12"); - rule_ptr->protocol = FW_TCP; - rule_ptr->target = FW_DROP; - store_firewall_rule(rule_ptr); - free(rule_ptr); - rule_ptr = retrieve_firewall_rule(0); - log_i("%s, %s, %i, %i", - rule_ptr->source, - rule_ptr->destination, - rule_ptr->protocol, - rule_ptr->target); - free(rule_ptr); - rule_ptr = retrieve_firewall_rule(1); - log_i("%s, %s, %i, %i", - rule_ptr->source, - rule_ptr->destination, - rule_ptr->protocol, - rule_ptr->target); - free(rule_ptr); } Storage::~Storage() @@ -111,10 +86,10 @@ namespace firewall uint16_t cert_length = certificate->getCertLength(); this->memory.begin("certificate", false); - this->memory.putBytes("pk_data", pk_data, pk_length); - this->memory.putBytes("cert_data", cert_data, cert_length); + this->memory.putBytes("pk_data", pk_data, sizeof(pk_data)); + this->memory.putBytes("cert_data", cert_data, sizeof(cert_data)); this->memory.putUInt("pk_length", pk_length); - this->memory.putUInt("pk_length", cert_length); + this->memory.putUInt("cert_length", cert_length); this->memory.end(); } }