c37e438a70ef4d7460f88c75a44f451a5fb8f40c
[openafs.git] / src / WINNT / afsd / afslogon.h
1 /*
2
3 Copyright 2004 by the Massachusetts Institute of Technology
4
5 All rights reserved.
6
7 Permission to use, copy, modify, and distribute this software and its
8 documentation for any purpose and without fee is hereby granted,
9 provided that the above copyright notice appear in all copies and that
10 both that copyright notice and this permission notice appear in
11 supporting documentation, and that the name of the Massachusetts
12 Institute of Technology (M.I.T.) not be used in advertising or publicity
13 pertaining to distribution of the software without specific, written
14 prior permission.
15
16 M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
17 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
18 M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
19 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
21 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
22 SOFTWARE.
23
24 */
25
26 /* We only support VC 1200 and above anyway */
27 #pragma once
28
29 #include <windows.h>
30 #include <npapi.h>
31 #include <ntsecapi.h>
32 #include <strsafe.h>
33
34
35 #define REG_CLIENT_DOMAINS_SUBKEY       "Domain"
36 #define REG_CLIENT_RETRY_INTERVAL_PARM  "LoginRetryInterval"
37 #define REG_CLIENT_SLEEP_INTERVAL_PARM  "LoginSleepInterval"
38 #define REG_CLIENT_FAIL_SILENTLY_PARM   "FailLoginsSilently"
39 #define REG_CLIENT_TRACE_OPTION_PARM    "TraceOption"
40 #define REG_CLIENT_LOGON_OPTION_PARM    "LogonOptions"
41 #define REG_CLIENT_LOGON_SCRIPT_PARMW   L"LogonScript"
42 #define REG_CLIENT_THESE_CELLS_PARM     "TheseCells"
43 #define DEFAULT_RETRY_INTERVAL          60                        /* seconds*/
44 #define DEFAULT_FAIL_SILENTLY           FALSE
45 #define DEFAULT_SLEEP_INTERVAL          5                         /* seconds*/
46 #define DEFAULT_LOGON_OPTION                    1
47
48 #define TRACE_OPTION_EVENT 1
49
50 #define ISLOGONTRACE(v) ( ((v) & TRACE_OPTION_EVENT)==TRACE_OPTION_EVENT)
51
52 #define ISLOGONINTEGRATED(v) ( ((v) & LOGON_OPTION_INTEGRATED)==LOGON_OPTION_INTEGRATED)
53 #define ISHIGHSECURITY(v) ( ((v) & LOGON_OPTION_HIGHSECURITY)==LOGON_OPTION_HIGHSECURITY)
54
55 #define ISREMOTE(v) ( ((v) & LOGON_FLAG_REMOTE)==LOGON_FLAG_REMOTE)
56 #define ISADREALM(v) ( ((v) & LOGON_FLAG_AD_REALM)==LOGON_FLAG_AD_REALM)
57 extern DWORD TraceOption;
58
59 #define LOGON_FLAG_LOCAL        0
60 #define LOGON_FLAG_REMOTE       1
61 #define LOGON_FLAG_AD_REALM 2
62
63 typedef struct LogonOptions_type {
64         DWORD   LogonOption;
65         BOOLEAN failSilently;
66         int     retryInterval;
67         int     sleepInterval;
68         char *  smbName;
69         LPWSTR  logonScript;
70         DWORD   flags; /* LOGON_FLAG_* */
71         char *  theseCells;
72 } LogonOptions_t;
73
74 /* */
75 #define MAX_USERNAME_LENGTH 256
76 #define MAX_PASSWORD_LENGTH 256
77 #define MAX_DOMAIN_LENGTH 256
78
79 BOOLEAN APIENTRY DllEntryPoint(HANDLE dll, DWORD reason, PVOID reserved);
80
81 DWORD APIENTRY NPGetCaps(DWORD index);
82
83 DWORD APIENTRY NPLogonNotify(
84         PLUID lpLogonId,
85         LPCWSTR lpAuthentInfoType,
86         LPVOID lpAuthentInfo,
87         LPCWSTR lpPreviousAuthentInfoType,
88         LPVOID lpPreviousAuthentInfo,
89         LPWSTR lpStationName,
90         LPVOID StationHandle,
91         LPWSTR *lpLogonScript);
92
93 DWORD APIENTRY NPPasswordChangeNotify(
94         LPCWSTR lpAuthentInfoType,
95         LPVOID lpAuthentInfo,
96         LPCWSTR lpPreviousAuthentInfoType,
97         LPVOID lpPreviousAuthentInfo,
98         LPWSTR lpStationName,
99         LPVOID StationHandle,
100         DWORD dwChangeInfo);
101
102 #ifdef __cplusplus
103 extern "C" {
104 #endif
105
106 void DebugEvent0(char *a);
107 void DebugEvent(char *b,...);
108
109 CHAR *GenRandomName(CHAR *pbuf);
110
111 BOOLEAN AFSWillAutoStart(void);
112
113 DWORD MapAuthError(DWORD code);
114
115 BOOL IsServiceRunning (void);
116
117 static BOOL WINAPI UnicodeStringToANSI(UNICODE_STRING uInputString, LPSTR lpszOutputString, int nOutStringLen);
118
119 void GetDomainLogonOptions( PLUID lpLogonId, char * username, char * domain, LogonOptions_t *opt );
120 DWORD GetFileCellName(char * path, char * cell, size_t cellLen);
121 DWORD GetAdHomePath(char * homePath, size_t homePathLen, PLUID lpLogonId, LogonOptions_t * opt);
122 DWORD QueryAdHomePathFromSid(char * homePath, size_t homePathLen, PSID psid, PWSTR domain);
123 BOOL GetLocalShortDomain(PWSTR Domain, DWORD cbDomain);
124
125 #ifdef __cplusplus
126 }
127 #endif