Esempio n. 1
0
        /// <summary>
        /// Register
        /// </summary>
        private void Register()
        {
            ifdata = iFolderData.GetData();

            simiasEventClient = new IProcEventClient(
                new IProcEventError(ErrorHandler), null);

            simiasEventClient.Register();

            simiasEventClient.SetEvent(IProcEventAction.AddNodeCreated,
                                       new IProcEventHandler(SimiasEventHandler));

            simiasEventClient.SetEvent(IProcEventAction.AddNodeChanged,
                                       new IProcEventHandler(SimiasEventHandler));

            simiasEventClient.SetEvent(IProcEventAction.AddNodeDeleted,
                                       new IProcEventHandler(SimiasEventHandler));

            simiasEventClient.SetEvent(IProcEventAction.AddCollectionSync,
                                       new IProcEventHandler(SimiasEventSyncCollectionHandler));

            simiasEventClient.SetEvent(IProcEventAction.AddFileSync,
                                       new IProcEventHandler(SimiasEventSyncFileHandler));

            simiasEventClient.SetEvent(IProcEventAction.AddNotifyMessage,
                                       new IProcEventHandler(SimiasEventNotifyHandler));

            runEventThread = true;
            SEThread.Start();
        }
Esempio n. 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="parent">GTK Parent Window</param>
        /// <param name="curDomain">Current Domain</param>
        public EnterpriseAccountDialog(Window parent, DomainInformation curDomain)
            : base(parent, curDomain)
        {
            ifdata = iFolderData.GetData();
//			this.simiasManager = Util.GetSimiasManager();

            domainController = DomainController.GetDomainController();

            bServerAddressChanged = false;
            bPasswordChanged      = false;

            SetupDialog();

            this.Response +=
                new ResponseHandler(OnDialogResponse);

            // FIXME: Figure out if we need to register for when the window closes so that fields will be saved.
            // I believe that the FocusOutEventHandlers should already take care of it, but you never know
        }
Esempio n. 3
0
        /// <summary>
        /// Logout
        /// </summary>
        /// <param name="dom">Domain Information</param>
        public void LogoutDomain(DomainInformation dom)
        {
            try
            {
                domainController.LogoutDomain(dom.ID);

                dom.Authenticated = false;

                // In the new accounts model, when a user makes an
                // account go offline, we should also disable the account.
//				if (dom.Active)
//				{
//					domainController.InactivateDomain(dom.ID);
//					UpdateDomainStatus(dom.ID);
//				}
//				else
//				{
                //UpdateDomainStatus(dom.ID);
                iFolderData ifdata = iFolderData.GetData();
                ifdata.Refresh();
//				}
            }
            catch (Exception)
            {
                iFolderMsgDialog dg = new iFolderMsgDialog(
                    topLevelWindow,
                    iFolderMsgDialog.DialogType.Error,
                    iFolderMsgDialog.ButtonSet.Ok,
                    "",
                    Util.GS("Unable to log out of the iFolder Server"),
                    Util.GS("An error was encountered while logging out of the iFolder Server.  If the problem persists, please contact your network administrator."));
                dg.Run();
                dg.Hide();
                dg.Destroy();
            }
        }
Esempio n. 4
0
        ///<summary>
        /// Start Simias
        ///</summary>
        ///<param name="args">Array of strings as arguments</param>
        public static void StartSimias(string[] args)
        {
            bool simiasRunning = false;

            simiasManager = Util.CreateSimiasManager(args);

            simiasManager.Start();

            string localServiceUrl = simiasManager.WebServiceUri.ToString();

            ifws     = new iFolderWebService();
            ifws.Url = localServiceUrl + "/iFolder.asmx";
            LocalService.Start(ifws, simiasManager.WebServiceUri, simiasManager.DataPath);

            simws     = new SimiasWebService();
            simws.Url = localServiceUrl + "/Simias.asmx";
            LocalService.Start(simws, simiasManager.WebServiceUri, simiasManager.DataPath);

            while (!simiasRunning)
            {
                try
                {
                    ifws.Ping();
                    simiasRunning = true;
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }

                if (forceShutdown)
                {
                    ForceQuit();
                }

                // Wait and ping again
                System.Threading.Thread.Sleep(10);
            }

            if (forceShutdown)
            {
                ForceQuit();
            }
            else
            {
                try
                {
                    simiasEventBroker = SimiasEventBroker.GetSimiasEventBroker();

                    // set up to have data ready for events
                    ifdata = iFolderData.GetData();

                    domainController = DomainController.GetDomainController();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    ifws = null;
                    ForceQuit();
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Event handler for Domain Login COmpleted
        /// </summary>
        private void OnDomainLoginCompleted(object o, DomainLoginCompletedArgs args)
        {
            if (WaitDialog != null)
            {
                WaitDialog.Hide();
                WaitDialog.Destroy();
                WaitDialog = null;
            }

            Status authStatus = args.AuthenticationStatus;

            if (authStatus != null)
            {
                switch (authStatus.statusCode)
                {
                case StatusCodes.Success:
                case StatusCodes.SuccessInGrace:
                    if (LoginDialog != null)
                    {
                        LoginDialog.Hide();
                        LoginDialog.Destroy();
                        LoginDialog = null;
                    }
                    // Check if any recovery agent present;
                    // if( domainController.GetRAList(args.DomainID) == null)
                    // {
                    // No recovery agent present;
                    //		return;
                    // }
                    ShowClientUpgradeMessageBox();
                    iFolderWebService ifws = DomainController.GetiFolderService();
                    int policy             = ifws.GetSecurityPolicy(args.DomainID);
                    if (policy % 2 == 0)
                    {
                        break;
                    }
                    bool passphraseStatus = simws.IsPassPhraseSet(args.DomainID);
                    if (passphraseStatus == true)
                    {
                        bool rememberOption = simws.GetRememberOption(args.DomainID);
                        if (rememberOption == false)
                        {
                            ShowVerifyDialog(args.DomainID, simws);
                        }
                        else
                        {
                            Debug.PrintLine(" remember Option true. Checking for passphrase existence");
                            string passphrasecheck = simws.GetPassPhrase(args.DomainID);
                            if (passphrasecheck == null || passphrasecheck == "")
                            {
                                Debug.PrintLine("BugBug: Passphrase doesn't exist");
                                ShowVerifyDialog(args.DomainID, simws);
                            }
                        }
                    }
                    else
                    {
                        iFolderWindow.ShowEnterPassPhraseDialog(args.DomainID, simws);
                    }

//						string[] array = domainController.GetRAList( args.DomainID);
                    iFolderData ifdata = iFolderData.GetData();
                    ifdata.Refresh();
                    UpdateWidgetSensitivity();
                    break;

                case StatusCodes.InvalidCertificate:
                    DomainInformation dom = domainController.GetDomain(args.DomainID);
                    if (authStatus.UserName != null)
                    {
                        dom.Host = authStatus.UserName;
                    }
                    byte[] byteArray = simws.GetCertificate(dom.Host);
                    System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(byteArray);

                    iFolderMsgDialog dialog = new iFolderMsgDialog(
                        null,
                        iFolderMsgDialog.DialogType.Question,
                        iFolderMsgDialog.ButtonSet.YesNo,
                        "",
                        Util.GS("Accept the certificate of this server?"),
                        string.Format(Util.GS("iFolder is unable to verify \"{0}\" as a trusted server.  You should examine this server's identity certificate carefully."), dom.Host),
                        cert.ToString(true));

                    Gdk.Pixbuf certPixbuf = new Gdk.Pixbuf(Util.ImagesPath("ifolder-application-x-x509-ca-cert_48.png"));
                    if (certPixbuf != null && dialog.Image != null)
                    {
                        dialog.Image.Pixbuf = certPixbuf;
                    }

                    int rc = dialog.Run();
                    dialog.Hide();
                    dialog.Destroy();
                    if (rc == -8)                            // User clicked the Yes button
                    {
                        simws.StoreCertificate(byteArray, dom.Host);
                        LoginDialog.Respond(Gtk.ResponseType.Ok);
                    }
                    else
                    {
                        LoginDialog.Respond(Gtk.ResponseType.Cancel);
                    }
                    break;

                case StatusCodes.UserAlreadyMoved:
                    LoginDialog.Respond(Gtk.ResponseType.Ok);
                    break;

                default:
                    Util.ShowLoginError(topLevelWindow, authStatus.statusCode);

                    if (LoginDialog != null)
                    {
                        LoginDialog.Present();
                    }

                    UpdateDomainStatus(args.DomainID);
                    break;
                }
                //UpdateiFolderWindowOnLoginComplete();
            }
            else
            {
                Util.ShowLoginError(topLevelWindow, StatusCodes.Unknown);

                if (LoginDialog != null)
                {
                    LoginDialog.Present();
                }

                UpdateDomainStatus(args.DomainID);
            }

            iFolderWindow ifwin = Util.GetiFolderWindow();

            ifwin.UpdateServerInfoForSelectedDomain();
            ifwin.UpdateListViewItems();
        }