Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.21.46.129
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/3/task/3/cwd/srv/modoboa/env/lib64/python3.5/site-packages/modoboa/relaydomains/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/3/task/3/cwd/srv/modoboa/env/lib64/python3.5/site-packages/modoboa/relaydomains/lib.py
"""Internal library."""

from django.utils.translation import ugettext as _

from modoboa.admin import models as admin_models
from modoboa.lib.exceptions import BadRequest
from modoboa.transport import backends as tr_backends, models as tr_models


def import_relaydomain(user, row, formopts):
    """Specific code for relay domains import"""
    if len(row) != 7:
        raise BadRequest(_("Invalid line"))
    domain = admin_models.Domain(
        name=row[1].strip(), type="relaydomain", quota=0,
        enabled=(row[5].strip().lower() in ["true", "1", "yes", "y"])
    )
    domain.save(creator=user)
    settings = {
        "relay_target_host": row[2].strip(),
        "relay_target_port": row[3].strip(),
        "relay_verify_recipients": (
            row[6].strip().lower() in ["true", "1", "yes", "y"])
    }
    transport = tr_models.Transport(
        pattern=domain.name, service="relay", _settings=settings)
    tr_backends.manager.get_backend("relay").serialize(transport)
    transport.save()

Anon7 - 2022
AnonSec Team