Path: blob/main/crypto/krb5/src/windows/leashdll/leash-int.h
34923 views
#ifndef __LEASH_INT_H__1#define __LEASH_INT_H__23#include <stdio.h>4#include <stdlib.h>56#include "leashdll.h"7#include <leashwin.h>89#include "tlhelp32.h"1011#define MIT_PWD_DLL_CLASS "MITPasswordWndDLL"1213BOOL14Register_MITPasswordEditControl(15HINSTANCE hInst16);1718BOOL19Unregister_MITPasswordEditControl(20HINSTANCE hInst21);2223// Some defines swiped from leash.h24// These are necessary but they must be kept sync'ed with leash.h25#define HELPFILE "leash32.hlp"26extern char KRB_HelpFile[_MAX_PATH];2728// Function Prototypes.29int DoNiftyErrorReport(long errnum, LPSTR what);30LONG Leash_timesync(int);3132// Crap...33#include <krb5.h>3435long36Leash_int_kinit_ex(37krb5_context ctx,38HWND hParent,39char * principal,40char * password,41int lifetime,42int forwardable,43int proxiable,44int renew_life,45int addressless,46unsigned long publicIP,47int displayErrors48);4950long51Leash_int_checkpwd(52char * principal,53char * password,54int displayErrors55);5657long58Leash_int_changepwd(59char * principal,60char * password,61char * newpassword,62char** result_string,63int displayErrors64);6566int67Leash_krb5_kdestroy(68void69);7071int72Leash_krb5_kinit(73krb5_context,74HWND hParent,75char * principal_name,76char * password,77krb5_deltat lifetime,78DWORD forwardable,79DWORD proxiable,80krb5_deltat renew_life,81DWORD addressless,82DWORD publicIP83);8485int86LeashKRB5_renew(void);8788int89config_boolean_to_int(90const char *s91);9293BOOL GetSecurityLogonSessionData(PSECURITY_LOGON_SESSION_DATA * ppSessionData);94BOOL IsKerberosLogon(VOID);9596int Leash_krb5_error(krb5_error_code rc, LPCSTR FailedFunctionName,97int FreeContextFlag, krb5_context *ctx,98krb5_ccache *cache);99int Leash_krb5_initialize(krb5_context *);100krb5_error_code101Leash_krb5_cc_default(krb5_context *ctx, krb5_ccache *cache);102103LPSTR err_describe(LPSTR buf, long code);104105// toolhelp functions106TYPEDEF_FUNC(107HANDLE,108WINAPI,109CreateToolhelp32Snapshot,110(DWORD, DWORD)111);112TYPEDEF_FUNC(113BOOL,114WINAPI,115Module32First,116(HANDLE, LPMODULEENTRY32)117);118TYPEDEF_FUNC(119BOOL,120WINAPI,121Module32Next,122(HANDLE, LPMODULEENTRY32)123);124125// psapi functions126TYPEDEF_FUNC(127DWORD,128WINAPI,129GetModuleFileNameExA,130(HANDLE, HMODULE, LPSTR, DWORD)131);132TYPEDEF_FUNC(133BOOL,134WINAPI,135EnumProcessModules,136(HANDLE, HMODULE*, DWORD, LPDWORD)137);138139#define pGetModuleFileNameEx pGetModuleFileNameExA140#define TOOLHELPDLL "kernel32.dll"141#define PSAPIDLL "psapi.dll"142143// psapi functions144extern DECL_FUNC_PTR(GetModuleFileNameExA);145extern DECL_FUNC_PTR(EnumProcessModules);146147// toolhelp functions148extern DECL_FUNC_PTR(CreateToolhelp32Snapshot);149extern DECL_FUNC_PTR(Module32First);150extern DECL_FUNC_PTR(Module32Next);151152/* In order to avoid including the private CCAPI headers */153typedef int cc_int32;154155#define CC_API_VER_1 1156#define CC_API_VER_2 2157158#define CCACHE_API cc_int32159160/*161** The Official Error Codes162*/163#define CC_NOERROR 0164#define CC_BADNAME 1165#define CC_NOTFOUND 2166#define CC_END 3167#define CC_IO 4168#define CC_WRITE 5169#define CC_NOMEM 6170#define CC_FORMAT 7171#define CC_LOCKED 8172#define CC_BAD_API_VERSION 9173#define CC_NO_EXIST 10174#define CC_NOT_SUPP 11175#define CC_BAD_PARM 12176#define CC_ERR_CACHE_ATTACH 13177#define CC_ERR_CACHE_RELEASE 14178#define CC_ERR_CACHE_FULL 15179#define CC_ERR_CRED_VERSION 16180181enum {182CC_CRED_VUNKNOWN = 0, // For validation183/* CC_CRED_V4 = 1, */184CC_CRED_V5 = 2,185CC_CRED_VMAX = 3 // For validation186};187188typedef struct opaque_dll_control_block_type* apiCB;189typedef struct _infoNC {190char* name;191char* principal;192cc_int32 vers;193} infoNC;194195TYPEDEF_FUNC(196CCACHE_API,197__cdecl,198cc_initialize,199(200apiCB** cc_ctx, // < DLL's primary control structure.201// returned here, passed everywhere else202cc_int32 api_version, // > ver supported by caller (use CC_API_VER_1)203cc_int32* api_supported, // < if ~NULL, max ver supported by DLL204const char** vendor // < if ~NULL, vendor name in read only C string205)206);207208TYPEDEF_FUNC(209CCACHE_API,210__cdecl,211cc_shutdown,212(213apiCB** cc_ctx // <> DLL's primary control structure. NULL after214)215);216217TYPEDEF_FUNC(218CCACHE_API,219__cdecl,220cc_get_NC_info,221(222apiCB* cc_ctx, // > DLL's primary control structure223struct _infoNC*** ppNCi // < (NULL before call) null terminated,224// list of a structs (free via cc_free_infoNC())225)226);227228TYPEDEF_FUNC(229CCACHE_API,230__cdecl,231cc_free_NC_info,232(233apiCB* cc_ctx,234struct _infoNC*** ppNCi // < free list of structs returned by235// cc_get_cache_names(). set to NULL on return236)237);238#define CCAPI_DLL "krbcc32.dll"239240/* The following definitions are summarized from KRB5, Leash32, and241* Leashw32 modules. They are current as of KfW 2.6.2. There is no242* guarantee that changes to other modules will be updated in this list.243*/244245/* Must match the values used in Leash32.exe */246#define LEASH_SETTINGS_REGISTRY_KEY_NAME "Software\\MIT\\Leash32\\Settings"247#define LEASH_SETTINGS_REGISTRY_VALUE_UPPERCASEREALM "UpperCaseRealm"248249/* These values are defined and used within Leashw32.dll */250#define LEASH_REGISTRY_KEY_NAME "Software\\MIT\\Leash"251#define LEASH_REGISTRY_VALUE_LIFETIME "lifetime"252#define LEASH_REGISTRY_VALUE_RENEW_TILL "renew_till"253#define LEASH_REGISTRY_VALUE_RENEWABLE "renewable"254#define LEASH_REGISTRY_VALUE_FORWARDABLE "forwardable"255#define LEASH_REGISTRY_VALUE_NOADDRESSES "noaddresses"256#define LEASH_REGISTRY_VALUE_PROXIABLE "proxiable"257#define LEASH_REGISTRY_VALUE_PUBLICIP "publicip"258#define LEASH_REGISTRY_VALUE_KINIT_OPT "hide_kinit_options"259#define LEASH_REGISTRY_VALUE_LIFE_MIN "life_min"260#define LEASH_REGISTRY_VALUE_LIFE_MAX "life_max"261#define LEASH_REGISTRY_VALUE_RENEW_MIN "renew_min"262#define LEASH_REGISTRY_VALUE_RENEW_MAX "renew_max"263#define LEASH_REGISTRY_VALUE_PRESERVE_KINIT "preserve_kinit_options"264265/* must match values used within krb5_32.dll */266#define KRB5_REGISTRY_KEY_NAME "Software\\MIT\\Kerberos5"267#define KRB5_REGISTRY_VALUE_CCNAME "ccname"268#define KRB5_REGISTRY_VALUE_CONFIGFILE "config"269270#endif /* __LEASH_INT_H__ */271272273