def GetAttachLink(self, session): _hash = Util.HashGen(self.path(), "python nb") filename = '' for i in range(2): filename += "%0x" % struct.unpack('=I', _hash[i*4:(i+1)*4]) link = "http://%s/bbscon.php?b=xattach&f=%s" % (session.GetMirror(Config.Config.GetInt('ATTACHMENT_PORT', 80)), filename) linkfile = "%s/boards/xattach/%s" % (Config.BBS_ROOT, filename) target = "../../%s" % self.path() try: os.symlink(target, linkfile) except: # we should not omit other errors # anyway... pass return link
def SetPasswd(self, passwd): self.userec.md5passwd = Util.HashGen(passwd, self.name)
def Authorize(self, password): return (Util.HashGen(password, self.name) == self.userec.md5passwd and self.HasPerm(PERM_BASIC))