comparison hgext/chgserver.py @ 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 e00e57d83653
children 8f9661d1637b
comparison
equal deleted inserted replaced
28341:8286f551b7ee 28342:bd05d38a1002
611 611
612 def _createsymlink(self): 612 def _createsymlink(self):
613 if self.baseaddress == self.address: 613 if self.baseaddress == self.address:
614 return 614 return
615 tempaddress = _tempaddress(self.baseaddress) 615 tempaddress = _tempaddress(self.baseaddress)
616 os.symlink(self.address, tempaddress) 616 os.symlink(os.path.basename(self.address), tempaddress)
617 util.rename(tempaddress, self.baseaddress) 617 util.rename(tempaddress, self.baseaddress)
618 618
619 def _reloadconfig(self, signum, frame): 619 def _reloadconfig(self, signum, frame):
620 self.ui = self.server.ui = _renewui(self.ui) 620 self.ui = self.server.ui = _renewui(self.ui)
621 621