Esempio n. 1
0
        public INovellOrganizationContactPerson CreateOrganization(INovellOrganizationContactPerson person)
        {
            string DN = "";

            foreach (string serverAddress in ServerAddresses)
            {
                try
                {
                    using (NovellProvider novell = new NovellProvider(serverAddress, 636))
                    {
                        novell.Connect();
                        novell.Bind(Properties.Settings.Default.NovellDN, Properties.Settings.Default.NovellPassword);
                        person.Login = novell.GenerateUniqueAlienCN(person.Login);
                        bool entryExist = novell.EntryExists(person.Login);
                        if (!entryExist)
                        {
                            DN = novell.CreateEntry(person);
                        }
                        if (DN != "")
                        {
                            break;
                        }
                    }
                }
                catch (Exception e)
                {
                    continue;
                }
            }
            return(person);
        }
Esempio n. 2
0
        public NovellUser Connect(string login, string password)
        {
            bool       res  = false;
            NovellUser user = new NovellUser();

            foreach (var serverAddress in ServerAddresses)
            {
                message += serverAddress;
                try
                {
                    using (NovellProvider novell = new NovellProvider(serverAddress, 636))
                    {
                        novell.Connect();
                        novell.Bind(Properties.Settings.Default.NovellDN, Properties.Settings.Default.NovellPassword);
                        user = novell.Search(login);
                        res  = novell.VerifyPassword(user.DN, password);
                        break;
                        //res = novell.CheckWorldPassword(login, password);

                        //if (res == false)
                        //{
                        //    res = novell.CheckAlienPassword(login, password);

                        //    if (res == false)
                        //    {
                        //        break;
                        //    }
                        //}
                        //if (res == true)
                        //{
                        //    novell.Bind();
                        //    user = novell.Find(login);
                        //    break;
                        //}


                        //novell.Connect()
                    }
                }
                catch (Exception e)
                {
                    //  message += " exc in novell provider, continue ";
                    //when ip address doesn't response - there will be exception
                    //continue;
                    //throw new NovelleDirectoryException("Cannot connect to Novell eDirectory");
                }
            }
            if (res == false)
            {
                throw new NovelleDirectoryException(message);
            }
            if (user.CN == null || user.CN == "")
            {
                throw new NovelleDirectoryException(message);
            }
            return(user);
        }