public void EsmtpUserListが有効な場合の認証(String user, String pass, bool expected)
 {
     //setUp
     var sut = new SmtpAuthUserList(false, _mailBox, _esmtpUserList);
     //exercise
     var actual = sut.Auth(user, pass);
     //verify
     Assert.That(actual, Is.EqualTo(expected));
 }
 public void GetPass_両方有効な場合(String user, String pass)
 {
     //setUp
     var sut = new SmtpAuthUserList(true, _mailBox, _esmtpUserList);
     var expected = pass;
     //exercise
     var actual = sut.GetPass(user);
     //verify
     Assert.That(actual, Is.EqualTo(expected));
 }
Exemple #3
0
        public SmtpAuth(SmtpAuthUserList smtpAuthUserList, bool usePlain, bool useLogin, bool useCramMd5)
        {
            _smtpAuthUserList = smtpAuthUserList;

            _usePlain = usePlain;
            _useLogin = useLogin;
            _useCramMd5 = useCramMd5;

            if (_usePlain || _useLogin || _useCramMd5){
                IsFinish = false; //認証未完了
            } else{
                IsFinish = true; //認証不要
            }
        }
Exemple #4
0
        public SmtpAuth(SmtpAuthUserList smtpAuthUserList, bool usePlain, bool useLogin, bool useCramMd5)
        {
            _smtpAuthUserList = smtpAuthUserList;

            _usePlain   = usePlain;
            _useLogin   = useLogin;
            _useCramMd5 = useCramMd5;

            if (_usePlain || _useLogin || _useCramMd5)
            {
                IsFinish = false; //認証未完了
            }
            else
            {
                IsFinish = true; //認証不要
            }
        }
Exemple #5
0
        Fetch _fetch; //自動受信

        #endregion Fields

        #region Constructors

        //#endif
        //コンストラクタ
        public Server(Kernel kernel, Conf conf, OneBind oneBind)
            : base(kernel, conf, oneBind)
        {
            //Ver5.8.9
            if (kernel.RunMode == RunMode.Normal || kernel.RunMode == RunMode.Service) {
                //メールボックスの初期化状態確認
                if (kernel.MailBox == null || !kernel.MailBox.Status) {
                    Logger.Set(LogKind.Error, null, 4, "");
                    return; //初期化失敗(サーバは機能しない)
                }
            }

            //ドメイン名のリスト整備
            DomainList = new List<string>();
            foreach (var s in ((string)Conf.Get("domainName")).Split(',')) {
                //Ver6.1.9
                // 設定時に誤って空白が入ってしまった際、強制的に削除する
                DomainList.Add(s.Trim());
                //DomainList.Add(s);
            }
            if (DomainList.Count == 0) {
                Logger.Set(LogKind.Error, null, 3, "");
                return;//初期化失敗(サーバは機能しない)
            }

            //エリアス初期化
            Alias = new Alias(DomainList, kernel.MailBox);
            foreach (var dat in (Dat)Conf.Get("aliasList")) {
                if (dat.Enable) {
                    var name = dat.StrList[0];
                    var alias = dat.StrList[1];
                    Alias.Add(name, alias, Logger);
                }
            }

            //メールキューの初期化
            _mailQueue = new MailQueue(kernel.ProgDir());

            //SaveMail初期化
            var receivedHeader = new ReceivedHeader(kernel, (string)Conf.Get("receivedHeader"));
            _mailSave = new MailSave(kernel.MailBox,Alias, _mailQueue,Logger, receivedHeader, DomainList);

            var always = (bool)Conf.Get("always");//キュー常時処理
            _agent = new Agent(kernel, this, Conf, Logger, _mailQueue, always);

            //中継許可の初期化
            _relay = new Relay((Dat)Conf.Get("allowList"), (Dat)Conf.Get("denyList"), (int)Conf.Get("order"), Logger);

            //PopBeforeSmtp
            _popBeforeSmtp = new PopBeforeSmtp((bool)conf.Get("usePopBeforeSmtp"), (int)conf.Get("timePopBeforeSmtp"), kernel.MailBox);

            //usePopAccountがfalseの時、内部でmailBoxが無効化される
            _smtpAuthUserList = new SmtpAuthUserList((bool)Conf.Get("usePopAcount"), Kernel.MailBox, (Dat)Conf.Get("esmtpUserList"));
            _smtpAuthRange = new SmtpAuthRange((Dat)Conf.Get("range"), (int)Conf.Get("enableEsmtp"), Logger);

            //ヘッダ置換
            _changeHeader = new ChangeHeader((Dat)Conf.Get("patternList"), (Dat)Conf.Get("appendList"));

            //Ver5.3.3 Ver5.2以前のバージョンのカラムの違いを修正する
            var d = (Dat)Conf.Get("hostList");
            if (d.Count > 0 && d[0].StrList.Count == 6) {
                foreach (var o in d) {
                    o.StrList.Add("False");
                }
                conf.Set("hostList", d);
                conf.Save(kernel.IniDb);
            }

            //#if ML_SERVER
            _mlList = new MlList(kernel,this,_mailSave, DomainList);
            //#endif
        }
Exemple #6
0
 public void SetUp()
 {
     var esmtpUserList = new Dat(new CtrlType[] { CtrlType.TextBox, CtrlType.TextBox });
     esmtpUserList.Add(true, "user1\t3OuFXZzV8+iY6TC747UpCA==");
     _smtpAuthUserList = new SmtpAuthUserList(false, null, esmtpUserList);
 }
Exemple #7
0
        readonly MlList _mlList;//MLリスト
//#endif

        //コンストラクタ
        public Server(Kernel kernel, Conf conf, OneBind oneBind)
            : base(kernel, conf, oneBind)
        {
            //Ver5.8.9
            if (kernel.RunMode == RunMode.Normal || kernel.RunMode == RunMode.Service)
            {
                //メールボックスの初期化状態確認
                if (kernel.MailBox == null || !kernel.MailBox.Status)
                {
                    Logger.Set(LogKind.Error, null, 4, "");
                    return; //初期化失敗(サーバは機能しない)
                }
            }


            //ドメイン名のリスト整備
            DomainList = new List <string>();
            foreach (var s in ((string)Conf.Get("domainName")).Split(','))
            {
                //Ver6.1.9
                // 設定時に誤って空白が入ってしまった際、強制的に削除する
                DomainList.Add(s.Trim());
                //DomainList.Add(s);
            }
            if (DomainList.Count == 0)
            {
                Logger.Set(LogKind.Error, null, 3, "");
                return;//初期化失敗(サーバは機能しない)
            }

            //エリアス初期化
            Alias = new Alias(DomainList, kernel.MailBox);
            foreach (var dat in (Dat)Conf.Get("aliasList"))
            {
                if (dat.Enable)
                {
                    var name  = dat.StrList[0];
                    var alias = dat.StrList[1];
                    Alias.Add(name, alias, Logger);
                }
            }

            //メールキューの初期化
            _mailQueue = new MailQueue(kernel.ProgDir());

            //SaveMail初期化
            var receivedHeader = new ReceivedHeader(kernel, (string)Conf.Get("receivedHeader"));

            _mailSave = new MailSave(kernel.MailBox, Alias, _mailQueue, Logger, receivedHeader, DomainList);

            var always = (bool)Conf.Get("always");//キュー常時処理

            _agent = new Agent(kernel, this, Conf, Logger, _mailQueue, always);

            //中継許可の初期化
            _relay = new Relay((Dat)Conf.Get("allowList"), (Dat)Conf.Get("denyList"), (int)Conf.Get("order"), Logger);

            //PopBeforeSmtp
            _popBeforeSmtp = new PopBeforeSmtp((bool)conf.Get("usePopBeforeSmtp"), (int)conf.Get("timePopBeforeSmtp"), kernel.MailBox);


            //usePopAccountがfalseの時、内部でmailBoxが無効化される
            _smtpAuthUserList = new SmtpAuthUserList((bool)Conf.Get("usePopAcount"), Kernel.MailBox, (Dat)Conf.Get("esmtpUserList"));
            _smtpAuthRange    = new SmtpAuthRange((Dat)Conf.Get("range"), (int)Conf.Get("enableEsmtp"), Logger);

            //ヘッダ置換
            _changeHeader = new ChangeHeader((Dat)Conf.Get("patternList"), (Dat)Conf.Get("appendList"));


            //Ver5.3.3 Ver5.2以前のバージョンのカラムの違いを修正する
            var d = (Dat)Conf.Get("hostList");

            if (d.Count > 0 && d[0].StrList.Count == 6)
            {
                foreach (var o in d)
                {
                    o.StrList.Add("False");
                }
                conf.Set("hostList", d);
                conf.Save(kernel.IniDb);
            }

//#if ML_SERVER
            _mlList = new MlList(kernel, this, _mailSave, DomainList);
//#endif
        }