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

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