/// <summary> /// Changes the password for the connector space object /// </summary> /// <param name="csentry">The CSEntry object for the user</param> /// <param name="oldPassword">The old password</param> /// <param name="newPassword">The new password</param> void IMAExtensible2Password.ChangePassword(CSEntry csentry, System.Security.SecureString oldPassword, System.Security.SecureString newPassword) { try { PasswordChangeOperation operation = MAConfig.OperationGroups[csentry.ObjectType.ToString()].ObjectOperations.FirstOrDefault(t => t is PasswordChangeOperation) as PasswordChangeOperation; if (operation != null) { try { Logger.WriteLine("Attempting to change password for {0}", csentry.DN.ToString()); SshConnection.ExecuteOperation(operation, csentry, oldPassword.ToUnsecureString(), newPassword.ToUnsecureString()); Logger.WriteLine("Changed password for {0} successfully", csentry.DN.ToString()); } catch (Exception ex) { Logger.WriteLine("Could not perform password change operation"); Logger.WriteException(ex); throw new ExtensibleExtensionException("Set password change operation failed", ex); } } else { Logger.WriteLine("Could not change password for {0} as no password change operation was defined for this object type", csentry.DN.ToString()); } } catch (ExtensibleExtensionException) { throw; } catch (Exception ex) { Logger.WriteLine("A exception occured during the password change operartion"); Logger.WriteException(ex); throw new ExtensibleExtensionException("An exception occured during the password change operation", ex); } }
/// <summary> /// Executes the specified operation against the SSH client /// </summary> /// <param name="operation">The operation to execute</param> /// <param name="csentry">The object to run the operation against</param> /// <param name="oldPassword">The old password for the specified object</param> /// <param name="newPassword">The new password for the specified object</param> /// <returns>An OperationResult object containing the results of the execution</returns> public static OperationResult ExecuteOperation(PasswordChangeOperation operation, CSEntry csentry, string oldPassword, string newPassword) { return(ExecuteOperation(operation, csentry, oldPassword, newPassword)); }