venus: Remove dedebug
[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 <objbase.h>
30 #include <npapi.h>
31 #if (_WIN32_WINNT < 0x0501)
32 #undef _WIN32_WINNT
33 #define _WIN32_WINNT 0x0501
34 #endif
35 #include <ntsecapi.h>
36 #include <tchar.h>
37 #include <strsafe.h>
38
39
40 #define REG_CLIENT_DOMAINS_SUBKEY       "Domain"
41 #define REG_CLIENT_RETRY_INTERVAL_PARM  "LoginRetryInterval"
42 #define REG_CLIENT_SLEEP_INTERVAL_PARM  "LoginSleepInterval"
43 #define REG_CLIENT_FAIL_SILENTLY_PARM   "FailLoginsSilently"
44 #define REG_CLIENT_TRACE_OPTION_PARM    "TraceOption"
45 #define REG_CLIENT_LOGON_OPTION_PARM    "LogonOptions"
46 #define REG_CLIENT_LOGON_SCRIPT_PARMW   L"LogonScript"
47 #define REG_CLIENT_LOGON_SCRIPT_PARM    "LogonScript"
48 #define REG_CLIENT_DEBUG_PARM           "Debug"
49 #define REG_CLIENT_REALM_PARM           "Realm"
50 #define REG_CLIENT_USERNAME_PARM        "Username"
51 #define REG_CLIENT_THESE_CELLS_PARM     "TheseCells"
52 #define REG_CLIENT_LOGOFF_TOKENS_PARM   "LogoffPreserveTokens"
53 #define DEFAULT_RETRY_INTERVAL          60                        /* seconds*/
54 #define DEFAULT_FAIL_SILENTLY           FALSE
55 #define DEFAULT_SLEEP_INTERVAL          5                         /* seconds*/
56 #define DEFAULT_LOGON_OPTION                    1
57
58 #define TRACE_OPTION_EVENT 1
59
60 #define ISLOGONTRACE(v) ( ((v) & TRACE_OPTION_EVENT)==TRACE_OPTION_EVENT)
61
62 #define ISLOGONINTEGRATED(v) ( ((v) & LOGON_OPTION_INTEGRATED)==LOGON_OPTION_INTEGRATED)
63
64 #define ISREMOTE(v) ( ((v) & LOGON_FLAG_REMOTE)==LOGON_FLAG_REMOTE)
65 #define ISADREALM(v) ( ((v) & LOGON_FLAG_AD_REALM)==LOGON_FLAG_AD_REALM)
66 #define ISLSA(v) ( ((v) & LOGON_FLAG_LSA)==LOGON_FLAG_LSA)
67 extern DWORD TraceOption;
68
69 #define LOGON_FLAG_LOCAL        0
70 #define LOGON_FLAG_REMOTE       1
71 #define LOGON_FLAG_AD_REALM     2
72 #define LOGON_FLAG_LSA          4       /* Kerberos credentials in LSA */
73
74 typedef struct LogonOptions_type {
75         DWORD   LogonOption;
76         BOOLEAN failSilently;
77         int     retryInterval;
78         int     sleepInterval;
79         char *  smbName;
80         LPWSTR  logonScript;
81         DWORD   flags; /* LOGON_FLAG_* */
82         char *  theseCells;
83         char *  username;
84         char *  realm;
85 } LogonOptions_t;
86
87 /* */
88 #define MAX_USERNAME_LENGTH 256
89 #define MAX_PASSWORD_LENGTH 256
90 #define MAX_DOMAIN_LENGTH 256
91
92 BOOLEAN APIENTRY DllEntryPoint(HANDLE dll, DWORD reason, PVOID reserved);
93
94 DWORD APIENTRY NPGetCaps(DWORD index);
95
96 DWORD APIENTRY NPLogonNotify(
97         PLUID lpLogonId,
98         LPCWSTR lpAuthentInfoType,
99         LPVOID lpAuthentInfo,
100         LPCWSTR lpPreviousAuthentInfoType,
101         LPVOID lpPreviousAuthentInfo,
102         LPWSTR lpStationName,
103         LPVOID StationHandle,
104         LPWSTR *lpLogonScript);
105
106 DWORD APIENTRY NPPasswordChangeNotify(
107         LPCWSTR lpAuthentInfoType,
108         LPVOID lpAuthentInfo,
109         LPCWSTR lpPreviousAuthentInfoType,
110         LPVOID lpPreviousAuthentInfo,
111         LPWSTR lpStationName,
112         LPVOID StationHandle,
113         DWORD dwChangeInfo);
114
115 #ifdef __cplusplus
116 extern "C" {
117 #endif
118
119 void DebugEvent0(char *a);
120 void DebugEvent(char *b,...);
121
122 CHAR *GenRandomName(CHAR *pbuf);
123
124 BOOLEAN AFSWillAutoStart(void);
125
126 DWORD MapAuthError(DWORD code);
127
128 BOOL IsServiceRunning (void);
129
130 static BOOL WINAPI UnicodeStringToANSI(UNICODE_STRING uInputString, LPSTR lpszOutputString, int nOutStringLen);
131
132 void GetDomainLogonOptions( PLUID lpLogonId, BOOLEAN bKerberos, char * username, char * domain, LogonOptions_t *opt);
133 DWORD GetFileCellName(char * path, char * cell, size_t cellLen);
134 DWORD GetAdHomePath(char * homePath, size_t homePathLen, PLUID lpLogonId, LogonOptions_t * opt);
135 DWORD QueryAdHomePathFromSid(char * homePath, size_t homePathLen, PSID psid, PWSTR domain);
136 BOOL GetLocalShortDomain(PWSTR Domain, DWORD cbDomain);
137
138 void AFSCreatePAG(PLUID lpLogonId);
139
140 DWORD LogonSSP(PLUID lpLogonId, PCtxtHandle outCtx);
141
142 #ifdef __cplusplus
143 }
144 #endif