mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-11-15 21:59:27 +00:00
* Update buildroot-patches for 2020.11-rc1 buildroot * Update buildroot to 2020.11-rc1 Signed-off-by: Stefan Agner <stefan@agner.ch> * Don't rely on sfdisk --list-free output The --list-free (-F) argument does not allow machine readable mode. And it seems that the output format changes over time (different spacing, using size postfixes instead of raw blocks). Use sfdisk json output and calculate free partition space ourselfs. This works for 2.35 and 2.36 and is more robust since we rely on output which is meant for scripts to parse. * Migrate defconfigs for Buildroot 2020.11-rc1 In particular, rename BR2_TARGET_UBOOT_BOOT_SCRIPT(_SOURCE) to BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT(_SOURCE). * Rebase/remove systemd patches for systemd 246 * Drop apparmor/libapparmor from buildroot-external * hassos-persists: use /run as directory for lockfiles The U-Boot tools use /var/lock by default which is not created any more by systemd by default (it is under tmpfiles legacy.conf, which we no longer install). * Disable systemd-update-done.service The service is not suited for pure read-only systems. In particular the service needs to be able to write a file in /etc and /var. Remove the service. Note: This is a static service and cannot be removed using systemd-preset. * Disable apparmor.service for now The service loads all default profiles. Some might actually cause problems. E.g. the profile for ping seems not to match our setup for /etc/resolv.conf: [85503.634653] audit: type=1400 audit(1605286002.684:236): apparmor="DENIED" operation="open" profile="ping" name="/run/resolv.conf" pid=27585 comm="ping" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
241 lines
8.4 KiB
Diff
241 lines
8.4 KiB
Diff
From cfcd8a8f73aa337e8f45d287a79cd9b8e5c51dcd Mon Sep 17 00:00:00 2001
|
|
From: Bernd Kuhls <bernd.kuhls@t-online.de>
|
|
Date: Sun, 5 Jul 2020 11:42:23 +0200
|
|
Subject: [PATCH] Compatibility with libmicrohttpd 0.9.71
|
|
|
|
From the libmicrohttpd 0.9.71 release notes:
|
|
|
|
Furthermore, the release introduces an 'enum MHD_Result' instead of
|
|
defines for MHD_YES/MHD_NO. This is intended to make it easier to check
|
|
for certain API misuse bugs by providing better types (not everything is
|
|
an 'int'). While this does NOT change the binary API, this change
|
|
_will_ cause compiler warnings for all legacy code -- until 'int' is
|
|
replaced with 'enum MHD_Result'
|
|
|
|
Patch sent upstream: https://github.com/etr/libhttpserver/pull/199
|
|
|
|
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
|
|
---
|
|
src/http_request.cpp | 6 +++---
|
|
src/httpserver/http_request.hpp | 6 +++---
|
|
src/httpserver/http_utils.hpp | 4 ++++
|
|
src/httpserver/webserver.hpp | 14 +++++++-------
|
|
src/webserver.cpp | 22 +++++++++++++---------
|
|
5 files changed, 30 insertions(+), 22 deletions(-)
|
|
|
|
diff --git a/src/http_request.cpp b/src/http_request.cpp
|
|
index 5703663..be342c7 100644
|
|
--- a/src/http_request.cpp
|
|
+++ b/src/http_request.cpp
|
|
@@ -88,7 +88,7 @@ const std::string http_request::get_connection_value(const std::string& key, enu
|
|
return header_c;
|
|
}
|
|
|
|
-int http_request::build_request_header(
|
|
+MHD_Result http_request::build_request_header(
|
|
void *cls,
|
|
enum MHD_ValueKind kind,
|
|
const char *key,
|
|
@@ -189,7 +189,7 @@ const std::string http_request::get_querystring() const
|
|
return querystring;
|
|
}
|
|
|
|
-int http_request::build_request_args(
|
|
+MHD_Result http_request::build_request_args(
|
|
void *cls,
|
|
enum MHD_ValueKind kind,
|
|
const char *key,
|
|
@@ -204,7 +204,7 @@ int http_request::build_request_args(
|
|
return MHD_YES;
|
|
}
|
|
|
|
-int http_request::build_request_querystring(
|
|
+MHD_Result http_request::build_request_querystring(
|
|
void *cls,
|
|
enum MHD_ValueKind kind,
|
|
const char *key,
|
|
diff --git a/src/httpserver/http_request.hpp b/src/httpserver/http_request.hpp
|
|
index 139272b..62e5275 100644
|
|
--- a/src/httpserver/http_request.hpp
|
|
+++ b/src/httpserver/http_request.hpp
|
|
@@ -247,15 +247,15 @@ class http_request
|
|
|
|
unescaper_ptr unescaper = 0x0;
|
|
|
|
- static int build_request_header(void *cls, enum MHD_ValueKind kind,
|
|
+ static MHD_Result build_request_header(void *cls, enum MHD_ValueKind kind,
|
|
const char *key, const char *value
|
|
);
|
|
|
|
- static int build_request_args(void *cls, enum MHD_ValueKind kind,
|
|
+ static MHD_Result build_request_args(void *cls, enum MHD_ValueKind kind,
|
|
const char *key, const char *value
|
|
);
|
|
|
|
- static int build_request_querystring(void *cls, enum MHD_ValueKind kind,
|
|
+ static MHD_Result build_request_querystring(void *cls, enum MHD_ValueKind kind,
|
|
const char *key, const char *value
|
|
);
|
|
|
|
diff --git a/src/httpserver/http_utils.hpp b/src/httpserver/http_utils.hpp
|
|
index 9ad89b4..a812197 100644
|
|
--- a/src/httpserver/http_utils.hpp
|
|
+++ b/src/httpserver/http_utils.hpp
|
|
@@ -53,6 +53,10 @@
|
|
|
|
#define DEFAULT_MASK_VALUE 0xFFFF
|
|
|
|
+#if MHD_VERSION < 0x00097002
|
|
+typedef int MHD_Result;
|
|
+#endif
|
|
+
|
|
namespace httpserver {
|
|
|
|
typedef void(*unescaper_ptr)(std::string&);
|
|
diff --git a/src/httpserver/webserver.hpp b/src/httpserver/webserver.hpp
|
|
index 1ff472b..661b6ee 100644
|
|
--- a/src/httpserver/webserver.hpp
|
|
+++ b/src/httpserver/webserver.hpp
|
|
@@ -195,14 +195,14 @@ class webserver
|
|
enum MHD_RequestTerminationCode toe
|
|
);
|
|
|
|
- static int answer_to_connection
|
|
+ static MHD_Result answer_to_connection
|
|
(
|
|
void* cls, MHD_Connection* connection,
|
|
const char* url, const char* method,
|
|
const char* version, const char* upload_data,
|
|
size_t* upload_data_size, void** con_cls
|
|
);
|
|
- static int post_iterator
|
|
+ static MHD_Result post_iterator
|
|
(
|
|
void *cls,
|
|
enum MHD_ValueKind kind,
|
|
@@ -219,25 +219,25 @@ class webserver
|
|
void **con_cls, int upgrade_socket
|
|
);
|
|
|
|
- int requests_answer_first_step(MHD_Connection* connection,
|
|
+ MHD_Result requests_answer_first_step(MHD_Connection* connection,
|
|
struct details::modded_request* mr
|
|
);
|
|
|
|
- int requests_answer_second_step(MHD_Connection* connection,
|
|
+ MHD_Result requests_answer_second_step(MHD_Connection* connection,
|
|
const char* method, const char* version, const char* upload_data,
|
|
size_t* upload_data_size, struct details::modded_request* mr
|
|
);
|
|
|
|
- int finalize_answer(MHD_Connection* connection,
|
|
+ MHD_Result finalize_answer(MHD_Connection* connection,
|
|
struct details::modded_request* mr, const char* method
|
|
);
|
|
|
|
- int complete_request(MHD_Connection* connection,
|
|
+ MHD_Result complete_request(MHD_Connection* connection,
|
|
struct details::modded_request* mr,
|
|
const char* version, const char* method
|
|
);
|
|
|
|
- friend int policy_callback (void *cls,
|
|
+ friend MHD_Result policy_callback (void *cls,
|
|
const struct sockaddr* addr, socklen_t addrlen
|
|
);
|
|
friend void error_log(void* cls, const char* fmt, va_list ap);
|
|
diff --git a/src/webserver.cpp b/src/webserver.cpp
|
|
index a3104e9..3340eb0 100644
|
|
--- a/src/webserver.cpp
|
|
+++ b/src/webserver.cpp
|
|
@@ -75,6 +75,10 @@
|
|
#define SOCK_CLOEXEC 02000000
|
|
#endif
|
|
|
|
+#if MHD_VERSION < 0x00097002
|
|
+typedef int MHD_Result;
|
|
+#endif
|
|
+
|
|
using namespace std;
|
|
|
|
namespace httpserver
|
|
@@ -82,7 +86,7 @@ namespace httpserver
|
|
|
|
using namespace http;
|
|
|
|
-int policy_callback (void *, const struct sockaddr*, socklen_t);
|
|
+MHD_Result policy_callback (void *, const struct sockaddr*, socklen_t);
|
|
void error_log(void*, const char*, va_list);
|
|
void* uri_log(void*, const char*);
|
|
void access_log(webserver*, string);
|
|
@@ -421,7 +425,7 @@ void webserver::disallow_ip(const string& ip)
|
|
allowances.erase(ip);
|
|
}
|
|
|
|
-int policy_callback (void *cls, const struct sockaddr* addr, socklen_t addrlen)
|
|
+MHD_Result policy_callback (void *cls, const struct sockaddr* addr, socklen_t addrlen)
|
|
{
|
|
if(!(static_cast<webserver*>(cls))->ban_system_enabled) return MHD_YES;
|
|
|
|
@@ -468,7 +472,7 @@ size_t unescaper_func(void * cls, struct MHD_Connection *c, char *s)
|
|
return std::string(s).size();
|
|
}
|
|
|
|
-int webserver::post_iterator (void *cls, enum MHD_ValueKind kind,
|
|
+MHD_Result webserver::post_iterator (void *cls, enum MHD_ValueKind kind,
|
|
const char *key,
|
|
const char *filename,
|
|
const char *content_type,
|
|
@@ -522,7 +526,7 @@ const std::shared_ptr<http_response> webserver::internal_error_page(details::mod
|
|
}
|
|
}
|
|
|
|
-int webserver::requests_answer_first_step(
|
|
+MHD_Result webserver::requests_answer_first_step(
|
|
MHD_Connection* connection,
|
|
struct details::modded_request* mr
|
|
)
|
|
@@ -574,7 +578,7 @@ int webserver::requests_answer_first_step(
|
|
return MHD_YES;
|
|
}
|
|
|
|
-int webserver::requests_answer_second_step(
|
|
+MHD_Result webserver::requests_answer_second_step(
|
|
MHD_Connection* connection, const char* method,
|
|
const char* version, const char* upload_data,
|
|
size_t* upload_data_size, struct details::modded_request* mr
|
|
@@ -597,7 +601,7 @@ int webserver::requests_answer_second_step(
|
|
return MHD_YES;
|
|
}
|
|
|
|
-int webserver::finalize_answer(
|
|
+MHD_Result webserver::finalize_answer(
|
|
MHD_Connection* connection,
|
|
struct details::modded_request* mr,
|
|
const char* method
|
|
@@ -731,10 +735,10 @@ int webserver::finalize_answer(
|
|
mr->dhrs->decorate_response(raw_response);
|
|
to_ret = mr->dhrs->enqueue_response(connection, raw_response);
|
|
MHD_destroy_response(raw_response);
|
|
- return to_ret;
|
|
+ return (MHD_Result) to_ret;
|
|
}
|
|
|
|
-int webserver::complete_request(
|
|
+MHD_Result webserver::complete_request(
|
|
MHD_Connection* connection,
|
|
struct details::modded_request* mr,
|
|
const char* version,
|
|
@@ -750,7 +754,7 @@ int webserver::complete_request(
|
|
return finalize_answer(connection, mr, method);
|
|
}
|
|
|
|
-int webserver::answer_to_connection(void* cls, MHD_Connection* connection,
|
|
+MHD_Result webserver::answer_to_connection(void* cls, MHD_Connection* connection,
|
|
const char* url, const char* method,
|
|
const char* version, const char* upload_data,
|
|
size_t* upload_data_size, void** con_cls
|
|
--
|
|
2.26.2
|
|
|