示例#1
0
文件: Alias.cs 项目: jsakamoto/bjd5
 public Alias(List<string> domainList, MailBox mailBox)
 {
     _domainList = domainList;
     _mailBox = mailBox;
     if (domainList == null || domainList.Count < 1){
         throw new Exception("Alias.cs Alias() domainList.Count<1");
     }
 }
示例#2
0
        int _idCounter; //id作成のための順次番号生成カウンタ

        #endregion Fields

        #region Constructors

        public MailSave(MailBox mailBox, Alias alias,MailQueue mailQueue, Logger logger, ReceivedHeader receivedHeader, List<string> domainList)
        {
            _mailBox = mailBox;
            _alias = alias;
            _mailQueue = mailQueue;
            _logger = logger;
            _receivedHeader = receivedHeader;
            _domainList = domainList;
            _localBox = new LocalBox(_logger);
        }
示例#3
0
        public void SetUp()
        {
            var datUser = new Dat(new CtrlType[2] { CtrlType.TextBox, CtrlType.TextBox });
            datUser.Add(true, "user1\t3OuFXZzV8+iY6TC747UpCA==");
            datUser.Add(true, "user2\tNKfF4/Tw/WMhHZvTilAuJQ==");
            datUser.Add(true, "user3\tXXX");

            _conf = new Conf();
            _conf.Add("user", datUser);

            _mailBox = new MailBox(new Logger(), datUser, "c:\\tmp2\\bjd5\\Pop3Server\\mailbox");
        }
示例#4
0
 public void AuthTest(string user,string pass,bool expected)
 {
     //setUp
     var dir = (String)_conf.Get("dir");
     var datUser = (Dat) _conf.Get("user");
     var sut = new MailBox(new Logger(),datUser,dir);
     //var expected = true;
     //exercise
     var actual = sut.Auth(user,pass);
     //verify
     Assert.That(actual, Is.EqualTo(expected));
 }
示例#5
0
文件: Kernel.cs 项目: jsakamoto/bjd5
        //�e�X�g�p�R���X�g���N�^(MailBox�̂ݏ�����)
        public Kernel(String option)
        {
            _isTest = true;
            DefaultInitialize(null, null, null, null);

            if (option.IndexOf("MailBox") != -1){
                var op = ListOption.Get("MailBox");
                var conf = new Conf(op);
                var dir = ReplaceOptionEnv((String)conf.Get("dir"));
                var datUser = (Dat)conf.Get("user");
                MailBox = new MailBox(null, datUser, dir);
            }
        }
示例#6
0
文件: Chps.cs 项目: jsakamoto/bjd5
 //パスワード変更
 public static bool Change(string user, string pass, MailBox mailBox, Conf conf)
 {
     if (pass == null){
         //無効なパスワードの指定は失敗する
         return false;
     }
     var dat = (Dat) conf.Get("user");
     foreach (var o in dat){
         if (o.StrList[0] == user){
             o.StrList[1] = Crypt.Encrypt(pass);
             conf.Set("user", dat); //データ変更
             if (mailBox.SetPass(user, pass)){
                 if (mailBox.Auth(user, pass)){
                     return true;
                 }
             }
             return false;
         }
     }
     return false;
 }
示例#7
0
        //usePopAcountがfalseの時、内部で強制的にmailBoxが無効化される
        //usePopAcountがtrueの時、内部で強制的にesmtpUserListが無効化される
        public SmtpAuthUserList(bool usePopAccount,MailBox mailBox, IEnumerable<OneDat> esmtpUserList)
        {
            _mailBox = mailBox;

            if (esmtpUserList != null){
                foreach (var o in esmtpUserList){
                    if (!o.Enable){
                        continue;
                    }
                    var user = o.StrList[0];
                    var pass = o.StrList[1];
                    pass = Crypt.Decrypt(pass);
                    _ar.Add(new SmtpAuthOneUser(user, pass));
                }
            }

            if (!usePopAccount){
                //POPアカウントを使用しない場合
                _mailBox = null; //強制的にmailBoxを無効化する
            }
        }
示例#8
0
 public void SetUp()
 {
     var datUser = new Dat(new CtrlType[]{CtrlType.TextBox, CtrlType.TextBox});
     datUser.Add(true, "user1\t3OuFXZzV8+iY6TC747UpCA==");
     _mailBox = new MailBox(new Logger(), datUser, "c:\\tmp2\\bjd5\\SmtpServerTest\\mailbox");
 }
示例#9
0
文件: Kernel.cs 项目: jsakamoto/bjd5
        //�T�[�o�ċN���ŁA�ēx���s����鏉����
        public void ListInitialize()
        {
            //Logger���g�p�ł��Ȃ��Ԃ̃��O�́A������ɕۑ����āA���Logger�ɑ���
            var tmpLogger = new TmpLogger();

            //************************************************************
            // �j��
            //************************************************************
            if (ListOption != null){
                ListOption.Dispose();
                ListOption = null;
            }
            //Java fix
            if (ListTool != null){
                ListTool.Dispose();
                ListTool = null;
            }
            if (ListServer != null){
                ListServer.Dispose();
                ListServer = null;
            }
            if (MailBox != null){
                MailBox = null;
            }
            if (LogFile != null){
                LogFile.Dispose();
                LogFile = null;
            }

            //************************************************************
            // ������
            //************************************************************
            //ListPlugin �́BListOption��ListServer�����������Ԃ�����������
            //isTest=true�̏ꍇ�A�p�X��""�ɂ��āA�v���O�C��0�‚ŏ�������������

            //ListPlugin listPlugin = new ListPlugin((isTest) ? "" : string.Format("%s\\plugins", getProgDir()));
            var listPlugin = new ListPlugin(ProgDir());
            foreach (var o in listPlugin){
                //�����[�g�N���C�A���g�̏ꍇ�A���̃��O�́A��₱�����̂ŕ\�����Ȃ�
                if (RunMode == RunMode.Normal){
                    tmpLogger.Set(LogKind.Detail, null, 9000008, string.Format("{0}Server", o.Name));
                }
            }

            //ListOption�Ŋe�I�v�V���������������O�ɁAisJp�����͏��������Ă����K�v������̂�
            //�ŏ���OptionBasic��lang������ǂݏo��
            //Ver5.8.6 Java fix
            //_isJp = OptionIni.GetInstance().IsJp();
            _isJp = IniDb.IsJp();

            ListOption = new ListOption(this, listPlugin);

            //Ver5.9.1
            //���߂Ă�����ʉ߂���Ƃ��A�ߋ��̃o�[�W������Option��ǂݍ��ނ�
            //���I�v�V�����̓I�u�W�F�N�g�̒���OneOption�ɂ̂ݕێ������
            //���̏�ԂŁA�����̃I�v�V�����w���OK����ƁA���̃I�v�V�����ȊO��
            //Option.ini�ɕۑ�����Ȃ����ߔj������Ă��܂�
            //���̖��ɑΏ����邽�߁A�����ň�x�AOption.ini��ۑ����邱�Ƃɂ���
            if (!_isTest){
                ListOption.Save(IniDb);
            }

            //OptionBasic
            var confBasic = new Conf(ListOption.Get("Basic"));
            EditBrowse = (bool) confBasic.Get("editBrowse");

            //OptionLog
            var confOption = new Conf(ListOption.Get("Log"));
            LogView.SetFont((Font) confOption.Get("font"));

            if (RunMode == RunMode.Normal || RunMode == RunMode.Service){
                //LogFile�̏�����
                var saveDirectory = (String) confOption.Get("saveDirectory");
                saveDirectory = ReplaceOptionEnv(saveDirectory);
                var normalLogKind = (int) confOption.Get("normalLogKind");
                var secureLogKind = (int) confOption.Get("secureLogKind");
                var saveDays = (int) confOption.Get("saveDays");
                //Ver6.0.7
                var useLogFile = (bool)confOption.Get("useLogFile");
                var useLogClear = (bool) confOption.Get("useLogClear");
                if (!useLogClear){
                    saveDays = 0; //���O�̎����폜�������ȏꍇ�AsaveDays��0��Z�b�g����
                }
                if (saveDirectory == ""){
                    tmpLogger.Set(LogKind.Error, null, 9000045, "It is not appointed");
                } else{
                    tmpLogger.Set(LogKind.Detail, null, 9000032, saveDirectory);
                    try{
                        LogFile = new LogFile(saveDirectory, normalLogKind, secureLogKind, saveDays,useLogFile);
                    } catch (IOException e){
                        LogFile = null;
                        tmpLogger.Set(LogKind.Error, null, 9000031, e.Message);
                    }
                }

                //Ver5.8.7 Java fix
                //mailBox������
                foreach (var o in ListOption) {
                    //SmtpServer�Ⴕ���́APop3Server���g�p�����ꍇ�̂݃��[���{�b�N�X�����������
                    if (o.NameTag == "Smtp" || o.NameTag == "Pop3") {
                        if (o.UseServer) {
                            var conf = new Conf(ListOption.Get("MailBox"));
                            var dir = ReplaceOptionEnv((String) conf.Get("dir"));
                            var datUser = (Dat) conf.Get("user");
                            var logger = CreateLogger("MailBox", (bool)conf.Get("useDetailsLog"), null);
                            MailBox = new MailBox(logger,datUser, dir);
                            break;
                        }
                    }
                }

            }
            _logger = CreateLogger("kernel", true, null);
            tmpLogger.Release(_logger);

            //Ver5.8.7 Java fix �����[�g�N���C�A���g�̏ꍇ����[���{�b�N�X��쐬���Ă��܂��o�O��C��
            //            //mailBox������
            //            foreach (var o in ListOption){
            //                //SmtpServer�Ⴕ���́APop3Server���g�p�����ꍇ�̂݃��[���{�b�N�X�����������
            //                if (o.NameTag == "Smtp" || o.NameTag == "Pop3"){
            //                    if (o.UseServer){
            //                        var conf = new Conf(ListOption.Get("MailBox"));
            //                        MailBox = new MailBox(this, conf);
            //                        break;
            //                    }
            //                }
            //            }

            ListServer = new ListServer(this, listPlugin);

            ListTool = new ListTool();
            ListTool.Initialize(this);

            View.SetColumnText(); //Log�r���[�̃J�����e�L�X�g�̏�����
            Menu.Initialize(IsJp()); //���j���[�\�z�i����e�[�u���̏������j

            WebApi = new WebApi();
        }
示例#10
0
 public void SetUp()
 {
     //mailBoxに"user1"を登録
     var datUser = new Dat(new CtrlType[] { CtrlType.TextBox, CtrlType.TextBox });
     datUser.Add(true, "user1\t3OuFXZzV8+iY6TC747UpCA==");
     _mailBox = new MailBox(new Logger(), datUser, "c:\\tmp2\\bjd5\\SmtpServerTest\\mailbox");
     //esmtpUserListに"user2"を登録
     _esmtpUserList = new Dat(new CtrlType[]{CtrlType.TextBox, CtrlType.TextBox });
     _esmtpUserList.Add(true, "user2\tNKfF4/Tw/WMhHZvTilAuJQ==");
 }
示例#11
0
        public void SetUp()
        {
            _domainList = new List<string>();
            _domainList.Add("example.com");

            var datUser = new Dat(new CtrlType[] { CtrlType.TextBox, CtrlType.TextBox });
            datUser.Add(true, "user1\t3OuFXZzV8+iY6TC747UpCA==");
            datUser.Add(true, "user2\tNKfF4/Tw/WMhHZvTilAuJQ==");
            datUser.Add(true, "user3\tjNBu6GHNV633O4jMz1GJiQ==");
            _mailBox = new MailBox(new Logger(), datUser, "c:\\tmp2\\bjd5\\SmtpServerTest\\mailbox");
        }
示例#12
0
        public void SetUp()
        {
            const string dir = "c:\\tmp2\\bjd5\\BJDTest\\mailbox";

            _datUser = new Dat(new CtrlType[2]{CtrlType.TextBox, CtrlType.TextBox});
            _datUser.Add(true, "user1\t3OuFXZzV8+iY6TC747UpCA==");
            _datUser.Add(true, "user2\tNKfF4/Tw/WMhHZvTilAuJQ==");
            _datUser.Add(true, "user3\tXXX");

            sut = new MailBox(new Logger(),_datUser,dir);
        }
示例#13
0
 public PopBeforeSmtp(bool usePopBeforeSmtp, int timePopBeforeSmtp,MailBox mailBox)
 {
     _usePopBeforeSmtp = usePopBeforeSmtp;
     _timePopBeforeSmtp = timePopBeforeSmtp;
     _mailBox = mailBox;
 }
示例#14
0
文件: SvMail.cs 项目: jsakamoto/bjd5
        private readonly WebApi _webApi; //コントロール

        #endregion Fields

        #region Constructors

        public SvMail(Kernel kernel)
        {
            _webApi = kernel.WebApi;
            _mailBox = kernel.MailBox;
            _mailQueue = kernel.ProgDir() + "\\MailQueue";
        }