summaryrefslogtreecommitdiffstats
path: root/ldap/synctools/passwordsync/passsync/syncserv.h
blob: 64b95260b7e96bbb520abaa87da8ef392c5f5556 (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
48
49
50
51
52
53
54
55
// Created: 2-8-2005
// Author(s): Scott Bridges
#ifndef _SYNCSERV_H_
#define _SYNCSERV_H_

#include <stdio.h>
#include <ldap.h>
#include <ldap_ssl.h>
#include "ntservice.h"
#include "../passhand.h"

#define REG_BUF_SIZE 64

class PassSyncService : public CNTService
{
public:
	PassSyncService(const TCHAR* serviceName);
	~PassSyncService();

	void Run();

	// ToDo: Move to private.
	int Connect();
	int Disconnect();
	int QueryUsername(char* username);
	int GetDN(char** dn);
	int ModifyPassword(char* dn, char* password);

	int SyncPasswords();

private:

	PasswordHandler ourPasswordHandler;
	HANDLE passhandEventHandle;

	// LDAP variables
	LDAP* pLdapConnection;
	LDAPMessage* results;
	LDAPMessage* currentResult;
	int lastLdapError;

	// Config variables
	char* dataFilename;
	char* logFilename;
	char* ldapHostName;
	char* ldpaHostPort;
	char* ldalAuthUsername;
	char* ldapAuthPassword;
	char* ldapSearchBase;
	char* ldapUsernameField;
	char* ldapPasswordField;
	bool multipleModify;
};

#endif