From 38214aa94ddf36051f83393412f57aec9e56ea51 Mon Sep 17 00:00:00 2001 From: dododedodonl Date: Thu, 27 Sep 2012 23:27:43 +0300 Subject: [PATCH] Option to not sandbox the username Option to disable the username to be included in the sandbox path. By default the username will be included. --- ftpd.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ftpd.js b/ftpd.js index 9356bdd..c342ebd 100755 --- a/ftpd.js +++ b/ftpd.js @@ -439,10 +439,17 @@ function createServer(host, sandbox) { socket.emit( "command:pass", commandArg, - function(username) { // implementor should call this on successful password check + function(username, sandboxUsername) { // implementor should call this on successful password check socket.write("230 Logged on\r\n"); socket.username = username; - socket.sandbox = PathModule.join(server.baseSandbox, username); + + //Sandbox the username by default, but overwrite is possible (true/false) + sandboxUsername = (typeof sandboxUsername === "undefined") ? true : sandboxUsername; + if(sandboxUsername) { + socket.sandbox = PathModule.join(server.baseSandbox, username); + } else { + socket.sandbox = server.baseSandbox; + } }, function() { // call second callback if password incorrect socket.write("530 Invalid password\r\n");