Ejemplo n.º 1
0
Archivo: digest.py Proyecto: net9/pybbs
    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
Ejemplo n.º 2
0
 def SetPasswd(self, passwd):
     self.userec.md5passwd = Util.HashGen(passwd, self.name)
Ejemplo n.º 3
0
 def Authorize(self, password):
     return (Util.HashGen(password, self.name) == self.userec.md5passwd
             and self.HasPerm(PERM_BASIC))