windows-netidmgr-plugin-20061010

Secure Endpoints Inc. is contributing its AFS plug-in for KFW 3.1's
Network Identity Manager to OpenAFS under an MIT style license.
This commit is contained in:
Asanka Herath 2006-10-11 05:32:16 +00:00 committed by Jeffrey Altman
parent 6e3aab757a
commit f72c2fc3e7
62 changed files with 9979 additions and 30 deletions

View File

@ -563,7 +563,14 @@ aklog: client_creds
$(NTMAKE)
$(CD) ..\..\..
extra: aklog
netidmgr_plugin: aklog
echo ***** $@
$(DOCD) $(SRC)\WINNT\$@
$(CD) $(SRC)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
extra: netidmgr_plugin
! IF EXIST($(SRC)\WINNT\extra) && EXIST($(SRC)\WINNT\extra\NTMakefile)
echo ***** $@
$(DOCD) $(SRC)\WINNT\$@

View File

@ -85,6 +85,7 @@ VIAddVersionKey "PrivateBuild" "Checked/Debug"
!define AFS_COMPANY_NAME "OpenAFS"
!define AFS_PRODUCT_NAME "OpenAFS"
!define AFS_REGKEY_ROOT "Software\TransarcCorporation"
!define NID_PLUGIN_MGR "Software\MIT\NetIDMgr\PluginManager"
CRCCheck force
;Folder selection page
@ -539,7 +540,7 @@ Section "!AFS Client" secClient
File "${AFS_CLIENT_BUILDDIR}\afsdacl.exe"
File "${AFS_CLIENT_BUILDDIR}\cmdebug.exe"
File "${AFS_CLIENT_BUILDDIR}\aklog.exe"
File "${AFS_CLIENT_BUILDDIR}\afscreds.exe"
!insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds.exe" "$INSTDIR\Client\Program\afscreds.exe" "$INSTDIR"
!insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext.dll" "$INSTDIR\Client\Program\afs_shl_ext.dll" "$INSTDIR"
File "${AFS_CLIENT_BUILDDIR}\afsd_service.exe"
File "${AFS_CLIENT_BUILDDIR}\symlink.exe"
@ -553,6 +554,9 @@ Section "!AFS Client" secClient
File "${AFS_DESTDIR}\etc\rxdebug.exe"
File "${AFS_DESTDIR}\etc\backup.exe"
!insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa.cpl" "$INSTDIR\Client\Program\afs_cpa.cpl" "$INSTDIR"
!insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscred.dll" "$INSTDIR\Client\Program\afscred.dll" "$INSTDIR"
!insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscred_en_us.dll" "$INSTDIR\Client\Program\afscred_en_us.dll" "$INSTDIR"
File "${AFS_CLIENT_BUILDDIR}\afsplhlp.chm"
SetOutPath "$SYSDIR"
!insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afslogon.dll" "$SYSDIR\afslogon.dll" "$INSTDIR"
@ -626,6 +630,18 @@ Section "!AFS Client" secClient
DeleteRegValue HKLM "${AFS_REGKEY_ROOT}\AFS Client\${AFS_VERSION}" "Debug"
!endif
;NetIDMgr Plug-in Reg Entries
WriteRegStr HKLM "${NID_PLUGIN_MGR}\Modules\OpenAFS" "ImagePath" "$INSTDIR\Client\Program\afscred.dll"
WriteRegStr HKLM "${NID_PLUGIN_MGR}\Modules\OpenAFS" "Description" "OpenAFS Module"
WriteRegStr HKLM "${NID_PLUGIN_MGR}\Modules\OpenAFS" "Vendor" "Secure Endpoints Inc."
WriteRegStr HKLM "${NID_PLUGIN_MGR}\Modules\OpenAFS" "PluginList" "AfsCred"
WriteRegDWORD HKLM "${NID_PLUGIN_MGR}\Modules\OpenAFS" "NoUnload" "1"
WriteRegStr HKLM "${NID_PLUGIN_MGR}\Plugins\AfsCred" "Module" "OpenAFS"
WriteRegStr HKLM "${NID_PLUGIN_MGR}\Plugins\AfsCred" "Description" "AFS Credentials Provider"
WriteRegStr HKLM "${NID_PLUGIN_MGR}\Plugins\AfsCred" "Dependencies" "Krb5Cred"
WriteRegDWORD HKLM "${NID_PLUGIN_MGR}\Plugins\AfsCred" "Type" "1"
; On Windows 2000 work around KB301673. This is fixed in Windows XP and 2003
Call GetWindowsVersion
Pop $R1
@ -1133,6 +1149,7 @@ Section /o "Debug symbols" secDebug
File "${AFS_DESTDIR}\etc\rxdebug.pdb"
File "${AFS_DESTDIR}\etc\backup.pdb"
File "${AFS_CLIENT_BUILDDIR}\afs_cpa.pdb"
File "${AFS_CLIENT_BUILDDIR}\afscred.pdb"
SetOutPath "$SYSDIR"
File "${AFS_CLIENT_BUILDDIR}\afslogon.pdb"
@ -1998,6 +2015,9 @@ StartRemove:
DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Server\CurrentVersion"
DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Server"
DeleteRegKey /ifempty HKLM "${AFS_REGKEY_ROOT}"
DeleteRegKey HKLM "${NID_PLUGIN_MGR}\Modules\OpenAFS"
DeleteRegKey HKLM "${NID_PLUGIN_MGR}\Plugins\AfsCred"
DeleteRegKey /ifempty HKLM "Software\MIT\NetIDMgr"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenAFS"
DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Services\NetBT\Parameters" "SmbDeviceEnabled"

View File

@ -24,33 +24,48 @@
<ComponentRef Id="rcm_Loopback"/>
</Feature>
<Feature Id="feaKB301673" AllowAdvertise="no" Absent="disallow" Display="hidden" InstallDefault="followParent" Level="0">
<ComponentRef Id="rcm_KB301673" />
<Condition Level="30">VersionNT = 500 And ServicePackLevel &lt; 3</Condition>
</Feature>
<?if $(env.CPU) = "i386"?>
<Feature Id="feaNetIDMgrPlugin" AllowAdvertise="no" Description="$(loc.StrNIDMPluginLongDesc)"
Display="expand" InstallDefault="followParent" Level="30" Title="$(loc.StrNIDMPluginDesc)">
<ComponentRef Id="_afscreds_plugin" />
<ComponentRef Id="_afscreds_en_us" />
<ComponentRef Id="_afscreds_chm" />
<?ifdef DebugSyms?>
<Feature Id="DebugSyms" Title="$(loc.StrNIDMDebugDesc)" InstallDefault="$(var.DebugSymInstallDefault)"
Level="$(var.DebugSymLowLevel)" Display="expand" Description="$(loc.StrNIDMDebugLongDesc)">
<ComponentRef Id="_afscreds_debugsym" />
</Feature>
<?endif?>
</Feature>
<?endif?>
<Feature Id="feaCredsStartup" AllowAdvertise="no" Display="hidden" InstallDefault="followParent" Level="30">
<ComponentRef Id="cmp_credsStartup" />
<Condition Level="130">CREDSSTARTUP = 0</Condition>
</Feature>
<Feature Id="feaKB301673" AllowAdvertise="no" Absent="disallow" Display="hidden" InstallDefault="followParent" Level="0">
<ComponentRef Id="rcm_KB301673" />
<Condition Level="30">VersionNT = 500 And ServicePackLevel &lt; 3</Condition>
</Feature>
<?ifdef DebugSyms?>
<Feature Id="feaClientDebug" AllowAdvertise="no" Description="$(loc.StrAFSClientDebugLongDesc)" Display="expand"
InstallDefault="$(var.DebugSymInstallDefault)" Level="$(var.DebugSymLowLevel)" Title="$(loc.StrAFSClientDebugDesc)">
<ComponentRef Id="cmp_ClientProgramDebug" />
<ComponentRef Id="cmp_CommonCommonDebug" />
<ComponentRef Id="cmp_ClientCommonDebug" />
<ComponentRef Id="cmp_ClientSystemDebug" />
<?include runtime_debug.wxi?>
</Feature>
<?endif?>
<Feature Id="feaCredsStartup" AllowAdvertise="no" Display="hidden" InstallDefault="followParent" Level="30">
<ComponentRef Id="cmp_credsStartup" />
<Condition Level="130">CREDSSTARTUP = 0</Condition>
</Feature>
<ComponentRef Id="rcm_Client" />
<?ifdef DebugSyms?>
<Feature Id="feaClientDebug" AllowAdvertise="no" Description="$(loc.StrAFSClientDebugLongDesc)" Display="expand"
InstallDefault="$(var.DebugSymInstallDefault)" Level="$(var.DebugSymLowLevel)" Title="$(loc.StrAFSClientDebugDesc)">
<ComponentRef Id="cmp_ClientProgramDebug" />
<ComponentRef Id="cmp_CommonCommonDebug" />
<ComponentRef Id="cmp_ClientCommonDebug" />
<ComponentRef Id="cmp_ClientSystemDebug" />
<?include runtime_debug.wxi?>
</Feature>
<?endif?>
<ComponentRef Id="rcm_Client" />
<ComponentRef Id="rcm_ClientCacheSize" />
<ComponentRef Id="rcm_ClientCachePath" />
<ComponentRef Id="rcm_StoreAnsiFilenames" />
<ComponentRef Id="cmp_CommonDir" />
<ComponentRef Id="cmp_CommonDir" />
<ComponentRef Id="efl_Readme_TXT_$(var.Language)" />
<ComponentRef Id="efl_CellServDB" />
@ -263,16 +278,31 @@
<Feature Id="feaBinaries" AllowAdvertise="no" Description="$(loc.StrBinsOnlyLongDesc)"
Display="expand" InstallDefault="followParent" Level="100" Title="$(loc.StrBinsOnlyDesc)">
<?ifdef DebugSyms?>
<Feature Id="feaClientDebug" AllowAdvertise="no" Description="$(loc.StrAFSClientDebugLongDesc)" Display="expand"
InstallDefault="$(var.DebugSymInstallDefault)" Level="$(var.DebugSymLowLevel)" Title="$(loc.StrAFSClientDebugDesc)">
<?ifdef DebugSyms?>
<Feature Id="feaClientDebug" AllowAdvertise="no" Description="$(loc.StrAFSClientDebugLongDesc)" Display="expand"
InstallDefault="$(var.DebugSymInstallDefault)" Level="$(var.DebugSymLowLevel)" Title="$(loc.StrAFSClientDebugDesc)">
<ComponentRef Id="cmp_ClientProgramDebug" />
<ComponentRef Id="cmp_CommonCommonDebug" />
<?include runtime_debug.wxi?>
</Feature>
<?endif?>
<ComponentRef Id="cmp_CommonDir" />
<?if $(env.CPU) = "i386"?>
<Feature Id="feaNetIDMgrPlugin" AllowAdvertise="no" Description="$(loc.StrNIDMPluginLongDesc)"
Display="expand" InstallDefault="followParent" Level="30" Title="$(loc.StrNIDMPluginDesc)">
<ComponentRef Id="_afscreds_plugin" />
<ComponentRef Id="_afscreds_en_us" />
<ComponentRef Id="_afscreds_chm" />
<?ifdef DebugSyms?>
<Feature Id="DebugSyms" Title="$(loc.StrNIDMDebugDesc)" InstallDefault="$(var.DebugSymInstallDefault)"
Level="$(var.DebugSymLowLevel)" Display="expand" Description="$(loc.StrNIDMDebugLongDesc)">
<ComponentRef Id="_afscreds_debugsym" />
</Feature>
<?endif?>
</Feature>
<?endif?>
<ComponentRef Id="cmp_CommonDir" />
<ComponentRef Id="cmf_afsrpc_DLL" />
<ComponentRef Id="cmf_afsauthent2_DLL" />

View File

@ -851,6 +851,42 @@
<File Id="fileafs_shl_ext_1033_DLL" Name="ashl1033.dll" LongName="afs_shl_ext_1033.dll" KeyPath="yes" DiskId="1" src="$(var.ClientDir)\afs_shl_ext_1033.dll"/>
</Component>
<?if $(env.CPU)="i386"?>
<Component Win64="$(var.Win64)" Id="_afscreds_en_us"
Guid="$(var._afscreds_en_us_guid)" DiskId="1">
<File Id="file_afscred_en_us_dll" Name="afscenu.dll" LongName="afscred_en_us.dll" KeyPath="yes"/>
</Component>
<Component Win64="$(var.Win64)" Id="_afscreds_plugin"
Guid="$(var._afscreds_plugin_guid)" DiskId="1">
<File Id="file_afscred_dll" Name="afscred.dll" LongName="afscred.dll" KeyPath="yes"/>
<Registry Id="reg_mod_01" Root="HKLM" Key="SOFTWARE\MIT\NetIDMgr\PluginManager\Modules\OpenAFS" Action="createKeyAndRemoveKeyOnUninstall" />
<Registry Id="reg_mod_02" Root="HKLM" Key="SOFTWARE\MIT\NetIDMgr\PluginManager\Modules\OpenAFS" />
<Registry Id="reg_mod_03" Root="HKLM" Key="SOFTWARE\MIT\NetIDMgr\PluginManager\Modules\OpenAFS" Name="ImagePath" Type="string" Value="[#file_afscred_dll]" />
<Registry Id="reg_mod_04" Root="HKLM" Key="SOFTWARE\MIT\NetIDMgr\PluginManager\Modules\OpenAFS" Name="Description" Type="string" Value="OpenAFS Module" />
<Registry Id="reg_mod_05" Root="HKLM" Key="SOFTWARE\MIT\NetIDMgr\PluginManager\Modules\OpenAFS" Name="Vendor" Type="string" Value="Secure Endpoints Inc." />
<Registry Id="reg_mod_06" Root="HKLM" Key="SOFTWARE\MIT\NetIDMgr\PluginManager\Modules\OpenAFS" Name="PluginList" Type="string" Value="AfsCred" />
<Registry Id="reg_mod_07" Root="HKLM" Key="SOFTWARE\MIT\NetIDMgr\PluginManager\Modules\OpenAFS" Name="NoUnload" Type="integer" Value="1" />
<Registry Id="reg_plg_01" Root="HKLM" Key="SOFTWARE\MIT\NetIDMgr\PluginManager\Plugins\AfsCred" Action="createKeyAndRemoveKeyOnUninstall" />
<Registry Id="reg_plg_02" Root="HKLM" Key="SOFTWARE\MIT\NetIDMgr\PluginManager\Plugins\AfsCred" />
<Registry Id="reg_plg_03" Root="HKLM" Key="SOFTWARE\MIT\NetIDMgr\PluginManager\Plugins\AfsCred" Name="Module" Type="string" Value="OpenAFS" />
<Registry Id="reg_plg_04" Root="HKLM" Key="SOFTWARE\MIT\NetIDMgr\PluginManager\Plugins\AfsCred" Name="Description" Type="string" Value="AFS Credentials Provider" />
<Registry Id="reg_plg_05" Root="HKLM" Key="SOFTWARE\MIT\NetIDMgr\PluginManager\Plugins\AfsCred" Name="Dependencies" Type="string" Value="Krb5Cred" />
<Registry Id="reg_plg_06" Root="HKLM" Key="SOFTWARE\MIT\NetIDMgr\PluginManager\Plugins\AfsCred" Name="Type" Type="integer" Value="1" />
</Component>
<?ifdef DebugSyms?>
<Component Win64="$(var.Win64)" Id="_afscreds_debugsym"
Guid="$(var._afscreds_debugsym_guid)" DiskId="1">
<File Id="file_afscred_pdb" Name="afscred.pdb" LongName="afscred.pdb" KeyPath="yes"/>
</Component>
<?endif?>
<Component Id="_afscreds_chm"
Guid="$(var._afscreds_chm_guid)" DiskId="1">
<File Id="file_afsplhlp_chm" Name="afsplhlp.chm" LongName="afsplhlp.chm" KeyPath="yes" />
</Component>
<?endif?>
<?ifndef BinsOnly ?>
<Component Win64="$(var.Win64)" Id="cmf_afsd_service_EXE" Guid="$(var.cmf_afsd_service_EXE_guid)">
<File Id="fileafsd_service_EXE" Name="afsd_svc.exe" LongName="afsd_service.exe" KeyPath="yes" DiskId="1" />

View File

@ -27,6 +27,10 @@
<String Id="StrLoopbackLongDesc">Loopback adapter for AFS. It is recommended that you install the loopback adapter if you are installing the client components.</String>
<String Id="StrBinsOnlyLongDesc">OpenAFS command-line utilities and libraries.</String>
<String Id="StrBinsOnlyDesc">Tools and libraries</String>
<String Id="StrNIDMPluginDesc">NetIDMgr Plug-in</String>
<String Id="StrNIDMPluginLongDesc">OpenAFS plug-in for Network Identity Manager. Adds AFS token management capabilities to Network Identity Manager.</String>
<String Id="StrNIDMDebugDesc">Debug symbols for NetIDMgr plug-in</String>
<String Id="StrNIDMDebugLongDesc">Debugging symbols for the OpenAFS NetIDMgr plug-in.</String>
<String Id="StrShlExtDesc">AFS Context Menu Shell Extension</String>
<String Id="StrAfsCredsDesc">Authentication for AFS</String>

View File

@ -207,7 +207,7 @@
<AdvertiseExecuteSequence />
<AdminExecuteSequence />
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallValidate">IBMAFS_UPGRADE OR OPENAFS_UPGRADE</RemoveExistingProducts>
<RemoveExistingProducts After="InstallValidate">IBMAFS_UPGRADE OR OPENAFS_UPGRADE OR AFSPLUGIN_UPGRADE</RemoveExistingProducts>
<Custom Action="RemoveNsisInstallation" Before="AbortInstallationA">NSISUNINSTALL &lt;&gt; "" AND UILevel &gt;= 4</Custom>
<Custom Action="AbortInstallationA" Before="CostInitialize">NSISUNINSTALL &lt;&gt; "" AND UILevel &lt; 4</Custom>
<!-- Assert that if the server is going to be installed locally after this session, control center and client are also local -->
@ -243,6 +243,13 @@
<UpgradeVersion IgnoreRemoveFailure="no" IncludeMaximum="yes" Maximum="3.6.2" MigrateFeatures="no" Property="IBMAFS_UPGRADE" />
</Upgrade>
<?if $(env.CPU) = "i386" ?>
<!-- Secure-Endpoints OpenAFS NetIDMgr plug-in -->
<Upgrade Id="646D643A-73E3-4C77-AE4A-EDBE313DD45D">
<UpgradeVersion IgnoreRemoveFailure="no" IncludeMaximum="no" Maximum="$(var.NumericVersion)" MigrateFeatures="no" Property="AFSPLUGIN_UPGRADE" />
</Upgrade>
<?endif?>
<!-- openafs.org NSIS installer is detected using other means -->
<!-- Please let us know if you want other Installers to be detected and upgraded/removed -->

View File

@ -198,7 +198,10 @@
<?define cmp_Server_Program_Debug_guid="5F7BA9F7-E9BD-4AC3-9232-5EFBF6B740F8"?>
<?define rcm_binsonly_parm_guid="4DFE834A-F129-4FDD-91AD-8A31A849AF0B"?>
<?define clsid_afs_shl_ext="DC515C27-6CAC-11D1-BAE7-00C04FD140D2"?>
<?define _afscreds_en_us_guid="B7F72D5F-B8A2-4FE8-B675-71BA4D04FA5C"?>
<?define _afscreds_plugin_guid="3477A7C4-9BC9-4AF9-B97D-C96455CC3AF6"?>
<?define _afscreds_debugsym_guid="DCBE9170-746F-4894-96FA-B8441A133133"?>
<?define _afscreds_chm_guid="11657F75-67AD-4DBA-8344-BF65B7CCAAD2"?>
<?else?>
<?error Unknown platform?>
<?endif?>

View File

@ -0,0 +1,183 @@
#
# Copyright (c) 2005,2006 Secure Endpoints Inc.
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
AFSDEV_AUXRCFLAGS=/i ..\kfw\inc\netidmgr
RELDIR=WINNT\netidmgr_plugin
!INCLUDE ..\..\config\NTMakefile.$(SYS_NAME)
!INCLUDE ..\..\config\NTMakefile.version
AFSPLUGIN_VERSION_MAJOR=$(AFSPRODUCT_VER_MAJOR)
AFSPLUGIN_VERSION_MINOR=$(AFSPRODUCT_VER_MINOR)
AFSPLUGIN_VERSION_PATCH=$(AFSPRODUCT_VER_PATCH)
AFSPLUGIN_VERSION_AUX =$(AFSPRODUCT_VER_BUILD)
AFSPLUGIN_VERSION=$(AFSPLUGIN_VERSION_MAJOR).$(AFSPLUGIN_VERSION_MINOR).$(AFSPLUGIN_VERSION_PATCH).$(AFSPLUGIN_VERSION_AUX)
AFSPLUGIN_VERLIST=$(AFSPLUGIN_VERSION_MAJOR),$(AFSPLUGIN_VERSION_MINOR),$(AFSPLUGIN_VERSION_PATCH),$(AFSPLUGIN_VERSION_AUX)
# short form version numbers
TAFSPLUGIN_VERSION=$(AFSPLUGIN_VERSION_MAJOR).$(AFSPLUGIN_VERSION_MINOR).$(AFSPLUGIN_VERSION_PATCH)
# Directories
EXEDIR = $(DESTDIR)\root.client\usr\vice\etc
INCFILEDIR = $(DESTDIR)\include\WINNT
LIBFILEDIR = $(DESTDIR)\lib
KFWINCDIR = ..\kfw\inc
KFWLIBDIR = ..\kfw\lib\$(CPU)
# Build environment
kfwincflags=-I$(KFWINCDIR)\krb5\KerberosIV -I$(KFWINCDIR)\loadfuncs -I$(KFWINCDIR)\krb5 -I$(KFWINCDIR)\netidmgr -I$(KFWINCDIR)
afsincflags=-I$(DESTDIR)\include
incflags=$(kfwincflags) $(afsincflags) -I.
pldefines=-DUNICODE -D_UNICODE
cdebug=$(cdebug) -Os -Zi
cwarn=$(cwarn) /Wp64 /WX
plcflags=$(cdebug) $(cflags) $(incflags) $(pldefines) $(cwarn) $(cvarsmt)
PC2OBJ=$(CC) $(plcflags) /Fo"$@" /c $**
{}.c{$(OBJ)}.obj:
$(PC2OBJ)
# Targets
CHMFILE=$(EXEDIR)\afsplhlp.chm
DLLFILE=$(EXEDIR)\afscred.dll
LIBFILE=$(LIBFILEDIR)\afscred.lib
INCFILES= \
$(INCFILEDIR)\afspext.h \
$(INCFILEDIR)\afsp_version.h
OBJFILES= \
$(OUT)\afsfuncs.obj \
$(OUT)\afsplugin.obj \
$(OUT)\main.obj \
$(OUT)\afsconfig.obj \
$(OUT)\afsconfigdlg.obj \
$(OUT)\afsnewcreds.obj \
$(OUT)\afsext.obj \
$(OUT)\afshelp.obj \
$(OUT)\dynimport.obj \
$(OUT)\krb5common.obj
LIBFILES= \
$(KFWLIBDIR)\nidmgr32.lib
SDKLIBFILES= \
$(DESTDIR)\lib\afsauthent.lib \
$(DESTDIR)\lib\libafsconf.lib \
$(KFWLIBDIR)\loadfuncs.lib \
htmlhelp.lib \
shell32.lib \
comctl32.lib \
version.lib \
shlwapi.lib \
psapi.lib
VERRESFILE=$(OUT)\version.res
$(OUT)\afsfuncs.obj: afsfuncs.c
$(PC2OBJ)
$(OUT)\afsplugin.obj: afsplugin.c
$(PC2OBJ)
$(OUT)\main.obj: main.c
$(PC2OBJ)
$(OUT)\afsconfig.obj: afsconfig.c
$(PC2OBJ)
$(OUT)\afsconfigdlg.obj: afsconfigdlg.c
$(PC2OBJ)
$(OUT)\afsnewcreds.obj: afsnewcreds.c
$(PC2OBJ)
$(OUT)\afsext.obj: afsext.c
$(PC2OBJ)
$(OUT)\afshelp.obj: afshelp.c
$(PC2OBJ)
$(OUT)\dynimport.obj: dynimport.c
$(PC2OBJ)
$(OUT)\krb5common.obj: krb5common.c
$(PC2OBJ)
!include afsp_version.h.in
$(DLLFILE): $(OBJFILES) $(VERRESFILE)
$(DLLGUILINK) $(LIBFILES) $(SDKLIBFILES)
$(_VC_MANIFEST_EMBED_DLL)
$(_VC_MANIFEST_CLEAN)
dummy:
$(CHMFILE): dummy
$(CD) help
nmake /f NTMakefile install
$(CD) ..
install: $(INCFILES) $(CHMFILE) $(DLLFILE) lang
lang::
# Repeat this block as necessary redefining LANG for additional
# languages.
# Begin language block
LANG=en_us
LANGDLL=$(EXEDIR)\afscred_$(LANG).dll
lang:: $(LANGDLL)
$(LANGDLL): $(OUT)\langres_$(LANG).res $(OUT)\langres_ver_$(LANG).res
$(DLLRESLINK)
$(OUT)\langres_ver_$(LANG).res: version.rc
$(RC) /d LANGVER /d LANG_$(LANG) /fo $@ $**
$(OUT)\langres_$(LANG).res: lang\$(LANG)\langres.rc
$(RC) /fo $@ $**
# End language block
clean::
!ifdef INCFILES
$(DEL) $(INCFILES)
!endif
$(CD) help
$(MAKECMD) /f NTMakefile clean
$(CD) ..

View File

@ -0,0 +1,36 @@
/*
This file was autogenerated from:
c:\work\pismere\athena\auth\krb5\src\windows\identity\config\csvschema.cfg
afsconfig.csv
Do not modify directly.
*/
#include<kconfig.h>
kconf_schema schema_afsconfig[] = {
{L"AfsCred",KC_SPACE,0,L"AFS Credentials Provider"},
{L"Module",KC_STRING,(khm_int64) L"OpenAFS",L""},
{L"Description",KC_STRING,(khm_int64) L"AFS Credentials Provider",L""},
{L"Dependencies",KC_STRING,(khm_int64) L"Krb5Cred",L""},
{L"Type",KC_INT32,1,L""},
{L"Flags",KC_INT32,0,L""},
{L"Cells",KC_STRING,(khm_int64) L"",L"Multi string giving list of cells to authenticate to"},
{L"Disableafscreds",KC_INT32,0,L"Disable afscreds.exe"},
{L"Parameters",KC_SPACE,0,L"Parameters for AfsCred"},
{L"AFSEnabled",KC_INT32,1,L"Is AFS enabled?"},
{L"LRUCells",KC_STRING,(khm_int64) L"",L"List of recently used cells"},
{L"LRURealms",KC_STRING,(khm_int64) L"",L"List of recently used realms"},
{L"DefaultCells",KC_STRING,(khm_int64) L"",L"List of default cells to authenticate to."},
{L"Parameters",KC_ENDSPACE,0,L""},
{L"Cells",KC_SPACE,0,L"Per identity cells list and plugin settings"},
{L"cellname",KC_STRING,(khm_int64) L"identity",L"Cell-identity mapping kept in the plugin configuration for the user."},
{L"_Schema",KC_SPACE,0,L"Schema is named for each cell to authenticate"},
{L"MethodName",KC_STRING,(khm_int64) L"",L"Name of method"},
{L"Method",KC_INT32,0,L"(Deprecated) Method identifier"},
{L"Realm",KC_STRING,(khm_int64) L"",L"Kerberos realm to use for authentication"},
{L"_Schema",KC_ENDSPACE,0,L""},
{L"Cells",KC_ENDSPACE,0,L""},
{L"AfsCred",KC_ENDSPACE,0,L""}
};

View File

@ -0,0 +1,646 @@
/*
* Copyright (c) 2004 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* $Id$ */
#include<afscred.h>
#include<kherror.h>
#include<khuidefs.h>
#include<commctrl.h>
#include<help/afsplhlp.h>
#include<htmlhelp.h>
/* disable the 'name was marked as deprecated' warnings. These get
issued for Str?Cat? and Str?Cpy? functions. We don't use those
anyway. */
#pragma warning(push)
#pragma warning(disable: 4995)
#include<shlwapi.h>
#include<shlobj.h>
#pragma warning(pop)
#include<assert.h>
typedef struct tag_afs_ids_dlg_data {
khui_config_init_data cfg;
khm_boolean afs_enabled;
} afs_ids_dlg_data;
INT_PTR CALLBACK
afs_cfg_ids_proc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam) {
afs_ids_dlg_data * d = NULL;
switch(uMsg) {
case WM_INITDIALOG:
{
khm_int32 t = 1;
d = PMALLOC(sizeof(*d));
ZeroMemory(d, sizeof(*d));
#pragma warning(push)
#pragma warning(disable: 4244)
SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR) d);
#pragma warning(pop)
d->cfg = *((khui_config_init_data *) lParam);
khc_read_int32(csp_params, L"AFSEnabled", &t);
d->afs_enabled = !!t;
CheckDlgButton(hwnd, IDC_CFG_OBTAIN,
(d->afs_enabled)? BST_CHECKED: BST_UNCHECKED);
}
return FALSE;
case WM_DESTROY:
{
d = (afs_ids_dlg_data *) (LONG_PTR)
GetWindowLongPtr(hwnd, DWLP_USER);
PFREE(d);
}
return TRUE;
case WM_COMMAND:
{
d = (afs_ids_dlg_data *) (LONG_PTR)
GetWindowLongPtr(hwnd, DWLP_USER);
if (wParam == MAKEWPARAM(IDC_CFG_OBTAIN, BN_CLICKED)) {
d->afs_enabled =
(IsDlgButtonChecked(hwnd, IDC_CFG_OBTAIN) ==
BST_CHECKED);
khui_cfg_set_flags_inst(&d->cfg, KHUI_CNFLAG_MODIFIED,
KHUI_CNFLAG_MODIFIED);
return TRUE;
}
}
return FALSE;
case KHUI_WM_CFG_NOTIFY:
{
d = (afs_ids_dlg_data *) (LONG_PTR)
GetWindowLongPtr(hwnd, DWLP_USER);
if (HIWORD(wParam) == WMCFG_APPLY) {
khm_int32 t;
if (KHM_FAILED(khc_read_int32(csp_params,
L"AFSEnabled", &t)) ||
!!t != !!d->afs_enabled) {
khc_write_int32(csp_params, L"AFSEnabled",
!!d->afs_enabled);
khui_cfg_set_flags_inst(&d->cfg,
KHUI_CNFLAG_APPLIED,
KHUI_CNFLAG_APPLIED |
KHUI_CNFLAG_MODIFIED);
} else {
khui_cfg_set_flags_inst(&d->cfg,
0,
KHUI_CNFLAG_MODIFIED);
}
}
}
return TRUE;
}
return FALSE;
}
INT_PTR CALLBACK
afs_cfg_id_proc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam) {
switch(uMsg) {
case WM_INITDIALOG:
{
INT_PTR rv;
afs_dlg_data * d;
wchar_t idname[KCDB_IDENT_MAXCCH_NAME];
khm_size cb;
rv = afs_dlg_proc(hwnd, uMsg, wParam, 0);
d = (afs_dlg_data *) (LONG_PTR) GetWindowLongPtr(hwnd, DWLP_USER);
d->cfg = *((khui_config_init_data *) lParam);
idname[0] = L'\0';
cb = sizeof(idname);
khui_cfg_get_name(d->cfg.ctx_node, idname, &cb);
d->ident = NULL;
kcdb_identity_create(idname, 0, &d->ident);
#ifdef DEBUG
assert(d->ident);
#endif
d->config_dlg = TRUE;
afs_cred_get_identity_creds(&d->creds, d->ident, &d->afs_enabled);
afs_dlg_proc(hwnd, KHUI_WM_NC_NOTIFY,
MAKEWPARAM(0, WMNC_DIALOG_SETUP), 0);
return rv;
}
break; /* not reached */
case WM_DESTROY:
{
afs_dlg_data * d;
d = (afs_dlg_data *) (LONG_PTR) GetWindowLongPtr(hwnd, DWLP_USER);
#ifdef DEBUG
assert(d && d->ident);
#endif
kcdb_identity_release(d->ident);
return afs_dlg_proc(hwnd, uMsg, wParam, lParam);
}
break; /* not reached */
case KHUI_WM_CFG_NOTIFY:
{
afs_dlg_data * d;
d = (afs_dlg_data *) (LONG_PTR) GetWindowLongPtr(hwnd, DWLP_USER);
if (HIWORD(wParam) == WMCFG_APPLY) {
afs_cred_write_ident_data(d);
}
}
return TRUE;
default:
return afs_dlg_proc(hwnd, uMsg, wParam, lParam);
}
}
static void
set_service_status(HWND hwnd) {
static DWORD wait_start = 0;
DWORD status = 0;
DWORD wait_hint = 0;
int i;
wchar_t status_strings_csv[1024];
wchar_t status_strings_ms[1024];
khm_size cb;
wchar_t *t;
GetServiceStatus(NULL,
TRANSARCAFSDAEMON,
&status, &wait_hint);
LoadString(hResModule, IDS_CFG_SVCSTATUS,
status_strings_csv, ARRAYLENGTH(status_strings_csv));
cb = sizeof(status_strings_ms);
csv_to_multi_string(status_strings_ms, &cb, status_strings_csv);
for(i=0, t = status_strings_ms; t && *t && *t != L' ';
t = multi_string_next(t), i++) {
if (i == status)
break;
}
if (!t || !*t)
t = status_strings_ms; /* the first one is "unknown". */
SetDlgItemText(hwnd, IDC_CFG_STATUS, t);
if (status != SERVICE_RUNNING) {
HWND hw;
hw = GetDlgItem(hwnd, IDC_CFG_STOP);
if (hw == GetFocus())
SetFocus(GetNextDlgTabItem(hwnd, hw, FALSE));
EnableWindow(hw, FALSE);
} else {
EnableWindow(GetDlgItem(hwnd, IDC_CFG_STOP), TRUE);
}
if (status != SERVICE_STOPPED &&
status != SERVICE_PAUSED) {
HWND hw;
hw = GetDlgItem(hwnd, IDC_CFG_START);
if (hw == GetFocus())
SetFocus(GetNextDlgTabItem(hwnd, hw, FALSE));
EnableWindow(hw, FALSE);
} else {
EnableWindow(GetDlgItem(hwnd, IDC_CFG_START), TRUE);
}
if (status == SERVICE_START_PENDING ||
status == SERVICE_STOP_PENDING) {
HWND hw;
DWORD now;
int progress;
hw = GetDlgItem(hwnd, IDC_CFG_PROGRESS);
#ifdef DEBUG
assert(hw);
#endif
if (!IsWindowVisible(hw))
ShowWindow(hw, SW_SHOW);
if (wait_start == 0)
wait_start = GetTickCount();
now = GetTickCount();
if (now + wait_hint != wait_start)
progress = (now - wait_start) * 100 /
(now + wait_hint - wait_start);
else
progress = 0;
SendMessage(hw, PBM_SETPOS, progress, 0);
SetTimer(hwnd, 1, 500, NULL);
} else {
HWND hw;
hw = GetDlgItem(hwnd, IDC_CFG_PROGRESS);
#ifdef DEBUG
assert(hw);
#endif
wait_start = 0;
if (IsWindowVisible(hw))
ShowWindow(hw, SW_HIDE);
}
}
void
afs_cfg_show_last_error(HWND hwnd, wchar_t * prefix, DWORD code) {
DWORD r;
wchar_t * err_desc = NULL;
wchar_t title[64];
wchar_t msg[1024];
wchar_t tmp[128];
r = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
code,
0,
(LPWSTR) &err_desc,
0,
NULL);
if (r == 0 || err_desc == NULL)
return;
LoadString(hResModule, IDS_PLUGIN_DESC,
title, ARRAYLENGTH(title));
if (prefix == NULL)
tmp[0] = L'\0';
else if (IS_INTRESOURCE(prefix))
LoadString(hResModule, (UINT)(UINT_PTR) prefix,
tmp, ARRAYLENGTH(tmp));
else
StringCbCopy(tmp, sizeof(tmp), prefix);
StringCbPrintf(msg, sizeof(msg), L"%s%s",
tmp, err_desc);
MessageBox(hwnd, msg, title, MB_OK | MB_APPLMODAL);
LocalFree(err_desc);
}
#define SCNAME_AFSCREDS L"AFS Credentials.lnk"
BOOL
afs_cfg_get_afscreds_shortcut(wchar_t * wpath) {
HRESULT hr;
BOOL shortcut_found = FALSE;
hr = SHGetFolderPath(NULL, CSIDL_COMMON_STARTUP,
NULL, SHGFP_TYPE_CURRENT,
wpath);
if (FAILED(hr))
goto _noshortcut;
if (!PathAppend(wpath, SCNAME_AFSCREDS)) {
goto _noshortcut;
}
if (PathFileExists(wpath)) {
shortcut_found = TRUE;
}
_noshortcut:
return shortcut_found;
}
INT_PTR CALLBACK
afs_cfg_main_proc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam) {
switch(uMsg) {
case WM_INITDIALOG:
{
wchar_t imagepath[MAX_PATH];
wchar_t blockname[MAX_PATH];
HKEY service_key;
LONG l;
DWORD cb;
DWORD dummy;
LPVOID ver_info;
wchar_t * value;
struct LANGANDCODEPATH {
WORD wLanguage;
WORD wCodePage;
} *translations;
#pragma warning(push)
#pragma warning(disable: 4244)
SetWindowLongPtr(hwnd, DWLP_USER, (DWORD_PTR) lParam);
#pragma warning(pop)
/* Try to figure out if afscreds.exe is on the startup
group for all users. */
{
khm_handle csp_afscred = NULL;
khm_int32 disable = FALSE;
if (KHM_SUCCEEDED(kmm_get_plugin_config(AFS_PLUGIN_NAME,
0,
&csp_afscred))) {
khc_read_int32(csp_afscred, L"Disableafscreds",
&disable);
khc_close_space(csp_afscred);
}
if (!disable) {
CheckDlgButton(hwnd, IDC_CFG_STARTAFSCREDS,
BST_UNCHECKED);
} else {
CheckDlgButton(hwnd, IDC_CFG_STARTAFSCREDS,
BST_CHECKED);
}
}
l = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
L"SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon",
0,
KEY_READ,
&service_key);
if (l != ERROR_SUCCESS)
goto _set_status;
cb = sizeof(imagepath);
l = RegQueryValueEx(service_key,
L"ImagePath",
NULL, NULL,
(LPBYTE) imagepath,
&cb);
if (l != ERROR_SUCCESS)
goto _close_key;
PathUnquoteSpaces(imagepath);
dummy = 1;
cb = GetFileVersionInfoSize(imagepath, &dummy);
if (cb == 0 || dummy)
goto _close_key;
ver_info = malloc(cb);
#ifdef DEBUG
assert(ver_info);
#endif
if (!ver_info)
goto _close_key;
if (!GetFileVersionInfo(imagepath,
0, cb, ver_info))
goto _free_buffer;
cb = 0;
if (!VerQueryValue(ver_info,
L"\\VarFileInfo\\Translation",
(LPVOID*) &translations,
&cb) ||
cb == 0)
goto _free_buffer;
StringCbPrintf(blockname, sizeof(blockname),
L"\\StringFileInfo\\%04x%04x\\FileVersion",
translations[0].wLanguage,
translations[0].wCodePage);
if (!VerQueryValue(ver_info,
blockname,
(LPVOID*) &value,
&cb) ||
cb == 0)
goto _free_buffer;
SetDlgItemText(hwnd, IDC_CFG_VERSION, value);
StringCbPrintf(blockname, sizeof(blockname),
L"\\StringFileInfo\\%04x%04x\\CompanyName",
translations[0].wLanguage,
translations[0].wCodePage);
if (!VerQueryValue(ver_info,
blockname,
(LPVOID*) &value,
&cb) ||
cb == 0)
goto _free_buffer;
SetDlgItemText(hwnd, IDC_CFG_COMPANY, value);
_free_buffer:
free(ver_info);
_close_key:
RegCloseKey(service_key);
_set_status:
set_service_status(hwnd);
}
return FALSE;
case WM_COMMAND:
switch(wParam) {
case MAKEWPARAM(IDC_CFG_STOP, BN_CLICKED):
{
DWORD r;
r = ServiceControl(NULL, TRANSARCAFSDAEMON, SERVICE_STOPPED);
if (r)
afs_cfg_show_last_error(hwnd,
MAKEINTRESOURCE(IDS_CFG_CANTSTOP),
r);
else
set_service_status(hwnd);
}
break;
case MAKEWPARAM(IDC_CFG_START,BN_CLICKED):
{
DWORD r;
r = ServiceControl(NULL, TRANSARCAFSDAEMON, SERVICE_RUNNING);
if (r)
afs_cfg_show_last_error(hwnd,
MAKEINTRESOURCE(IDS_CFG_CANTSTART),
r);
else
set_service_status(hwnd);
}
break;
case MAKEWPARAM(IDC_CFG_CPL, BN_CLICKED):
if (32 >= (LRESULT) ShellExecute (NULL, NULL,
L"AFS_CONFIG.EXE", NULL,
NULL, SW_SHOW)) {
MessageBox(NULL,
L"Can't find file AFS_CONFIG.EXE",
L"Error", MB_OK);
}
break;
case MAKEWPARAM(IDC_CFG_STARTAFSCREDS, BN_CLICKED):
{
khui_config_node node;
node = (khui_config_node) (DWORD_PTR)
GetWindowLongPtr(hwnd, DWLP_USER);
khui_cfg_set_flags(node,
KHUI_CNFLAG_MODIFIED,
KHUI_CNFLAG_MODIFIED);
}
break;
}
return TRUE;
case KHUI_WM_CFG_NOTIFY:
{
if (HIWORD(wParam) == WMCFG_APPLY) {
wchar_t wpath[MAX_PATH];
int dlg_state;
khui_config_node node;
khm_handle csp_afscred = NULL;
khm_int32 disable = FALSE;
node = (khui_config_node) (DWORD_PTR)
GetWindowLongPtr(hwnd, DWLP_USER);
kmm_get_plugin_config(AFS_PLUGIN_NAME, KHM_PERM_WRITE,
&csp_afscred);
if (csp_afscred)
khc_read_int32(csp_afscred, L"Disableafscreds",
&disable);
dlg_state = IsDlgButtonChecked(hwnd, IDC_CFG_STARTAFSCREDS);
if (!!disable !=
(dlg_state == BST_CHECKED)) {
if (csp_afscred)
khc_write_int32(csp_afscred,
L"Disableafscreds",
(dlg_state == BST_CHECKED));
khui_cfg_set_flags(node,
KHUI_CNFLAG_APPLIED,
KHUI_CNFLAG_MODIFIED |
KHUI_CNFLAG_APPLIED);
} else {
khui_cfg_set_flags(node, 0,
KHUI_CNFLAG_MODIFIED);
}
if (dlg_state == BST_CHECKED &&
afs_cfg_get_afscreds_shortcut(wpath)) {
DeleteFile(wpath);
}
}
}
return TRUE;
case WM_TIMER:
if (wParam == 1) {
KillTimer(hwnd, 1);
set_service_status(hwnd);
}
break;
case WM_DESTROY:
return FALSE;
case WM_HELP:
{
static const DWORD ctx_help[] = {
IDC_CFG_STATUS, IDH_SVCSTATUS,
IDC_CFG_STOP, IDH_SVCSTOP,
IDC_CFG_START, IDH_SVCSTART,
IDC_CFG_VERSION, IDH_SVCVERSION,
IDC_CFG_COMPANY, IDH_SVCCOMPANY,
IDC_CFG_CPL, IDH_SVCCPL,
IDC_CFG_STARTAFSCREDS, IDH_STARTAFSCREDS,
0
};
LPHELPINFO hlp;
hlp = (LPHELPINFO) lParam;
if (hlp->iContextType != HELPINFO_WINDOW)
break;
afs_html_help(hlp->hItemHandle, L"::/popups_cfg.txt",
HH_TP_HELP_WM_HELP, (DWORD_PTR) ctx_help);
}
return TRUE;
}
return FALSE;
}

View File

@ -0,0 +1,208 @@
/*
* Copyright (c) 2004 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* $Id$ */
#ifndef __KHIMAIRA_AFSCRED_H
#define __KHIMAIRA_AFSCRED_H
#define _WINSOCKAPI_
#include<windows.h>
#include<time.h>
#define KHERR_FACILITY L"AfsCred"
#define KHERR_HMODULE hResModule
#include<netidmgr.h>
#include<langres.h>
#include <afs/cm_config.h>
#include <afs/stds.h>
#include <afs/auth.h>
#include <afs/ptserver.h>
#include <afs/ptuser.h>
#include<afspext.h>
#include<afsfuncs.h>
#include<afsnewcreds.h>
#ifndef NOSTRSAFE
#include<strsafe.h>
#endif
#define AFS_PLUGIN_NAME L"AfsCred"
#define AFS_CREDTYPE_NAME L"AfsCred"
#define AFS_PLUGIN_DEPS L"Krb5Cred\0"
#define KRB5_CREDTYPE_NAME L"Krb5Cred"
#define KRB4_CREDTYPE_NAME L"Krb4Cred"
#define AFS_TYPENAME_PRINCIPAL L"AFSPrincipal"
#define AFS_TYPENAME_METHOD L"AFSTokenMethod"
#define AFS_ATTRNAME_CLIENT_PRINC L"AFSClientPrinc"
#define AFS_ATTRNAME_SERVER_PRINC L"AFSServerPrinc"
#define AFS_ATTRNAME_CELL L"AFSCell"
#define AFS_ATTRNAME_METHOD L"AFSMethod"
#define AFS_ATTRNAME_REALM L"AFSRealm"
#define AFS_VALID_CELL_CHARS L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-"
#define AFS_VALID_REALM_CHARS AFS_VALID_CELL_CHARS
#define AFS_CONFIG_NODE_IDS L"AfsIdentities"
#define AFS_CONFIG_NODE_ID L"AfsIdentity"
#define AFS_CONFIG_NODE_MAIN L"AfsOptions"
#define AFS_HELPFILE L"afsplhlp.chm"
/* token acquisition methods provided by extensions begin with this
ID */
#define AFS_TOKEN_USER 8
void init_afs();
void exit_afs();
KHMEXP khm_int32 KHMAPI init_module(kmm_module h_module);
KHMEXP khm_int32 KHMAPI exit_module(kmm_module h_module);
/* globals */
extern kmm_module h_khModule;
extern HMODULE hResModule;
extern HINSTANCE hInstance;
extern khm_int32 afs_credtype_id;
extern khm_int32 krb5_credtype_id;
extern khm_int32 krb4_credtype_id;
extern khm_int32 afs_msg_type_id;
extern khm_handle afs_credset;
extern khm_int32 afs_type_principal;
extern khm_int32 afs_attr_client_princ;
extern khm_int32 afs_attr_server_princ;
extern khm_int32 afs_attr_cell;
extern khm_int32 afs_attr_method;
extern khm_int32 afs_attr_realm;
/* Configuration spaces */
#define CSNAME_PLUGINS L"Plugins"
#define CSNAME_AFSCRED L"AfsCred"
#define CSNAME_PARAMS L"Parameters"
extern khm_handle csp_plugins;
extern khm_handle csp_afscred;
extern khm_handle csp_params;
extern khm_handle afs_sub;
/* defined in afsconfig.c which is generated from afsconfig.csv */
extern kconf_schema schema_afsconfig[];
/* plugin callback procedure */
khm_int32 KHMAPI
afs_plugin_cb(khm_int32 msg_type,
khm_int32 msg_subtype,
khm_ui_4 uparam,
void * vparam);
INT_PTR CALLBACK
afs_cfg_ids_proc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam);
INT_PTR CALLBACK
afs_cfg_id_proc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam);
INT_PTR CALLBACK
afs_cfg_main_proc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam);
HWND
afs_html_help(HWND caller,
wchar_t * postfix,
UINT cmd,
DWORD_PTR data);
/* extensions */
typedef afs_msg_announce afs_extension;
/* not thread safe. only call from the plugin thread */
afs_extension *
afs_find_extension(const wchar_t * name);
/* not thread safe. only call from the plugin thread */
afs_extension *
afs_get_extension(khm_size i);
/* not thread safe. only call from the plugin thread */
afs_extension *
afs_get_next_token_acq(afs_extension * f);
/* not thread safe. only call from the plugin thread */
khm_boolean
afs_is_valid_method_id(afs_tk_method method);
afs_tk_method
afs_get_next_method_id(afs_tk_method method);
afs_tk_method
afs_get_method_id(wchar_t * name);
khm_boolean
afs_get_method_name(afs_tk_method method, wchar_t * buf, khm_size cbbuf);
afs_extension *
afs_get_method_ext(afs_tk_method method);
khm_boolean
afs_method_describe(afs_tk_method method, khm_int32 flags,
wchar_t * wbuf, khm_size cbbuf);
khm_boolean
afs_ext_resolve_token(const wchar_t * cell,
const struct ktc_token * token,
const struct ktc_principal * serverp,
const struct ktc_principal * clientp,
khm_handle * pident,
afs_tk_method * pmethod);
khm_boolean
afs_ext_klog(afs_tk_method method,
khm_handle identity,
const char * service,
const char * cell,
const char * realm,
const afs_conf_cell * cell_config,
khm_int32 lifetime);
BOOL
afs_cfg_get_afscreds_shortcut(wchar_t * wpath);
#endif

View File

@ -0,0 +1,454 @@
/*
* Copyright (c) 2004 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* $Id$ */
#include<afscred.h>
#include<assert.h>
#include<wchar.h>
/* supported API versions */
#define AFS_PLUGIN_VERSION_MIN 0x00000001
#define AFS_PLUGIN_VERSION_MAX AFS_PLUGIN_VERSION
#define MAX_EXTENSIONS 8
afs_extension extensions[MAX_EXTENSIONS];
khm_size n_extensions = 0;
khm_int32 next_method_id = AFS_TOKEN_USER;
/* not threadsafe. should only be called from the plugin thread */
khm_int32
afs_add_extension(afs_msg_announce * ann) {
size_t cbname = 0;
size_t cbtashort = 0;
size_t cbtalong = 0;
afs_extension * ext;
wchar_t * tmp;
if (ann->cbsize != sizeof(afs_msg_announce) ||
FAILED(StringCbLength(ann->name, KHUI_MAXCB_NAME, &cbname)) ||
ann->sub == NULL ||
(ann->provide_token_acq &&
((FAILED(StringCbLength(ann->token_acq.short_desc,
KHUI_MAXCB_SHORT_DESC,
&cbtashort))) ||
(ann->token_acq.long_desc &&
FAILED(StringCbLength(ann->token_acq.long_desc,
KHUI_MAXCB_LONG_DESC,
&cbtalong))))) ||
ann->version < AFS_PLUGIN_VERSION_MIN ||
ann->version > AFS_PLUGIN_VERSION_MAX)
return KHM_ERROR_INVALID_PARAM;
if (n_extensions == MAX_EXTENSIONS)
return KHM_ERROR_NO_RESOURCES;
cbname += sizeof(wchar_t);
cbtashort += sizeof(wchar_t);
cbtalong += sizeof(wchar_t);
ext = &extensions[n_extensions];
*ext = *ann;
tmp = PMALLOC(cbname);
#ifdef DEBUG
assert(tmp);
#endif
StringCbCopy(tmp, cbname, ann->name);
ext->name = tmp;
if (ann->provide_token_acq) {
tmp = PMALLOC(cbtashort);
#ifdef DEBUG
assert(tmp);
#endif
StringCbCopy(tmp, cbtashort, ann->token_acq.short_desc);
ext->token_acq.short_desc = tmp;
if (ann->token_acq.long_desc) {
tmp = PMALLOC(cbtalong);
#ifdef DEBUG
assert(tmp);
#endif
StringCbCopy(tmp, cbtalong,
ann->token_acq.long_desc);
ext->token_acq.long_desc = tmp;
} else {
ext->token_acq.long_desc = NULL;
}
ann->token_acq.method_id = next_method_id++;
ext->token_acq.method_id = ann->token_acq.method_id;
} else {
ZeroMemory(&ext->token_acq, sizeof(ext->token_acq));
}
n_extensions++;
return KHM_ERROR_SUCCESS;
}
void
afs_free_extension(khm_int32 idx) {
afs_extension * ext;
#ifdef DEBUG
assert(idx >= 0 && idx < (khm_int32) n_extensions);
#endif
ext = &extensions[idx];
if (ext->name)
PFREE((void *) ext->name);
if (ext->token_acq.short_desc)
PFREE((void *) ext->token_acq.short_desc);
if (ext->token_acq.long_desc)
PFREE((void *) ext->token_acq.long_desc);
if (ext->sub)
kmq_delete_subscription(ext->sub);
ZeroMemory(ext, sizeof(*ext));
}
/* not thread safe. only call from plugin thread */
void
afs_remove_extension(khm_int32 idx) {
if (idx < 0 || idx > (khm_int32) n_extensions)
return;
afs_free_extension(idx);
if (idx == n_extensions-1) {
n_extensions--;
} else {
MoveMemory(&extensions[idx], &extensions[idx + 1],
(n_extensions - (idx+1)) * sizeof(*extensions));
}
}
/* not thread safe. only call from the plugin thread */
afs_extension *
afs_find_extension(const wchar_t * name) {
khm_size i;
for (i=0; i < n_extensions; i++) {
if (extensions[i].name &&
!wcscmp(extensions[i].name, name))
return &extensions[i];
}
return NULL;
}
/* not thread safe. only call from the plugin thread */
khm_boolean
afs_is_valid_method_id(afs_tk_method method) {
khm_size i;
if (method == AFS_TOKEN_AUTO ||
method == AFS_TOKEN_KRB5 ||
method == AFS_TOKEN_KRB524 ||
method == AFS_TOKEN_KRB4)
return TRUE;
for (i=0; i < n_extensions; i++) {
if (extensions[i].provide_token_acq &&
extensions[i].token_acq.method_id == method)
return TRUE;
}
return FALSE;
}
khm_boolean
afs_method_describe(afs_tk_method method, khm_int32 flags,
wchar_t * wbuf, khm_size cbbuf) {
khm_size idx;
switch(method) {
case AFS_TOKEN_AUTO:
return LoadString(hResModule,
((flags & KCDB_TS_SHORT)?
IDS_NC_METHOD_AUTO:
IDS_NC_METHODL_AUTO),
wbuf, (int) cbbuf / sizeof(wchar_t));
case AFS_TOKEN_KRB5:
return LoadString(hResModule,
((flags & KCDB_TS_SHORT)?
IDS_NC_METHOD_KRB5:
IDS_NC_METHODL_KRB5),
wbuf, (int) cbbuf / sizeof(wchar_t));
case AFS_TOKEN_KRB524:
return LoadString(hResModule,
((flags & KCDB_TS_SHORT)?
IDS_NC_METHOD_KRB524:
IDS_NC_METHODL_KRB524),
wbuf, (int) cbbuf / sizeof(wchar_t));
case AFS_TOKEN_KRB4:
return LoadString(hResModule,
((flags & KCDB_TS_SHORT)?
IDS_NC_METHOD_KRB4:
IDS_NC_METHODL_KRB4),
wbuf, (int) cbbuf / sizeof(wchar_t));
default:
for (idx = 0; idx < n_extensions; idx++) {
if(!extensions[idx].provide_token_acq ||
extensions[idx].token_acq.method_id != method)
continue;
if ((flags & KCDB_TS_SHORT) ||
extensions[idx].token_acq.long_desc == NULL)
return SUCCEEDED(StringCbCopy(wbuf, cbbuf,
extensions[idx].token_acq.short_desc));
else
return SUCCEEDED(StringCbCopy(wbuf, cbbuf,
extensions[idx].token_acq.long_desc));
}
}
return FALSE;
}
afs_tk_method
afs_get_next_method_id(afs_tk_method method) {
khm_size idx;
switch(method) {
case -1:
return AFS_TOKEN_AUTO;
case AFS_TOKEN_AUTO:
return AFS_TOKEN_KRB5;
case AFS_TOKEN_KRB5:
return AFS_TOKEN_KRB524;
case AFS_TOKEN_KRB524:
return AFS_TOKEN_KRB4;
case AFS_TOKEN_KRB4:
idx = 0;
break;
default:
for(idx = 0; idx < n_extensions; idx ++) {
if (extensions[idx].provide_token_acq &&
extensions[idx].token_acq.method_id == method)
break;
}
idx++;
}
for(; idx < n_extensions; idx++) {
if (extensions[idx].provide_token_acq)
return extensions[idx].token_acq.method_id;
}
return -1;
}
/* not thread safe. only call from the plugin thread */
afs_extension *
afs_get_next_token_acq(afs_extension * f) {
khm_size idx;
if (f == NULL)
idx = 0;
else
idx = (f - extensions) + 1;
for(; idx < n_extensions; idx++) {
if (extensions[idx].provide_token_acq)
return &extensions[idx];
}
return NULL;
}
afs_extension *
afs_get_extension(khm_size i) {
if (i >= n_extensions)
return NULL;
else
return &extensions[i];
}
afs_tk_method
afs_get_method_id(wchar_t * name) {
if (!wcscmp(name, AFS_TOKENNAME_AUTO))
return AFS_TOKEN_AUTO;
else if (!wcscmp(name, AFS_TOKENNAME_KRB5))
return AFS_TOKEN_KRB5;
else if (!wcscmp(name, AFS_TOKENNAME_KRB524))
return AFS_TOKEN_KRB524;
else if (!wcscmp(name, AFS_TOKENNAME_KRB4))
return AFS_TOKEN_KRB4;
else {
khm_size i;
for (i=0; i < n_extensions; i++) {
if (!extensions[i].provide_token_acq)
continue;
if (!wcscmp(extensions[i].name, name))
return extensions[i].token_acq.method_id;
}
}
return AFS_TOKEN_AUTO;
}
khm_boolean
afs_get_method_name(afs_tk_method method, wchar_t * buf, khm_size cbbuf) {
if (method == AFS_TOKEN_AUTO)
return SUCCEEDED(StringCbCopy(buf, cbbuf, AFS_TOKENNAME_AUTO));
else if (method == AFS_TOKEN_KRB5)
return SUCCEEDED(StringCbCopy(buf, cbbuf, AFS_TOKENNAME_KRB5));
else if (method == AFS_TOKEN_KRB524)
return SUCCEEDED(StringCbCopy(buf, cbbuf, AFS_TOKENNAME_KRB524));
else if (method == AFS_TOKEN_KRB4)
return SUCCEEDED(StringCbCopy(buf, cbbuf, AFS_TOKENNAME_KRB4));
else {
khm_size i;
for (i=0; i < n_extensions; i++) {
if (!extensions[i].provide_token_acq)
continue;
if (extensions[i].token_acq.method_id == method)
return SUCCEEDED(StringCbCopy(buf, cbbuf,
extensions[i].name));
}
}
return FALSE;
}
/* not thread safe. only call from the plugin thread */
khm_boolean
afs_ext_resolve_token(const wchar_t * cell,
const struct ktc_token * token,
const struct ktc_principal * serverp,
const struct ktc_principal * clientp,
khm_handle * pident,
afs_tk_method * pmethod) {
afs_msg_resolve_token rt;
khm_size idx;
khm_int32 rv;
ZeroMemory(&rt, sizeof(rt));
rt.cbsize = sizeof(rt);
rt.cell = cell;
rt.token = token;
rt.serverp = serverp;
rt.clientp = clientp;
rt.method = AFS_TOKEN_AUTO;
rt.ident = NULL;
for (idx = 0; idx < n_extensions; idx++) {
if (!extensions[idx].provide_token_acq)
continue;
rv = kmq_send_sub_msg(extensions[idx].sub,
afs_msg_type_id,
AFS_MSG_RESOLVE_TOKEN,
0,
(void *) &rt);
if (KHM_SUCCEEDED(rv)) {
assert(rt.ident != NULL);
*pident = rt.ident;
*pmethod = rt.method;
return TRUE;
}
}
return FALSE;
}
/* not thread safe. only call from the plugin thread */
khm_boolean
afs_ext_klog(afs_tk_method method,
khm_handle identity,
const char * service,
const char * cell,
const char * realm,
const afs_conf_cell * cell_config,
khm_int32 lifetime) {
khm_size idx;
khm_int32 rv = KHM_ERROR_GENERAL;
afs_msg_klog msg;
afs_conf_cell cellconfig;
ZeroMemory(&msg, sizeof(msg));
ZeroMemory(&cellconfig, sizeof(cellconfig));
msg.cbsize = sizeof(msg);
msg.identity = identity;
msg.service = service;
msg.cell = cell;
msg.realm = realm;
msg.lifetime = lifetime;
msg.cell_config = &cellconfig;
cellconfig = *cell_config;
cellconfig.cbsize = sizeof(cellconfig);
for (idx = 0; idx < n_extensions; idx++) {
if (!extensions[idx].provide_token_acq ||
(method != AFS_TOKEN_AUTO &&
extensions[idx].token_acq.method_id != method))
continue;
rv = kmq_send_sub_msg(extensions[idx].sub,
afs_msg_type_id,
AFS_MSG_KLOG,
0,
(void *) &msg);
if (KHM_SUCCEEDED(rv))
return TRUE;
}
return FALSE;
}
khm_int32 KHMAPI
afs_msg_ext(khm_int32 msg_subtype, khm_ui_4 uparam, void * vparam) {
switch(msg_subtype) {
case AFS_MSG_ANNOUNCE:
return afs_add_extension((afs_msg_announce *) vparam);
}
return KHM_ERROR_SUCCESS;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,80 @@
/*
* Copyright (c) 2004 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* $Id$ */
#ifndef __KHIMAIRA_AFSFUNCS_H
#define __KHIMAIRA_AFSFUNCS_H
BOOL
afs_is_running(void);
int
afs_princ_to_string(struct ktc_principal * p, wchar_t * buf, size_t cbbuf);
int
afs_list_tokens(void);
khm_handle
afs_find_token(khm_handle credset, wchar_t * cell);
int
afs_list_tokens_internal(void);
int
afs_klog(khm_handle identity,
char *service,
char *cell,
char *realm,
int LifeTime,
afs_tk_method method,
time_t * tok_expiration /* OUT: expiration time of new
token */
);
int
afs_unlog(void);
int
afs_unlog_cred(khm_handle cred);
DWORD
GetServiceStatus(LPSTR lpszMachineName,
LPSTR lpszServiceName,
DWORD *lpdwCurrentState,
DWORD *lpdwWaitHint);
DWORD
ServiceControl(LPSTR lpszMachineName,
LPSTR lpszServiceName,
DWORD dwNewState);
void afs_report_error(LONG rc, LPCSTR FailedFunctionName);
static char *afs_realm_of_cell(afs_conf_cell *);
static long afs_get_cellconfig_callback(void *, struct sockaddr_in *, char *);
static int afs_get_cellconfig(char *, afs_conf_cell *, char *);
#endif

View File

@ -0,0 +1,70 @@
/*
* Copyright (c) 2004 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* $Id$ */
#define NOSTRSAFE
#include<afscred.h>
#include<shlwapi.h>
#include<htmlhelp.h>
#include<psapi.h>
#ifdef DEBUG
#include<assert.h>
#endif
#include<strsafe.h>
static wchar_t helpfile[MAX_PATH] = L"";
/* can only be called from the UI thread */
HWND
afs_html_help(HWND caller,
wchar_t * postfix,
UINT cmd,
DWORD_PTR data) {
wchar_t fullp[MAX_PATH + MAX_PATH];
if (!helpfile[0]) {
DWORD rv;
rv = GetModuleFileNameEx(GetCurrentProcess(),
hInstance,
helpfile,
ARRAYLENGTH(helpfile));
#ifdef DEBUG
assert(rv != 0);
#endif
PathRemoveFileSpec(helpfile);
PathAppend(helpfile, AFS_HELPFILE);
}
StringCbCopy(fullp, sizeof(fullp), helpfile);
if (postfix)
StringCbCat(fullp, sizeof(fullp), postfix);
return HtmlHelp(caller, fullp, cmd, data);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,145 @@
/*
* Copyright (c) 2004 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* $Id$ */
#ifndef __AFS_NEWCREDS_H
#define __AFS_NEWCREDS_H
typedef struct tag_afs_cred_row {
wchar_t * cell;
wchar_t * realm;
afs_tk_method method;
khm_int32 flags;
} afs_cred_row;
/* we checked whether this cell exists */
#define DLGROW_FLAG_CHECKED 0x00000001
/* cell was checked and was found to be valid */
#define DLGROW_FLAG_VALID 0x00000002
/* cell was deleted */
#define DLGROW_FLAG_DELETED 0x00000004
/* tokens obtained for cell */
#define DLGROW_FLAG_DONE 0x00000008
/* tokens for this cell already exist */
#define DLGROW_FLAG_EXISTS 0x00000010
/* tokens for this cell exist and is listed under a different
identity */
#define DLGROW_FLAG_NOTOWNED 0x00000020
/* tokens for this cell exist and are expired */
#define DLGROW_FLAG_EXPIRED 0x00000040
/* the subitem indexes for each data field */
enum afs_ncwnd_subitems {
NCAFS_IDX_CELL=0,
NCAFS_IDX_REALM,
NCAFS_IDX_METHOD
};
#define DLG_TOOLTIP_TIMER_ID 1
#define DLG_TOOLTIP_TIMEOUT 5000
typedef struct tag_afs_cred_list {
afs_cred_row * rows;
int n_rows;
int nc_rows;
} afs_cred_list;
typedef struct tag_afs_dlg_data {
khui_new_creds * nc;
afs_cred_list creds;
khm_int32 afs_enabled;
BOOL tooltip_visible;
BOOL dirty;
HWND tooltip;
/* list view state image indices */
int idx_new_token;
int idx_existing_token;
int idx_bad_token;
CRITICAL_SECTION cs;
/* used with configuration dialogs */
khm_boolean config_dlg;
khui_config_init_data cfg;
khm_handle ident;
} afs_dlg_data;
#define AFS_DLG_ROW_ALLOC 4
INT_PTR CALLBACK
afs_dlg_proc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam);
void
afs_dlg_update_rows(HWND hwnd, afs_dlg_data * d);
void
afs_cred_flush_rows(afs_cred_list * l);
void
afs_cred_free_rows(afs_cred_list * l);
void
afs_cred_assert_rows(afs_cred_list * l, int n);
void
afs_cred_delete_row(afs_cred_list * l, int i);
afs_cred_row *
afs_cred_get_new_row(afs_cred_list * l);
khm_int32 KHMAPI
afs_cred_add_cred_proc(khm_handle cred, void * rock);
void
afs_cred_get_context_creds(afs_cred_list *l,
khui_action_context * ctx);
void
afs_cred_get_identity_creds(afs_cred_list * l,
khm_handle ident,
khm_boolean * enabled);
void
afs_cred_write_ident_data(afs_dlg_data * d);
khm_int32
afs_msg_newcred(khm_int32 msg_subtype,
khm_ui_4 uparam,
void * vparam);
#endif

View File

@ -0,0 +1,37 @@
/* Copyright (c) 2004 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
#ifndef __AFSPLUGIN_VERSION_H
#define __AFSPLUGIN_VERSION_H
#define AFSPLUGIN_VERSION_MAJOR 1
#define AFSPLUGIN_VERSION_MINOR 5
#define AFSPLUGIN_VERSION_PATCH 0002
#define AFSPLUGIN_VERSION_AUX 0
#define AFSPLUGIN_VERSION 1.5.0002.0
#define AFSPLUGIN_VERSION_STR "1.5.0002.0"
#define AFSPLUGIN_VERSION_LST 1,5,0002,0
#endif

View File

@ -0,0 +1,40 @@
afsp_version.h: NTMakefile afsp_version.h.in
$(COPY) << $@
/* Copyright (c) 2004 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
#ifndef __AFSPLUGIN_VERSION_H
#define __AFSPLUGIN_VERSION_H
#define AFSPLUGIN_VERSION_MAJOR $(AFSPLUGIN_VERSION_MAJOR)
#define AFSPLUGIN_VERSION_MINOR $(AFSPLUGIN_VERSION_MINOR)
#define AFSPLUGIN_VERSION_PATCH $(AFSPLUGIN_VERSION_PATCH)
#define AFSPLUGIN_VERSION_AUX $(AFSPLUGIN_VERSION_AUX)
#define AFSPLUGIN_VERSION $(AFSPLUGIN_VERSION)
#define AFSPLUGIN_VERSION_STR "$(AFSPLUGIN_VERSION)"
#define AFSPLUGIN_VERSION_LST $(AFSPLUGIN_VERLIST)
#endif
<<

View File

@ -0,0 +1,328 @@
/*
* Copyright (c) 2004 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* $Id$ */
#ifndef __AFSPLUGIN_EXT_H
#define __AFSPLUGIN_EXT_H
/*! \defgroup afs_ext OpenAFS Plugin extensions
This section documents messages and data structures used by AFS
extension plugins. These are plugins which augment the behavior
of the AFS plugin.
When performing specific tasks for NetIDMgr, the AFS plugin will
send out messages to the extension plugins either via broadcast or
unicast. The extension plugins provide functionality by
responding to these messages.
@{*/
#define MAXCELLCHARS 64
#define MAXHOSTCHARS 64
#define MAXHOSTSPERCELL 8
#define TRANSARCAFSDAEMON "TransarcAFSDaemon"
#define AFS_TOKENNAME_AUTO L"Auto"
#define AFS_TOKENNAME_KRB5 L"Kerberos5"
#define AFS_TOKENNAME_KRB524 L"Kerberos524"
#define AFS_TOKENNAME_KRB4 L"Kerberos4"
/*! \brief An AFS token acquisition method identifier
This takes on a value from ::afs_token_method or a token
acquisition method identifier assigned to an extension plugin.
*/
typedef khm_int32 afs_tk_method;
/*! \brief Predefined token acquisition methods */
enum afs_token_method {
AFS_TOKEN_AUTO = 0, /*!< Automatic. This method iterates
through Krb5, Krb524, Krb4 and then
any extensions which provide token
acquisition methods until one of
them succeeds. */
AFS_TOKEN_KRB5, /*!< Kerberos 5 */
AFS_TOKEN_KRB524, /*!< Kerberos 5 with krb524 translation */
AFS_TOKEN_KRB4, /*!< Kerberos 4 */
};
/*! \brief Version of the OpenAFS Plugin
This is an internal number that identifies the version of the
OpenAFS plugin API that this extension was built against. This
number is specified when sending the ::AFS_MSG_ANNOUNCE message.
*/
#define AFS_PLUGIN_VERSION 0x0000001
/*! \name Messages
The AFS plugin registers the message type named ::AFS_MSG_TYPENAME
and sends messages of this type to notify any AFS extension
plugins to notify them of various events.
@{*/
/*! \brief Name of the AFS plugin message
This message type is registered when the AFS plugin starts and is
unregistered when the plugin stops.
Use kmq_find_type() to find the type ID of this message type.
*/
#define AFS_MSG_TYPENAME L"AfsExtMessage"
/*! \brief Announce an extension plugin
Sent by an extension plugin to announce its existence to the AFS
plugin. This message should be sent by the extension plugin when
it has finished loading, and is the only message permitted to be
sent by an extension. All other messages are sent by the AFS
plugin.
Since this message contains pointer parameters and there is no
cleanup performed on this, the message should be sent using
kmq_send_message().
<table>
<tr><td>Type</td><td>type ID of ::AFS_MSG_TYPENAME</td></tr>
<tr><td>Subtype</td><td>::AFS_MSG_ANNOUNCE</td></tr>
<tr><td>uparam</td><td>0</td></tr>
<tr><td>vparam</td><td>Pointer to a ::afs_msg_announce structure</td></tr>
</table>
\note This message is only sent from extension plugins to the AFS plugin.
*/
#define AFS_MSG_ANNOUNCE 1
/*! \brief Parameter structure for announcing an extension plugin
\see ::AFS_MSG_ANNOUNCE
*/
typedef struct tag_afs_msg_announce_v1 {
khm_size cbsize; /*!< Size of the strucutre. Set to \a
sizeof(::afs_msg_announce). If
there is a version skew between the
AFS plugin and the extension, then
this parameter will ensure that the
AFS plugin understands the correct
version of the structure. */
khm_ui_4 version; /*!< Version of the AFS plugin that
the extension is compiled for. Set
this to ::AFS_PLUGIN_VERSION.
Depending on this value, the AFS
plugin will either reject the
extension or determine which set of
messages and structures should be
used to communicate with the
extension. */
const wchar_t * name; /*!< Name of the extension. Should be
unique among all AFS extension
plugins. Size constrained by
::KHUI_MAXCCH_NAME*/
khm_handle sub; /*!< A valid subscription for unicast
messages. This must have been
created through
kmq_create_subscription(). The
supplied handle will be
automatically released when the
plugin exits. However, if the
announcement message fails, then the
extension has to release the handle
itself. */
khm_boolean provide_token_acq; /*!< non-zero if the extension
provides a token acquisition
method. The \a token_acq
substructure should be filled if
this member is set to
non-zero. */
struct {
const wchar_t * short_desc; /*!< Short description of token
acquisition method. (localized,
required). Size is constrained by
::KHUI_MAXCCH_SHORT_DESC */
const wchar_t * long_desc; /*!< Long description. (localized,
optional). Size is constrained by
::KHUI_MAXCCH_LONG_DESC */
afs_tk_method method_id; /*!< Once the message is processed,
this will receive a new method
identifier. The value of this field
on entry is ignored. */
} token_acq; /*!< Registration information for
token acquisition method. Only
assumed to be valid if \a
provide_token_acq is TRUE. */
} afs_msg_announce;
/*! \brief Sent to all extensions to resolve the identity of a token
If the identity and credentials acquisition method of an AFS token
cannot be determined by the AFS plugin, this message is sent out
to extension plugins to allow them a chance to resolve it.
If the extension plugin successfully resolves the identity and
token acquisition method of the specified token, it should return
::KHM_ERROR_SUCCESS. Otherwise it should return a failure code.
The actual return code is not interpreted other than whether or
not it passes the ::KHM_SUCCEEDED() test.
<table>
<tr><td>Type</td><td>type ID of ::AFS_MSG_TYPENAME</td></tr>
<tr><td>Subtype</td><td>::AFS_MSG_RESOLVE_TOKEN</td></tr>
<tr><td>uparam</td><td>0</td></tr>
<tr><td>vparam</td><td>Pointer to a ::afs_msg_resolve_token structure</td></tr>
</table>
\note This message is only sent from the AFS plugin to extension plugins
\note Only sent if the extension plugin has ::provide_token_acq set.
*/
#define AFS_MSG_RESOLVE_TOKEN 2
/*! \brief Message structure for AFS_MSG_RESOLVE_TOKEN
Other than the fields marked as \a [OUT], all other fields should
be considered read-only and should not be modified.
\see ::AFS_MSG_RESOLVE_TOKEN
*/
typedef struct tag_afs_msg_resolve_token_v1 {
khm_size cbsize; /*!< Size of the structure. This will
be set to \a
sizeof(::afs_msg_resolve_token). */
const wchar_t * cell; /*!< Specifies the cell that the token
belongs to. */
const struct ktc_token * token; /*!< The token */
const struct ktc_principal * serverp; /*!< Server principal */
const struct ktc_principal * clientp; /*!< Client principal */
khm_handle ident; /*!< [OUT] If the extension
successfully resolves the identity,
then it should assign a handle to
the identity to this field and
return ::KHM_ERROR_SUCCESS. The
handle will be automatically freed
by the AFS plugin. */
afs_tk_method method; /*!< [OUT] If the extension
successfully resolves the identity,
it should also assign the token
acquisition method identifier to
this field. The default method is
::AFS_TOKEN_AUTO. This field
indicates the token acquisition
method that was used to obtain the
token and is used when the token
needs to be renewed. */
} afs_msg_resolve_token;
/*! \brief Sent to an extension plugin to obtain AFS tokens
<table>
<tr><td>Type</td><td>type ID of ::AFS_MSG_TYPENAME</td></tr>
<tr><td>Subtype</td><td>::AFS_MSG_KLOG</td></tr>
<tr><td>uparam</td><td>0</td></tr>
<tr><td>vparam</td><td>Pointer to a ::afs_msg_klog</td></tr>
</table>
\note Only sent from the AFS plugin to extension plugins
\note Only sent to extension plugins which have ::provide_token_acq set.
*/
#define AFS_MSG_KLOG 3
/*! \brief Cell configuration information
\see ::afs_msg_klog
\note This structure uses ANSI char fields instead of unicode fields.
*/
typedef struct tag_afs_conf_cellA_v1 {
khm_size cbsize; /*!< set to \a sizeof(afs_conf_cell) */
char name[MAXCELLCHARS]; /*!< Name of the cell */
short numServers; /*!< Number of servers for cell.
Upper bound of MAXHOSTSPERCELL */
short flags; /*!< Not used. Set to zero. */
struct sockaddr_in hostAddr[MAXHOSTSPERCELL];
/*!< addresses for each server. There
are \a numServers entries.*/
char hostName[MAXHOSTSPERCELL][MAXHOSTCHARS];
/*!< names of the servers. There are
\a numServers entries. */
char * linkedCell; /*!< Not used. Set to zero. */
} afs_conf_cell;
/*! \brief Message parameters for AFS_MSG_KLOG message
\see ::AFS_MSG_KLOG
\note This structure uses ANSI char fields instead of unicode fields.
*/
typedef struct tag_afs_msg_klogA_v1 {
khm_size cbsize; /*!< Set to \a sizeof(afs_msg_klog) */
khm_handle identity; /*!< Handle to identity for which we
are obtaining tokens. */
const char * service; /*!< Service name to use when
obtaining token. This can be NULL
if the service name has not be
determined. */
const char * cell; /*!< Name of cell to obtain tokens
for. Can be NULL if the local cell
is to be used. */
const char * realm; /*!< Realm to use when obtaining
tokens. Can be NULL if the realm
has not been determined. */
const afs_conf_cell * cell_config; /*!< Cell configuration for the
cell specified in \a cell. */
khm_int32 lifetime; /*!< Advisory lifetime specifier, in
seconds. If set to zero, means
there is no specification for
lifetime. Extensions should feel
free to ignore this parameter. */
} afs_msg_klog;
/*!@}*/
/*!@}*/
#endif

View File

@ -0,0 +1,642 @@
/*
* Copyright (c) 2004 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* $Id$ */
#include<afscred.h>
#include<kcreddb.h>
#include<khmsgtypes.h>
#include<kherror.h>
#include<khuidefs.h>
#include<commctrl.h>
#include<assert.h>
static BOOL initialized = FALSE;
khm_int32 afs_credtype_id = -1;
khm_int32 krb5_credtype_id = -1;
khm_int32 krb4_credtype_id = -1;
khm_int32 afs_msg_type_id = -1;
khm_int32 afs_type_principal = -1;
khm_int32 afs_type_method = -1;
khm_int32 afs_attr_client_princ = -1;
khm_int32 afs_attr_server_princ = -1;
khm_int32 afs_attr_cell = -1;
khm_int32 afs_attr_method = -1;
khm_int32 afs_attr_realm = -1;
khm_handle afs_credset = NULL;
khm_handle afs_sub = NULL; /* AFS message subscription */
/* forward dcls */
khm_int32 KHMAPI
afs_msg_system(khm_int32 msg_subtype, khm_ui_4 uparam, void * vparam);
khm_int32 KHMAPI
afs_msg_kcdb(khm_int32 msg_subtype, khm_ui_4 uparam, void * vparam);
khm_int32 KHMAPI
afs_msg_cred(khm_int32 msg_subtype, khm_ui_4 uparam, void * vparam);
khm_int32 KHMAPI
afs_msg_ext(khm_int32 msg_subtype, khm_ui_4 uparam, void * vparam);
/* AFS plugin callback */
khm_int32 KHMAPI
afs_plugin_cb(khm_int32 msg_type,
khm_int32 msg_subtype,
khm_ui_4 uparam,
void * vparam)
{
if (msg_type == KMSG_SYSTEM)
return afs_msg_system(msg_subtype, uparam, vparam);
if (msg_type == KMSG_KCDB)
return afs_msg_kcdb(msg_subtype, uparam, vparam);
if (msg_type == KMSG_CRED)
return afs_msg_cred(msg_subtype, uparam, vparam);
if (msg_type == afs_msg_type_id)
return afs_msg_ext(msg_subtype, uparam, vparam);
return KHM_ERROR_SUCCESS;
}
/* ktc_principal attribute type */
/* String */
khm_int32 KHMAPI
afs_type_principal_toString(const void * d,
khm_size cbd,
wchar_t * buffer,
khm_size * cb_buf,
khm_int32 flags)
{
size_t cbsize;
struct ktc_principal * p;
wchar_t sprinc[512] = L"";
if(!cb_buf)
return KHM_ERROR_INVALID_PARAM;
p = (struct ktc_principal *) d;
// assume this works.
afs_princ_to_string(p, sprinc, sizeof(sprinc));
StringCbLength(sprinc, sizeof(sprinc), &cbsize);
cbsize += sizeof(wchar_t);
if(!buffer || *cb_buf < cbsize) {
*cb_buf = cbsize;
return KHM_ERROR_TOO_LONG;
}
StringCbCopy(buffer, *cb_buf, sprinc);
*cb_buf = cbsize;
return KHM_ERROR_SUCCESS;
}
khm_boolean KHMAPI
afs_type_principal_isValid(const void * d,
khm_size cbd)
{
/*TODO: check for more inconsistencies */
if(cbd != sizeof(struct ktc_principal))
return FALSE;
return TRUE;
}
khm_int32 KHMAPI
afs_type_principal_comp(const void * d1,
khm_size cbd1,
const void * d2,
khm_size cbd2)
{
struct ktc_principal * p1 = (struct ktc_principal *) d1;
struct ktc_principal * p2 = (struct ktc_principal *) d2;
int r;
r = strcmp(p1->name, p2->name);
if(r != 0)
return r;
r = strcmp(p1->instance, p2->instance);
if(r != 0)
return r;
r = strcmp(p1->cell, p2->cell);
return r;
}
khm_int32 KHMAPI
afs_type_principal_dup(const void * d_src,
khm_size cbd_src,
void * d_dst,
khm_size * cbd_dst)
{
if(!d_dst || *cbd_dst < sizeof(struct ktc_principal)) {
*cbd_dst = sizeof(struct ktc_principal);
return KHM_ERROR_TOO_LONG;
}
memcpy(d_dst, d_src, sizeof(struct ktc_principal));
*cbd_dst = sizeof(struct ktc_principal);
return KHM_ERROR_SUCCESS;
}
khm_int32 KHMAPI
afs_type_method_toString(const void * data,
khm_size cb_data,
wchar_t * s_buf,
khm_size * pcb_s_buf,
khm_int32 flags) {
khm_int32 * pmethod = (khm_int32 *) data;
wchar_t wbuf[KHUI_MAXCCH_LONG_DESC];
khm_size cb;
if (!data || cb_data != sizeof(khm_int32))
return KHM_ERROR_INVALID_PARAM;
wbuf[0] = L'\0';
if (!afs_method_describe(*pmethod, flags, wbuf, sizeof(wbuf))) {
LoadString(hResModule,
IDS_NC_METHOD_INVALID,
wbuf,
ARRAYLENGTH(wbuf));
}
StringCbLength(wbuf, sizeof(wbuf), &cb);
cb += sizeof(wchar_t);
if (!s_buf || *pcb_s_buf < cb) {
*pcb_s_buf = cb;
return KHM_ERROR_TOO_LONG;
} else {
StringCbCopy(s_buf, *pcb_s_buf, wbuf);
*pcb_s_buf = cb;
return KHM_ERROR_SUCCESS;
}
}
/* process KMSG_SYSTEM messages */
khm_int32 KHMAPI
afs_msg_system(khm_int32 msg_subtype,
khm_ui_4 uparam,
void * vparam)
{
khm_int32 rv = KHM_ERROR_UNKNOWN;
switch(msg_subtype) {
case KMSG_SYSTEM_INIT:
/* Perform critical registrations and data structure
initalization */
{
kcdb_credtype ct;
wchar_t buf[KCDB_MAXCCH_LONG_DESC];
size_t cbsize;
kcdb_attrib att;
khm_handle csp_afscred = NULL;
khm_int32 disable_afscreds = FALSE;
ZeroMemory(&ct, sizeof(ct));
/* first of all, register the AFS token credential type */
ct.id = KCDB_CREDTYPE_AUTO;
ct.name = AFS_CREDTYPE_NAME;
if(LoadString(hResModule,
IDS_AFS_SHORT_DESC,
buf,
ARRAYLENGTH(buf)) != 0) {
StringCbLength(buf, sizeof(buf), &cbsize);
cbsize += sizeof(wchar_t);
ct.short_desc = PMALLOC(cbsize);
StringCbCopy(ct.short_desc, cbsize, buf);
} else
ct.short_desc = NULL;
if(LoadString(hResModule,
IDS_AFS_LONG_DESC,
buf,
ARRAYLENGTH(buf)) != 0) {
StringCbLength(buf, sizeof(buf), &cbsize);
cbsize += sizeof(wchar_t);
ct.long_desc = PMALLOC(cbsize);
StringCbCopy(ct.long_desc, cbsize, buf);
} else
ct.long_desc = NULL;
ct.icon = LoadImage(hResModule,
MAKEINTRESOURCE(IDI_AFSTOKEN),
IMAGE_ICON,
0, 0, LR_DEFAULTSIZE);
kmq_create_subscription(afs_plugin_cb, &afs_sub);
ct.sub = afs_sub;
kcdb_credtype_register(&ct, &afs_credtype_id);
/* register the attribute types */
{
kcdb_type type;
ZeroMemory(&type, sizeof(type));
type.comp = afs_type_principal_comp;
type.dup = afs_type_principal_dup;
type.isValid = afs_type_principal_isValid;
type.toString = afs_type_principal_toString;
type.name = AFS_TYPENAME_PRINCIPAL;
type.id = KCDB_TYPE_INVALID;
type.cb_max = sizeof(struct ktc_principal);
type.cb_min = sizeof(struct ktc_principal);
type.flags = KCDB_TYPE_FLAG_CB_FIXED;
if(KHM_FAILED(kcdb_type_register(&type,
&afs_type_principal)))
goto _exit_init;
}
{
kcdb_type type;
kcdb_type *ti32 = NULL;
kcdb_type_get_info(KCDB_TYPE_INT32, &ti32);
ZeroMemory(&type, sizeof(type));
type.comp = ti32->comp;
type.dup = ti32->dup;
type.isValid = ti32->isValid;
type.toString = afs_type_method_toString;
type.name = AFS_TYPENAME_METHOD;
type.id = KCDB_TYPE_INVALID;
type.cb_max = sizeof(khm_int32);
type.cb_min = sizeof(khm_int32);
type.flags = KCDB_TYPE_FLAG_CB_FIXED;
if(KHM_FAILED(kcdb_type_register(&type,
&afs_type_method))) {
kcdb_type_release_info(ti32);
goto _exit_init;
}
kcdb_type_release_info(ti32);
}
/* now register the attributes */
{
wchar_t short_desc[KCDB_MAXCCH_SHORT_DESC];
ZeroMemory(&att, sizeof(att));
att.type = KCDB_TYPE_STRING;
att.name = AFS_ATTRNAME_CELL;
LoadString(hResModule,
IDS_ATTR_CELL_SHORT_DESC,
short_desc,
ARRAYLENGTH(short_desc));
att.short_desc = short_desc;
att.long_desc = NULL;
att.id = KCDB_ATTR_INVALID;
att.flags = KCDB_ATTR_FLAG_TRANSIENT;
if(KHM_FAILED(rv = kcdb_attrib_register(&att,
&afs_attr_cell)))
goto _exit_init;
}
{
wchar_t short_desc[KCDB_MAXCCH_SHORT_DESC];
ZeroMemory(&att, sizeof(att));
att.type = KCDB_TYPE_STRING;
att.name = AFS_ATTRNAME_REALM;
LoadString(hResModule,
IDS_ATTR_REALM_SHORT_DESC,
short_desc,
ARRAYLENGTH(short_desc));
att.short_desc = short_desc;
att.long_desc = NULL;
att.id = KCDB_ATTR_INVALID;
att.flags = KCDB_ATTR_FLAG_TRANSIENT;
if(KHM_FAILED(rv = kcdb_attrib_register(&att,
&afs_attr_realm)))
goto _exit_init;
}
{
wchar_t short_desc[KCDB_MAXCCH_SHORT_DESC];
ZeroMemory(&att, sizeof(att));
att.type = afs_type_method;
att.name = AFS_ATTRNAME_METHOD;
LoadString(hResModule,
IDS_ATTR_METHOD_SHORT_DESC,
short_desc,
ARRAYLENGTH(short_desc));
att.short_desc = short_desc;
att.long_desc = NULL;
att.id = KCDB_ATTR_INVALID;
att.flags = KCDB_ATTR_FLAG_TRANSIENT;
if(KHM_FAILED(rv = kcdb_attrib_register(&att,
&afs_attr_method)))
goto _exit_init;
}
{
wchar_t short_desc[KCDB_MAXCCH_SHORT_DESC];
ZeroMemory(&att, sizeof(att));
att.type = afs_type_principal;
att.name = AFS_ATTRNAME_CLIENT_PRINC;
LoadString(hResModule,
IDS_ATTR_CLIENT_PRINC_SHORT_DESC,
short_desc,
ARRAYLENGTH(short_desc));
att.short_desc = short_desc;
att.long_desc = NULL;
att.id = KCDB_ATTR_INVALID;
att.flags = KCDB_ATTR_FLAG_TRANSIENT;
if(KHM_FAILED(rv = kcdb_attrib_register(&att, &afs_attr_client_princ)))
goto _exit_init;
}
{
wchar_t short_desc[KCDB_MAXCCH_SHORT_DESC];
ZeroMemory(&att, sizeof(att));
att.type = afs_type_principal;
att.name = AFS_ATTRNAME_SERVER_PRINC;
LoadString(hResModule,
IDS_ATTR_SERVER_PRINC_SHORT_DESC,
short_desc, ARRAYLENGTH(short_desc));
att.short_desc = short_desc;
att.long_desc = NULL;
att.id = KCDB_ATTR_INVALID;
att.flags = KCDB_ATTR_FLAG_TRANSIENT;
if(KHM_FAILED(rv = kcdb_attrib_register(&att, &afs_attr_server_princ)))
goto _exit_init;
}
/* afs_credset is our stock credentials set that we
use for all our credset needs (instead of creating
a new one every time) */
if(KHM_FAILED(rv = kcdb_credset_create(&afs_credset)))
goto _exit_init;
if(KHM_FAILED(rv = kcdb_credtype_get_id(KRB5_CREDTYPE_NAME,
&krb5_credtype_id)))
goto _exit_init;
/* register the configuration nodes */
{
khui_config_node node_ident;
khui_config_node_reg reg;
wchar_t wshort_desc[KHUI_MAXCCH_SHORT_DESC];
wchar_t wlong_desc[KHUI_MAXCCH_LONG_DESC];
if (KHM_FAILED(rv = khui_cfg_open(NULL,
L"KhmIdentities",
&node_ident)))
goto _exit_init;
ZeroMemory(&reg, sizeof(reg));
reg.name = AFS_CONFIG_NODE_MAIN;
reg.short_desc = wshort_desc;
reg.long_desc = wlong_desc;
reg.h_module = hResModule;
reg.dlg_template = MAKEINTRESOURCE(IDD_CFG_AFS);
reg.dlg_proc = afs_cfg_main_proc;
reg.flags = 0;
LoadString(hResModule, IDS_CFG_MAIN_LONG,
wlong_desc, ARRAYLENGTH(wlong_desc));
LoadString(hResModule, IDS_CFG_MAIN_SHORT,
wshort_desc, ARRAYLENGTH(wshort_desc));
khui_cfg_register(NULL, &reg);
ZeroMemory(&reg, sizeof(reg));
reg.name = AFS_CONFIG_NODE_IDS;
reg.short_desc = wshort_desc;
reg.long_desc = wshort_desc;
reg.h_module = hResModule;
reg.dlg_template = MAKEINTRESOURCE(IDD_CFG_IDS_TAB);
reg.dlg_proc = afs_cfg_ids_proc;
reg.flags = KHUI_CNFLAG_SUBPANEL;
LoadString(hResModule, IDS_CFG_IDS_TAB,
wshort_desc, ARRAYLENGTH(wshort_desc));
khui_cfg_register(node_ident, &reg);
ZeroMemory(&reg, sizeof(reg));
reg.name = AFS_CONFIG_NODE_ID;
reg.short_desc = wshort_desc;
reg.long_desc = wshort_desc;
reg.h_module = hResModule;
reg.dlg_template = MAKEINTRESOURCE(IDD_CFG_ID_TAB);
reg.dlg_proc = afs_cfg_id_proc;
reg.flags = KHUI_CNFLAG_SUBPANEL | KHUI_CNFLAG_PLURAL;
LoadString(hResModule, IDS_CFG_ID_TAB,
wshort_desc, ARRAYLENGTH(wshort_desc));
khui_cfg_register(node_ident, &reg);
}
/* and register the AFS message type */
rv = kmq_register_type(AFS_MSG_TYPENAME, &afs_msg_type_id);
if (KHM_SUCCEEDED(rv))
kmq_subscribe(afs_msg_type_id, afs_plugin_cb);
/* if the configuration is set to disable afscreds.exe,
then we look for the shortcut and remove it if
found. */
if (KHM_SUCCEEDED(kmm_get_plugin_config(AFS_PLUGIN_NAME,
0,
&csp_afscred))) {
wchar_t wpath[MAX_PATH];
khc_read_int32(csp_afscred, L"Disableafscreds",
&disable_afscreds);
if (disable_afscreds &&
afs_cfg_get_afscreds_shortcut(wpath)) {
DeleteFile(wpath);
}
khc_close_space(csp_afscred);
}
_exit_init:
if(ct.short_desc)
PFREE(ct.short_desc);
if(ct.long_desc)
PFREE(ct.long_desc);
}
/* now that the critical stuff is done, we move on to the
non-critical stuff */
if(KHM_SUCCEEDED(rv)) {
initialized = TRUE;
/* obtain existing tokens */
afs_list_tokens();
}
/* define this so that if there are no TGT's, we don't
deadlock trying to open a new creds dialog from within the
new creds dialog. */
SetEnvironmentVariable(L"KERBEROSLOGIN_NEVER_PROMPT", L"1");
break;
/* end of KMSG_SYSTEM_INIT */
case KMSG_SYSTEM_EXIT:
if (afs_msg_type_id != -1) {
kmq_unsubscribe(afs_msg_type_id, afs_plugin_cb);
kmq_unregister_type(afs_msg_type_id);
}
if(afs_credtype_id >= 0) {
kcdb_credtype_unregister(afs_credtype_id);
}
#if 0
if(afs_attr_client >= 0) {
kcdb_attrib_unregister(afs_attr_client);
}
#endif
if(afs_attr_cell >= 0) {
kcdb_attrib_unregister(afs_attr_cell);
}
if(afs_attr_realm >= 0) {
kcdb_attrib_unregister(afs_attr_realm);
}
if(afs_attr_method >= 0) {
kcdb_attrib_unregister(afs_attr_method);
}
if(afs_attr_client_princ >= 0) {
kcdb_attrib_unregister(afs_attr_client_princ);
}
if(afs_attr_server_princ >= 0) {
kcdb_attrib_unregister(afs_attr_server_princ);
}
if(afs_type_principal >= 0) {
kcdb_type_unregister(afs_type_principal);
}
if(afs_type_method >= 0) {
kcdb_type_unregister(afs_type_method);
}
initialized = FALSE;
if(afs_credset)
kcdb_credset_delete(afs_credset);
/* afs_sub doesn't need to be deleted. That is taken care
of when unregistering the afs cred type */
afs_sub = NULL;
rv = KHM_ERROR_SUCCESS;
break;
/* end of KMSG_SYSTEM_EXIT */
}
return rv;
}
/* process KMSG_KCDB messages */
khm_int32 KHMAPI
afs_msg_kcdb(khm_int32 msg_subtype,
khm_ui_4 uparam,
void * vparam)
{
khm_int32 rv = KHM_ERROR_SUCCESS;
/* we don't really do anything with this yet */
#if 0
switch(msg_subtype) {
}
#endif
return rv;
}
static khm_int32 KHMAPI
afs_cred_destroy_proc(khm_handle cred, void * rock) {
khm_int32 t;
if (KHM_FAILED(kcdb_cred_get_type(cred, &t)) ||
t != afs_credtype_id)
return KHM_ERROR_SUCCESS;
afs_unlog_cred(cred);
return KHM_ERROR_SUCCESS;
}
/* process KMSG_CRED messages */
khm_int32 KHMAPI
afs_msg_cred(khm_int32 msg_subtype,
khm_ui_4 uparam,
void * vparam)
{
khm_int32 rv = KHM_ERROR_SUCCESS;
switch(msg_subtype) {
case KMSG_CRED_REFRESH:
afs_list_tokens();
break;
case KMSG_CRED_DESTROY_CREDS:
{
khui_action_context * ctx;
ctx = (khui_action_context *) vparam;
if (ctx->credset) {
_begin_task(0);
_report_cs0(KHERR_INFO, L"Destroying AFS Tokens");
_describe();
kcdb_credset_apply(ctx->credset,
afs_cred_destroy_proc,
NULL);
_end_task();
}
}
break;
default:
if (IS_CRED_ACQ_MSG(msg_subtype))
return afs_msg_newcred(msg_subtype, uparam, vparam);
}
return rv;
}

View File

@ -0,0 +1,69 @@
/*
* Copyright (c) 2004 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* $Id$ */
#include<windows.h>
#include<msiquery.h>
#include<tchar.h>
static
const TCHAR * const dword_props[] = {
_TEXT("OPENAFSVERSIONMAJOR"),
_TEXT("OPENAFSVERSIONMINOR"),
_TEXT("KFWVERSIONMAJOR")
};
static void strip_decoration(TCHAR * str, int cchlen) {
int i;
if (str[0] != _T('#') || cchlen < 1)
return;
for (i=1; i < cchlen && str[i]; i++) {
str[i-1] = str[i];
}
str[i-1] = _T('\0');
}
UINT __stdcall StripRegDecoration(MSIHANDLE hInstall) {
TCHAR propbuffer[16]; /* we are looking for string
representations of DOWRDs. They
can't be longer than this. */
DWORD cch_buffer;
UINT rv;
int i;
for (i=0; i < sizeof(dword_props)/sizeof(dword_props[0]); i++) {
cch_buffer = sizeof(propbuffer)/sizeof(propbuffer[0]);
rv = MsiGetProperty(hInstall, dword_props[i], propbuffer, &cch_buffer);
if (rv == ERROR_SUCCESS) {
strip_decoration(propbuffer, cch_buffer);
MsiSetProperty(hInstall, dword_props[i], propbuffer);
}
}
return ERROR_SUCCESS;
}

View File

@ -0,0 +1,463 @@
/*
* Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* $Id$ */
#include<windows.h>
#include<khdefs.h>
#include<kherror.h>
#include<dynimport.h>
HINSTANCE hKrb4 = 0;
HINSTANCE hKrb5 = 0;
HINSTANCE hKrb524 = 0;
HINSTANCE hSecur32 = 0;
HINSTANCE hComErr = 0;
HINSTANCE hService = 0;
HINSTANCE hProfile = 0;
HINSTANCE hPsapi = 0;
HINSTANCE hToolHelp32 = 0;
HINSTANCE hCCAPI = 0;
DWORD AfsAvailable = 0;
// CCAPI
DECL_FUNC_PTR(cc_initialize);
DECL_FUNC_PTR(cc_shutdown);
DECL_FUNC_PTR(cc_get_NC_info);
DECL_FUNC_PTR(cc_free_NC_info);
// krb4 functions
DECL_FUNC_PTR(get_krb_err_txt_entry);
DECL_FUNC_PTR(k_isinst);
DECL_FUNC_PTR(k_isname);
DECL_FUNC_PTR(k_isrealm);
DECL_FUNC_PTR(kadm_change_your_password);
DECL_FUNC_PTR(kname_parse);
DECL_FUNC_PTR(krb_get_cred);
DECL_FUNC_PTR(krb_get_krbhst);
DECL_FUNC_PTR(krb_get_lrealm);
DECL_FUNC_PTR(krb_get_pw_in_tkt);
DECL_FUNC_PTR(krb_get_tf_realm);
DECL_FUNC_PTR(krb_mk_req);
DECL_FUNC_PTR(krb_realmofhost);
DECL_FUNC_PTR(tf_init);
DECL_FUNC_PTR(tf_close);
DECL_FUNC_PTR(tf_get_cred);
DECL_FUNC_PTR(tf_get_pname);
DECL_FUNC_PTR(tf_get_pinst);
DECL_FUNC_PTR(LocalHostAddr);
DECL_FUNC_PTR(tkt_string);
DECL_FUNC_PTR(krb_set_tkt_string);
DECL_FUNC_PTR(initialize_krb_error_func);
DECL_FUNC_PTR(initialize_kadm_error_table);
DECL_FUNC_PTR(dest_tkt);
DECL_FUNC_PTR(krb_in_tkt);
DECL_FUNC_PTR(krb_save_credentials);
DECL_FUNC_PTR(krb_get_krbconf2);
DECL_FUNC_PTR(krb_get_krbrealm2);
DECL_FUNC_PTR(krb_life_to_time);
// krb5 functions
DECL_FUNC_PTR(krb5_change_password);
DECL_FUNC_PTR(krb5_get_init_creds_opt_init);
DECL_FUNC_PTR(krb5_get_init_creds_opt_set_tkt_life);
DECL_FUNC_PTR(krb5_get_init_creds_opt_set_renew_life);
DECL_FUNC_PTR(krb5_get_init_creds_opt_set_forwardable);
DECL_FUNC_PTR(krb5_get_init_creds_opt_set_proxiable);
DECL_FUNC_PTR(krb5_get_init_creds_opt_set_address_list);
DECL_FUNC_PTR(krb5_get_init_creds_password);
DECL_FUNC_PTR(krb5_get_prompt_types);
DECL_FUNC_PTR(krb5_build_principal_ext);
DECL_FUNC_PTR(krb5_cc_get_name);
DECL_FUNC_PTR(krb5_cc_get_type);
DECL_FUNC_PTR(krb5_cc_resolve);
DECL_FUNC_PTR(krb5_cc_default);
DECL_FUNC_PTR(krb5_cc_default_name);
DECL_FUNC_PTR(krb5_cc_set_default_name);
DECL_FUNC_PTR(krb5_cc_initialize);
DECL_FUNC_PTR(krb5_cc_destroy);
DECL_FUNC_PTR(krb5_cc_close);
DECL_FUNC_PTR(krb5_cc_store_cred);
DECL_FUNC_PTR(krb5_cc_copy_creds);
DECL_FUNC_PTR(krb5_cc_retrieve_cred);
DECL_FUNC_PTR(krb5_cc_get_principal);
DECL_FUNC_PTR(krb5_cc_start_seq_get);
DECL_FUNC_PTR(krb5_cc_next_cred);
DECL_FUNC_PTR(krb5_cc_end_seq_get);
DECL_FUNC_PTR(krb5_cc_remove_cred);
DECL_FUNC_PTR(krb5_cc_set_flags);
// DECL_FUNC_PTR(krb5_cc_get_type);
DECL_FUNC_PTR(krb5_free_context);
DECL_FUNC_PTR(krb5_free_cred_contents);
DECL_FUNC_PTR(krb5_free_principal);
DECL_FUNC_PTR(krb5_get_in_tkt_with_password);
DECL_FUNC_PTR(krb5_init_context);
DECL_FUNC_PTR(krb5_parse_name);
DECL_FUNC_PTR(krb5_timeofday);
DECL_FUNC_PTR(krb5_timestamp_to_sfstring);
DECL_FUNC_PTR(krb5_unparse_name);
DECL_FUNC_PTR(krb5_get_credentials);
DECL_FUNC_PTR(krb5_mk_req);
DECL_FUNC_PTR(krb5_sname_to_principal);
DECL_FUNC_PTR(krb5_get_credentials_renew);
DECL_FUNC_PTR(krb5_free_data);
DECL_FUNC_PTR(krb5_free_data_contents);
// DECL_FUNC_PTR(krb5_get_realm_domain);
DECL_FUNC_PTR(krb5_free_unparsed_name);
DECL_FUNC_PTR(krb5_os_localaddr);
DECL_FUNC_PTR(krb5_copy_keyblock_contents);
DECL_FUNC_PTR(krb5_copy_data);
DECL_FUNC_PTR(krb5_free_creds);
DECL_FUNC_PTR(krb5_build_principal);
DECL_FUNC_PTR(krb5_get_renewed_creds);
DECL_FUNC_PTR(krb5_get_default_config_files);
DECL_FUNC_PTR(krb5_free_config_files);
DECL_FUNC_PTR(krb5_get_default_realm);
DECL_FUNC_PTR(krb5_set_default_realm);
DECL_FUNC_PTR(krb5_free_ticket);
DECL_FUNC_PTR(krb5_decode_ticket);
DECL_FUNC_PTR(krb5_get_host_realm);
DECL_FUNC_PTR(krb5_free_host_realm);
DECL_FUNC_PTR(krb5_c_random_make_octets);
DECL_FUNC_PTR(krb5_free_addresses);
DECL_FUNC_PTR(krb5_free_default_realm);
// Krb524 functions
DECL_FUNC_PTR(krb524_init_ets);
DECL_FUNC_PTR(krb524_convert_creds_kdc);
// ComErr functions
DECL_FUNC_PTR(com_err);
DECL_FUNC_PTR(error_message);
// Profile functions
DECL_FUNC_PTR(profile_init);
DECL_FUNC_PTR(profile_flush);
DECL_FUNC_PTR(profile_release);
DECL_FUNC_PTR(profile_get_subsection_names);
DECL_FUNC_PTR(profile_free_list);
DECL_FUNC_PTR(profile_get_string);
DECL_FUNC_PTR(profile_get_values);
DECL_FUNC_PTR(profile_get_relation_names);
DECL_FUNC_PTR(profile_clear_relation);
DECL_FUNC_PTR(profile_add_relation);
DECL_FUNC_PTR(profile_update_relation);
DECL_FUNC_PTR(profile_release_string);
// Service functions
DECL_FUNC_PTR(OpenSCManagerA);
DECL_FUNC_PTR(OpenServiceA);
DECL_FUNC_PTR(QueryServiceStatus);
DECL_FUNC_PTR(CloseServiceHandle);
DECL_FUNC_PTR(LsaNtStatusToWinError);
// LSA Functions
DECL_FUNC_PTR(LsaConnectUntrusted);
DECL_FUNC_PTR(LsaLookupAuthenticationPackage);
DECL_FUNC_PTR(LsaCallAuthenticationPackage);
DECL_FUNC_PTR(LsaFreeReturnBuffer);
DECL_FUNC_PTR(LsaGetLogonSessionData);
// CCAPI
FUNC_INFO ccapi_fi[] = {
MAKE_FUNC_INFO(cc_initialize),
MAKE_FUNC_INFO(cc_shutdown),
MAKE_FUNC_INFO(cc_get_NC_info),
MAKE_FUNC_INFO(cc_free_NC_info),
END_FUNC_INFO
};
FUNC_INFO k4_fi[] = {
MAKE_FUNC_INFO(get_krb_err_txt_entry),
MAKE_FUNC_INFO(k_isinst),
MAKE_FUNC_INFO(k_isname),
MAKE_FUNC_INFO(k_isrealm),
MAKE_FUNC_INFO(kadm_change_your_password),
MAKE_FUNC_INFO(kname_parse),
MAKE_FUNC_INFO(krb_get_cred),
MAKE_FUNC_INFO(krb_get_krbhst),
MAKE_FUNC_INFO(krb_get_lrealm),
MAKE_FUNC_INFO(krb_get_pw_in_tkt),
MAKE_FUNC_INFO(krb_get_tf_realm),
MAKE_FUNC_INFO(krb_mk_req),
MAKE_FUNC_INFO(krb_realmofhost),
MAKE_FUNC_INFO(tf_init),
MAKE_FUNC_INFO(tf_close),
MAKE_FUNC_INFO(tf_get_cred),
MAKE_FUNC_INFO(tf_get_pname),
MAKE_FUNC_INFO(tf_get_pinst),
MAKE_FUNC_INFO(LocalHostAddr),
MAKE_FUNC_INFO(tkt_string),
MAKE_FUNC_INFO(krb_set_tkt_string),
MAKE_FUNC_INFO(initialize_krb_error_func),
MAKE_FUNC_INFO(initialize_kadm_error_table),
MAKE_FUNC_INFO(dest_tkt),
/* MAKE_FUNC_INFO(lsh_LoadKrb4LeashErrorTables), */// XXX
MAKE_FUNC_INFO(krb_in_tkt),
MAKE_FUNC_INFO(krb_save_credentials),
MAKE_FUNC_INFO(krb_get_krbconf2),
MAKE_FUNC_INFO(krb_get_krbrealm2),
MAKE_FUNC_INFO(krb_life_to_time),
END_FUNC_INFO
};
FUNC_INFO k5_fi[] = {
MAKE_FUNC_INFO(krb5_change_password),
MAKE_FUNC_INFO(krb5_get_init_creds_opt_init),
MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_tkt_life),
MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_renew_life),
MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_forwardable),
MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_proxiable),
MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_address_list),
MAKE_FUNC_INFO(krb5_get_init_creds_password),
MAKE_FUNC_INFO(krb5_get_prompt_types),
MAKE_FUNC_INFO(krb5_build_principal_ext),
MAKE_FUNC_INFO(krb5_cc_get_name),
MAKE_FUNC_INFO(krb5_cc_get_type),
MAKE_FUNC_INFO(krb5_cc_resolve),
MAKE_FUNC_INFO(krb5_cc_default),
MAKE_FUNC_INFO(krb5_cc_default_name),
MAKE_FUNC_INFO(krb5_cc_set_default_name),
MAKE_FUNC_INFO(krb5_cc_initialize),
MAKE_FUNC_INFO(krb5_cc_destroy),
MAKE_FUNC_INFO(krb5_cc_close),
MAKE_FUNC_INFO(krb5_cc_copy_creds),
MAKE_FUNC_INFO(krb5_cc_store_cred),
MAKE_FUNC_INFO(krb5_cc_retrieve_cred),
MAKE_FUNC_INFO(krb5_cc_get_principal),
MAKE_FUNC_INFO(krb5_cc_start_seq_get),
MAKE_FUNC_INFO(krb5_cc_next_cred),
MAKE_FUNC_INFO(krb5_cc_end_seq_get),
MAKE_FUNC_INFO(krb5_cc_remove_cred),
MAKE_FUNC_INFO(krb5_cc_set_flags),
// MAKE_FUNC_INFO(krb5_cc_get_type),
MAKE_FUNC_INFO(krb5_free_context),
MAKE_FUNC_INFO(krb5_free_cred_contents),
MAKE_FUNC_INFO(krb5_free_principal),
MAKE_FUNC_INFO(krb5_get_in_tkt_with_password),
MAKE_FUNC_INFO(krb5_init_context),
MAKE_FUNC_INFO(krb5_parse_name),
MAKE_FUNC_INFO(krb5_timeofday),
MAKE_FUNC_INFO(krb5_timestamp_to_sfstring),
MAKE_FUNC_INFO(krb5_unparse_name),
MAKE_FUNC_INFO(krb5_get_credentials),
MAKE_FUNC_INFO(krb5_mk_req),
MAKE_FUNC_INFO(krb5_sname_to_principal),
MAKE_FUNC_INFO(krb5_get_credentials_renew),
MAKE_FUNC_INFO(krb5_free_data),
MAKE_FUNC_INFO(krb5_free_data_contents),
// MAKE_FUNC_INFO(krb5_get_realm_domain),
MAKE_FUNC_INFO(krb5_free_unparsed_name),
MAKE_FUNC_INFO(krb5_os_localaddr),
MAKE_FUNC_INFO(krb5_copy_keyblock_contents),
MAKE_FUNC_INFO(krb5_copy_data),
MAKE_FUNC_INFO(krb5_free_creds),
MAKE_FUNC_INFO(krb5_build_principal),
MAKE_FUNC_INFO(krb5_get_renewed_creds),
MAKE_FUNC_INFO(krb5_free_addresses),
MAKE_FUNC_INFO(krb5_get_default_config_files),
MAKE_FUNC_INFO(krb5_free_config_files),
MAKE_FUNC_INFO(krb5_get_default_realm),
MAKE_FUNC_INFO(krb5_set_default_realm),
MAKE_FUNC_INFO(krb5_free_ticket),
MAKE_FUNC_INFO(krb5_decode_ticket),
MAKE_FUNC_INFO(krb5_get_host_realm),
MAKE_FUNC_INFO(krb5_free_host_realm),
MAKE_FUNC_INFO(krb5_c_random_make_octets),
MAKE_FUNC_INFO(krb5_free_default_realm),
END_FUNC_INFO
};
FUNC_INFO k524_fi[] = {
MAKE_FUNC_INFO(krb524_init_ets),
MAKE_FUNC_INFO(krb524_convert_creds_kdc),
END_FUNC_INFO
};
FUNC_INFO profile_fi[] = {
MAKE_FUNC_INFO(profile_init),
MAKE_FUNC_INFO(profile_flush),
MAKE_FUNC_INFO(profile_release),
MAKE_FUNC_INFO(profile_get_subsection_names),
MAKE_FUNC_INFO(profile_free_list),
MAKE_FUNC_INFO(profile_get_string),
MAKE_FUNC_INFO(profile_get_values),
MAKE_FUNC_INFO(profile_get_relation_names),
MAKE_FUNC_INFO(profile_clear_relation),
MAKE_FUNC_INFO(profile_add_relation),
MAKE_FUNC_INFO(profile_update_relation),
MAKE_FUNC_INFO(profile_release_string),
END_FUNC_INFO
};
FUNC_INFO ce_fi[] = {
MAKE_FUNC_INFO(com_err),
MAKE_FUNC_INFO(error_message),
END_FUNC_INFO
};
FUNC_INFO service_fi[] = {
MAKE_FUNC_INFO(OpenSCManagerA),
MAKE_FUNC_INFO(OpenServiceA),
MAKE_FUNC_INFO(QueryServiceStatus),
MAKE_FUNC_INFO(CloseServiceHandle),
MAKE_FUNC_INFO(LsaNtStatusToWinError),
END_FUNC_INFO
};
FUNC_INFO lsa_fi[] = {
MAKE_FUNC_INFO(LsaConnectUntrusted),
MAKE_FUNC_INFO(LsaLookupAuthenticationPackage),
MAKE_FUNC_INFO(LsaCallAuthenticationPackage),
MAKE_FUNC_INFO(LsaFreeReturnBuffer),
MAKE_FUNC_INFO(LsaGetLogonSessionData),
END_FUNC_INFO
};
// psapi functions
DECL_FUNC_PTR(GetModuleFileNameExA);
DECL_FUNC_PTR(EnumProcessModules);
FUNC_INFO psapi_fi[] = {
MAKE_FUNC_INFO(GetModuleFileNameExA),
MAKE_FUNC_INFO(EnumProcessModules),
END_FUNC_INFO
};
// toolhelp functions
DECL_FUNC_PTR(CreateToolhelp32Snapshot);
DECL_FUNC_PTR(Module32First);
DECL_FUNC_PTR(Module32Next);
FUNC_INFO toolhelp_fi[] = {
MAKE_FUNC_INFO(CreateToolhelp32Snapshot),
MAKE_FUNC_INFO(Module32First),
MAKE_FUNC_INFO(Module32Next),
END_FUNC_INFO
};
khm_int32 init_imports(void) {
OSVERSIONINFO osvi;
int imp_rv = 1;
#define CKRV if(!imp_rv) goto _err_ret
#ifndef _WIN64
imp_rv = LoadFuncs(KRB4_DLL, k4_fi, &hKrb4, 0, 1, 0, 0);
CKRV;
#endif
imp_rv = LoadFuncs(KRB5_DLL, k5_fi, &hKrb5, 0, 1, 0, 0);
CKRV;
imp_rv = LoadFuncs(COMERR_DLL, ce_fi, &hComErr, 0, 0, 1, 0);
CKRV;
imp_rv = LoadFuncs(SERVICE_DLL, service_fi, &hService, 0, 1, 0, 0);
CKRV;
imp_rv = LoadFuncs(SECUR32_DLL, lsa_fi, &hSecur32, 0, 1, 1, 1);
CKRV;
imp_rv = LoadFuncs(KRB524_DLL, k524_fi, &hKrb524, 0, 1, 1, 1);
CKRV;
imp_rv = LoadFuncs(PROFILE_DLL, profile_fi, &hProfile, 0, 1, 0, 0);
CKRV;
imp_rv = LoadFuncs(CCAPI_DLL, ccapi_fi, &hCCAPI, 0, 1, 0, 0);
/* CCAPI_DLL is optional. No error check. */
memset(&osvi, 0, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osvi);
// XXX: We should really use feature testing, first
// checking for CreateToolhelp32Snapshot. If that's
// not around, we try the psapi stuff.
//
// Only load LSA functions if on NT/2000/XP
if(osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
{
// Windows 9x
imp_rv = LoadFuncs(TOOLHELPDLL, toolhelp_fi, &hToolHelp32, 0, 1, 0, 0);
CKRV;
hPsapi = 0;
}
else if(osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)
{
// Windows NT
imp_rv = LoadFuncs(PSAPIDLL, psapi_fi, &hPsapi, 0, 1, 0, 0);
CKRV;
hToolHelp32 = 0;
}
AfsAvailable = TRUE; //afscompat_init();
return KHM_ERROR_SUCCESS;
_err_ret:
return KHM_ERROR_NOT_FOUND;
}
khm_int32 exit_imports(void) {
//afscompat_close();
if (hKrb4)
FreeLibrary(hKrb4);
if (hKrb5)
FreeLibrary(hKrb5);
if (hProfile)
FreeLibrary(hProfile);
if (hComErr)
FreeLibrary(hComErr);
if (hService)
FreeLibrary(hService);
if (hSecur32)
FreeLibrary(hSecur32);
if (hKrb524)
FreeLibrary(hKrb524);
if (hPsapi)
FreeLibrary(hPsapi);
if (hToolHelp32)
FreeLibrary(hToolHelp32);
return KHM_ERROR_SUCCESS;
}
int (*Lcom_err)(LPSTR,long,LPSTR,...);
LPSTR (*Lerror_message)(long);
LPSTR (*Lerror_table_name)(long);
void Leash_load_com_err_callback(FARPROC ce,
FARPROC em,
FARPROC etn)
{
(FARPROC)Lcom_err=ce;
(FARPROC)Lerror_message=em;
(FARPROC)Lerror_table_name=etn;
}

View File

@ -0,0 +1,350 @@
/*
* Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* $Id$ */
#ifndef __KHIMAIRA_DYNIMPORT_H
#define __KHIMAIRA_DYNIMPORT_H
/* Dynamic imports */
#include<khdefs.h>
#include<tlhelp32.h>
#include<ntsecapi.h>
#ifndef FAR
#define FAR
#endif
extern HINSTANCE hKrb4;
extern HINSTANCE hKrb5;
extern HINSTANCE hProfile;
///////////////////////////////////////////////////////////////////////////////
#define CCAPI_DLL "krbcc32.dll"
#define KRBCC32_DLL "krbcc32.dll"
#define SERVICE_DLL "advapi32.dll"
#define SECUR32_DLL "secur32.dll"
#define PROFILE_DLL "xpprof32.dll"
//////////////////////////////////////////////////////////////////////////////
#include <loadfuncs-com_err.h>
#include <loadfuncs-krb5.h>
#include <loadfuncs-profile.h>
#include <loadfuncs-krb.h>
#include <loadfuncs-krb524.h>
#include <loadfuncs-lsa.h>
//// CCAPI
/* In order to avoid including the private CCAPI headers */
typedef int cc_int32;
#define CC_API_VER_1 1
#define CC_API_VER_2 2
#define CCACHE_API cc_int32
/*
** The Official Error Codes
*/
#define CC_NOERROR 0
#define CC_BADNAME 1
#define CC_NOTFOUND 2
#define CC_END 3
#define CC_IO 4
#define CC_WRITE 5
#define CC_NOMEM 6
#define CC_FORMAT 7
#define CC_LOCKED 8
#define CC_BAD_API_VERSION 9
#define CC_NO_EXIST 10
#define CC_NOT_SUPP 11
#define CC_BAD_PARM 12
#define CC_ERR_CACHE_ATTACH 13
#define CC_ERR_CACHE_RELEASE 14
#define CC_ERR_CACHE_FULL 15
#define CC_ERR_CRED_VERSION 16
enum {
CC_CRED_VUNKNOWN = 0, // For validation
CC_CRED_V4 = 1,
CC_CRED_V5 = 2,
CC_CRED_VMAX = 3 // For validation
};
typedef struct opaque_dll_control_block_type* apiCB;
typedef struct _infoNC {
char* name;
char* principal;
cc_int32 vers;
} infoNC;
TYPEDEF_FUNC(
CCACHE_API,
CALLCONV_C,
cc_initialize,
(
apiCB** cc_ctx, // < DLL's primary control structure.
// returned here, passed everywhere else
cc_int32 api_version, // > ver supported by caller (use CC_API_VER_1)
cc_int32* api_supported, // < if ~NULL, max ver supported by DLL
const char** vendor // < if ~NULL, vendor name in read only C string
)
);
TYPEDEF_FUNC(
CCACHE_API,
CALLCONV_C,
cc_shutdown,
(
apiCB** cc_ctx // <> DLL's primary control structure. NULL after
)
);
TYPEDEF_FUNC(
CCACHE_API,
CALLCONV_C,
cc_get_NC_info,
(
apiCB* cc_ctx, // > DLL's primary control structure
struct _infoNC*** ppNCi // < (NULL before call) null terminated,
// list of a structs (free via cc_free_infoNC())
)
);
TYPEDEF_FUNC(
CCACHE_API,
CALLCONV_C,
cc_free_NC_info,
(
apiCB* cc_ctx,
struct _infoNC*** ppNCi // < free list of structs returned by
// cc_get_cache_names(). set to NULL on return
)
);
//// \CCAPI
extern DWORD AfsAvailable;
// service definitions
typedef SC_HANDLE (WINAPI *FP_OpenSCManagerA)(char *, char *, DWORD);
typedef SC_HANDLE (WINAPI *FP_OpenServiceA)(SC_HANDLE, char *, DWORD);
typedef BOOL (WINAPI *FP_QueryServiceStatus)(SC_HANDLE, LPSERVICE_STATUS);
typedef BOOL (WINAPI *FP_CloseServiceHandle)(SC_HANDLE);
//////////////////////////////////////////////////////////////////////////////
// CCAPI
extern DECL_FUNC_PTR(cc_initialize);
extern DECL_FUNC_PTR(cc_shutdown);
extern DECL_FUNC_PTR(cc_get_NC_info);
extern DECL_FUNC_PTR(cc_free_NC_info);
// krb4 functions
extern DECL_FUNC_PTR(get_krb_err_txt_entry);
extern DECL_FUNC_PTR(k_isinst);
extern DECL_FUNC_PTR(k_isname);
extern DECL_FUNC_PTR(k_isrealm);
extern DECL_FUNC_PTR(kadm_change_your_password);
extern DECL_FUNC_PTR(kname_parse);
extern DECL_FUNC_PTR(krb_get_cred);
extern DECL_FUNC_PTR(krb_get_krbhst);
extern DECL_FUNC_PTR(krb_get_lrealm);
extern DECL_FUNC_PTR(krb_get_pw_in_tkt);
extern DECL_FUNC_PTR(krb_get_tf_realm);
extern DECL_FUNC_PTR(krb_mk_req);
extern DECL_FUNC_PTR(krb_realmofhost);
extern DECL_FUNC_PTR(tf_init);
extern DECL_FUNC_PTR(tf_close);
extern DECL_FUNC_PTR(tf_get_cred);
extern DECL_FUNC_PTR(tf_get_pname);
extern DECL_FUNC_PTR(tf_get_pinst);
extern DECL_FUNC_PTR(LocalHostAddr);
extern DECL_FUNC_PTR(tkt_string);
extern DECL_FUNC_PTR(krb_set_tkt_string);
extern DECL_FUNC_PTR(initialize_krb_error_func);
extern DECL_FUNC_PTR(initialize_kadm_error_table);
extern DECL_FUNC_PTR(dest_tkt);
extern DECL_FUNC_PTR(lsh_LoadKrb4LeashErrorTables); // XXX
extern DECL_FUNC_PTR(krb_in_tkt);
extern DECL_FUNC_PTR(krb_save_credentials);
extern DECL_FUNC_PTR(krb_get_krbconf2);
extern DECL_FUNC_PTR(krb_get_krbrealm2);
extern DECL_FUNC_PTR(krb_life_to_time);
// krb5 functions
extern DECL_FUNC_PTR(krb5_change_password);
extern DECL_FUNC_PTR(krb5_get_init_creds_opt_init);
extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_tkt_life);
extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_renew_life);
extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_forwardable);
extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_proxiable);
extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_renew_life);
extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_address_list);
extern DECL_FUNC_PTR(krb5_get_init_creds_password);
extern DECL_FUNC_PTR(krb5_get_prompt_types);
extern DECL_FUNC_PTR(krb5_build_principal_ext);
extern DECL_FUNC_PTR(krb5_cc_get_name);
extern DECL_FUNC_PTR(krb5_cc_get_type);
extern DECL_FUNC_PTR(krb5_cc_resolve);
extern DECL_FUNC_PTR(krb5_cc_default);
extern DECL_FUNC_PTR(krb5_cc_default_name);
extern DECL_FUNC_PTR(krb5_cc_set_default_name);
extern DECL_FUNC_PTR(krb5_cc_initialize);
extern DECL_FUNC_PTR(krb5_cc_destroy);
extern DECL_FUNC_PTR(krb5_cc_close);
extern DECL_FUNC_PTR(krb5_cc_copy_creds);
extern DECL_FUNC_PTR(krb5_cc_store_cred);
extern DECL_FUNC_PTR(krb5_cc_retrieve_cred);
extern DECL_FUNC_PTR(krb5_cc_get_principal);
extern DECL_FUNC_PTR(krb5_cc_start_seq_get);
extern DECL_FUNC_PTR(krb5_cc_next_cred);
extern DECL_FUNC_PTR(krb5_cc_end_seq_get);
extern DECL_FUNC_PTR(krb5_cc_remove_cred);
extern DECL_FUNC_PTR(krb5_cc_set_flags);
// extern DECL_FUNC_PTR(krb5_cc_get_type);
extern DECL_FUNC_PTR(krb5_free_context);
extern DECL_FUNC_PTR(krb5_free_cred_contents);
extern DECL_FUNC_PTR(krb5_free_principal);
extern DECL_FUNC_PTR(krb5_get_in_tkt_with_password);
extern DECL_FUNC_PTR(krb5_init_context);
extern DECL_FUNC_PTR(krb5_parse_name);
extern DECL_FUNC_PTR(krb5_timeofday);
extern DECL_FUNC_PTR(krb5_timestamp_to_sfstring);
extern DECL_FUNC_PTR(krb5_unparse_name);
extern DECL_FUNC_PTR(krb5_get_credentials);
extern DECL_FUNC_PTR(krb5_mk_req);
extern DECL_FUNC_PTR(krb5_sname_to_principal);
extern DECL_FUNC_PTR(krb5_get_credentials_renew);
extern DECL_FUNC_PTR(krb5_free_data);
extern DECL_FUNC_PTR(krb5_free_data_contents);
// extern DECL_FUNC_PTR(krb5_get_realm_domain);
extern DECL_FUNC_PTR(krb5_free_unparsed_name);
extern DECL_FUNC_PTR(krb5_os_localaddr);
extern DECL_FUNC_PTR(krb5_copy_keyblock_contents);
extern DECL_FUNC_PTR(krb5_copy_data);
extern DECL_FUNC_PTR(krb5_free_creds);
extern DECL_FUNC_PTR(krb5_build_principal);
extern DECL_FUNC_PTR(krb5_get_renewed_creds);
extern DECL_FUNC_PTR(krb5_free_addresses);
extern DECL_FUNC_PTR(krb5_get_default_config_files);
extern DECL_FUNC_PTR(krb5_free_config_files);
extern DECL_FUNC_PTR(krb5_get_default_realm);
extern DECL_FUNC_PTR(krb5_set_default_realm);
extern DECL_FUNC_PTR(krb5_free_ticket);
extern DECL_FUNC_PTR(krb5_decode_ticket);
extern DECL_FUNC_PTR(krb5_get_host_realm);
extern DECL_FUNC_PTR(krb5_free_host_realm);
extern DECL_FUNC_PTR(krb5_c_random_make_octets);
extern DECL_FUNC_PTR(krb5_free_default_realm);
// Krb524 functions
extern DECL_FUNC_PTR(krb524_init_ets);
extern DECL_FUNC_PTR(krb524_convert_creds_kdc);
// ComErr functions
extern DECL_FUNC_PTR(com_err);
extern DECL_FUNC_PTR(error_message);
// Profile functions
extern DECL_FUNC_PTR(profile_init);
extern DECL_FUNC_PTR(profile_flush);
extern DECL_FUNC_PTR(profile_release);
extern DECL_FUNC_PTR(profile_get_subsection_names);
extern DECL_FUNC_PTR(profile_free_list);
extern DECL_FUNC_PTR(profile_get_string);
extern DECL_FUNC_PTR(profile_get_values);
extern DECL_FUNC_PTR(profile_get_relation_names);
extern DECL_FUNC_PTR(profile_clear_relation);
extern DECL_FUNC_PTR(profile_add_relation);
extern DECL_FUNC_PTR(profile_update_relation);
extern DECL_FUNC_PTR(profile_release_string);
// Service functions
extern DECL_FUNC_PTR(OpenSCManagerA);
extern DECL_FUNC_PTR(OpenServiceA);
extern DECL_FUNC_PTR(QueryServiceStatus);
extern DECL_FUNC_PTR(CloseServiceHandle);
extern DECL_FUNC_PTR(LsaNtStatusToWinError);
// LSA Functions
extern DECL_FUNC_PTR(LsaConnectUntrusted);
extern DECL_FUNC_PTR(LsaLookupAuthenticationPackage);
extern DECL_FUNC_PTR(LsaCallAuthenticationPackage);
extern DECL_FUNC_PTR(LsaFreeReturnBuffer);
extern DECL_FUNC_PTR(LsaGetLogonSessionData);
// toolhelp functions
TYPEDEF_FUNC(
HANDLE,
WINAPI,
CreateToolhelp32Snapshot,
(DWORD, DWORD)
);
TYPEDEF_FUNC(
BOOL,
WINAPI,
Module32First,
(HANDLE, LPMODULEENTRY32)
);
TYPEDEF_FUNC(
BOOL,
WINAPI,
Module32Next,
(HANDLE, LPMODULEENTRY32)
);
// psapi functions
TYPEDEF_FUNC(
DWORD,
WINAPI,
GetModuleFileNameExA,
(HANDLE, HMODULE, LPSTR, DWORD)
);
TYPEDEF_FUNC(
BOOL,
WINAPI,
EnumProcessModules,
(HANDLE, HMODULE*, DWORD, LPDWORD)
);
#define pGetModuleFileNameEx pGetModuleFileNameExA
#define TOOLHELPDLL "kernel32.dll"
#define PSAPIDLL "psapi.dll"
// psapi functions
extern DECL_FUNC_PTR(GetModuleFileNameExA);
extern DECL_FUNC_PTR(EnumProcessModules);
// toolhelp functions
extern DECL_FUNC_PTR(CreateToolhelp32Snapshot);
extern DECL_FUNC_PTR(Module32First);
extern DECL_FUNC_PTR(Module32Next);
khm_int32 init_imports(void);
khm_int32 exit_imports(void);
#endif

View File

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft&reg; HTML Help Workshop 4.1">
<!-- Sitemap 1.0 -->
</HEAD><BODY>
<UL>
</UL>
</BODY></HTML>

View File

@ -0,0 +1,37 @@
#
# Copyright (c) 2005 Massachusetts Institute of Technology
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
RELDIR=WINNT\netidmgr_plugin
!INCLUDE ..\..\..\config\NTMakefile.$(SYS_NAME)
!INCLUDE ..\..\..\config\NTMakefile.version
CHMFILE=$(DESTDIR)\root.client\usr\vice\etc\afsplhlp.chm
install: $(CHMFILE)
$(CHMFILE): afsplhlp.hhp
-hhc $**
$(COPY) afsplhlp.chm $(CHMFILE)
clean::
$(DEL) $(CHMFILE)

View File

@ -0,0 +1,14 @@
#define IDH_OBTAIN 3000
#define IDH_CELL 3001
#define IDH_REALM 3002
#define IDH_METHOD 3003
#define IDH_ADD 3004
#define IDH_DELETE 3005
#define IDH_TOKENLIST 3006
#define IDH_SVCSTATUS 3007
#define IDH_SVCSTOP 3008
#define IDH_SVCSTART 3009
#define IDH_SVCVERSION 3010
#define IDH_SVCCOMPANY 3011
#define IDH_SVCCPL 3012
#define IDH_STARTAFSCREDS 3013

View File

@ -0,0 +1,29 @@
[OPTIONS]
Auto Index=Yes
Compatibility=1.1 or later
Compiled file=afsplhlp.chm
Contents file=toc.hhc
Default Window=MainHelpWnd
Default topic=html/welcome.htm
Display compile progress=No
Index file=Index.hhk
Language=0x409 English (United States)
Title=OpenAFS Plugin for NetIDMgr
[WINDOWS]
MainHelpWnd="OpenAFS/NetIDMgr Help","toc.hhc","Index.hhk","html/welcome.htm","html/welcome.htm",,,,,0x42120,,0x384e,[271,372,593,566],0x830000,,,,,,0
[ALIAS]
[MAP]
#include afsplhlp.h
[TEXT POPUPS]
afsplhlp.h
popups_newcred.txt
popups_cfg.txt
[INFOTYPES]
Category:Usage
CategoryDesc:Usage instructions for OpenAFS/NetIDMgr

View File

@ -0,0 +1,73 @@
BODY {
font-family:helvetica,sans-serif;
font-size:8pt;
font-style:normal;
background-color:white;
margin-top: 0;
margin-left: 0;
margin-right: 0;
}
H1 {
font-size: 10pt;
border-bottom:1px solid black;
padding:5px;
background-color:#eeeeee;
}
H2 {
}
H3 {
font-size: 9pt;
border-bottom: 1px solid lightgrey;
padding: 5px;
}
H4 {
font-size: 9pt;
font-style: italic;
border-bottom: 1px dashed lightgrey;
margin-left: 10px;
}
P {
margin-left: 5px;
margin-right: 5px;
}
P.caption {
margin-left: 5px;
margin-right: 5px;
font-style: italic;
}
DIV.inline {
float: left;
}
DIV.sidebar {
float: right;
background-color:#ffffb9;
border: 1px solid #ffff00;
}
A.external {
}
A.mail {
}
IMG {
border: 0;
}
SPAN.pre {
font-family: courier;
font-weight: bold;
}
SPAN.title {
font-weight: bold;
}

View File

@ -0,0 +1,24 @@
<html>
<head>
<title>Reporting Bugs and Requesting Features</title>
<meta name="description" content="Reporting bugs and Requesting features">
<meta name="keywords" content="bugs,features">
<link rel="stylesheet" type="text/css" href="afsplhlp.css">
</head>
<body>
<h1>Reporting Bugs and Requesting Features</h1>
<p>If you experience a bug in the program, please send email to <a
href="mailto:bugs@secure-endpoints.com"
class="mail">bugs@secure-endpoints.com</a> and report it. Please
include as much information as possible to enable us to reproduce the
problem.
</p>
<p>If there is a feature you would like to see in a future release,
please send email to the same address given above.
</p>
</body>
</html>

View File

@ -0,0 +1,39 @@
<html>
<head>
<title>Configuring the AFS Service</title>
<meta name="description" content="Configuring the AFS Service">
<meta name="keywords" content="configure,service">
<link rel="stylesheet" type="text/css" href="afsplhlp.css">
</head>
<body>
<h1>Configuring the AFS Service</h1>
<p>The OpenAFS plug-in allows you to start or stop the AFS
client service, determine the installed version, and invoke the AFS
Control Panel. This is provided via the AFS configuration panel in
the NetIDMgr configuration dialog, as seen below:
</p>
<p><img src="images/window_cfg_afs_main.bmp" /></p>
<p>Depending on the status of the service, either the <span
class="pre">Stop service</span> or the <span class="pre">Start
service</span> buttons will be enabled. If the service is in a state
where it will not accept these control requests, then both buttons will
be disabled.
</p>
<p>The <span class="pre">Version</span> field and the <span
class="pre">Company</span> fields are populated based on the resources
found in the <span class="pre">afsd_service.exe</span> binary. This
is the main binary that provides the AFS client service. Unless the
build of OpenAFS that you have installed is a private build, the
version should correspond to the release of OpenAFS that is installed
on your machine.</p>
<p>Clicking the <span class="pre">Open AFS Control Panel...</span>
will open the AFS configuration utility.</p>
</body>
</html>

View File

@ -0,0 +1,42 @@
<html>
<head>
<title>License</title>
<meta name="description" content="License agreement">
<meta name="keywords" content="license">
<link rel="stylesheet" type="text/css" href="afsplhlp.css">
</head>
<body>
<h1>OpenAFS Plug-in for Network Identification Manager License</h1>
<p>This software is being provided to you, the LICENSEE, by Secure
Endpoints Inc. under the following license. By obtaining, using and/or
copying this software, you agree that you have read, understood, and
will comply with these terms and conditions:</p>
<p>Permission to use, copy, modify and distribute this software and its
documentation for any purpose and without fee or royalty is hereby
granted, provided that you agree to comply with the following
copyright notice and statements, including the disclaimer, and that
the same appear on ALL copies of the software and documentation,
including modifications that you make for internal use or for
distribution:</p>
<p>Copyright 2005 by Secure Endpoints Inc.. All rights reserved.</p>
<p>THIS SOFTWARE IS PROVIDED "AS IS", AND SECURE ENDPOINTS INC. MAKES
NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
example, but not limitation, SECURE ENDPOINTS INC. MAKES NO
REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE OR
DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
TRADEMARKS OR OTHER RIGHTS.</p>
<p>The name of Secure Endpoints Inc. may NOT be used in advertising or
publicity pertaining to distribution of the software. Title to
copyright in this software and any associated documentation shall at
all times remain with Secure Endpoints Inc., and USER agrees to
preserve same.</p>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

View File

@ -0,0 +1,11 @@
<html>
<head>
<title>title</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link rel="stylesheet" type="text/css" href="afsplhlp.css">
</head>
<body>
</body>
</html>

View File

@ -0,0 +1,70 @@
<html>
<head>
<title>Token Acquisition Methods</title>
<meta name="description" content="Token Acquisition Methods">
<meta name="keywords" content="token, krb5, krb4, krb524">
<link rel="stylesheet" type="text/css" href="afsplhlp.css">
</head>
<body>
<h1>Token Acquisition Methods</h1>
<p>AFS tokens can be obtained via several different methods. Each of
the methods that are natively supported by the OpenAFS plug-in is
described below. Note that, additional plug-ins may define other
acquisition methods that are not listed here.
</p>
<h4>Contents</h4>
<ul>
<li><a href="#krb5">Kerberos 5</a></li>
<li><a href="#krb524">Kerberos 5 to 4 conversion</a></li>
<li><a href="#krb4">Kerberos 4</a></li>
<li><a href="#auto">Automatic method selection</a></li>
</ul>
<a name="krb5" />
<h3>Kerberos 5</h3>
<p>A Kerberos 5 service ticket is obtained for the cell and used directly to
construct the AFS token.
</p>
<a name="krb524"/>
<h3>Kerberos 5 to 4 conversion (Kerberos 524)</h3>
<p>A Kerberos 5 service ticket is obtained for the cell and then
converted to a Kerberos 4 service ticket using the krb524 daemon. The
resulting Kerberos 4 ticket is used to construct the AFS token.
</p>
<a name="krb4"/>
<h3>Kerberos 4</h3>
<p>A Kerberos 4 service ticket is obtained for the cell and then used
to construct the AFS token. In order to use this method, the identity
must be be configured to obtain Kerberos 4 tickets when obtaining and
renewing credentials. Otherwise a Kerberos 4 TGT (ticket granting
ticket) will not be available to obtain the service ticket with.
</p>
<a name="auto"/>
<h3>Automatic method selection</h3>
<p>When the OpenAFS plug-in is configured to use automatic method
selection for obtaining an AFS token, it iterates through the Kerberos
5, Kerberos 524 and Kerberos 4 methods until one of them succeeds. If
a realm for the service ticket is specified, then the realm will be
used for all methods.
</p>
<p>The correct method to use for your AFS cell will depend on the
configuration of the AFS cell and the associated Kerberos realm. In
most cases, automatic method selection will determine the correct
realm. However, other cases, the method will have to be specified
explicitly.
</p>
</body>
</html>

View File

@ -0,0 +1,189 @@
<html>
<head>
<title>Configuring identifications to obtain tokens for AFS cells</title>
<meta name="description" content="Specifying tokens per identification">
<meta name="keywords" content="tokns, identification, specify">
<link rel="stylesheet" type="text/css" href="afsplhlp.css">
</head>
<body>
<h1>Configuring identifications to obtain tokens for AFS cells</h1>
<p>
The OpenAFS plug-in maintains a list of AFS cells for each identification.
A list is created the first time AFS tokens are obtained for an
identification or when the list of cells is
specified in the identification configuration panels. Each AFS cell that
is listed is associated with a method by which a token should
be obtained and the name of the Kerberos realm that is used to
obtain the service ticket (more details are provided in the <a
href="token_methods.htm">Token Aquisition Methods</a> topic).
</p>
<p>The following sections detail the process by which AFS cells can be
specified when obtaining new credentials or configuring identifications.
</p>
<a name="new_tokens" />
<h3>Specifying AFS cells when obtaining new credentials</h3>
<p>
When the OpenAFS plug-in is installed, it enhances the NetIDMgr new credentials
dialog with an AFS tokens options panel. A typical new
credentials dialog is shown below demonstrating AFS cells listed in the
credentials summary window.
</p>
<p><img src="images/window_nc_main.bmp" alt="New credentials window showing AFS cells in the credentials summary window" /></p>
<p>Clicking on the <span class="pre">AFS</span> link in the
credentials summary window will take you to the AFS options page.
Alternatively, you can select the <span class="pre">Options
&gt;&gt;</span> button which expands the dialog to show the
credentials type buttons, and then click the <span
class="pre">AFS</span> button at the bottom of the expanded dialog.
</p>
<p>The AFS identification options page is shown below</p>
<p><img src="images/window_nc_afs_0.bmp" alt="AFS identification options page" /></p>
<p>This page allows you to specify if AFS tokens are obtained for this
identification and if so, for which tokens and by which method will they be
obtained. By unchecking the <span class="pre">Obtain AFS
tokens</span> checkbox, you can prevent AFS tokens from being obtained
for this idenfication.
</p>
<p>Once the new credentials dialog successfully completes, the list of
cells will be saved with the identification. The next
time you obtain new credentials for the identification, the list of cells
will be loaded automatically. This list can be edited either by using
the new credentials dialog or the identity configuration
panels. (See <a href="#persistent_tokens">Changing persistent tokent lists</a>).
</p>
<h4>To add a cell:</h4>
<p>
<ul>
<li>Specify the name of the cell in the <span class="pre">Cell</span>
text box.</li>
<li>Specify the Kerberos realm for the service ticket in the <span
class="pre">Realm</span> text box. Note that you can select <span
class="pre">(Automatic)</span> as the realm to allow the OpenAFS
plug-in to select the realm. For most cases, you don't need to specify
the realm manually and can safely leave the <span
class="pre">Realm</span> as <span class="pre">(Automatic)</span></li>
<li>Specify the token acquisition method in the <span
class="pre">Method</span>. You can select <span
class="pre">(Automatic)</span> as the method to allow the OpenAFS
plug-in to select the method automatically. Similar to the automatic
realm selection, for most cases the plug-in will be able to correctly
select the token aquisition method. More details about credentials
acquisition methods are provided in the <a
href="token_methods.htm">Token Acquisition Methods</a> topic.</li>
<li>Select the <span class="pre">Add/Update</span> button to add the
cell.</li>
</ul>
</p>
<p>Note that only one token can exist per cell per login session.
Which means that if you already have a token for cell <em>X</em> while
you are logged in as user <em>A</em>, then you can't have another
token for cell <em>X</em>. This means that only one identification can
obtain a token for a given cell.</p>
<p>Therefore, if you try to add a cell to an identification which is
already listed in the persistent cell list for another identification or
which currently exists under a different identification, you will receive a
warning such as the following:
</p>
<p>
<img src="images/window_nc_prob.bmp" alt="Message displaying warning about a duplicate cell" />
</p>
<p>From here, you can decide to keep the cell listed for both
identifications (although only one of them can be active at any given
time), or remove the cell from all the other identifications and add it to
the current one. Also, you can cancel the add cell request.
</p>
<h4>To modify a cell</h4>
<p>
<ul>
<li>Select the cell from the list of cells. The cell name, realm and
method in the text boxes will be updated to display the information
from the cell just selected.</li>
<li>Make changes to the realm and method fields as appropriate</li>
<li>Select <span class="pre">Add / Update</span> to update the
information in the cell list</li>
</ul>
</p>
<p>Note that if you don't click the <span class="pre">Add /
Update</span>, the cell entry will not be updated.
</p>
<h4>To delete cells</h4>
<p>
<ul>
<li>Select the cells you want to delete from the cell list. You can
select multiple cells by clicking while holding the <span
class="pre">Ctrl</span> key.</li>
<li>Select the <span class="pre">Delete</span> button.</span></li>
</ul>
</p>
<h4>Cell states</h4>
<p>When you add cells or when you view the cell list, you will see
an icon next to each cell name. This icon represents the current state of
the cell's token. You can double-click on the cell to get details about the
state.
</p>
<p><img src="images/window_nc_afs_2.bmp" /></p>
<p>
<div class="inline"><img src="images/window_nc_afs_1.bmp" /></div>
Token for cell <span class="pre">foo.bar</span> is a new token while
the token for <span class="pre">net.mit.edu</span> is in a problem
state. Double clicking the problem token will display a balloon
prompt indicating what the problem is.
</p>
<a name="persistent_tokens" />
<h3>Changing persistent cell lists for existing identifications</h3>
<p>
The configuration panel for a persistent identification contains a panel for
specifying the AFS cells. This panel is identical to the panel used
by the new credentials dialog. You can easily modify the cell lists
as described above and click <span class="pre">Apply</span> and you
are done.
</p>
<p>The AFS configuration panel for an identification is shown below.</p>
<p><img src="images/window_cfg_afs_0.bmp" /></p>
<p>You can reach this configuration panel by opening the configuration
dialog (<span class="pre">Options</span> menu), and then clicking the
persistent identification you need to modify options for.</p>
</body>
</html>

View File

@ -0,0 +1,61 @@
<html>
<head>
<title>Welcome to the OpenAFS plug-in for NetIDMgr</title>
<meta name="description" content="Welcome">
<meta name="keywords" content="welcome">
<link rel="stylesheet" type="text/css" href="afsplhlp.css">
</head>
<h1>Welcome to the OpenAFS plug-in for NetIDMgr</h1>
<img src="images/openafs-logo.jpg"/>
<p>
The OpenAFS plug-in extends the Network Identity Manager (or
NetIDMgr for short) to support AFS credential management. This plug-in
obtains AFS tokens for the cells associated with each identification
and provides the tools necessary to maintain them.
</p>
<p>
This version of the plug-in is provided by Secure Endpoints Inc.
Visit <a class="external"
href="http://www.secure-endpoints.com">http://www.secure-endpoints.com</a>
for updates.
</p>
<ul>
<li><a href="copyright.htm">Legal information</a></li>
<li><a href="bugs.htm">Reporting problems and requesting features</a></li>
</ul>
<h3>Using the OpenAFS plug-in</h3>
<ul>
<li>
<a href="tokens_per_id.htm">Associating an AFS cell with an
identification</a>: How to configure identification options to obtain
tokens for select AFS cells.</li>
<li>
<a href="config_service.htm">Managing the AFS client service</a>: How
to manage the AFS client service and configuration. </li>
</ul>
<h3>External links</h3>
<ul>
<li><a class="external" href="http://openafs.org">http://openafs.org</a>:
OpenAFS
</li>
<li><a class="external" href="http://www.secure-endpoints.com">http://www.secure-endpoints.com</a>:
Secure Endpoints Inc.
</ul>
</html>

View File

@ -0,0 +1,30 @@
.topic IDH_SVCSTATUS
Current status of the OpenAFS Client Service.
.topic IDH_SVCSTOP
Stops the OpenAFS Client service. Access to resources in AFS will not
be available until the service is started again. All exising AFS
tokens will also be lost.
.topic IDH_SVCSTART
Start the service. Once the service starts, it will not have any AFS
tokens for any of the users. Therefore new tokens will be
automatically be obtained once the service starts.
.topic IDH_SVCVERSION
Version of the OpenAFS Client that is installed on this machine. The
version is derived from the executable that provides the OpenAFS
Client service on this machine.
.topic IDH_SVCCOMPANY
The company that provided the OpenAFS client.
.topic IDH_SVCCPL
Open the OpenAFS Client Configuration utility.
.topic IDH_STARTAFSCREDS
Once the OpenAFS plugin for NetIDMgr is installed, it is no longer
necessary to start AFSCreds.exe everytime a user logs in. The allows
you to disable AFSCreds.exe. Note that this is a per machine setting
and requires Administrator privileges on the machine to have an
effect.

View File

@ -0,0 +1,31 @@
.topic IDH_OBTAIN
If checked, obtains AFS tokens for this identity as specified below.
Otherwise, doesn't obtain AFS tokens at all.
.topic IDH_CELL
The name of the cell for which this token will be obtained for.
.topic IDH_REALM
The Kerberos realm used to obtain the service ticket for the cell.
Select 'Automatic' to let the AFS plug-in determine the realm
automatically.
.topic IDH_METHOD
The method used to construct the AFS token. Select 'Automatic' to let
the AFS plugin determine the method automatically.
.topic IDH_ADD
Add or update the token in the token list. If the token already
exists in the list, then the information will be updated. Otherwise
it will be added.
.topic IDH_DELETE
Delete the selected tokens from the token list. Tokens that are
currently selected in the tokens list will be deleted. If no tokens
are selected in the list, then the token corresponding to the cell
listed in the 'Cell' input box will be deleted.
.topic IDH_TOKENLIST
The list of tokens that will be obtained for this identity.
Double-click on any of the tokens here to get details about the state
of each token.

View File

@ -0,0 +1,56 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<!-- Sitemap 1.0 -->
</HEAD>
<BODY>
<OBJECT type="text/site properties">
<param name="Category" value="Usage">
<param name="CategoryDesc" value="Usage instructions for Network Identity Manager">
<param name="Window Styles" value="0x800025">
</OBJECT>
<UL>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Welcome to OpenAFS">
<param name="Local" value="html\welcome.htm">
</OBJECT>
<UL>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Reporting bugs">
<param name="Local" value="html\bugs.htm">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="License agreement">
<param name="Local" value="html\copyright.htm">
</OBJECT>
</UL>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="How do I ...">
</OBJECT>
<ul>
<li> <object type="text/sitemap">
<param name="Name" value="Specify AFS tokens when getting new credentials...">
<param name="Local" value="html\tokens_per_id.htm#new_tokens">
</object>
<li> <object type="text/sitemap">
<param name="Name" value="Change AFS tokens list for an identity...">
<param name="Local" value="html\tokens_per_id.htm#persistent_tokens">
</object>
<li> <object type="text/sitemap">
<param name="Name" value="Configure the AFS client service...">
<param name="Local" value="html\config_service.htm">
</object>
</ul>
<li> <object type="text/sitemap">
<param name="Name" value="Topics">
</object>
<ul>
<li> <object type="text/sitemap">
<param name="Name" value="Token Acquisition Methods">
<param name="Local" value="html\token_methods.htm">
</object>
</ul>
</UL>
</BODY></HTML>

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,449 @@
/*
* Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* $Id$ */
#include<windows.h>
#include<netidmgr.h>
#include<dynimport.h>
#include<krb5common.h>
#ifdef DEBUG
#include<assert.h>
#endif
#include<strsafe.h>
/**************************************/
/* khm_krb5_error(): */
/**************************************/
int
khm_krb5_error(krb5_error_code rc, LPCSTR FailedFunctionName,
int FreeContextFlag, krb5_context * ctx,
krb5_ccache * cache)
{
#ifdef NO_KRB5
return 0;
#else
#ifdef SHOW_MESSAGE_IN_AN_ANNOYING_WAY
char message[256];
const char *errText;
int krb5Error = ((int)(rc & 255));
errText = perror_message(rc);
_snprintf(message, sizeof(message),
"%s\n(Kerberos error %ld)\n\n%s failed",
errText,
krb5Error,
FailedFunctionName);
MessageBoxA(NULL, message, "Kerberos Five", MB_OK | MB_ICONERROR |
MB_TASKMODAL |
MB_SETFOREGROUND);
#endif
if (FreeContextFlag == 1)
{
if (*ctx != NULL)
{
if (*cache != NULL) {
pkrb5_cc_close(*ctx, *cache);
*cache = NULL;
}
pkrb5_free_context(*ctx);
*ctx = NULL;
}
}
return rc;
#endif //!NO_KRB5
}
int
khm_krb5_initialize(khm_handle ident,
krb5_context *ctx,
krb5_ccache *cache)
{
#ifdef NO_KRB5
return(0);
#else
LPCSTR functionName;
int freeContextFlag;
krb5_error_code rc = 0;
krb5_flags flags = 0;
if (pkrb5_init_context == NULL)
return 1;
if (*ctx == 0 && (rc = (*pkrb5_init_context)(ctx))) {
functionName = "krb5_init_context()";
freeContextFlag = 0;
goto on_error;
}
if(*cache == 0) {
wchar_t wccname[MAX_PATH];
khm_size cbwccname;
if(ident != NULL) {
cbwccname = sizeof(wccname);
do {
char ccname[256];
if(KHM_FAILED(kcdb_identity_get_attrib(ident, L"Krb5CCName",
NULL, wccname,
&cbwccname))) {
cbwccname = sizeof(wccname);
if (KHM_FAILED
(khm_krb5_find_ccache_for_identity(ident,
ctx,
wccname,
&cbwccname))) {
#ifdef DEBUG_LIKE_A_MADMAN
assert(FALSE);
#endif
break;
}
}
if(UnicodeStrToAnsi(ccname, sizeof(ccname), wccname) == 0)
break;
if((*pkrb5_cc_resolve)(*ctx, ccname, cache)) {
functionName = "krb5_cc_resolve()";
freeContextFlag = 1;
goto on_error;
}
} while(FALSE);
}
#ifndef FAILOVER_TO_DEFAULT_CCACHE
rc = 1;
#endif
if (*cache == 0
#ifdef FAILOVER_TO_DEFAULT_CCACHE
&& (rc = (*pkrb5_cc_default)(*ctx, cache))
#endif
) {
functionName = "krb5_cc_default()";
freeContextFlag = 1;
goto on_error;
}
}
#ifdef KRB5_TC_NOTICKET
flags = KRB5_TC_NOTICKET;
#endif
if ((rc = (*pkrb5_cc_set_flags)(*ctx, *cache, flags)))
{
if (rc != KRB5_FCC_NOFILE && rc != KRB5_CC_NOTFOUND)
khm_krb5_error(rc, "krb5_cc_set_flags()", 0, ctx,
cache);
else if ((rc == KRB5_FCC_NOFILE || rc == KRB5_CC_NOTFOUND) && *ctx != NULL) {
if (*cache != NULL)
(*pkrb5_cc_close)(*ctx, *cache);
}
return rc;
}
return 0;
on_error:
return khm_krb5_error(rc, functionName, freeContextFlag, ctx, cache);
#endif //!NO_KRB5
}
#define TIMET_TOLERANCE (60*5)
khm_int32 KHMAPI
khm_get_identity_expiration_time(krb5_context ctx, krb5_ccache cc,
khm_handle ident,
krb5_timestamp * pexpiration)
{
krb5_principal principal = 0;
char * princ_name = NULL;
krb5_creds creds;
krb5_error_code code;
krb5_error_code cc_code;
krb5_cc_cursor cur;
krb5_timestamp now, expiration = 0;
wchar_t w_ident_name[KCDB_IDENT_MAXCCH_NAME];
char ident_name[KCDB_IDENT_MAXCCH_NAME];
khm_size cb;
khm_int32 rv = KHM_ERROR_NOT_FOUND;
if (!ctx || !cc || !ident || !pexpiration)
return KHM_ERROR_GENERAL;
code = pkrb5_cc_get_principal(ctx, cc, &principal);
if ( code )
return KHM_ERROR_INVALID_PARAM;
cb = sizeof(w_ident_name);
kcdb_identity_get_name(ident, w_ident_name, &cb);
UnicodeStrToAnsi(ident_name, sizeof(ident_name), w_ident_name);
code = pkrb5_unparse_name(ctx, principal, &princ_name);
/* compare principal to ident. */
if ( code || !princ_name ||
strcmp(princ_name, ident_name) ) {
if (princ_name)
pkrb5_free_unparsed_name(ctx, princ_name);
pkrb5_free_principal(ctx, principal);
return KHM_ERROR_UNKNOWN;
}
pkrb5_free_unparsed_name(ctx, princ_name);
pkrb5_free_principal(ctx, principal);
code = pkrb5_timeofday(ctx, &now);
if (code)
return KHM_ERROR_UNKNOWN;
cc_code = pkrb5_cc_start_seq_get(ctx, cc, &cur);
while (!(cc_code = pkrb5_cc_next_cred(ctx, cc, &cur, &creds))) {
krb5_data * c0 = krb5_princ_name(ctx, creds.server);
krb5_data * c1 = krb5_princ_component(ctx, creds.server, 1);
krb5_data * r = krb5_princ_realm(ctx, creds.server);
if ( c0 && c1 && r && c1->length == r->length &&
!strncmp(c1->data,r->data,r->length) &&
!strncmp("krbtgt",c0->data,c0->length) ) {
/* we have a TGT, check for the expiration time.
* if it is valid and renewable, use the renew time
*/
if (!(creds.ticket_flags & TKT_FLG_INVALID) &&
creds.times.starttime < (now + TIMET_TOLERANCE) &&
(creds.times.endtime + TIMET_TOLERANCE) > now) {
expiration = creds.times.endtime;
if ((creds.ticket_flags & TKT_FLG_RENEWABLE) &&
(creds.times.renew_till > creds.times.endtime)) {
expiration = creds.times.renew_till;
}
}
}
}
if (cc_code == KRB5_CC_END) {
cc_code = pkrb5_cc_end_seq_get(ctx, cc, &cur);
rv = KHM_ERROR_SUCCESS;
*pexpiration = expiration;
}
return rv;
}
khm_int32 KHMAPI
khm_krb5_find_ccache_for_identity(khm_handle ident, krb5_context *pctx,
void * buffer, khm_size * pcbbuf)
{
krb5_context ctx = 0;
krb5_ccache cache = 0;
krb5_error_code code;
apiCB * cc_ctx = 0;
struct _infoNC ** pNCi = NULL;
int i;
khm_int32 t;
wchar_t * ms = NULL;
khm_size cb;
krb5_timestamp expiration = 0;
krb5_timestamp best_match_expiration = 0;
char best_match_ccname[256] = "";
khm_handle csp_params = NULL;
khm_handle csp_plugins = NULL;
if (!buffer || !pcbbuf)
return KHM_ERROR_GENERAL;
ctx = *pctx;
if (!pcc_initialize ||
!pcc_get_NC_info ||
!pcc_free_NC_info ||
!pcc_shutdown)
goto _skip_cc_iter;
code = pcc_initialize(&cc_ctx, CC_API_VER_2, NULL, NULL);
if (code)
goto _exit;
code = pcc_get_NC_info(cc_ctx, &pNCi);
if (code)
goto _exit;
for(i=0; pNCi[i]; i++) {
if (pNCi[i]->vers != CC_CRED_V5)
continue;
code = (*pkrb5_cc_resolve)(ctx, pNCi[i]->name, &cache);
if (code)
continue;
/* need a function to check the cache for the identity
* and determine if it has valid tickets. If it has
* the right identity and valid tickets, store the
* expiration time and the cache name. If it has the
* right identity but no valid tickets, store the ccache
* name and an expiration time of zero. if it does not
* have the right identity don't save the name.
*
* Keep searching to find the best cache available.
*/
if (KHM_SUCCEEDED(khm_get_identity_expiration_time(ctx, cache,
ident,
&expiration))) {
if ( expiration > best_match_expiration ) {
best_match_expiration = expiration;
StringCbCopyA(best_match_ccname,
sizeof(best_match_ccname),
"API:");
StringCbCatA(best_match_ccname,
sizeof(best_match_ccname),
pNCi[i]->name);
expiration = 0;
}
}
if(ctx != NULL && cache != NULL)
(*pkrb5_cc_close)(ctx, cache);
cache = 0;
}
_skip_cc_iter:
if (KHM_SUCCEEDED(kmm_get_plugins_config(0, &csp_plugins))) {
khc_open_space(csp_plugins, L"Krb5Cred\\Parameters", 0, &csp_params);
khc_close_space(csp_plugins);
csp_plugins = NULL;
}
#ifdef DEBUG
if (csp_params == NULL) {
assert(FALSE);
}
#endif
if (csp_params &&
KHM_SUCCEEDED(khc_read_int32(csp_params, L"MsLsaList", &t)) && t) {
code = (*pkrb5_cc_resolve)(ctx, "MSLSA:", &cache);
if (code == 0 && cache) {
if (KHM_SUCCEEDED(khm_get_identity_expiration_time(ctx, cache,
ident,
&expiration))) {
if ( expiration > best_match_expiration ) {
best_match_expiration = expiration;
StringCbCopyA(best_match_ccname, sizeof(best_match_ccname),
"MSLSA:");
expiration = 0;
}
}
}
if (ctx != NULL && cache != NULL)
(*pkrb5_cc_close)(ctx, cache);
cache = 0;
}
if (csp_params &&
khc_read_multi_string(csp_params, L"FileCCList", NULL, &cb)
== KHM_ERROR_TOO_LONG &&
cb > sizeof(wchar_t) * 2) {
wchar_t * t;
char ccname[MAX_PATH + 6];
ms = PMALLOC(cb);
#ifdef DEBUG
assert(ms);
#endif
khc_read_multi_string(csp_params, L"FileCCList", ms, &cb);
for(t = ms; t && *t; t = multi_string_next(t)) {
StringCchPrintfA(ccname, ARRAYLENGTH(ccname),
"FILE:%S", t);
code = (*pkrb5_cc_resolve)(ctx, ccname, &cache);
if (code)
continue;
if (KHM_SUCCEEDED(khm_get_identity_expiration_time(ctx, cache,
ident,
&expiration))) {
if ( expiration > best_match_expiration ) {
best_match_expiration = expiration;
StringCbCopyA(best_match_ccname,
sizeof(best_match_ccname),
ccname);
expiration = 0;
}
}
if (ctx != NULL && cache != NULL)
(*pkrb5_cc_close)(ctx, cache);
cache = 0;
}
PFREE(ms);
}
_exit:
if (csp_params)
khc_close_space(csp_params);
if (pNCi)
(*pcc_free_NC_info)(cc_ctx, &pNCi);
if (cc_ctx)
(*pcc_shutdown)(&cc_ctx);
if (best_match_ccname[0]) {
if (*pcbbuf = AnsiStrToUnicode((wchar_t *)buffer,
*pcbbuf,
best_match_ccname)) {
*pcbbuf = (*pcbbuf + 1) * sizeof(wchar_t);
return KHM_ERROR_SUCCESS;
}
}
return KHM_ERROR_GENERAL;
}

View File

@ -0,0 +1,56 @@
/*
* Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* $Id$ */
/* Adapted from multiple Leash header files */
#ifndef __KHIMAIRA_KRB5COMMON_H
#define __KHIMAIRA_KRB5COMMON_H
#include<krb5.h>
#ifndef NO_KRB5
int khm_krb5_error(krb5_error_code rc, LPCSTR FailedFunctionName,
int FreeContextFlag, krb5_context *ctx,
krb5_ccache *cache);
int
khm_krb5_get_error_string(krb5_error_code rc,
wchar_t * buffer,
khm_size cb_buffer);
int khm_krb5_initialize(khm_handle ident, krb5_context *, krb5_ccache *);
khm_int32 KHMAPI
khm_krb5_find_ccache_for_identity(khm_handle ident, krb5_context *pctx,
void * buffer, khm_size * pcbbuf);
khm_int32 KHMAPI
khm_get_identity_expiration_time(krb5_context ctx, krb5_ccache cc,
khm_handle ident,
krb5_timestamp * pexpiration);
#endif /* NO_KRB5 */
#endif

View File

@ -0,0 +1,273 @@
// Microsoft Visual C++ generated resource script.
//
#include "..\..\langres.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"..\\..\\langres.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_NC_AFS DIALOGEX 0, 0, 300, 166
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "AFS Token Options",IDC_STATIC,7,7,286,11,SS_SUNKEN | NOT WS_GROUP
CONTROL "Obtain &AFS tokens",IDC_NCAFS_OBTAIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,19,74,12
GROUPBOX "Token for",IDC_STATIC,7,32,286,54
LTEXT "&Cell",IDC_STATIC,12,41,42,10
COMBOBOX IDC_NCAFS_CELL,57,38,152,12,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "&Realm",IDC_STATIC,12,57,42,10
COMBOBOX IDC_NCAFS_REALM,57,54,152,12,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "&Method",IDC_STATIC,12,73,42,10
COMBOBOX IDC_NCAFS_METHOD,57,70,152,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Add/Update",IDC_NCAFS_ADD_TOKEN,213,38,77,13,BS_NOTIFY
PUSHBUTTON "&Delete",IDC_NCAFS_DELETE_TOKEN,213,70,77,13,BS_NOTIFY
CONTROL "",IDC_NCAFS_TOKENLIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,88,286,71
END
IDD_CFG_IDS_TAB DIALOGEX 0, 0, 235, 151
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "Obtain AFS tokens for new identities",IDC_CFG_OBTAIN,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,133,10
END
IDD_CFG_ID_TAB DIALOGEX 0, 0, 235, 151
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "Obtain &AFS tokens",IDC_NCAFS_OBTAIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,74,12
GROUPBOX "Token for",IDC_STATIC,7,18,221,56
LTEXT "&Cell",IDC_STATIC,13,28,42,10
COMBOBOX IDC_NCAFS_CELL,57,25,109,12,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "&Realm",IDC_STATIC,13,44,42,10
COMBOBOX IDC_NCAFS_REALM,57,41,109,12,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "&Method",IDC_STATIC,13,60,42,10
COMBOBOX IDC_NCAFS_METHOD,57,57,109,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Add/Update",IDC_NCAFS_ADD_TOKEN,174,26,50,13,BS_NOTIFY
PUSHBUTTON "&Delete",IDC_NCAFS_DELETE_TOKEN,174,56,50,13,BS_NOTIFY
CONTROL "",IDC_NCAFS_TOKENLIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,75,221,69
END
IDD_CFG_AFS DIALOGEX 0, 0, 255, 182
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
GROUPBOX "AFS Service",IDC_CFG_SVCGRP,7,7,241,86
LTEXT "Service status",IDC_CFG_LBL_STATUS,14,18,46,8
EDITTEXT IDC_CFG_STATUS,68,16,172,14,ES_AUTOHSCROLL | ES_READONLY
PUSHBUTTON "Stop service",IDC_CFG_STOP,68,34,50,14
PUSHBUTTON "Start service",IDC_CFG_START,127,34,50,14
CONTROL "",IDC_CFG_PROGRESS,"msctls_progress32",NOT WS_VISIBLE | WS_BORDER,184,38,56,8
LTEXT "Version",IDC_CFG_LBL_VERSION,14,57,24,8
EDITTEXT IDC_CFG_VERSION,68,54,172,14,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Company",IDC_CFG_LBL_COMPANY,14,75,31,8
EDITTEXT IDC_CFG_COMPANY,68,72,172,14,ES_AUTOHSCROLL | ES_READONLY
PUSHBUTTON "Open AFS Control Panel ...",IDC_CFG_CPL,128,161,112,14
GROUPBOX "Startup options",IDC_CFG_STARTGRP,7,99,241,48
CONTROL "Prevent AFSCreds.exe from starting automatically everytime you log in to Windows.",IDC_CFG_STARTAFSCREDS,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,14,108,226,22
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_NC_AFS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 293
TOPMARGIN, 7
BOTTOMMARGIN, 159
END
IDD_CFG_IDS_TAB, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 228
TOPMARGIN, 7
BOTTOMMARGIN, 144
END
IDD_CFG_ID_TAB, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 228
TOPMARGIN, 7
BOTTOMMARGIN, 144
END
IDD_CFG_AFS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 248
VERTGUIDE, 14
VERTGUIDE, 68
VERTGUIDE, 240
TOPMARGIN, 7
BOTTOMMARGIN, 175
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_AFSTOKEN ICON "..\\..\\images\\afstoken.ico"
IDI_AFSPLUGIN ICON "..\\..\\images\\OpenAFS.ico"
IDI_NC_NEW ICON "..\\..\\images\\nc_new.ico"
IDI_NC_EXIST ICON "..\\..\\images\\nc_exist.ico"
IDI_NC_NOTOWNED ICON "..\\..\\images\\nc_notowned.ico"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_AFS_SHORT_DESC "AFS tokens"
IDS_AFS_LONG_DESC "AFS tokens"
IDS_AFS_NAME "AFS"
IDS_NCAFS_COL_CELL "Cell"
IDS_NCAFS_COL_REALM "Realm"
IDS_NCAFS_COL_METHOD "Method"
IDS_NC_METHOD_AUTO "(Automatic)"
IDS_NC_METHOD_KRB5 "Kerberos 5"
IDS_NC_METHOD_KRB4 "Kerberos 4"
IDS_NC_METHOD_KRB524 "Krb524"
IDS_NC_REALM_AUTO "(Automatic)"
END
STRINGTABLE
BEGIN
IDS_NC_TT_NO_CELL "You have not specified an AFS cell to authenticate to."
IDS_NC_TT_CANT_ADD "Can't add a new token"
IDS_NC_TT_MALFORMED_CELL
"The cell name you specified contains invalid characters."
IDS_NC_TT_NO_REALM "You have not specified a Kerberos realm to use to obtain tokesn for the cell."
IDS_NC_AUTO "(Auto)"
IDS_NC_TT_MALFORMED_REALM
"The realm name you entered contains invalid characters."
IDS_NC_TT_CANT_UPDATE "Can't update token"
IDS_AFS_CREDTEXT_DIS "<p><a id=""SwitchPanel"" param=""AfsCred""><b>AFS</b></a><tab>: AFS is disabled. (click <a id=""AfsCred:Enable"">here</a> to enable)</p>"
IDS_AFS_CREDTEXT_0 "<p><a id=""SwitchPanel"" param=""AfsCred""><b>AFS</b></a><tab>: No tokens selected</p>"
IDS_AFS_CREDTEXT_1 "<p><a id=""SwitchPanel"" param=""AfsCred""><b>AFS</b></a><tab>: Token for cell %s</p>"
IDS_AFS_CREDTEXT_N "<p><a id=""SwitchPanel"" param=""AfsCred""><b>AFS</b></a><tab>: Tokens for cells %s</p>"
IDS_ATTR_CELL_SHORT_DESC "Cell"
IDS_ATTR_REALM_SHORT_DESC "Realm"
IDS_ATTR_METHOD_SHORT_DESC "Method"
IDS_ATTR_CLIENT_SHORT_DESC "Client Principal"
IDS_ATTR_CLIENT_PRINC_SHORT_DESC "Client Principal"
END
STRINGTABLE
BEGIN
IDS_ATTR_SERVER_PRINC_SHORT_DESC "Server Principal"
IDS_DEF_LOCATION "AFS Cache Manager"
IDS_PLUGIN_DESC "AFS Credentials Provider"
IDS_CFG_IDS_TAB "AFS"
IDS_CFG_ID_TAB "AFS"
IDS_CFG_MAIN_LONG "AFS Configuration"
IDS_CFG_MAIN_SHORT "AFS"
IDS_CFG_SVCSTATUS "Status is unknown,Stopped,Starting ...,Stopping ...,Running,Continuing ...,Pausing ...,Paused,Status is unknown"
IDS_NC_METHODL_AUTO "(Automatically determine method)"
IDS_NC_METHODL_KRB5 "Kerberos 5"
IDS_NC_METHODL_KRB4 "Kerberos 4"
IDS_NC_METHODL_KRB524 "Krb524"
IDS_NC_METHOD_INVALID "(Invalid method identifier)"
IDS_NC_TT_CONFLICT "Tokens for cell %s are already listed for identity %s.\nDo you want to keep the token for this cell for other identities?"
IDS_NC_TT_PROBLEM "Problem with new token"
IDS_NC_TT_CONFLICTM "Tokens for cell %s are already listed for identity %s.\nDo you want to keep the token for other identities as well as this one?"
END
STRINGTABLE
BEGIN
IDS_NC_TT_DETAILS "Details about token"
IDS_NC_TT_CONFLICTD "This token already exists under a different identity."
IDS_NC_TT_EXPIRED "Currently existing token has expired."
IDS_NC_TT_EXISTS "This token already exists for this identity."
IDS_NC_TT_NEW "This is a new token for this identity."
IDS_CFG_CANTSTART "The AFS service could not be started.\n\n"
IDS_CFG_CANTSTOP "The AFS service could not be stopped.\n\n"
IDS_ERR_CELLCONFIG "Could not locate configuration information for cell %1!S!."
IDS_ERR_NOSERVICE "The AFS service is not running. If OpenAFS is installed, you can start the service using the AFS configuration panel."
IDS_ERR_CELLCONFIG_S "The error code returned was %2!d!."
IDS_ERR_GENERAL "Tokens could not be obtained for cell %1!S!."
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

Binary file not shown.

View File

@ -0,0 +1,15 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by langres.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -0,0 +1,101 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by C:\work\pismere\athena\auth\krb5\src\windows\identity\plugins\afs\lang\en_us\langres.rc
//
#define IDS_AFS_SHORT_DESC 101
#define IDS_AFS_LONG_DESC 102
#define IDI_ICON1 102
#define IDD_NC_AFS 103
#define IDS_AFS_NAME 103
#define IDS_NCAFS_COL_CELL 104
#define IDD_CFG_IDS_TAB 104
#define IDS_NCAFS_COL_REALM 105
#define IDD_CFG_ID_TAB 105
#define IDS_NCAFS_COL_METHOD 106
#define IDD_CFG_AFS 106
#define IDS_NC_METHOD_AUTO 107
#define IDI_AFSTOKEN 107
#define IDS_NC_METHOD_KRB5 108
#define IDI_AFSPLUGIN 108
#define IDS_NC_METHOD_KRB4 109
#define IDI_NC_NEW 109
#define IDS_NC_METHOD_KRB524 110
#define IDI_NC_EXIST 110
#define IDS_NC_REALM_AUTO 111
#define IDI_NC_NOTOWNED 111
#define IDS_NC_TT_NO_CELL 112
#define IDS_NC_TT_CANT_ADD 113
#define IDS_NC_TT_MALFORMED_CELL 114
#define IDS_NC_TT_NO_REALM 115
#define IDS_NC_AUTO 116
#define IDS_NC_TT_MALFORMED_REALM 117
#define IDS_NC_TT_CANT_UPDATE 118
#define IDS_AFS_CREDTEXT_DIS 119
#define IDS_AFS_CREDTEXT_0 120
#define IDS_AFS_CREDTEXT_1 121
#define IDS_AFS_CREDTEXT_N 122
#define IDS_ATTR_CELL_SHORT_DESC 123
#define IDS_ATTR_REALM_SHORT_DESC 124
#define IDS_ATTR_METHOD_SHORT_DESC 125
#define IDS_ATTR_CLIENT_SHORT_DESC 126
#define IDS_ATTR_CLIENT_PRINC_SHORT_DESC 127
#define IDS_ATTR_SERVER_PRINC_SHORT_DESC 128
#define IDS_DEF_LOCATION 129
#define IDS_PLUGIN_DESC 130
#define IDS_CFG_IDS_TAB 131
#define IDS_CFG_ID_TAB 132
#define IDS_CFG_MAIN_LONG 133
#define IDS_CFG_MAIN_SHORT 134
#define IDS_CFG_SVCSTATUS 135
#define IDS_NC_METHODL_AUTO 136
#define IDS_NC_METHODL_KRB5 137
#define IDS_NC_METHODL_KRB4 138
#define IDS_NC_METHODL_KRB524 139
#define IDS_NC_METHOD_INVALID 140
#define IDS_NC_TT_CONFLICT 141
#define IDS_NC_TT_PROBLEM 142
#define IDS_NC_TT_CONFLICTM 143
#define IDS_NC_TT_DETAILS 144
#define IDS_NC_TT_CONFLICTD 145
#define IDS_NC_TT_EXPIRED 146
#define IDS_NC_TT_EXISTS 147
#define IDS_NC_TT_NEW 148
#define IDS_CFG_CANTSTART 149
#define IDS_CFG_CANTSTOP 150
#define IDS_ERR_CELLCONFIG 151
#define IDS_ERR_NOSERVICE 152
#define IDS_ERR_CELLCONFIG_S 153
#define IDS_ERR_GENERAL 154
#define IDC_NCAFS_OBTAIN 1001
#define IDC_NCAFS_TOKENLIST 1002
#define IDC_NCAFS_CELL 1004
#define IDC_NCAFS_REALM 1005
#define IDC_NCAFS_METHOD 1006
#define IDC_NCAFS_ADD_TOKEN 1007
#define IDC_NCAFS_DELETE_TOKEN 1008
#define IDC_CFG_SVCGRP 1009
#define IDC_CFG_LBL_STATUS 1010
#define IDC_CFG_STATUS 1011
#define IDC_CFG_LBL_VERSION 1012
#define IDC_CFG_VERSION 1013
#define IDC_CFG_STOP 1014
#define IDC_CFG_START 1015
#define IDC_CFG_CPL 1016
#define IDC_CFG_OBTAIN 1017
#define IDC_CFG_PROGRESS 1019
#define IDC_CFG_LBL_COMPANY 1020
#define IDC_CFG_COMPANY 1021
#define IDC_CFG_STARTGRP 1022
#define IDC_CHECK1 1023
#define IDC_CFG_STARTAFSCREDS 1023
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 112
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1024
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -0,0 +1,148 @@
/* Copyright (c) 2004 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* $Id$ */
/* Disable the 'macro redefinition' warning which is getting
triggerred by a redefinition of the ENCRYPT and DECRYPT macros. */
#pragma warning (push)
#pragma warning (disable: 4005)
#include<afscred.h>
#include<kmm.h>
#include<dynimport.h>
#ifdef DEBUG
#include<assert.h>
#endif
#pragma warning (pop)
kmm_module h_khModule; /* KMM's handle to this module */
HINSTANCE hInstance;
HMODULE hResModule; /* HMODULE to the resource library */
khm_handle csp_plugins = NULL;
khm_handle csp_afscred = NULL;
khm_handle csp_params = NULL;
kmm_module_locale locales[] = {
LOCALE_DEF(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US), L"afscred_en_us.dll", KMM_MLOC_FLAG_DEFAULT)
};
int n_locales = ARRAYLENGTH(locales);
/* These two probably should not do anything */
void init_afs() {
}
void exit_afs() {
}
/* called by the NetIDMgr module manager */
KHMEXP khm_int32 KHMAPI init_module(kmm_module h_module) {
khm_int32 rv = KHM_ERROR_SUCCESS;
kmm_plugin_reg pi;
wchar_t buf[256];
h_khModule = h_module;
rv = kmm_set_locale_info(h_module, locales, n_locales);
if(KHM_SUCCEEDED(rv)) {
hResModule = kmm_get_resource_hmodule(h_module);
} else {
goto _exit;
}
ZeroMemory(&pi,sizeof(pi));
pi.msg_proc = afs_plugin_cb;
pi.name = AFS_PLUGIN_NAME;
pi.type = KHM_PITYPE_CRED;
pi.icon = LoadImage(hResModule, MAKEINTRESOURCE(IDI_AFSPLUGIN), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE);
pi.dependencies = AFS_PLUGIN_DEPS;
pi.description = buf;
LoadString(hResModule, IDS_PLUGIN_DESC,
buf, ARRAYLENGTH(buf));
kmm_provide_plugin(h_module, &pi);
if(KHM_FAILED(rv = init_imports()))
goto _exit;
rv = kmm_get_plugins_config(0, &csp_plugins);
if(KHM_FAILED(rv)) goto _exit;
rv = khc_load_schema(csp_plugins, schema_afsconfig);
if(KHM_FAILED(rv)) goto _exit;
rv = khc_open_space(csp_plugins, CSNAME_AFSCRED, 0, &csp_afscred);
if(KHM_FAILED(rv)) goto _exit;
rv = khc_open_space(csp_afscred, CSNAME_PARAMS, 0, &csp_params);
if(KHM_FAILED(rv)) goto _exit;
_exit:
return rv;
}
/* called by the NetIDMgr module manager */
KHMEXP khm_int32 KHMAPI exit_module(kmm_module h_module) {
exit_imports();
if(csp_params) {
khc_close_space(csp_params);
csp_params = NULL;
}
if(csp_afscred) {
khc_close_space(csp_afscred);
csp_afscred = NULL;
}
if(csp_plugins) {
khc_unload_schema(csp_plugins, schema_afsconfig);
khc_close_space(csp_plugins);
csp_plugins = NULL;
}
return KHM_ERROR_SUCCESS; /* the return code is ignored */
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL,
DWORD fdwReason,
LPVOID lpvReserved)
{
switch(fdwReason) {
case DLL_PROCESS_ATTACH:
hInstance = hinstDLL;
init_afs();
break;
case DLL_PROCESS_DETACH:
exit_afs();
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
return TRUE;
}

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2004 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* $Id$ */
#ifndef __KHIMAIRA_KRBAFSCRED_PARAMS_H
#define __KHIMAIRA_KRBAFSCRED_PARAMS_H
#endif

View File

@ -0,0 +1,87 @@
/* Copyright (c) 2004 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
/* $Id$ */
#include<netidmgr_version.h>
#include<afsp_version.h>
#ifndef LANGVER
#define STR_FILEDESC "OpenAFS Plugin for NetIDMgr"
#define STR_INTNAME "afscred"
#define STR_ORIGNAME "afscred.dll"
#else
#ifdef LANG_en_us
#define STR_FILEDESC "English(US) language resources for OpenAFS plugin"
#define STR_INTNAME "afscred_en_us"
#define STR_ORIGNAME "afscred_en_us.dll"
#else
#error Unknown langugae
#endif
#endif
1 VERSIONINFO
FILEVERSION AFSPLUGIN_VERSION_LST
PRODUCTVERSION KH_VERSION_LIST
FILEFLAGSMASK KH_VER_FILEFLAGMASK
FILEFLAGS KH_VER_FILEFLAGS
FILEOS KH_VER_FILEOS
FILETYPE KH_VER_FILETYPEDLL
FILESUBTYPE 0
{
BLOCK "StringFileInfo"
{
BLOCK "040904b0"
{
VALUE "CompanyName", "Secure Endpoints Inc."
VALUE "FileDescription", STR_FILEDESC
VALUE "FileVersion", AFSPLUGIN_VERSION_STR
VALUE "InternalName", STR_INTNAME
VALUE "LegalCopyright", "(C) 2005 Secure Endpoints Inc."
VALUE "OriginalFilename", STR_ORIGNAME
VALUE "ProductName", "OpenAFS Plugin for NetIDMgr"
VALUE "ProductVersion", KH_VERSION_STRING
#ifndef LANGVER
VALUE NIMV_MODULE, "OpenAFS"
VALUE NIMV_PLUGINS, "AfsCred"
VALUE NIMV_APIVER, KH_VERSION_STRINGAPI
VALUE NIMV_SUPPORT, "http://www.secure-endpoints.com"
#endif
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 0x409, 1200
}
}

View File

@ -374,6 +374,9 @@ idirs: doclink
! IF (!EXIST($(OJT)\WINNT\license\lang))
$(MKDIR) $(OJT)\WINNT\license\lang
! ENDIF
! IF (!EXIST($(OJT)\WINNT\netidmgr_plugin))
$(MKDIR) $(OJT)\WINNT\netidmgr_plugin
! ENDIF
! IF (!EXIST($(OJT)\WINNT\pthread))
$(MKDIR) $(OJT)\WINNT\pthread
! ENDIF