summaryrefslogtreecommitdiffstats
path: root/ldap/synctools/passwordsync/passhook/passhook.cpp
blob: ff49d57588d29f4d9e072d7ab440811ba1aa3391 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Created: 2-8-2005
// Author(s): Scott Bridges
#include <windows.h>
#include <ntsecapi.h>
#include  "../passhand.h"

#ifndef STATUS_SUCCESS
#define STATUS_SUCCESS  ((NTSTATUS)0x00000000L)
#endif

NTSTATUS NTAPI PasswordChangeNotify(
	PUNICODE_STRING UserName,
	ULONG RelativeId,
	PUNICODE_STRING Password)
{
	PasswordHandler ourPasswordHandler;
	HANDLE passhookEventHandle = OpenEvent(EVENT_MODIFY_STATE, FALSE, PASSHAND_EVENT_NAME);

	ourPasswordHandler.LoadSet("passhook.dat");
	ourPasswordHandler.PushUserPass(UserName, Password);
	ourPasswordHandler.SaveSet("passhook.dat");

	if(passhookEventHandle == NULL)
	{
		// ToDo: Generate event sync service not running.
	}
	else
	{
		SetEvent(passhookEventHandle);
	}

	return STATUS_SUCCESS;
}

BOOL NTAPI PasswordFilter(
	PUNICODE_STRING UserName,
	PUNICODE_STRING FullName,
	PUNICODE_STRING Password,
	BOOL SetOperation)
{
	return TRUE;
}

BOOL NTAPI InitializeChangeNotify()
{
	return TRUE;
}