Rev 3562: do not chmod a directory over sftp unless necessary (Christophe in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Jul 18 01:52:20 BST 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3562
revision-id:pqm at pqm.ubuntu.com-20080718005210-ysk1505wgphsumzj
parent: pqm at pqm.ubuntu.com-20080717225948-n84fbip5sl9n1mde
parent: ian.clatworthy at canonical.com-20080718002308-yzhiwe0din1q5mpr
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2008-07-18 01:52:10 +0100
message:
do not chmod a directory over sftp unless necessary (Christophe
Troestler)
modified:
bzrlib/transport/sftp.py sftp.py-20051019050329-ab48ce71b7e32dfe
------------------------------------------------------------
revno: 3560.1.1
revision-id:ian.clatworthy at canonical.com-20080718002308-yzhiwe0din1q5mpr
parent: pqm at pqm.ubuntu.com-20080717220108-mjcsi7zryl615o91
parent: christophe.troestler at umh.ac.be-20080709093751-l5yht55owvjshi7f
committer: Ian Clatworthy <ian.clatworthy at canonical.com>
branch nick: ianc-integration
timestamp: Fri 2008-07-18 10:23:08 +1000
message:
do not chmod a directory over sftp unless necessary (Christophe Troestler)
modified:
bzrlib/transport/sftp.py sftp.py-20051019050329-ab48ce71b7e32dfe
------------------------------------------------------------
revno: 3526.4.3
revision-id:christophe.troestler at umh.ac.be-20080709093751-l5yht55owvjshi7f
parent: christophe.troestler at umh.ac.be-20080709093641-3ex2g37eq15fxhhi
parent: pqm at pqm.ubuntu.com-20080709054822-jrzq8pdw4w7ob493
committer: Christophe Troestler <Christophe.Troestler at umh.ac.be>
branch nick: sftp-mkdir
timestamp: Wed 2008-07-09 11:37:51 +0200
message:
Merged bzr.dev
added:
contrib/bash/bzrbashprompt.sh bzrbashprompt.sh-20080414112733-b78chl4ubylc6775-1
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/graph.py graph_walker.py-20070525030359-y852guab65d4wtn0-1
bzrlib/ignores.py ignores.py-20060712153832-2von9l0t7p43ixsv-1
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
bzrlib/mail_client.py mail_client.py-20070809192806-vuxt3t19srtpjpdn-1
bzrlib/smart/request.py request.py-20061108095550-gunadhxmzkdjfeek-1
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/test_errors.py test_errors.py-20060210110251-41aba2deddf936a8
bzrlib/tests/test_ignores.py test_ignores.py-20060712172354-vqq9ln0t8di27v53-1
bzrlib/tests/test_knit.py test_knit.py-20051212171302-95d4c00dd5f11f2b
bzrlib/tests/test_selftest.py test_selftest.py-20051202044319-c110a115d8c0456a
bzrlib/tests/test_smart.py test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
------------------------------------------------------------
revno: 3526.4.2
revision-id:christophe.troestler at umh.ac.be-20080709093641-3ex2g37eq15fxhhi
parent: christophe.troestler at umh.ac.be-20080709001159-2rihz5z2mjbng1yr
committer: Christophe Troestler <Christophe.Troestler at umh.ac.be>
branch nick: sftp-mkdir
timestamp: Wed 2008-07-09 11:36:41 +0200
message:
sftp: More informative warning message for chmod and suid/sgid bits problems.
modified:
bzrlib/transport/sftp.py sftp.py-20051019050329-ab48ce71b7e32dfe
------------------------------------------------------------
revno: 3526.4.1
revision-id:christophe.troestler at umh.ac.be-20080709001159-2rihz5z2mjbng1yr
parent: pqm at pqm.ubuntu.com-20080704171330-ieh195xj7su2k2xq
committer: Christophe Troestler <Christophe.Troestler at umh.ac.be>
branch nick: sftp-mkdir
timestamp: Wed 2008-07-09 02:11:59 +0200
message:
sftp transport: do not chmod a dir when unecessary (fix suid and sgid problems).
modified:
bzrlib/transport/sftp.py sftp.py-20051019050329-ab48ce71b7e32dfe
=== modified file 'bzrlib/transport/sftp.py'
--- a/bzrlib/transport/sftp.py 2008-05-08 04:33:38 +0000
+++ b/bzrlib/transport/sftp.py 2008-07-09 09:36:41 +0000
@@ -519,7 +519,21 @@
try:
self._get_sftp().mkdir(abspath, local_mode)
if mode is not None:
- self._get_sftp().chmod(abspath, mode=mode)
+ # chmod a dir through sftp will erase any sgid bit set
+ # on the server side. So, if the bit mode are already
+ # set, avoid the chmod. If the mode is not fine but
+ # the sgid bit is set, report a warning to the user
+ # with the umask fix.
+ stat = self._get_sftp().lstat(abspath)
+ mode = mode & 0777 # can't set special bits anyway
+ if mode != stat.st_mode & 0777:
+ if stat.st_mode & 06000:
+ warning('About to chmod %s over sftp, which will result'
+ ' in its suid or sgid bits being cleared. If'
+ ' you want to preserve those bits, change your '
+ ' environment on the server to use umask 0%03o.'
+ % (abspath, 0777 - mode))
+ self._get_sftp().chmod(abspath, mode=mode)
except (paramiko.SSHException, IOError), e:
self._translate_io_exception(e, abspath, ': unable to mkdir',
failure_exc=FileExists)
More information about the bazaar-commits
mailing list