Merge pull request #19861 from womfoo/fix/netdata

netdata: allow execution without a config file
This commit is contained in:
Tim Steinbach 2016-11-02 19:45:21 -04:00 committed by GitHub
commit 29f679d32e
2 changed files with 36 additions and 5 deletions

View File

@ -13,11 +13,22 @@ stdenv.mkDerivation rec{
buildInputs = [ autoreconfHook zlib pkgconfig libuuid ];
preConfigure = ''
export ZLIB_CFLAGS=" "
export ZLIB_LIBS="-lz"
export UUID_CFLAGS=" "
export UUID_LIBS="-luuid"
# Allow UI to load when running as non-root
patches = [ ./web_access.patch ];
# Build will fail trying to create /var/{cache,lib,log}/netdata without this
postPatch = ''
sed -i '/dist_.*_DATA = \.keep/d' src/Makefile.am
'';
configureFlags = [
"--localstatedir=/var"
];
# App fails on runtime if the default config file is not detected
# The upstream installer does prepare an empty file too
postInstall = ''
touch $out/etc/netdata/netdata.conf
'';
meta = with stdenv.lib; {

View File

@ -0,0 +1,20 @@
--- a/src/web_client.c.orig
+++ b/src/web_client.c
@@ -331,7 +331,7 @@
buffer_sprintf(w->response.data, "File '%s' does not exist, or is not accessible.", webfilename);
return 404;
}
-
+#if 0
// check if the file is owned by expected user
if(stat.st_uid != web_files_uid()) {
error("%llu: File '%s' is owned by user %u (expected user %u). Access Denied.", w->id, webfilename, stat.st_uid, web_files_uid());
@@ -345,7 +345,7 @@
buffer_sprintf(w->response.data, "Access to file '%s' is not permitted.", webfilename);
return 403;
}
-
+#endif
if((stat.st_mode & S_IFMT) == S_IFDIR) {
snprintfz(webfilename, FILENAME_MAX, "%s/index.html", filename);
return mysendfile(w, webfilename);