public void UpdateTrustRelationship(Forest targetForest, TrustDirection newTrustDirection) { CheckIfDisposed(); if (targetForest == null) { throw new ArgumentNullException(nameof(targetForest)); } if (newTrustDirection < TrustDirection.Inbound || newTrustDirection > TrustDirection.Bidirectional) { throw new InvalidEnumArgumentException(nameof(newTrustDirection), (int)newTrustDirection, typeof(TrustDirection)); } // no we generate trust password string password = TrustHelper.CreateTrustPassword(); TrustHelper.UpdateTrustDirection(_context, Name, targetForest.Name, password, true /*is forest*/, newTrustDirection); // then create trust on remote side TrustDirection reverseDirection = 0; if ((newTrustDirection & TrustDirection.Inbound) != 0) { reverseDirection |= TrustDirection.Outbound; } if ((newTrustDirection & TrustDirection.Outbound) != 0) { reverseDirection |= TrustDirection.Inbound; } TrustHelper.UpdateTrustDirection(targetForest.GetDirectoryContext(), targetForest.Name, Name, password, true /*is forest*/, reverseDirection); }
public void UpdateTrustRelationship(Forest targetForest, TrustDirection newTrustDirection) { this.CheckIfDisposed(); if (targetForest == null) { throw new ArgumentNullException("targetForest"); } if ((newTrustDirection < TrustDirection.Inbound) || (newTrustDirection > TrustDirection.Bidirectional)) { throw new InvalidEnumArgumentException("newTrustDirection", (int)newTrustDirection, typeof(TrustDirection)); } string password = TrustHelper.CreateTrustPassword(); TrustHelper.UpdateTrustDirection(this.context, this.Name, targetForest.Name, password, true, newTrustDirection); TrustDirection direction = (TrustDirection)0; if ((newTrustDirection & TrustDirection.Inbound) != ((TrustDirection)0)) { direction |= TrustDirection.Outbound; } if ((newTrustDirection & TrustDirection.Outbound) != ((TrustDirection)0)) { direction |= TrustDirection.Inbound; } TrustHelper.UpdateTrustDirection(targetForest.GetDirectoryContext(), targetForest.Name, this.Name, password, true, direction); }
public void UpdateLocalSideOfTrustRelationship(string targetForestName, TrustDirection newTrustDirection, string newTrustPassword) { CheckIfDisposed(); if (targetForestName == null) { throw new ArgumentNullException(nameof(targetForestName)); } if (targetForestName.Length == 0) { throw new ArgumentException(SR.EmptyStringParameter, nameof(targetForestName)); } if (newTrustDirection < TrustDirection.Inbound || newTrustDirection > TrustDirection.Bidirectional) { throw new InvalidEnumArgumentException(nameof(newTrustDirection), (int)newTrustDirection, typeof(TrustDirection)); } if (newTrustPassword == null) { throw new ArgumentNullException(nameof(newTrustPassword)); } if (newTrustPassword.Length == 0) { throw new ArgumentException(SR.EmptyStringParameter, nameof(newTrustPassword)); } TrustHelper.UpdateTrustDirection(_context, Name, targetForestName, newTrustPassword, true /*is forest*/, newTrustDirection); }
public void UpdateLocalSideOfTrustRelationship(string targetForestName, TrustDirection newTrustDirection, string newTrustPassword) { this.CheckIfDisposed(); if (targetForestName == null) { throw new ArgumentNullException("targetForestName"); } if (targetForestName.Length == 0) { throw new ArgumentException(Res.GetString("EmptyStringParameter"), "targetForestName"); } if ((newTrustDirection < TrustDirection.Inbound) || (newTrustDirection > TrustDirection.Bidirectional)) { throw new InvalidEnumArgumentException("newTrustDirection", (int)newTrustDirection, typeof(TrustDirection)); } if (newTrustPassword == null) { throw new ArgumentNullException("newTrustPassword"); } if (newTrustPassword.Length == 0) { throw new ArgumentException(Res.GetString("EmptyStringParameter"), "newTrustPassword"); } TrustHelper.UpdateTrustDirection(this.context, this.Name, targetForestName, newTrustPassword, true, newTrustDirection); }