Esempio n. 1
0
def list_exists(listname):
    """Return true iff list `listname' exists."""
    # The existance of any of the following file proves the list exists
    # <wink>: config.pck, config.pck.last, config.db, config.db.last
    #
    # The former two are for 2.1alpha3 and beyond, while the latter two are
    # for all earlier versions.
    basepath = Site.get_listpath(listname)
    for ext in ('.pck', '.pck.last', '.db', '.db.last'):
        dbfile = os.path.join(basepath, 'config' + ext)
        if os.path.exists(dbfile):
            return True
    return False
Esempio n. 2
0
def list_exists(listname):
    """Return true iff list `listname' exists."""
    # The existance of any of the following file proves the list exists
    # <wink>: config.pck, config.pck.last, config.db, config.db.last
    #
    # The former two are for 2.1alpha3 and beyond, while the latter two are
    # for all earlier versions.
    basepath = Site.get_listpath(listname)
    for ext in ('.pck', '.pck.last', '.db', '.db.last'):
        dbfile = os.path.join(basepath, 'config' + ext)
        if os.path.exists(dbfile):
            return True
    return False
Esempio n. 3
0
def list_exists(listname):
    """Return true iff list `listname' exists."""
    # The existance of any of the following file proves the list exists
    # <wink>: config.pck, config.pck.last, config.db, config.db.last
    #
    # The former two are for 2.1alpha3 and beyond, while the latter two are
    # for all earlier versions.
    #
    # But first ensure the list name doesn't contain a path traversal
    # attack.
    if len(re.sub(mm_cfg.ACCEPTABLE_LISTNAME_CHARACTERS, '', listname)) > 0:
        syslog('mischief', 'Hostile listname: %s', listname)
        return False
    basepath = Site.get_listpath(listname)
    for ext in ('.pck', '.pck.last', '.db', '.db.last'):
        dbfile = os.path.join(basepath, 'config' + ext)
        if os.path.exists(dbfile):
            return True
    return False
Esempio n. 4
0
def list_exists(listname):
    """Return true iff list `listname' exists."""
    # The existance of any of the following file proves the list exists
    # <wink>: config.pck, config.pck.last, config.db, config.db.last
    #
    # The former two are for 2.1alpha3 and beyond, while the latter two are
    # for all earlier versions.
    #
    # But first ensure the list name doesn't contain a path traversal
    # attack.
    if len(re.sub(mm_cfg.ACCEPTABLE_LISTNAME_CHARACTERS, "", listname)) > 0:
        syslog("mischief", "Hostile listname: %s", listname)
        return False
    basepath = Site.get_listpath(listname)
    for ext in (".pck", ".pck.last", ".db", ".db.last"):
        dbfile = os.path.join(basepath, "config" + ext)
        if os.path.exists(dbfile):
            return True
    return False
Esempio n. 5
0
	return

    if not Utils.list_exists(oldlistname):
            usage(1, "List '%s' not exists." % (oldlistname))

    if Utils.list_exists(newlistname):
            usage(1, "List '%s' already exists." % (newlistname))

    if verbose:
        print 'Renaming list %s to %s.' % (oldlistname, newlistname)

    oldmlist = MailList.MailList(oldlistname)
    if not oldmlist.Locked():
       oldmlist.Lock()
    
    oldlistpath = Site.get_listpath(oldlistname)
    lists_path = os.path.dirname(oldlistpath)
    newlistpath = lists_path + '/' + newlistname

    os.rename(oldlistpath, newlistpath)
    

    if verbose:
        print 'Assing archives of list %s to %s.' % (oldlistname, newlistname)
  
    oldarchdir = Site.get_archpath(oldlistname)
    arch_dir = os.path.dirname(oldarchdir)
    newarchdir = arch_dir + '/' + newlistname

    oldmbox = arch_dir + '/' + oldlistname + '.mbox'
    newmbox = arch_dir + '/' + newlistname + '.mbox'