Mercurial > hg-stable
changeset 28342:bd05d38a1002
chgserver: use basename for socket symlink
Previously we use full path and the symlink may point to outside (unsafe)
world if the directory is moved. This patch fixes it by only linking to
basename of the target. Therefore the symbolic link and socket files will
always stay in the same directory.
author | Jun Wu <quark@fb.com> |
---|---|
date | Fri, 04 Mar 2016 13:18:02 +0000 |
parents | 8286f551b7ee |
children | a6c2310b3827 |
files | hgext/chgserver.py |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/chgserver.py Thu Mar 03 18:34:19 2016 +0100 +++ b/hgext/chgserver.py Fri Mar 04 13:18:02 2016 +0000 @@ -613,7 +613,7 @@ if self.baseaddress == self.address: return tempaddress = _tempaddress(self.baseaddress) - os.symlink(self.address, tempaddress) + os.symlink(os.path.basename(self.address), tempaddress) util.rename(tempaddress, self.baseaddress) def _reloadconfig(self, signum, frame):