Hide home directory when chrooted or guest. From Ake Holmlund
authorLove Hörnquist Åstrand <lha@kth.se>
Sat, 25 Apr 2009 16:25:36 +0000 (16:25 +0000)
committerLove Hörnquist Åstrand <lha@kth.se>
Sat, 25 Apr 2009 16:25:36 +0000 (16:25 +0000)
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25129 ec53bebd-3082-4978-b11e-865c3cabbd6b

appl/ftp/ftpd/extern.h
appl/ftp/ftpd/ftpcmd.y
appl/ftp/ftpd/popen.c

index db40f2fdd21da09c11f46147f6e24a6a38ef4609..fb4852728701b204a390e3aaf43384c7a5ce3541 100644 (file)
@@ -129,6 +129,7 @@ extern      struct sockaddr *data_dest;
 extern int logged_in;
 extern struct passwd *pw;
 extern int guest;
+extern  int dochroot;
 extern int logging;
 extern int type;
 extern off_t file_size;
index 6ec03d6657ea648990b451da3deaf53b6b953398..eb672fdbbfe15679534dac25b33dec0202d514f9 100644 (file)
@@ -352,8 +352,12 @@ cmd
                }
        | CWD CRLF check_login
                {
-                       if ($3)
-                               cwd(pw->pw_dir);
+                       if ($3) {
+                               const char *path = pw->pw_dir;
+                               if (dochroot || guest)
+                                       path = "/";
+                               cwd(path);
+                       }
                }
        | CWD SP pathname CRLF check_login
                {
index abf4aa442e0a925ed3cee16ce1bfc77c11f57b38..916e32f758a8cce835fa69f87d819c045d9f77f7 100644 (file)
@@ -73,8 +73,6 @@ RCSID("$Id$");
 static int *pids;
 static int fds;
 
-extern int dochroot;
-
 /* return path prepended with ~ftp if that file exists, otherwise
  * return path unchanged
  */