From 46f30392173c62c42801815c54fd9b9ac8c986c8 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Fri, 26 Apr 2013 18:36:00 -0500 Subject: [PATCH] SFTP: Fix broken mkdir Thanks Antek88! --- phpseclib/Net/SFTP.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index 46245a42..4a0eb11f 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -1331,7 +1331,9 @@ class Net_SFTP extends Net_SSH2 { } $dir = $this->_realpath($dir); - $attr = $mode == -1 ? chr(0) : pack('N2', NET_SFTP_ATTR_PERMISSIONS, $mode & 07777); + // by not providing any permissions, hopefully the server will use the logged in users umask - their + // default permissions. + $attr = $mode == -1 ? "\0\0\0\0" : pack('N2', NET_SFTP_ATTR_PERMISSIONS, $mode & 07777); if ($recursive) { $dirs = explode('/', preg_replace('#/(?=/)|/$#', '', $dir)); @@ -1359,8 +1361,6 @@ class Net_SFTP extends Net_SSH2 { */ function _mkdir_helper($dir, $attr) { - // by not providing any permissions, hopefully the server will use the logged in users umask - their - // default permissions. if (!$this->_send_sftp_packet(NET_SFTP_MKDIR, pack('Na*a*', strlen($dir), $dir, $attr))) { return false; } @@ -2205,4 +2205,4 @@ class Net_SFTP extends Net_SSH2 { $this->pwd = false; parent::_disconnect($reason); } -} +} \ No newline at end of file