OpenAFS
OpenAFS distributed network file system
|
00001 /* 00002 00003 Copyright 2004 by the Massachusetts Institute of Technology 00004 00005 All rights reserved. 00006 00007 Permission to use, copy, modify, and distribute this software and its 00008 documentation for any purpose and without fee is hereby granted, 00009 provided that the above copyright notice appear in all copies and that 00010 both that copyright notice and this permission notice appear in 00011 supporting documentation, and that the name of the Massachusetts 00012 Institute of Technology (M.I.T.) not be used in advertising or publicity 00013 pertaining to distribution of the software without specific, written 00014 prior permission. 00015 00016 M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 00017 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 00018 M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 00019 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 00020 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 00021 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 00022 SOFTWARE. 00023 00024 */ 00025 00026 /* We only support VC 1200 and above anyway */ 00027 #pragma once 00028 00029 #include <objbase.h> 00030 #include <npapi.h> 00031 #if (_WIN32_WINNT < 0x0501) 00032 #undef _WIN32_WINNT 00033 #define _WIN32_WINNT 0x0501 00034 #endif 00035 #include <ntsecapi.h> 00036 #include <tchar.h> 00037 #include <strsafe.h> 00038 00039 00040 #define REG_CLIENT_DOMAINS_SUBKEY "Domain" 00041 #define REG_CLIENT_RETRY_INTERVAL_PARM "LoginRetryInterval" 00042 #define REG_CLIENT_SLEEP_INTERVAL_PARM "LoginSleepInterval" 00043 #define REG_CLIENT_FAIL_SILENTLY_PARM "FailLoginsSilently" 00044 #define REG_CLIENT_TRACE_OPTION_PARM "TraceOption" 00045 #define REG_CLIENT_LOGON_OPTION_PARM "LogonOptions" 00046 #define REG_CLIENT_LOGON_SCRIPT_PARMW L"LogonScript" 00047 #define REG_CLIENT_LOGON_SCRIPT_PARM "LogonScript" 00048 #define REG_CLIENT_DEBUG_PARM "Debug" 00049 #define REG_CLIENT_REALM_PARM "Realm" 00050 #define REG_CLIENT_USERNAME_PARM "Username" 00051 #define REG_CLIENT_THESE_CELLS_PARM "TheseCells" 00052 #define REG_CLIENT_LOGOFF_TOKENS_PARM "LogoffPreserveTokens" 00053 #define DEFAULT_RETRY_INTERVAL 60 /* seconds*/ 00054 #define DEFAULT_FAIL_SILENTLY FALSE 00055 #define DEFAULT_SLEEP_INTERVAL 5 /* seconds*/ 00056 #define DEFAULT_LOGON_OPTION 1 00057 00058 #define TRACE_OPTION_EVENT 1 00059 00060 #define ISLOGONTRACE(v) ( ((v) & TRACE_OPTION_EVENT)==TRACE_OPTION_EVENT) 00061 00062 #define ISLOGONINTEGRATED(v) ( ((v) & LOGON_OPTION_INTEGRATED)==LOGON_OPTION_INTEGRATED) 00063 00064 #define ISREMOTE(v) ( ((v) & LOGON_FLAG_REMOTE)==LOGON_FLAG_REMOTE) 00065 #define ISADREALM(v) ( ((v) & LOGON_FLAG_AD_REALM)==LOGON_FLAG_AD_REALM) 00066 #define ISLSA(v) ( ((v) & LOGON_FLAG_LSA)==LOGON_FLAG_LSA) 00067 extern DWORD TraceOption; 00068 00069 #define LOGON_FLAG_LOCAL 0 00070 #define LOGON_FLAG_REMOTE 1 00071 #define LOGON_FLAG_AD_REALM 2 00072 #define LOGON_FLAG_LSA 4 /* Kerberos credentials in LSA */ 00073 00074 typedef struct LogonOptions_type { 00075 DWORD LogonOption; 00076 BOOLEAN failSilently; 00077 int retryInterval; 00078 int sleepInterval; 00079 char * smbName; 00080 LPWSTR logonScript; 00081 DWORD flags; /* LOGON_FLAG_* */ 00082 char * theseCells; 00083 char * username; 00084 char * realm; 00085 } LogonOptions_t; 00086 00087 /* */ 00088 #define MAX_USERNAME_LENGTH 256 00089 #define MAX_PASSWORD_LENGTH 256 00090 #define MAX_DOMAIN_LENGTH 256 00091 00092 BOOLEAN APIENTRY DllEntryPoint(HANDLE dll, DWORD reason, PVOID reserved); 00093 00094 DWORD APIENTRY NPGetCaps(DWORD index); 00095 00096 DWORD APIENTRY NPLogonNotify( 00097 PLUID lpLogonId, 00098 LPCWSTR lpAuthentInfoType, 00099 LPVOID lpAuthentInfo, 00100 LPCWSTR lpPreviousAuthentInfoType, 00101 LPVOID lpPreviousAuthentInfo, 00102 LPWSTR lpStationName, 00103 LPVOID StationHandle, 00104 LPWSTR *lpLogonScript); 00105 00106 DWORD APIENTRY NPPasswordChangeNotify( 00107 LPCWSTR lpAuthentInfoType, 00108 LPVOID lpAuthentInfo, 00109 LPCWSTR lpPreviousAuthentInfoType, 00110 LPVOID lpPreviousAuthentInfo, 00111 LPWSTR lpStationName, 00112 LPVOID StationHandle, 00113 DWORD dwChangeInfo); 00114 00115 #ifdef __cplusplus 00116 extern "C" { 00117 #endif 00118 00119 void DebugEvent0(char *a); 00120 void DebugEvent(char *b,...); 00121 00122 CHAR *GenRandomName(CHAR *pbuf); 00123 00124 BOOLEAN AFSWillAutoStart(void); 00125 00126 DWORD MapAuthError(DWORD code); 00127 00128 BOOL IsServiceRunning (void); 00129 00130 static BOOL WINAPI UnicodeStringToANSI(UNICODE_STRING uInputString, LPSTR lpszOutputString, int nOutStringLen); 00131 00132 void GetDomainLogonOptions( PLUID lpLogonId, BOOLEAN bKerberos, char * username, char * domain, LogonOptions_t *opt); 00133 DWORD GetFileCellName(char * path, char * cell, size_t cellLen); 00134 DWORD GetAdHomePath(char * homePath, size_t homePathLen, PLUID lpLogonId, LogonOptions_t * opt); 00135 DWORD QueryAdHomePathFromSid(char * homePath, size_t homePathLen, PSID psid, PWSTR domain); 00136 BOOL GetLocalShortDomain(PWSTR Domain, DWORD cbDomain); 00137 00138 void AFSCreatePAG(PLUID lpLogonId); 00139 00140 DWORD LogonSSP(PLUID lpLogonId, PCtxtHandle outCtx); 00141 00142 #ifdef __cplusplus 00143 } 00144 #endif