mirror of
https://github.com/MichaelGrafnetter/DSInternals
synced 2025-01-10 08:20:02 +00:00
Minor validation and perf fixes in password mod.
This commit is contained in:
parent
047731c67b
commit
38d19bdefb
@ -44,13 +44,18 @@
|
||||
// Calculate NT hash
|
||||
byte[] ntHash = NTHash.ComputeHash(newPassword);
|
||||
|
||||
// TODO TODO TODO: Change parameter to DSAccount from DatastoreObject
|
||||
var account = this.GetAccount(targetObject, targetObjectIdentifier, bootKey);
|
||||
// We need to read sAMAccountName and userPrincipalName to be able to generate the supplementalCredentials.
|
||||
string samAccountName;
|
||||
targetObject.ReadAttribute(CommonDirectoryAttributes.SAMAccountName, out samAccountName);
|
||||
|
||||
string userPrincipalName;
|
||||
targetObject.ReadAttribute(CommonDirectoryAttributes.UserPrincipalName, out userPrincipalName);
|
||||
|
||||
|
||||
var supplementalCredentials = new SupplementalCredentials(
|
||||
newPassword,
|
||||
account.SamAccountName,
|
||||
account.UserPrincipalName,
|
||||
samAccountName,
|
||||
userPrincipalName,
|
||||
this.context.DomainController.NetBIOSDomainName,
|
||||
this.context.DomainController.Domain);
|
||||
|
||||
@ -93,6 +98,7 @@
|
||||
{
|
||||
// Validate input
|
||||
Validator.AssertLength(newNtHash, NTHash.HashSize, "newNtHash");
|
||||
Validator.AssertNotNull(bootKey, "bootKey");
|
||||
|
||||
if (!targetObject.IsAccount)
|
||||
{
|
||||
|
@ -3,7 +3,6 @@ using DSInternals.DataStore;
|
||||
using DSInternals.PowerShell.Properties;
|
||||
using System;
|
||||
using System.Management.Automation;
|
||||
using System.Security;
|
||||
|
||||
namespace DSInternals.PowerShell.Commands
|
||||
{
|
||||
@ -24,6 +23,7 @@ namespace DSInternals.PowerShell.Commands
|
||||
|
||||
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true)]
|
||||
[Alias("KerberosKeys", "sc", "c")]
|
||||
[ValidateNotNull]
|
||||
public SupplementalCredentials SupplementalCredentials
|
||||
{
|
||||
get;
|
||||
|
Loading…
Reference in New Issue
Block a user