Blame SOURCES/0053-Always-do-chdir-after-chroot.patch

bd689f
From 315f9720db94af3319c9550feaf473b9cf09aeac Mon Sep 17 00:00:00 2001
bd689f
From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <olysonek@redhat.com>
bd689f
Date: Thu, 3 May 2018 13:20:28 +0200
bd689f
Subject: [PATCH 53/59] Always do chdir("/") after chroot()
bd689f
bd689f
Always do chdir("/") after chroot() to be more sure we'll never get out
bd689f
of it. This will not affect the working directory after calling
bd689f
vsf_sysutil_chroot(), because in the current state vsftpd always calls
bd689f
vsf_sysutil_chroot(".").
bd689f
---
bd689f
 sysutil.c | 5 +++++
bd689f
 1 file changed, 5 insertions(+)
bd689f
bd689f
diff --git a/sysutil.c b/sysutil.c
bd689f
index b68583b..3014c05 100644
bd689f
--- a/sysutil.c
bd689f
+++ b/sysutil.c
bd689f
@@ -2588,6 +2588,11 @@ vsf_sysutil_chroot(const char* p_root_path)
bd689f
   {
bd689f
     die("chroot");
bd689f
   }
bd689f
+  retval = chdir("/");
bd689f
+  if (retval != 0)
bd689f
+  {
bd689f
+    die("chdir");
bd689f
+  }
bd689f
 }
bd689f
 
bd689f
 unsigned int
bd689f
-- 
bd689f
2.14.4
bd689f