Exemple #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="storePath"></param>
        /// <param name="upgrade"></param>
        private LdapSettings(string storePath, bool upgrade)
        {
            if (upgrade)
            {
                this.storePath = storePath;

                Configuration config = new Configuration(storePath, true);
                settingChangeMap = 0;

                ldapType = LdapDirectoryType.eDirectory;

                // <setting name="LdapUri" />
                string uriString = config.Get(LdapAuthenticationSection, UriKey);
                if (uriString != null)
                {
                    this.uri = new Uri(uriString);
                }

                this.scheme = uri.Scheme;
                this.host   = uri.Host;
                if ((this.port = uri.Port) == -1)
                {
                    this.port = SSL ? UriPortLdaps : UriPortLdap;
                }

                string proxyString = config.Get(LdapAuthenticationSection, ProxyDNKey);
                if (proxyString != null)
                {
                    proxy = proxyString;
                }

                // Get the password from the file if it exists.
                this.password = GetProxyPasswordFromFile();

                string simiasAdminString = config.Get(OldDomainSection, SimiasOldAdminDNKey);
                if (simiasAdminString != null)
                {
                    simiasAdmin = simiasAdminString;
                }

                // <setting name="Search" />
                searchElement = config.GetElement(OldLdapSystemBookSection, SearchKey);
                if (searchElement != null)
                {
                    XmlNodeList contextNodes = searchElement.SelectNodes(XmlContextTag);
                    foreach (XmlElement contextNode in contextNodes)
                    {
                        searchContexts.Add(contextNode.GetAttribute(XmlDNAttr));
                    }
                }

                string namingAttributeString = config.Get(OldLdapSystemBookSection, NamingAttributeKey);
                if (namingAttributeString != null)
                {
                    this.namingAttribute = namingAttributeString;
                }
            }
        }
Exemple #2
0
    private void Awake()
    {
        if (singleton != null && singleton != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            singleton = this;
        }

        asd = new EpicSwitch();
    }
Exemple #3
0
 public void AfterClick(IndexOfList2D clickPos)
 {
     if (precalculate.problemsAndResults != null && precalculate.tableBase != null)
     {
         foreach (var search in precalculate.problemsAndResults.Values)
         {
             if (!search.isDead)
             {
                 return;
             }
         }
         changeMap = new ChangeMap(clickPos, precalculate.problemsAndResults, precalculate.tableBase);
         changeMap.Calculate();
         List <SetMap> setMaps = changeMap.result;
         visualizedData(setMaps);
         changeMap.ChangeMineData();
     }
 }
Exemple #4
0
 //rain ame;
 // Start is called before the first frame update
 void Start()
 {
     //  ame = GameObject.Find("rain").GetComponent<rain>();
     Ch = GameObject.Find("map_0Prefab").GetComponent <ChangeMap>();
 }
Exemple #5
0
        /// <summary>
        /// Update the ldap settings
        /// </summary>
        /// <param name="LdapAdminDN">ldap admin DN</param>
        /// <param name="LdapAdminPwd">ldap admin password</param>
        /// <param name="FieldToUpdate">which field is to update in config file</param>
        /// <param name="IsMaster">Is it master server</param>
        private void UpdateLdapSettings(string LdapAdminDN, string LdapAdminPwd, string FieldToUpdate, bool IsMaster)
        {
            if (FieldToUpdate.Equals("LDAPURI"))
            {
                UriBuilder newUri = new UriBuilder();
                newUri.Host   = host;
                newUri.Scheme = scheme;
                Uri    newldapUrl = new Uri(newUri.ToString());
                string ldapUrl    = newldapUrl.ToString();
                log.Debug("into condition ldapuri modification, ldapurl is {0} and going to create an instance of ldaputility", ldapUrl);
                LdapWebUtility ldapUtility = new LdapWebUtility(ldapUrl, LdapAdminDN, LdapAdminPwd);

                if (ldapUtility.Secure)
                {
                    string certfile = Path.Combine(storePath, "RootCert.cer");

                    if (Execute("../../../../bin/get-root-certificate", "{0} {1} {2} {3} get {4}",
                                ldapUtility.Host, ldapUtility.Port, LdapAdminDN, LdapAdminPwd, certfile) != 0)
                    {
                        //Failed , getting certificate and install
                        log.Debug("Failed : getting certificate for {0}", ldapUtility.Host);
                        throw new Exception(string.Format("Failed to get certificate."));
                    }
                    if (Execute("/usr/bin/mono", "/usr/lib/mono/1.0/certmgr.exe -add -c Trust {0}",
                                certfile) != 0)
                    {
                        //Failed , getting certificate and install
                        log.Debug("Failed : Installing certificate for {0}", ldapUtility.Host);
                        throw new Exception(string.Format("Failed to save certificate."));
                    }
                }
                log.Debug("Connecting to {0}", ldapUrl);
                try
                {
                    ldapUtility.Connect();
                }
                catch (Exception ex)
                {
                    log.Debug("Ldap connect failed to server URL {0} ", ldapUrl);
                    throw new Exception(string.Format("Ldap connect failed to server URL {0} ", ldapUrl));
                }

                // get the directory type.
                log.Debug("Querying for directory type...");
                LdapDirectoryType directoryType = ldapUtility.QueryDirectoryType();
                log.Debug(" {0}", directoryType);
                ldapUtility.Disconnect();

                if (directoryType.Equals(LdapDirectoryType.Unknown))
                {
                    throw new Exception(string.Format("Unable to determine directory type for {0}", ldapUtility.Host));
                }

                // now check connecting with this proxy
                ldapUtility = new LdapWebUtility(ldapUrl, proxy, password);
                try
                {
                    ldapUtility.Connect();
                }
                catch (Exception ex)
                {
                    log.Debug("Ldap connect failed to server URL {0} with proxy user {1} ", ldapUrl, proxy);
                    throw new Exception(string.Format("Ldap connect failed to server URL {0} with proxy user {1} ", ldapUrl, proxy));
                }
                ldapUtility.Disconnect();
            }
            else
            {
                // ldap IP and SSL status has not changed , other fields (context, proxyDN, proxypwd) might have changed

                UriBuilder newUri = new UriBuilder();
                newUri.Host   = host;
                newUri.Scheme = scheme;
                Uri            newldapUrl  = new Uri(newUri.ToString());
                string         ldapUrl     = newldapUrl.ToString();
                LdapWebUtility ldapUtility = new LdapWebUtility(ldapUrl, LdapAdminDN, LdapAdminPwd);
                // connect
                ldapUtility.Connect();
                if (FieldToUpdate.Equals("PROXYDN"))
                {
                    LdapDirectoryType directoryType = ldapUtility.QueryDirectoryType();
                    // proxy DN has changed , so either create user or change the password.
                    if (password == null || password == "")
                    {
                        ProxyUser proxyDetails = new ProxyUser();
                        ProxyPassword = proxyDetails.Password;
                    }
                    if (ldapUtility.CreateUser(proxy, password))
                    {
                        // successful, proxy user is created
                        log.Debug("New user created with DN = {0} ", proxy);
                    }
                    settingChangeMap |= ChangeMap.searchContexts;
                }
                else if (FieldToUpdate.Equals("PROXYPWD"))
                {
                    if (password == null || password == "")
                    {
                        ProxyUser proxyDetails = new ProxyUser();
                        password = proxyDetails.Password;
                    }
                    ldapUtility.ChangePassword(proxy, password);
                }
                else
                {
                    UpdateLdapContexts(ldapUrl, LdapAdminDN, LdapAdminPwd);
                }

                ldapUtility.Disconnect();
            }
        }
Exemple #6
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="storePath">path of simias store</param>
        private LdapSettings(string storePath)
        {
            this.storePath = storePath;

            Configuration config = new Configuration(storePath, true);

            settingChangeMap = 0;

            string identity = config.Get(IdentitySection, AssemblyKey);

            if (identity != null)
            {
                switch (identity)
                {
                case "Simias.LdapProvider":
                    ldapType = LdapDirectoryType.eDirectory;
                    break;

                case "Simias.ADLdapProvider":
                    ldapType = LdapDirectoryType.ActiveDirectory;
                    break;

                case "Simias.OpenLdapProvider":
                    ldapType = LdapDirectoryType.OpenLDAP;
                    break;
                }
            }

            // <setting name="LdapUri" />
            string uriString = config.Get(LdapAuthenticationSection, UriKey);

            if (uriString != null)
            {
                this.uri = new Uri(uriString);
            }

            this.scheme = uri.Scheme;
            this.host   = uri.Host;
            if ((this.port = uri.Port) == -1)
            {
                this.port = SSL ? UriPortLdaps : UriPortLdap;
            }

            string proxyString = config.Get(LdapAuthenticationSection, ProxyDNKey);

            if (proxyString != null)
            {
                proxy = proxyString;
            }

            string masterUrlString = config.Get(ServerSection, MasterAddressKey);

            if (masterUrlString != null)
            {
                masterURL = masterUrlString;
            }

            // Get the password from the file if it exists.
            this.password = GetProxyPasswordFromFile();

            string simiasAdminString = config.Get(DomainSection, SimiasAdminDNKey);

            if (simiasAdminString != null)
            {
                simiasAdmin = simiasAdminString;
            }

            // <setting name="Search" />
            searchElement = config.GetElement(LdapSystemBookSection, SearchKey);
            if (searchElement != null)
            {
                XmlNodeList contextNodes = searchElement.SelectNodes(XmlContextTag);
                foreach (XmlElement contextNode in contextNodes)
                {
                    searchContexts.Add(contextNode.GetAttribute(XmlDNAttr));
                }
            }

            string namingAttributeString = config.Get(LdapSystemBookSection, NamingAttributeKey);

            if (namingAttributeString != null)
            {
                this.namingAttribute = namingAttributeString;
            }
        }
Exemple #7
0
 // Start is called before the first frame update
 void Start()
 {
     @event = null;
     @map   = null;
 }
Exemple #8
0
 public void ClearMap()
 {
     @map = null;
 }
Exemple #9
0
 public void GetMap(ChangeMap _map)
 {
     @map = _map;
 }