Пример #1
0
        private void ConnectToHost()
        {
            Logger.Log("FileShareManagerPlugIn.ConnectToHost", Logger.FileShareManagerLogLevel);

            if (_hn.creds.Invalidated)
            {
                _container.ShowError("File Browser PlugIn cannot connect to domain due to invalid credentials");
                _hn.IsConnectionSuccess = false;
                return;
            }
            if (!String.IsNullOrEmpty(_hn.hostName))
            {
                if (_currentHost != _hn.hostName)
                {
                    if (fileHandle != null)
                    {
                        fileHandle.Dispose();
                        fileHandle = null;
                    }

                    if (_pluginNode != null && !String.IsNullOrEmpty(_hn.hostName))
                    {
                        OpenHandle(_hn.hostName);
                    }

                    _currentHost = _hn.hostName;
                }
                _hn.IsConnectionSuccess = true;
            }
            else
            {
                _hn.IsConnectionSuccess = false;
            }
        }
Пример #2
0
        public override string OnWizardNext()
        {
            string errorMsg = string.Empty;

            bool bIsValidData = ValidateData(out errorMsg);

            if (!String.IsNullOrEmpty(errorMsg))
            {
                bIsValidData = true;
                container.ShowError(errorMsg);
                return(WizardDialog.NoPageChange);
            }

            if (!bIsValidData)
            {
                return(WizardDialog.NoPageChange);
            }

            parentDlg.shareInfo.folderName = textBoxFoldername.Text.Trim();
            parentDlg.shareInfo.hostName   = textBoxComputername.Text.Trim();
            parentDlg.shareInfo.shareName  = textBoxSharename.Text.Trim();
            parentDlg.shareInfo.shareDesc  = textBoxShareDesc.Text.Trim();

            return(base.OnWizardNext());
        }
Пример #3
0
        private void cm_OnConnect(object sender, EventArgs e)
        {
            //check if we are joined to a domain -- if not, use simple bind
            uint requestedFields = (uint)Hostinfo.FieldBitmaskBits.FQ_HOSTNAME;

            //string domainFQDN = null;

            if (_hn == null)
            {
                _hn = new Hostinfo();
            }

            //TODO: kerberize eventlog, so that creds are meaningful.
            //for now, there's no reason to attempt single sign-on
            requestedFields |= (uint)Hostinfo.FieldBitmaskBits.FORCE_USER_PROMPT;


            if (_hn != null)
            {
                if (!_container.GetTargetMachineInfo(this, _hn, requestedFields))
                {
                    Logger.Log(
                        "Could not find information about target machine",
                        Logger.eventLogLogLevel);
                    if (eventLogHandle != null)
                    {
                        _hn.IsConnectionSuccess = true;
                    }
                }
                else
                {
                    if (_pluginNode != null && !String.IsNullOrEmpty(_hn.hostName))
                    {
                        logs = null;

                        if (eventLogHandle == null)
                        {
                            _container.ShowError("Unable to open the event log; eventlog server may be disabled");
                            _pluginNode.sc.ShowControl(_pluginNode);
                        }
                    }
                }
            }
        }
Пример #4
0
        private void ConnectToHost()
        {
            Logger.Log("ServiceManagerPlugin.ConnectToHost", Logger.ServiceManagerLoglevel);

            string hostName = System.Environment.MachineName;

            if (!String.IsNullOrEmpty(hostName))
            {
                if (_pluginNode != null && !String.IsNullOrEmpty(hostName))
                {
                    if (Configurations.currentPlatform == LikewiseTargetPlatform.Windows &&
                        ServiceManagerWindowsWrapper.phSCManager == IntPtr.Zero)
                    {
                        IsConnectionSuccess = Do_LogonSCManager();
                        if (IsConnectionSuccess)
                        {
                            if (_pluginNode.PluginPage == null)
                            {
                                Type type = _pluginNode.NodeType;

                                object o = Activator.CreateInstance(type);
                                if (o is IPlugInPage)
                                {
                                    ((IPlugInPage)o).SetPlugInInfo(_container, _pluginNode.Plugin, _pluginNode, (LWTreeView)_pluginNode.TreeView, _pluginNode.sc);
                                }
                            }
                            else
                            {
                                ((ServiceManagerEditorPage)_pluginNode.PluginPage).Refresh();
                            }
                        }
                        if (!IsConnectionSuccess)
                        {
                            _container.ShowError("Unable to access the Services for the speficied user authentication");
                            return;
                        }
                    }
                    else
                    {
                        IsConnectionSuccess = true;
                    }
                    _pluginNode.Text = string.Concat(Properties.Resources.ServiceManager, " on ", hostName);
                }
            }
        }
Пример #5
0
        private void ConnectToHost()
        {
            IsConnectionSuccess = false;
            _currentHost        = System.Environment.MachineName;

            Logger.Log("RegistryViewerPlugin.ConnectToHost", Logger.RegistryViewerLoglevel);

            if (!String.IsNullOrEmpty(_currentHost))
            {
                if (handle != null)
                {
                    handle.Dispose();
                    handle = null;
                }
                if (_pluginNode != null && !String.IsNullOrEmpty(_currentHost))
                {
                    if (Configurations.currentPlatform == LikewiseTargetPlatform.Windows)
                    {
                        IsConnectionSuccess = Do_LogonUserSet();
                        if (!IsConnectionSuccess)
                        {
                            _container.ShowError("Unable to access the Registry for the speficied user authentication");
                            return;
                        }
                        else
                        {
                            Do_LogonUserHandleClose();
                        }
                    }
                    else
                    {
                        IsConnectionSuccess = OpenHandle();
                        if (!IsConnectionSuccess)
                        {
                            Logger.ShowUserError("Unable to get registry handle");
                            return;
                        }
                    }
                    if (handle != null)
                    {
                        _pluginNode.Nodes.Clear();
                    }
                }
            }
        }
Пример #6
0
        /// <summary>
        /// Will be called when we click on 'Set Target Machine Info' menu item and if plugin is already connected to domain
        /// Will gets all nodes along with its childs
        /// </summary>
        private bool ConnectToDomain()
        {
            Logger.Log("ADUCPlugin.ConnectToDomain", Logger.manageLogLevel);

            if (_usingSimpleBind &&
                (!Hostinfo.HasCreds(_hn) || _hn.creds.Invalidated))
            {
                _container.ShowError("ADUC cannot connect to domain due to invalid credentials");
                _hn.IsConnectionSuccess = false;
                return(_hn.IsConnectionSuccess);
            }

            //Make sure one ADUC plugin only hosts one domain

            if (_aducPagelvChildNodes != null)
            {
                _aducPagelvChildNodes.Items.Clear();
            }

            if (_pluginNode != null && _pluginNode.Nodes.Count != 0)
            {
                foreach (TreeNode treeNode in _pluginNode.Nodes)
                {
                    LACTreeNode lacTreeNode = treeNode as LACTreeNode;
                    if (lacTreeNode != null && lacTreeNode is LACTreeNode)
                    {
                        if (!lacTreeNode._IsPlugIn)
                        {
                            _pluginNode.Nodes.Remove(treeNode);
                        }
                        else
                        {
                            ListViewItem lvItem = new ListViewItem(treeNode.Text);
                            lvItem.Tag        = treeNode;
                            lvItem.ImageIndex = (int)treeNode.ImageIndex;
                            _aducPagelvChildNodes.Items.Add(lvItem);
                        }
                    }
                }
            }

            _currentDomain          = new ADUCDomain();
            _currentDomain.HostInfo = _hn;
            _currentDomain.plugin   = this;

            if (_currentDomain.ConnectToDomain(_usingSimpleBind) != null)
            {
                if (!_domainList.ContainsKey(_currentDomain.rootDN.ToLower()))
                {
                    _domainList.Add(_currentDomain.rootDN.ToLower(), _currentDomain);
                }

                _pluginNode.Text = string.Format("Active Directory Users & Computers [{0}]", _hn.domainName);

                if (_currentDomain.rootNode != null)
                {
                    _currentDomain.rootNode.sc = _pluginNode.sc;
                    //_pluginNode.Nodes.Add(domain.rootNode);
                    bool IsFound = false;
                    if (_pluginNode != null && _pluginNode.Nodes.Count != 0)
                    {
                        int index = 0;
                        foreach (TreeNode treeNode in _pluginNode.Nodes)
                        {
                            IsFound = false;
                            ADUCDirectoryNode node = treeNode as ADUCDirectoryNode;
                            if (node != null && node.Name.Trim().ToLower().Equals(_currentDomain.rootNode.Name.Trim().ToLower()))
                            {
                                IsFound = true;
                                _pluginNode.Nodes.RemoveAt(index);
                                _pluginNode.Nodes.Insert(index, _currentDomain.rootNode);
                                break;
                            }
                            index++;
                        }
                    }
                    if (!IsFound)
                    {
                        _pluginNode.Nodes.Add(_currentDomain.rootNode);
                    }

                    _currentDomain.rootNode.Collapse();
                    _currentDomain.rootNode.ExpandAll();
                }

                _adContext       = _currentDomain.adContext;
                _rootDN          = _currentDomain.rootDN;
                _shortDomainName = _currentDomain.ShortDomainName;

                _defaultUnixHomedir = _currentDomain.DefaultUnixHomeDir;

                _loginShell             = _currentDomain.LoginShell;
                _hn.IsConnectionSuccess = true;
            }
            else
            {
                _hn.IsConnectionSuccess = false;
            }

            return(_hn.IsConnectionSuccess);
        }