]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
privsep: Disable RLIMIT_FSIZE when using the logfile option
authorRoy Marples <roy@marples.name>
Wed, 10 Jun 2020 06:04:29 +0000 (07:04 +0100)
committerRoy Marples <roy@marples.name>
Wed, 10 Jun 2020 06:04:29 +0000 (07:04 +0100)
We cannot offload it to the root process either because not all
sandboxes have access to that.....
Really need to fix syslog so that it starts before dhcpcd.

src/privsep.c

index a29c1da6cd4f85b17916932d5ca5a6a6494cd90f..ec8e4cc1ac9ddeb6ba8facbce2deb0c347fd287e 100644 (file)
@@ -164,10 +164,16 @@ ps_dropprivs(struct dhcpcd_ctx *ctx)
        }
 
 #if !defined(HAVE_CAPSICUM) && !defined(HAVE_PLEDGE)
-       /* Prohibit large files */
-       if (setrlimit(RLIMIT_FSIZE, &rzero) == -1) {
-               logerr("setrlimit RLIMIT_FSIZE");
-               return -1;
+       /*
+        * Prohibit large files
+        * Cannot offload this to the privilged actioneer because
+        * only the master process has access to it.
+        */
+       if (ctx->logfile == NULL) {
+               if (setrlimit(RLIMIT_FSIZE, &rzero) == -1) {
+                       logerr("setrlimit RLIMIT_FSIZE");
+                       return -1;
+               }
        }
 #endif