00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #pragma once
00030
00031 #ifndef __AFXWIN_H__
00032 #error include 'stdafx.h' before including this file for PCH
00033 #endif
00034
00035 #include "pgina_headers.h"
00036 #include "messages_def.h"
00037 #include <wchar.h>
00038 #include <WCHAR.h>
00039 #include <Winldap.h>
00040 #include <Winreg.h>
00041 #include <Windows.h>
00042 #include <stdio.h>
00043 #include <stdlib.h>
00044 #include <Winber.h>
00045 #include <Lm.h>
00046
00047 #ifdef _DEBUG
00048 #include <atltime.h>
00049 #endif
00050
00051
00052 #define MISCONFIGURED 0
00053 #define MULTIMAP 1
00054 #define SEARCH 2
00055 #define STRMAP 3
00056
00057 #define DOMAIN_USER_RID_ADMIN (0x000001F4L)
00058 #define DOMAIN_USER_RID_GUEST (0x000001F5L)
00059 #define DOMAIN_GROUP_RID_ADMINS (0x00000200L)
00060 #define DOMAIN_GROUP_RID_USERS (0x00000201L)
00061 #define DOMAIN_GROUP_RID_GUESTS (0x00000202L)
00062
00063 #define DOMAIN_ALIAS_RID_ADMINS (0x00000220L)
00064 #define DOMAIN_ALIAS_RID_USERS (0x00000221L)
00065 #define DOMAIN_ALIAS_RID_GUESTS (0x00000222L)
00066 #define DOMAIN_ALIAS_RID_POWER_USERS (0x00000223L)
00067 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS (0x00000224L)
00068 #define DOMAIN_ALIAS_RID_SYSTEM_OPS (0x00000225L)
00069 #define DOMAIN_ALIAS_RID_PRINT_OPS (0x00000226L)
00070 #define DOMAIN_ALIAS_RID_BACKUP_OPS (0x00000227L)
00071 #define DOMAIN_ALIAS_RID_REPLICATOR (0x00000228L)
00072
00073 #define LDAPAUTHVERSION TEXT("LDAPAuth Version 1.4 by Micah Cooper and Michael Morris")
00074
00075 long regLookup(WCHAR *,WCHAR *);
00076 PWCHAR * ldapSearchAttr(LPTSTR, WCHAR *, LDAP *, WCHAR *, bool ldpOverride);
00077 void plugError(LPCWSTR *, LPVOID, DWORD);
00078 bool ldapDoBindTest(LPTSTR, LPTSTR, LPTSTR, LDAP *);
00079 bool ldapTestMap(LPTSTR, LPTSTR, WCHAR *, WCHAR *, LDAP *, WCHAR *);
00080 bool ldapMapGo(LPTSTR, LPTSTR, LPTSTR, LPTSTR, LPTSTR, LDAP *, WCHAR *);
00081 WCHAR * getContext(WCHAR *);
00082 bool ldapSearchForDN(LPTSTR, WCHAR *, WCHAR *, LDAP *);
00083 bool ldapTestMultiMap(LPTSTR, LPTSTR, WCHAR *, WCHAR *, LDAP *, WCHAR *);
00084 bool regSet(WCHAR *, WCHAR *);
00085 bool ldapTestSearch(LPTSTR, LPTSTR, WCHAR *, LDAP *, WCHAR *);
00086 DWORD determineLdap(void);
00087 bool ldapGroupCheck(WCHAR *, WCHAR *, LDAP *,WCHAR *);
00088 bool okToLogin(WCHAR *, LDAP *, WCHAR *);
00089 bool createAsAdmin(WCHAR *, LDAP *, WCHAR *);
00090 PWCHAR * ldapSearchAttr(LPTSTR, WCHAR *, LDAP *, WCHAR *);
00091 void populateUserInfo(pGinaInfo *, LDAP *, WCHAR *);
00092 void setNDSReg(WCHAR *, WCHAR *);
00093 void confNDSClient(WCHAR *, WCHAR *, WCHAR *);
00094 BOOL whoIsGroup(WCHAR *, DWORD);
00095 TCHAR * regReadString(LPCTSTR location);
00096 BOOL regWriteString(LPTSTR value,LPCTSTR location);
00097 BOOL regWriteDword(DWORD,LPCTSTR);
00098 DWORD regReadDword(LPCTSTR);
00099 void regDelValue(LPCTSTR);
00101
00104 void doLdapSearch(WCHAR ldapFilter[256]);
00105
00106 #ifdef _DEBUG
00107 void debugOut(WCHAR *,...);
00108 #endif
00109
00110
00112
00113
00114 class Cldapauth_plusApp : public CWinApp
00115 {
00116 public:
00117 Cldapauth_plusApp();
00118
00119
00120 public:
00121 virtual BOOL InitInstance();
00122
00123 DECLARE_MESSAGE_MAP();
00124 };