예제 #1
0
        /// <summary>
        /// We need a password, raise an event to fetch it.
        /// </summary>
        /// <param name="pwType">
        /// name of the password (e.g. 'private key')
        /// </param>
        /// <returns>the given password, null if none</returns>
        internal string getPW(string pwType)
        {
            if (NoEvents)
            {
                return(null);
            }

            m_logs.logDebugLine(1, "Asking user for password \"" + pwType + "\"");
            NeedPasswordEventArgs args =
                new NeedPasswordEventArgs(pwType);

            if (NeedPassword != null)
            {
                NeedPassword(this, args);
            }
            else
            {
                return(null);
            }
            return(args.Password);
        }
예제 #2
0
        /// <summary>
        /// We need a password, raise an event to fetch it.
        /// </summary>
        /// <param name="pwType">
        /// name of the password (e.g. 'private key')
        /// </param>
        /// <returns>the given password, null if none</returns>
        internal string getPW(string pwType)
        {
            if (NoEvents)
            {
                return(null);
            }


            NeedPasswordEventArgs args =
                new NeedPasswordEventArgs(pwType);

            if (NeedPassword != null)
            {
                NeedPassword(this, args);
            }
            else
            {
                return(null);
            }
            return(args.Password);
        }
예제 #3
0
        /// <summary>
        /// We need a password, raise an event to fetch it.
        /// </summary>
        /// <param name="pwType">
        /// name of the password (e.g. 'private key')
        /// </param>
        /// <returns>the given password, null if none</returns>
        internal string getPW(string pwType)
        {
            if (NoEvents) return null;

            m_logs.logDebugLine(1, "Asking user for password \"" + pwType + "\"");
            NeedPasswordEventArgs args =
                new NeedPasswordEventArgs(pwType);

            if(NeedPassword != null)
                NeedPassword(this, args);
            else
                return null;
            return args.Password;
        }
예제 #4
0
        /// <summary>
        /// OVPN requests a password <br />
        /// generates and shows a form, answers via e
        /// </summary>
        /// <param name="sender">OVPN which requests the password</param>
        /// <param name="e">Information, what is needed</param>
        private void m_vpn_needPassword(object sender, NeedPasswordEventArgs e)
        {
            m_frmpw = new FrmPasswd();
            e.Password = m_frmpw.AskPass(e.PasswordType, Name);

            // if no password was entered, disconnect
            if (e.Password == null &&
                VPNConnection.State.CreateSnapshot().ConnectionState
                == VPNConnectionState.Initializing)
            {
                m_disconnectTimer.Start();
            }
            m_frmpw = null;
        }