为什么用户名在我的 Active Directory 密码过滤器 DLL 中以 $ 结尾?

Why do usernames end in $ in my Active Directory password filter DLL?

我有一个自定义 Active Directory 密码过滤器 DLL。

在双域 DC (Windows Server 2012 R2) 上,密码过滤器有时会收到带有美元符号 ($) 的用户名。

  1. 一个用户的账户名为JSMITH
  2. 密码过滤器 DLL 报告 JSMITH$ 更改了他们的密码。

为什么会这样?

extern "C" __declspec(dllexport) NTSTATUS __stdcall PasswordChangeNotify(
    _In_ PUNICODE_STRING UserName,
    _In_ ULONG RelativeId,
    _In_ PUNICODE_STRING NewPassword
)
{
    // Set up process creation arguments
    STARTUPINFO startupInformation;
    PROCESS_INFORMATION processInformation;

    ZeroMemory(&startupInformation, sizeof(startupInformation));
    ZeroMemory(&processInformation, sizeof(processInformation));

    // Prepare arguments
    std::wstring arguments = std::wstring(UserName->Buffer)
        + L" "
        + std::wstring(NewPassword->Buffer);

    // ...

唯一一次用户名(又名 sAMAccountName attribute in AD) automatically contains a $ at the end is for computer accounts. And computer accounts do actually have passwords,因此它可能只是报告计算机更新了密码。

我猜 JSMITH$ 可能只是编造的例子,因为 JSMITH 听起来像一个用户帐户。

但是,如果您愿意,可以在用户名的末尾显式添加 $