Exemplo n.º 1
0
        public void UpdateLocalSideOfTrustRelationship(string targetForestName, string newTrustPassword)
        {
            CheckIfDisposed();

            if (targetForestName == null)
            {
                throw new ArgumentNullException(nameof(targetForestName));
            }

            if (targetForestName.Length == 0)
            {
                throw new ArgumentException(SR.EmptyStringParameter, nameof(targetForestName));
            }

            if (newTrustPassword == null)
            {
                throw new ArgumentNullException(nameof(newTrustPassword));
            }

            if (newTrustPassword.Length == 0)
            {
                throw new ArgumentException(SR.EmptyStringParameter, nameof(newTrustPassword));
            }

            TrustHelper.UpdateTrust(_context, Name, targetForestName, newTrustPassword, true);
        }
Exemplo n.º 2
0
        private void RepairTrustHelper(Forest targetForest, TrustDirection direction)
        {
            string password = TrustHelper.CreateTrustPassword();
            string preferredTargetServer = TrustHelper.UpdateTrust(targetForest.GetDirectoryContext(), targetForest.Name, this.Name, password, true);
            string str3 = TrustHelper.UpdateTrust(this.context, this.Name, targetForest.Name, password, true);

            if ((direction & TrustDirection.Outbound) != ((TrustDirection)0))
            {
                try
                {
                    TrustHelper.VerifyTrust(this.context, this.Name, targetForest.Name, true, TrustDirection.Outbound, true, preferredTargetServer);
                }
                catch (ActiveDirectoryObjectNotFoundException)
                {
                    throw new ActiveDirectoryObjectNotFoundException(Res.GetString("WrongTrustDirection", new object[] { this.Name, targetForest.Name, direction }), typeof(ForestTrustRelationshipInformation), null);
                }
            }
            if ((direction & TrustDirection.Inbound) != ((TrustDirection)0))
            {
                try
                {
                    TrustHelper.VerifyTrust(targetForest.GetDirectoryContext(), targetForest.Name, this.Name, true, TrustDirection.Outbound, true, str3);
                }
                catch (ActiveDirectoryObjectNotFoundException)
                {
                    throw new ActiveDirectoryObjectNotFoundException(Res.GetString("WrongTrustDirection", new object[] { this.Name, targetForest.Name, direction }), typeof(ForestTrustRelationshipInformation), null);
                }
            }
        }
Exemplo n.º 3
0
 public void UpdateLocalSideOfTrustRelationship(string targetForestName, string newTrustPassword)
 {
     this.CheckIfDisposed();
     if (targetForestName == null)
     {
         throw new ArgumentNullException("targetForestName");
     }
     if (targetForestName.Length == 0)
     {
         throw new ArgumentException(Res.GetString("EmptyStringParameter"), "targetForestName");
     }
     if (newTrustPassword == null)
     {
         throw new ArgumentNullException("newTrustPassword");
     }
     if (newTrustPassword.Length == 0)
     {
         throw new ArgumentException(Res.GetString("EmptyStringParameter"), "newTrustPassword");
     }
     TrustHelper.UpdateTrust(this.context, this.Name, targetForestName, newTrustPassword, true);
 }