From a16b140dc876c4f52d15ba9f49ae7263653259cd Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 26 Feb 2004 19:22:35 +0000 Subject: [PATCH] skyrope-mit-merge-hell-20040226 From Skyrope: The Skyrope work attempted to improve on the end user experience of using OpenAFS in the following ways: * Obtain tokens using renewable Kerberos 5 tickets in order to reduce the need for end users to renew expired tokens * Monitor the list of IP Addresses in order to detect changes in the network configuration which might affect the reachability of cells or the state of the AFS Client Service. When cells are newly reachable, obtain tokens for the cells. If the AFS Client Service is not running, start it. If tokens are expiring attempt to renew them. * Use KDC probes to detect the accessibility of realms/cells. If the KDC is not reachable, do not prompt the end user for a username and password. (fs probe is not implemented on windows) * Automatically obtain tokens using the Windows Logon Session Kerberos credentials (if available) * Allow tokens for multiple cells to be obtained by using the same Kerberos 5 tickets. (no UI yet implemented) * Perform drive mapping persistance by tracking it within the afsdsbmt.ini file instead of relying on the Windows Shell to persist the state. * Add new afscreds.exe command line options and change the default set used when creating the "AFS Credentials" shortcut in the Start Menu->Programs->Startup folder. From MIT: * Auto-detection of loopback adapters. Use "AFS" as the netbios name when a loopback adapter is installed. * Support for responding to power management events. Used to flush the cache when the machine is about to suspend, hibernate, or shutdown * Documentation of Registry entries * Support for Extended SMB Requests * Beginning of support for true Event Log reporting from a message database * Hidden Dot File support (configured via the HideDotFiles registry option) * Configurable Max number of Multiplexed Sessions (MaxMpxRequests registry option) * Configurable Max MTU size (RxMaxMTU registry option) * Configurable Jumbogram support (RxNoJumbo registry option) * Configurable Max number of Virtual Connections per Server (MaxVCPerServer registry option) * Win32 DNS API support * Addition of SMB_ATTR_xxxx defines for use instead of hex numbers * A variety of heap access and resource deallocation errors corrected in the SMB code * Support for recursive directory creation * Modifications to the en_US version of the client configuration dialog (need to port to other languages) Notes on the current check-in: * The KfW code will always be used when installed on the machine. This code only supports Krb5 and will not work with Krb4 only realms. A registry flag indicating whether or not KfW should be used if found needs to be added. * afscreds.exe needs to have a registry entry created to control the parameter list it should be started with. There should be a dialog to control this in the installer and within afscreds.exe * The MIT method of auto-assigning the mount-root and the netbios name is in conflict with the morgan stanley submissions in some parts of the code. If you are using the loopback adapter with this code both the "NetbiosName" = "AFS" and "Mountroot" = "/afs" registry options must be specified. This will be fixed in coming days. --- doc/txt/winnotes/registry.txt | 241 ++ src/NTMakefile | 54 +- src/README-NT | 1172 +++--- src/WINNT/afsd/NTMakefile | 83 +- src/WINNT/afsd/afsd_eventlog.c | 222 ++ src/WINNT/afsd/afsd_eventlog.h | 13 + src/WINNT/afsd/afsd_eventmessages.mc | 109 + src/WINNT/afsd/afsd_eventmessages.rc | 2 + src/WINNT/afsd/afsd_flushvol.c | 483 +++ src/WINNT/afsd/afsd_flushvol.h | 45 + src/WINNT/afsd/afsd_init.c | 221 +- src/WINNT/afsd/afsd_service.c | 222 +- src/WINNT/afsd/cm.h | 10 +- src/WINNT/afsd/cm_cell.c | 2 + src/WINNT/afsd/cm_config.c | 184 +- src/WINNT/afsd/cm_conn.c | 1 + src/WINNT/afsd/cm_vnodeops.c | 246 +- src/WINNT/afsd/fs_utils.c | 4 +- src/WINNT/afsd/fs_utils.h | 4 +- src/WINNT/afsd/lanahelper.cpp | 318 ++ src/WINNT/afsd/lanahelper.h | 21 + src/WINNT/afsd/smb.c | 510 ++- src/WINNT/afsd/smb.h | 30 +- src/WINNT/afsd/smb3.c | 694 +++- src/WINNT/afsd/smb_ioctl.c | 13 +- src/WINNT/afssvrcfg/NTMakefile | 4 +- src/WINNT/afssvrcpa/NTMakefile | 4 +- src/WINNT/client_config/NTMakefile | 46 +- src/WINNT/client_config/RegistrySupport.cpp | 132 + src/WINNT/client_config/config.cpp | 123 - src/WINNT/client_config/dlg_automap.cpp | 24 +- src/WINNT/client_config/dlg_binding.cpp | 266 ++ src/WINNT/client_config/dlg_misc.cpp | 17 +- src/WINNT/client_config/drivemap.cpp | 185 +- src/WINNT/client_config/drivemap.h | 4 + src/WINNT/client_config/getlana.cpp | 436 +++ src/WINNT/client_config/getlana.h | 24 + .../client_config/lang/en_US/afs_config.rc | 94 +- .../client_config/lang/zh_CN/afs_config.rc | 1510 ++++---- src/WINNT/client_config/resource.h | 11 +- src/WINNT/client_config/tab_advanced.cpp | 10 + src/WINNT/client_config/tab_drives.cpp | 8 + src/WINNT/client_creds/Makefile | 2 +- src/WINNT/client_creds/NTMakefile | 19 +- src/WINNT/client_creds/advtab.cpp | 8 +- src/WINNT/client_creds/afscreds.h | 3 + src/WINNT/client_creds/afskfw-int.h | 278 ++ src/WINNT/client_creds/afskfw.c | 3281 +++++++++++++++++ src/WINNT/client_creds/afskfw.h | 59 + src/WINNT/client_creds/creds.cpp | 8 +- src/WINNT/client_creds/main.cpp | 77 +- src/WINNT/client_creds/mounttab.cpp | 14 +- src/WINNT/client_creds/shortcut.cpp | 3 +- src/WINNT/client_creds/window.cpp | 44 + src/WINNT/client_exp/gui2fs.cpp | 7 +- src/WINNT/client_exp/partition_info_dlg.cpp | 7 +- src/WINNT/client_exp/shell_ext.cpp | 11 +- src/WINNT/client_exp/shell_ext.h | 2 +- src/WINNT/client_osi/NTMakefile | 3 +- src/WINNT/client_osi/largeint.h | 257 ++ src/WINNT/client_osi/libosi.def | 1 + src/WINNT/client_osi/osi.h | 2 +- src/WINNT/client_osi/osilog.c | 30 + src/WINNT/client_osi/osilog.h | 1 + src/WINNT/client_osi/osistatl.h | 2 +- src/WINNT/doc/help/en_US/afs-cc.CNT | 20 +- src/WINNT/doc/help/en_US/afs-light.CNT | 126 +- src/WINNT/doc/help/en_US/afs-nt.CNT | 154 +- src/WINNT/doc/help/en_US/taafscfg.cnt | 64 +- src/WINNT/doc/help/en_US/taafssvrmgr.cnt | 178 +- src/WINNT/doc/help/en_US/taafsusrmgr.cnt | 132 +- src/WINNT/kfw/inc/kclient/kclient.h | 48 + src/WINNT/kfw/inc/kclient/kcmacerr.h | 68 + src/WINNT/kfw/inc/krb4/com_err.h | 56 + src/WINNT/kfw/inc/krb4/conf-pc.h | 108 + src/WINNT/kfw/inc/krb4/conf.h | 74 + src/WINNT/kfw/inc/krb4/des.h | 115 + src/WINNT/kfw/inc/krb4/kadm_err.h | 56 + src/WINNT/kfw/inc/krb4/krb.h | 455 +++ src/WINNT/kfw/inc/krb4/krberr.h | 22 + src/WINNT/kfw/inc/krb4/mit_copy.h | 20 + src/WINNT/kfw/inc/krb4/osconf.h | 59 + src/WINNT/kfw/inc/krb5/KerberosIV/des.h | 209 ++ src/WINNT/kfw/inc/krb5/KerberosIV/kadm_err.h | 58 + src/WINNT/kfw/inc/krb5/KerberosIV/krb.h | 794 ++++ src/WINNT/kfw/inc/krb5/KerberosIV/krb_err.h | 278 ++ .../kfw/inc/krb5/KerberosIV/mit-copyright.h | 23 + src/WINNT/kfw/inc/krb5/com_err.h | 72 + src/WINNT/kfw/inc/krb5/gssapi/gssapi.h | 805 ++++ .../kfw/inc/krb5/gssapi/gssapi_generic.h | 55 + src/WINNT/kfw/inc/krb5/gssapi/gssapi_krb5.h | 114 + src/WINNT/kfw/inc/krb5/krb5.h | 3063 +++++++++++++++ src/WINNT/kfw/inc/krb5/profile.h | 179 + src/WINNT/kfw/inc/krb5/win-mac.h | 176 + src/WINNT/kfw/inc/krbcc/cacheapi.h | 458 +++ src/WINNT/kfw/inc/leash/leasherr.h | 32 + src/WINNT/kfw/inc/leash/leashinfo.h | 2 + src/WINNT/kfw/inc/leash/leashwin.h | 133 + src/WINNT/kfw/inc/loadfuncs/loadfuncs-afs.h | 51 + src/WINNT/kfw/inc/loadfuncs/loadfuncs-afs36.h | 51 + .../kfw/inc/loadfuncs/loadfuncs-com_err.h | 40 + src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb.h | 306 ++ src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb5.h | 1737 +++++++++ .../kfw/inc/loadfuncs/loadfuncs-krb524.h | 23 + src/WINNT/kfw/inc/loadfuncs/loadfuncs-leash.h | 373 ++ src/WINNT/kfw/inc/loadfuncs/loadfuncs-lsa.h | 45 + .../kfw/inc/loadfuncs/loadfuncs-profile.h | 147 + .../kfw/inc/loadfuncs/loadfuncs-wshelper.h | 232 ++ src/WINNT/kfw/inc/loadfuncs/loadfuncs.c | 88 + src/WINNT/kfw/inc/loadfuncs/loadfuncs.h | 41 + src/WINNT/kfw/inc/wshelper/arpa/nameser.h | 263 ++ src/WINNT/kfw/inc/wshelper/hesiod.h | 125 + src/WINNT/kfw/inc/wshelper/mitwhich.h | 156 + src/WINNT/kfw/inc/wshelper/resolv.h | 201 + src/WINNT/kfw/inc/wshelper/wshelper.h | 58 + src/WINNT/kfw/lib/i386/comerr32.lib | Bin 0 -> 2560 bytes src/WINNT/kfw/lib/i386/delaydlls.lib | Bin 0 -> 13306 bytes src/WINNT/kfw/lib/i386/getopt.lib | Bin 0 -> 5932 bytes src/WINNT/kfw/lib/i386/gssapi32.lib | Bin 0 -> 13558 bytes src/WINNT/kfw/lib/i386/kclnt32.lib | Bin 0 -> 4570 bytes src/WINNT/kfw/lib/i386/krb524.lib | Bin 0 -> 1976 bytes src/WINNT/kfw/lib/i386/krb5_32.lib | Bin 0 -> 62630 bytes src/WINNT/kfw/lib/i386/krbcc32.lib | Bin 0 -> 6844 bytes src/WINNT/kfw/lib/i386/krbv4w32.lib | Bin 0 -> 19668 bytes src/WINNT/kfw/lib/i386/leashw32.lib | Bin 0 -> 20078 bytes src/WINNT/kfw/lib/i386/loadfuncs.lib | Bin 0 -> 1646 bytes src/WINNT/kfw/lib/i386/wshelp32.lib | Bin 0 -> 6982 bytes src/WINNT/kfw/lib/i386/xpprof32.lib | Bin 0 -> 6114 bytes src/config/NTMakefile.i386_nt40 | 15 +- src/config/param.sun4_413.h | 254 +- src/libafsauthent/NTMakefile | 2 +- src/libafsrpc/afsrpc.def | 1 + src/rx/rx_clock_nt.c | 2 + src/rx/rx_user.c | 14 +- src/sys/pioctl_nt.c | 104 +- 135 files changed, 21721 insertions(+), 2735 deletions(-) create mode 100644 doc/txt/winnotes/registry.txt create mode 100644 src/WINNT/afsd/afsd_eventlog.c create mode 100644 src/WINNT/afsd/afsd_eventlog.h create mode 100644 src/WINNT/afsd/afsd_eventmessages.mc create mode 100644 src/WINNT/afsd/afsd_eventmessages.rc create mode 100644 src/WINNT/afsd/afsd_flushvol.c create mode 100644 src/WINNT/afsd/afsd_flushvol.h create mode 100644 src/WINNT/afsd/lanahelper.cpp create mode 100644 src/WINNT/afsd/lanahelper.h create mode 100644 src/WINNT/client_config/RegistrySupport.cpp create mode 100644 src/WINNT/client_config/dlg_binding.cpp create mode 100644 src/WINNT/client_config/getlana.cpp create mode 100644 src/WINNT/client_config/getlana.h create mode 100644 src/WINNT/client_creds/afskfw-int.h create mode 100644 src/WINNT/client_creds/afskfw.c create mode 100644 src/WINNT/client_creds/afskfw.h create mode 100644 src/WINNT/client_osi/largeint.h create mode 100644 src/WINNT/kfw/inc/kclient/kclient.h create mode 100644 src/WINNT/kfw/inc/kclient/kcmacerr.h create mode 100644 src/WINNT/kfw/inc/krb4/com_err.h create mode 100644 src/WINNT/kfw/inc/krb4/conf-pc.h create mode 100644 src/WINNT/kfw/inc/krb4/conf.h create mode 100644 src/WINNT/kfw/inc/krb4/des.h create mode 100644 src/WINNT/kfw/inc/krb4/kadm_err.h create mode 100644 src/WINNT/kfw/inc/krb4/krb.h create mode 100644 src/WINNT/kfw/inc/krb4/krberr.h create mode 100644 src/WINNT/kfw/inc/krb4/mit_copy.h create mode 100644 src/WINNT/kfw/inc/krb4/osconf.h create mode 100644 src/WINNT/kfw/inc/krb5/KerberosIV/des.h create mode 100644 src/WINNT/kfw/inc/krb5/KerberosIV/kadm_err.h create mode 100644 src/WINNT/kfw/inc/krb5/KerberosIV/krb.h create mode 100644 src/WINNT/kfw/inc/krb5/KerberosIV/krb_err.h create mode 100644 src/WINNT/kfw/inc/krb5/KerberosIV/mit-copyright.h create mode 100644 src/WINNT/kfw/inc/krb5/com_err.h create mode 100644 src/WINNT/kfw/inc/krb5/gssapi/gssapi.h create mode 100644 src/WINNT/kfw/inc/krb5/gssapi/gssapi_generic.h create mode 100644 src/WINNT/kfw/inc/krb5/gssapi/gssapi_krb5.h create mode 100644 src/WINNT/kfw/inc/krb5/krb5.h create mode 100644 src/WINNT/kfw/inc/krb5/profile.h create mode 100644 src/WINNT/kfw/inc/krb5/win-mac.h create mode 100644 src/WINNT/kfw/inc/krbcc/cacheapi.h create mode 100644 src/WINNT/kfw/inc/leash/leasherr.h create mode 100644 src/WINNT/kfw/inc/leash/leashinfo.h create mode 100644 src/WINNT/kfw/inc/leash/leashwin.h create mode 100644 src/WINNT/kfw/inc/loadfuncs/loadfuncs-afs.h create mode 100644 src/WINNT/kfw/inc/loadfuncs/loadfuncs-afs36.h create mode 100644 src/WINNT/kfw/inc/loadfuncs/loadfuncs-com_err.h create mode 100644 src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb.h create mode 100644 src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb5.h create mode 100644 src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb524.h create mode 100644 src/WINNT/kfw/inc/loadfuncs/loadfuncs-leash.h create mode 100644 src/WINNT/kfw/inc/loadfuncs/loadfuncs-lsa.h create mode 100644 src/WINNT/kfw/inc/loadfuncs/loadfuncs-profile.h create mode 100644 src/WINNT/kfw/inc/loadfuncs/loadfuncs-wshelper.h create mode 100644 src/WINNT/kfw/inc/loadfuncs/loadfuncs.c create mode 100644 src/WINNT/kfw/inc/loadfuncs/loadfuncs.h create mode 100644 src/WINNT/kfw/inc/wshelper/arpa/nameser.h create mode 100644 src/WINNT/kfw/inc/wshelper/hesiod.h create mode 100644 src/WINNT/kfw/inc/wshelper/mitwhich.h create mode 100644 src/WINNT/kfw/inc/wshelper/resolv.h create mode 100644 src/WINNT/kfw/inc/wshelper/wshelper.h create mode 100644 src/WINNT/kfw/lib/i386/comerr32.lib create mode 100644 src/WINNT/kfw/lib/i386/delaydlls.lib create mode 100644 src/WINNT/kfw/lib/i386/getopt.lib create mode 100644 src/WINNT/kfw/lib/i386/gssapi32.lib create mode 100644 src/WINNT/kfw/lib/i386/kclnt32.lib create mode 100644 src/WINNT/kfw/lib/i386/krb524.lib create mode 100644 src/WINNT/kfw/lib/i386/krb5_32.lib create mode 100644 src/WINNT/kfw/lib/i386/krbcc32.lib create mode 100644 src/WINNT/kfw/lib/i386/krbv4w32.lib create mode 100644 src/WINNT/kfw/lib/i386/leashw32.lib create mode 100644 src/WINNT/kfw/lib/i386/loadfuncs.lib create mode 100644 src/WINNT/kfw/lib/i386/wshelp32.lib create mode 100644 src/WINNT/kfw/lib/i386/xpprof32.lib diff --git a/doc/txt/winnotes/registry.txt b/doc/txt/winnotes/registry.txt new file mode 100644 index 000000000..da79e58b2 --- /dev/null +++ b/doc/txt/winnotes/registry.txt @@ -0,0 +1,241 @@ + +Registry keys used in the Windows AFS Client +-------------------------------------------- + +This file describes the registry keys used in the Windows AFS clients. + +1. Service parameters +--------------------- + +The service parameters primarily affect the behavior of the AFS client +service (afsd_service.exe). + +Regkey: +[HKLM\SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters] + +Value : LANadapter +Type : DWORD +Default : -1 +Variable: LANadapter + + LAN adapter number to use. This is the lana number of the LAN + adapter that the SMB server should bind to. If unspecified or set + to -1, a LAN adapter with named 'AFS' or a loopback adapter will be + selected. If neither are present, then all available adapters will + be bound to. When binding to a non-loopback adapter, the NetBIOS + name '%hostname%-AFS' will be used (where %hostname% is the NetBIOS + name of the host truncated to 11 characters). Otherwise, the NetBIOS + name will be 'AFS'. + +Value : CacheSize +Type : QWORD +Default : 20480 (CM_CONFIGDEFAULT_CACHESIZE) +Variable: cm_initParams.cacheSize + + Size of the AFS cache. + +Value : ChunkSize +Type : DWORD +Default : 15 (CM_CONFIGDEFAULT_CHUNKSIZE) +Variable: cm_logChunkSize (cm_chunkSize = 1 << cm_logChunkSize) + + Size of chunk for reading and writing. Actual chunk size is 2^cm_logChunkSize. + +Value : Daemons +Type : DWORD +Default : 2 (CM_CONFIGDEFAULT_DAEMONS) +Variable: numBkgD + + Number of background daemons (number of threads of + cm_BkgDaemon). (see cm_BkgDaemon in cm_daemon.c) + +Value : ServerThreads +Type : DWORD +Default : 4 (CM_CONFIGDEFAULT_SVTHREADS) +Variable: numSvThreads + + Number of SMB server threads (number of threads of smb_Server). (see + smb_Server in smb.c). + +Value : Stats +Type : QWORD +Default : 1000 (CM_CONFIGDEFAULT_STATS) +Variable: cm_initParams.nStatCaches + + Cache configuration. + +Value : LogoffTokenTransfer +Type : DWORD {1,0} +Default : 1 +Variable: smb_LogoffTokenTransfer + + If enabled (set to 1), activates functionality where the user's + tokens are kept intact until smb_LogofTokenTransferTimeout seconds + elapse after user logs off. If roaming profiles are used and the + roaming profile takes a long time to be written back, this ensures + that the tokens remain valid until the profile save is complete. + +Value : LogoffTokenTransferTimeout +Type : QWORD +Default : 10 +Variable: smb_LogoffTokenTransferTimeout + + See LogoffTokenTransfer above. + +Value : RootVolume +Type : REG_SZ +Default : "root.afs" +Variable: cm_rootVolumeName + + Root volume name. + +Value : Mountroot +Type : REG_SZ +Default : "/afs" +Variable: cm_mountRoot + + Name of root mount point. In symlinks, if a path starts with + cm_mountRoot, it is assumed that the path is absolute (as opposed to + relative) and is adjusted accordingly. Eg: if a path is specified as + /afs/athena.mit.edu/foo/bar/baz and cm_mountRoot is "/afs", then the + path is interpreted as \\afs\all\athena.mit.edu\foo\bar\baz. If a + path does not start with with cm_mountRoot, the path is assumed to + be relative and suffixed to the reference directory (i.e. directory + where the symlink exists) + +Value : CachePath +Type : REG_SZ +Default : "\AFSCache" +Variable: cm_CachePath + + Location of on-disk cache file. + +Value : TrapOnPanic +Type : DWORD {1,0} +Default : 0 +Variable: traceOnPanic + + Issues a breakpoint in the event of a panic. (breakpoint: _asm int 3). + +Value : IsGateway +Type : DWORD {1,0} +Default : 0 +Variable: isGateway + + Select whether or not this AFS client should act as a gateway. If + set and the NetBIOS name hostname-AFS is bound to a physical NIC, + other machines in the subnet can access AFS via SMB connections to + hostname-AFS . + +Value : ReportSessionStartups +Type : DWORD {1,0} +Default : 0 +Variable: reportSessionStartups + + If enabled, all SMB sessions created are recorded in the Application + event log. + +Value : TraceBufferSize +Type : QWORD +Default : 5000 (CM_CONFIGDEFAULT_TRACEBUFSIZE) +Variable: traceBufSize + + Number of entries to keep in trace log. + +Value : SysName +Type : REG_SZ +Default : "i386_nt40" +Variable: cm_sysName + + Self explanatory. + +Value : SecurityLevel +Type : DWORD {1,0} +Default : 0 +Variable: cryptall + + Enables encryption on RX calls. + +Value : UseDNS +Type : DWORD {1,0} +Default : 1 +Variable: cm_dnsEnabled + + Enables resolving volservers using AFSDB DNS queries. (see + afsdb-freelance-notes) + +Value : FreelanceClient +Type : DWORD {1,0} +Default : 0 +Variable: cm_freelanceEnabled + + Enables freelance client. (see afsdb-freelance-notes) + +Value : HideDotFiles +Type : DWORD {1,0} +Default : 1 +Variable: smb_hideDotFiles + + Enables marking dotfiles with the hidden attribute. Dot files are + files whose name starts with a period (excluding "." and ".."). + +Value : MaxMpxRequests +Type : DWORD +Default : 50 +Variable: smb_maxMpxRequests + + Maximum number of multiplexed SMB requests that can be made. + +Value : MaxVCPerServer +Type : DWORD +Default : 100 +Variable: smb_maxVCPerServer + + Maximum number of SMB virtual circuits. + +Value : Cell +Type : REG_SZ +Default : +Variable: rootCellName + + Name of root cell (the cell from which root.afs should be mounted in + \\afs\all). + +Value : RxNoJumbo +Type : DWORD {0,1} +Default : 0 +Variable: rx_nojumbo + + If enabled, does not send or indicate that we are able to send or + receive RX jumbograms. + +Value : RxMaxMTU +Type : DWORD +Default : -1 +Variable: rx_mtu + + If set to anything other than -1, uses that value as the maximum MTU + supported by the RX interface. + +2. Network provider parameters +------------------------------ +Affects the network provider (aklogon.dll). + +Regkey: +[HKLM\SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters] + +Value : FailLoginsSilently +Type : DWORD +Default : 0 + +Do not display message boxes if the login fails. + +Regkey: +[HKLM\SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider] + +Value : NoWarnings +Type : DWORD +Default : 0 + +Disables visible warnings during logon. + diff --git a/src/NTMakefile b/src/NTMakefile index 05af7ee0f..f224da701 100644 --- a/src/NTMakefile +++ b/src/NTMakefile @@ -537,7 +537,18 @@ client_creds: client_exp $(NTMAKE) $(CD) ..\..\.. -finale: client_creds +extra: client_creds +! IF EXIST($(SRC)\WINNT\extra) && EXIST($(SRC)\WINNT\extra\NTMakefile) + echo ***** $@ + $(DOCD) $(SRC)\WINNT\$@ + $(CD) $(SRC)\WINNT\$@ + $(NTMAKE) + $(CD) ..\..\.. +! ELSE + echo ***** Skipping $@ ***** Not found. +! ENDIF + +finale: extra echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ @@ -549,20 +560,6 @@ install: finale # InstallShield dependencies -InstallShield5: - echo ***** afs_setup_utils - $(DOCD) $(SRC)\WINNT\afs_setup_utils - $(CD) $(SRC)\WINNT\afs_setup_utils - $(NTMAKE) - $(CD) ..\..\.. - - $(DOCD) $(SRC)\WINNT\install\$@ - $(CD) $(SRC)\WINNT\install\$@ - $(NTMAKE) - $(CD) ..\..\..\.. - -media: InstallShield5 NSIS - # Clean target for obj tree clean: nmake /nologo /f ntmakefile "NTMAKE = nmake /nologo /f ntmakefile clean" "NTMAKE_HEADERS = nmake /nologo /f ntmakefile clean" "NTMAKE_OBJS = nmake /nologo /f ntmakefile clean" install @@ -586,12 +583,35 @@ mkdir: NSIS: echo ***** Making NSIS Installer - $(DOCD) $(SRC)\WINNT\install\NSIS - $(CD) $(SRC)\WINNT\install\NSIS + $(DOCD) $(SRC)\WINNT\install\$@ + $(CD) $(SRC)\WINNT\install\$@ $(NTMAKE) $(CD) ..\..\..\.. +#msi: +# echo ***** Making MSI Installer +# $(DOCD) $(SRC)\WINNT\install\$@ +# $(CD) $(SRC)\WINNT\install\$@ +# $(NTMAKE) +# $(CD) ..\..\..\.. + +InstallShield5: + echo ***** afs_setup_utils + $(DOCD) $(SRC)\WINNT\afs_setup_utils + $(CD) $(SRC)\WINNT\afs_setup_utils + $(NTMAKE) + $(CD) ..\..\.. + + $(DOCD) $(SRC)\WINNT\install\$@ + $(CD) $(SRC)\WINNT\install\$@ + $(NTMAKE) + $(CD) ..\..\..\.. + +media: install InstallShield5 NSIS + install-nsis: install NSIS +install-msi: install msi + install-is5: install InstallShield5 diff --git a/src/README-NT b/src/README-NT index 445a6e854..c802d270b 100644 --- a/src/README-NT +++ b/src/README-NT @@ -1,586 +1,586 @@ -This software has been released under the terms of the IBM Public -License. For details, see the LICENSE file in the top-level source -directory or on-line at http://www.openafs.org/dl/license10.html - -The document now provides a step by step procedure that takes the user -from a basic Windows NT/2000 workstation to an OpenAFS development -environment. Details are provided so that a 'beginning' windows -developer can build an OpenAFS installable package for Windows NT/2000. - -*********** Windows NT/2000 Build Process **************** - -Building OpenAFS for Windows requires configuring a Windows -development system by installing compilation tools and header files. -Open AFS Software development can be done on Windows NT or 2000. The -target system, where OpenAFS will be installed, should be either -Windows NT or Windows 2000. The building process is controlled by a -nmake file that generates the necessary binaries and binds them into an -install package. - -The following steps describe how to configure Windows 2000/NT: - - A. Obtain a copy of the OpenAFS Source Tree - B. Install Compiler and Development tools. - C. Set up drive mappings. - D. Install SDK header files - E. Configure Environment variables - F. Set program version Level - G. Build Win2000 binaries - H. Install InstallShield 5.x - I. Build Win2000 InstallShield Package - J. Build Win2000 InstallShield Package for the Web - K. Final Results - L. Creating a Debug Environment - M. Optional Items - N. Required patches for 1.2.2a and earlier releases - -The Software development tools with InstallShield require 900 MB -storage. - -The Software development tools (without InstallShield) require 660 MB -storage. - -The OpenAFS Source directory requires about 200 MB storage. The Source -directory size includes additional space for files that will be -generated during the build process. - -The following CDs are used in this example: - Microsoft SDK and Tools Jan 2001 - Microsoft Visual Studio Version 6.0 - InstallShield 5.5 - -Different versions of above CDs can be used; however, building an -install package for Windows NT/2000 requires InstallShield -version 5.0 to 5.5 (version 6.0 or better will not work). - -You can build all the necessary binaries without the InstallShield -software. InstallShield is only needed to build an install package. - -STEP A. Obtain a copy of the Open AFS Source Tree. - -Transfer OpenAFS source tree onto your hardrive. The source can be -downloaded from the OpenAFS web site: - http://www.OpenAFS.org/release/snapindex.html. - -For this example, download source for version 1.2.2a using the -following URL: -http://www.openafs.org/dl/openafs/1.2.2a/openafs-1.2.2a-src.tar - -HINT: DailySnapShots are pre-release source trees and much more -likely to have compilation errors. If this is your first attempt, do -your build based on a release version of the source, e.g. 1.2.2.a. Once -you have completed a build process successfully, you can experiment with -other source trees. - -You will need an unzip utility that can expand compressed tar files. -For example "Pkzip for Windows" from Pkware will uncompress tar files. -(http://www.pkware.com/) - -Expand the downloaded tar file (openafs-1.2.2a-src.tar) into target -directory (c:\OpenAFS), the unzip routine will expand the source into a -subdirectory tree: - c:\OpenAFS\OpenAFS-1.2.2a\src - -Copy files NTMAKEFILE from 'src' to the AFS base directory: - -From a DOS command prompt window, enter the following copy commands: - -copy c:\OpenAFS\OpenAFS-1.2.2a\src\NTMAKEFILE c:\OpenAFS\OpenAFS-1.2.2a\. - -The AFS base directory should look something like the following: - -c:\OpenAFS\OpenAFS-1.2.2a\ - NTMakefile - src - -STEP B. Install compiler and development tools. - -Install a copy of Microsoft Visual C++ 5.0 or 6.0. The "Typical" install -setting is sufficient. - -(1) You can reduce the installation size by selecting "Custom" install -and remove all but the following Options: - - Microsoft Visual C++ - Data Access - -(2) When asked, Select to Register Environment Variables. - -(3) After rebooting you have to choice to install additional software -packages. It is not necessary to install these packages. - -STEP C. Map development drive letters. - -The following documentation will assume you are mapping the Y: drive to -the OpenAFS source directory and you are mapping X: drive to your -development tools directory. Other configurations will work, including -not mapping any drives, as long as the path assignments are consistent -and you don't exceed the maximum environment variable length. - -Y: drive mapping provides a consistent directory location to build from. -Building OpenAFS will require you to open up a command DOS prompt, -navigate to drive Y: and execute the nmake file. The source is based -from Y: drive and the generated files are based from Y:\DEST. If the OpenAFS -source tree is at a different location, you only need to re-map the -Y: drive. - -X: drive mapping shortens the length of several Environment variables -by mapping it to a directory where Visual Studio is installed. Although -this step is not important when using Windows NT or 2000 as a -development OS, it does reduce the chance of typing errors during -the configuration phase. - -From a DOS command window enter the following commands: - -SUBST y: c:\OpenAFS\OpenAFS-1.2.2a -SUBST x: "c:\Program Files\Microsoft Visual Studio\VC98" - -SUBST is persistent across DOS command prompts; that is, if you open up -another DOS command prompt the mapped drives are still defined. -However, if you reboot the mapped drives using SUBST will be lost. - -If you need to remove Y: drive mapping, execute the following command -from a DOS command prompt window: - -SUBST y: /d - -STEP D. Install SDK header files. - -Files from Microsoft's Platform SDK for NT or 98 are required to -complete a build on NT/2000. - -The header files that are required are found from a Microsoft SDK are: - - netspi.h - npapi.h - -These files come from Microsoft DDKs/SDKs as follows: - - January 1997 Windows NT Workstation DDK - /ddk/frc/network/inc/npapi.h - November 2001 Microsoft Platform SDK - install "samples" from "Core SDK" - samples/winbase/security/winnt/logonnp/npapi.h - July 1998 Windows 95 DDK - net/inc/netmpr.h and net/inc/netspi.h - July 1999 Windows 98 DDK - src/net/inc/netmpr.h and src/net/inc/netspi.h - - you need to install "Legacy and Related - driver samples" - -To Install Platform SDK from CDROM - - Run "setup.exe default.htm" from CDROM: - Select Microsoft Core SDK - Select Sample and Source - Select installation path x:\SDK - -To Install Windows SDK from WEB: - http://www.microsoft.com/sdk - -STEP E. Configure the OpenAFS build environment. - -The following environment variables should be set: - -SET AFSDEV_LIB=%LIB% -SET AFSROOT=Y: -SET SYS_NAME=i386_nt40 -SET _WIN32_IE=0x400 -SET MSSDK=X:\Sdk -SET MSTOOLS=X:\Sdk -SET MSVCDIR=X: -SET AFSDEV_BIN=X:\BIN -SET AFSDEV_BUILDTYPE=FREE -SET AFSDEV_INCLUDE=X:\Sdk\samples\winbase\security\winnt\logonNP;X:\Sdk\Include\ATL30;X:\Sdk\Include;%INCLUDE% - -Please do not include unnecessary spaces in AFSDEV_INLCUDE. - -Create a batch file (SETAFS.BAT) to make these settings that can be -executed when you bring up a DOS command prompt window. Environment -variables are not persistent, if you close the DOS command window -or reboot, the environment variables are lost and they must be -recreated when you open a new DOS command prompt window. - -HINT: SET AFSDEV_BUILDTYPE=CHECKED if you want debug information -included in your binaries. - -HINT: Adding drive mapping commands to the batch file makes it easy to -establish your development environment even if you logoff. I suggest -adding the following lines to the beginning of the batch file: - -SUBST y: /d -SUBST x: /d -SUBST y: c:\OpenAfs\OpenAFS-1.2.2a -SUBST x: "c:\Program Files\Microsoft Visual Studio\VC98" - -HINT: Windows 2000/NT provides an alternate way to set environment -variables in System Proprieties. These can be accessed from the system -control panel, advanced tab, Environment Variables. These are -persistent and will be reset every time a DOS command prompt window is -opened. - -STEP F. Set version and installation options - -Add a CellServDB file to install area. CellServDB contains the entries -for the various cell names. You can download a general purpose one -from: - http://grand.central.org/dl/cellservdb/CellServDB -then copy it to Y:\DEST\Wininstall\Config\CellServDB.GrandCentral - -Note: Create directory Y:\DEST\Wininstall\Config\ if it doesn't exist. - -Edit file Y:\src\config\NTMakefile.i386_nt40 - AFSPRODUCT_VERSION - Product version - CELLSERVDB_INSTALL - The default file name for the CellServDB - included in the install Package. - CELLNAME_DEFAULT - The default home cell name. - CELLSERVDB_WEB - The default web address to obtain CellServDB - -For example: in the file Y:\src\config\NTMakefile.i386_nt40 you would -see the following: - - AFSPRODUCT_VERSION=1.2.2a - CELLNAME_DEFAULT=home.cell.com - CELLSERVDB_INSTALL=CellServDB.GrandCentral - CELLSERVDB_WEB=http://grand.central.org/dl/cellservdb/CellServDB - -During the Open AFS installation process the user will be presented -with two choices for the CellServDB: Local copy (CELLSERVDB_INSTALL) and -one that can be downloaded from the web (CELLSERVDB_WEB). - -HINT: The product version number (AFSPRODUCT_VERSION) can be changed to -create a new version number. For example if you have added source -changes to OpenAFS-1.2.2a and you wanted to create a new version level, -you may want to use the following: AFSPRODUCT_VERSION=1.2.2b - -STEP G. Begin the build - -(1) From Windows 2000 open up a DOS prompt window. - -(2) Clean the work area. - - nmake /f NTMakefile clean - -(3) Build the complete Windows NT/2000 development environment. - - nmake /f NTMakefile install - -While the build is running you will see many compile warnings. This -behavior is normal; the build process is successful as long as the build -process doesn't terminate with an error ("nmake.exe return code 0x2") -and it displays 'Build Finished Successfully'. - -STEP H. Install InstallShield (optional). - -In order to build an install package for OpenAFS, InstallShield 5.5 -must be installed along with InstallShield East and West -multi-Language packs. - -(1) Install InstallShield (version between 5.0 and 5.5) - -For minimum installation choose "compact". - -(2) Install West Language Pack (5.5) - -(3) Install East Language Pack (5.5) - -NOTE: InstallShield's versions 6 and higher WILL NOT WORK for -Windows NT/2000 build process. - -(4) Add necessary DLL's to work with the InstallShield package. - -Two Microsoft DLL's are missing from the InstallShield package. These -DLL's must be copied to Y:\DEST\WinInstall\Config\: - SHLWAPI.DLL - WININET.DLL - -These files are only used during the installation, and they will not -be left on the target machine. They can be located at -%SystemRoot%\SYSTEM32. - -From a DOS command prompt window enter the following commands: - -copy %systemRoot%\System32\SHLWAPI.DLL y:\dest\wininstall\config\. -copy %systemRoot%\System32\WININET.DLL y:\dest\wininstall\config\. - -(5) Add two Environment variables to the bottom of the batch file, -SETAFS.BAT (see STEP E:). - -SET IS5ROOT="C:\Program Files\InstallShield\InstallShield 5.5 Professional Edition" -SET AFSDEV_INCLUDE=%AFSDEV_INCLUDE%;%IS5ROOT%\Include - -STEP I. Build Win2000 InstallShield package - -From the DOS command prompt window run: - - Y: - nmake /f NTMakefile media - -While the build is running you will see a few compile warnings. This -behavior is normal; the build process is successful as long as the build -process doesn't terminate with an error ("nmake.exe return code 0x2") -and it displays 'Install Script Finished Successfully'. - -STEP J. Build Win2000 InstallShield package for the Web - -InstallShield's PackageForTheWeb combines the installation files into a -single application file that will expand on execution and lead you -through the OpenAFS installation. - -Install PackageForTheWeb 3 from InstallShield - -Add Environment variables to the bottom of the batch file, SETAFS.BAT -(see STEP E:). - -SET ISWEB="C:\Program Files\InstallShield\PackageForTheWeb 3" - -From the DOS command prompt window run: - - Y: - nmake /f NTMakefile media - -While the build is running you will see a few compile warnings. This -behavior is normal; the build process is successful as long as the build -process doesn't terminate with an error ("nmake.exe return code 0x2") and -it displays 'Install Script Finished Successfully'. - -HINT: It is only necessary to run "nmake /f NTMakefile media" once, by -combining steps I & J. - -STEP K. Final Results - -The build process generates its binaries in Y:\DEST. The subdirectory -would look like the following: - -Y:\DEST - bin - etc - include - lib - root.client - root.server - WinInstall - -Y:\DEST\Bin - contains build utilities. -Y:\DEST\root.client - contains Open AFS binaries -Y:\DEST\root.server - contain Open AFS Server binaries -Y:\DEST\WinInstall\PackageWeb\AFSforWindows.exe - is the Web install -package for Open AFS. -Y:\DEST\WinInstall\ - are the install package files for Open AFS - -Step L. Creating a Debug Environment - -Instructions on building a debugging environment from Visual Studio C++ -workspace. This example give the user a way to step through the source -code for AFSCREDS.EXE. - -These instructions are to be followed after you have set up the -development environment. - -The following steps must be done before you can build a debug -environment: - -1. Set up the development environment as described above -2. set AFS_BUILDTYPE=CHECKED to get debug information. -3. You must use environment variables in System Properties -4. Do a complete build. - -To set the the environment variables in the System Properties: -1. Select the 'System' icon in the control Panel -2. Select the 'Advanced' tab -3. Select the 'Environment Variables' button -4. In the user area set all variables as you did above that -were used in the setafs.bat file. - -To build a new work space to debug afs_creds.exe: - -1. Create New Workspace - -Select from Microsoft Visual C++ toolbar file New -Select from 'new' Project Tab Makefile Project name: Creds -Location Y:\src\winnt\client_creds -Select OK - -From Dialog Box 'Makefile - Step 1 of 2' -command line= nmake /f"ntmakefile" install -Output = y:\dest\root.client\usr\vice\etc\AFSCREDS.EXE -Select NEXT - -Dialog Box 'Makefile - Step 2 of 2' -Command line= nmake /f"ntmakefile" install -Output = y:\dest\root.client\usr\vice\etc\AFSCREDS.EXE - -Select Finish - -Switch to FileView -Right click on 'Source Files' and select 'Add Files to folder', select -all *.cpp files. - -Right click on 'Header Files' and select 'Add Files to folder', select -all *.h files. - -Right click on 'creds files' and select 'New Folder' -Fill name in 'Build' - -From the toolbar select Build -Select 'Build All' - -You should see the following string when the compile is finished: -"afs_creds.exe - 0 errors(0), 0 warnings(s)" - -Press to execute afs_creds.exe. - -STEP M. Optional Items - -The build process has an error table that is compiled for many OpenAFS -applications. This table is generated by Unix based tools. It is not -normally necessary to modify this table so pre-generated source files -are included in the OpenAFS source. If you need to make modifications -in these areas the Unix base tools that run on Windows can be found on -the web. For example: - - http://cygwin.com/ - -Below is a short explanation how to update the error table. - -(1) Install flex and bison from a Unix based tool provider. - -(2) Make changes to the source files. - -There are two files in the source tree that are processed with lex -and yacc on UNIX systems, src/comerr/et_lex.lex.l and -src/comerr/error_table.y, that when processed produce the files -et_lex.lex_nt.c, error_table_nt.c, and error_table_nt.h. - -Since NT does not include lex and yacc or any equivalent tools, we -have provided the output files that lex and yacc produce (using Win32 -ports of flex and bison). This will allow builds to work for anyone -who does not need to change the .l and .y files. - -If you do need to change et_lex.lex.l, then you will need to install -Win32 port of flex on your system. Put flex.exe in a directory on the -path and rebuild. - -If you do need to change error_table.y, then you will need to install -a Win32 port of bison on your system. Put bison.exe in a directory on -the path, configure bison as explained in step 5, and rebuild. - -You can also attempt to use other replacements for lex and yacc. This -will require modifying the LEX and YACC settings in -/config/NTMakefile.i386_nt40. If the replacements require different -command line options than flex and bison, then you may also need to -change src/comerr/NTMakefile. - -(3) Generate new OpenAFS binaries - - -STEP N. Required patches for 1.2.2a and earlier releases - -There are two set of patches must be applied to 1.2.2a source to -successfully build the binaries: - -(1) Patches applied to 1.2.2a to build binaries, excluding install -package. - -diff -Nur --exclude-from=exclude bas/src/NTMakefile upd/src/NTMakefile ---- bas/src/NTMakefile Wed Nov 14 19:38:06 2001 -+++ upd/src/NTMakefile Mon Dec 3 14:41:12 2001 -@@ -471,6 +471,7 @@ - $(CD) $(OBJ)\$@ - $(NTMAKE) - $(CD) ..\.. -+ echo Build Finished Successfully - - install: start finale - -@@ -487,6 +488,7 @@ - $(CD) ..\..\..\.. - - media: InstallShield5 -+ echo Install Script Finished Successfully - - -(2) Patches applied to 1.2.2a to build install package. - -diff -Nur --exclude-from=exclude bas/src/WINNT/afsd/NTMakefile upd/src/WINNT/afsd/NTMakefile ---- bas/src/WINNT/afsd/NTMakefile Tue Nov 20 22:45:40 2001 -+++ upd/src/WINNT/afsd/NTMakefile Wed Dec 5 11:42:46 2001 -@@ -169,8 +169,8 @@ - $(EXEDIR)\tokens.exe \ - $(EXEDIR)\unlog.exe $(EXEDIR)\afsd.exe $(EXEDIR)\afsd_service.exe \ - $(EXEDIR)\fs.exe $(EXEDIR)\symlink.exe \ -- $(LOGON_DLLFILE) $(LOG95_DLLFILE) \ -- $(EXEDIR)\afsshare.exe \ -+ $(LOGON_DLLFILE) \ -+ $(EXEDIR)\afsshare.exe \ - $(DESTDIR)\bin\kpasswd.exe - - install9X: install_headers $(CONF_DLLFILE) \ - -diff -Nur --exclude-from=exclude bas/src/WINNT/install/InstallShield5/NTMakefile upd/src/WINNT/install/InstallShield5/NTMakefile ---- bas/src/WINNT/install/InstallShield5/NTMakefile Wed Nov 14 19:38:50 2001 -+++ upd/src/WINNT/install/InstallShield5/NTMakefile Mon Dec 3 16:43:08 2001 -@@ -60,7 +60,7 @@ - $(MKDIR) $(DESTDIR)\Wininstall\PackageWeb - ! ENDIF - $(DEL) /q $(DESTDIR)\Wininstall\PackageWeb\*.* -- $(ISWEB)\Pftwwiz.exe $(AFSROOT)\src\winnt\install\InstallShield5\PackageWeb.pfw -s -a -+ "$(ISWEB)\Pftwwiz.exe" $(AFSROOT)\src\winnt\install\InstallShield5\PackageWeb.pfw -s -a - !ENDIF - xcopy /s/e/y "Media\OpenAFS\Disk Images\disk1\*.*" $(DESTDIR)\WinInstall - copy AFS_component_version_number.txt $(DESTDIR)\WinInstall\Version.txt -diff -Nur --exclude-from=exclude bas/src/WINNT/afs_setup_utils/_isuser/_IsUser.RC upd/src/WINNT/afs_setup_utils/_isuser/_IsUser.RC ---- bas/src/WINNT/afs_setup_utils/_isuser/_IsUser.RC Thu Sep 6 20:54:58 2001 -+++ upd/src/WINNT/afs_setup_utils/_isuser/_IsUser.RC Mon Dec 3 15:11:46 2001 -@@ -10,7 +10,7 @@ - #define APSTUDIO_HIDDEN_SYMBOLS - #include "windows.h" - #undef APSTUDIO_HIDDEN_SYMBOLS --#include <.\sdrc.h> -+#include - - ///////////////////////////////////////////////////////////////////////////// - #undef APSTUDIO_READONLY_SYMBOLS -diff -Nur --exclude-from=exclude bas/src/WINNT/afs_setup_utils/_isuser/_IsUser.dep upd/src/WINNT/afs_setup_utils/_isuser/_IsUser.dep ---- bas/src/WINNT/afs_setup_utils/_isuser/_IsUser.dep Thu Sep 6 20:54:58 2001 -+++ upd/src/WINNT/afs_setup_utils/_isuser/_IsUser.dep Wed Dec 31 16:00:00 1969 -@@ -1,5 +0,0 @@ --# Microsoft Developer Studio Generated Dependency File, included by _IsUser.mak -- --.\_Isuser.RC : \ -- ".\sdrc.h"\ -- -diff -Nur --exclude-from=exclude bas/src/WINNT/afs_setup_utils/_isuser/ntmakefile upd/src/WINNT/afs_setup_utils/_isuser/ntmakefile ---- bas/src/WINNT/afs_setup_utils/_isuser/ntmakefile Mon Sep 10 09:39:50 2001 -+++ upd/src/WINNT/afs_setup_utils/_isuser/ntmakefile Mon Dec 3 15:16:04 2001 -@@ -30,14 +30,6 @@ - "$(OUTDIR)" :: - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - --HEADERS = ".\sdrc.h" -- --".\sdrc.h" : $(IS5ROOT)\INCLUDE\sdrc.h -- $(COPY) $(IS5ROOT)\INCLUDE\sdrc.h . --! IF EXIST($(IS5ROOT)\Script\ISRT\Include\sdrc.h) -- $(COPY) $(IS5ROOT)\Script\ISRT\Include\sdrc.h . --! ENDIF -- - CPP=cl.exe - CPP_PROJ=/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ISUSER_EXPORTS" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -@@ -85,20 +77,10 @@ - "$(INTDIR)\_isuser.obj" \ - "$(INTDIR)\_Isuser.res" - --"$(OUTDIR)\_IsUser.dll" : "$(OUTDIR)" $(HEADERS) $(DEF_FILE) $(LINK32_OBJS) -+"$(OUTDIR)\_IsUser.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) - << -- -- --!IF "$(NO_EXTERNAL_DEPS)" != "1" --!IF EXISTS("_IsUser.dep") --!INCLUDE "_IsUser.dep" --!ELSE --!MESSAGE Warning: cannot find "_IsUser.dep" --!ENDIF --!ENDIF -- - - SOURCE=.\_isuser.c +This software has been released under the terms of the IBM Public +License. For details, see the LICENSE file in the top-level source +directory or on-line at http://www.openafs.org/dl/license10.html + +The document now provides a step by step procedure that takes the user +from a basic Windows NT/2000 workstation to an OpenAFS development +environment. Details are provided so that a 'beginning' windows +developer can build an OpenAFS installable package for Windows NT/2000. + +*********** Windows NT/2000 Build Process **************** + +Building OpenAFS for Windows requires configuring a Windows +development system by installing compilation tools and header files. +Open AFS Software development can be done on Windows NT or 2000. The +target system, where OpenAFS will be installed, should be either +Windows NT or Windows 2000. The building process is controlled by a +nmake file that generates the necessary binaries and binds them into an +install package. + +The following steps describe how to configure Windows 2000/NT: + + A. Obtain a copy of the OpenAFS Source Tree + B. Install Compiler and Development tools. + C. Set up drive mappings. + D. Install SDK header files + E. Configure Environment variables + F. Set program version Level + G. Build Win2000 binaries + H. Install InstallShield 5.x + I. Build Win2000 InstallShield Package + J. Build Win2000 InstallShield Package for the Web + K. Final Results + L. Creating a Debug Environment + M. Optional Items + N. Required patches for 1.2.2a and earlier releases + +The Software development tools with InstallShield require 900 MB +storage. + +The Software development tools (without InstallShield) require 660 MB +storage. + +The OpenAFS Source directory requires about 200 MB storage. The Source +directory size includes additional space for files that will be +generated during the build process. + +The following CDs are used in this example: + Microsoft SDK and Tools Jan 2001 + Microsoft Visual Studio Version 6.0 + InstallShield 5.5 + +Different versions of above CDs can be used; however, building an +install package for Windows NT/2000 requires InstallShield +version 5.0 to 5.5 (version 6.0 or better will not work). + +You can build all the necessary binaries without the InstallShield +software. InstallShield is only needed to build an install package. + +STEP A. Obtain a copy of the Open AFS Source Tree. + +Transfer OpenAFS source tree onto your hardrive. The source can be +downloaded from the OpenAFS web site: + http://www.OpenAFS.org/release/snapindex.html. + +For this example, download source for version 1.2.2a using the +following URL: +http://www.openafs.org/dl/openafs/1.2.2a/openafs-1.2.2a-src.tar + +HINT: DailySnapShots are pre-release source trees and much more +likely to have compilation errors. If this is your first attempt, do +your build based on a release version of the source, e.g. 1.2.2.a. Once +you have completed a build process successfully, you can experiment with +other source trees. + +You will need an unzip utility that can expand compressed tar files. +For example "Pkzip for Windows" from Pkware will uncompress tar files. +(http://www.pkware.com/) + +Expand the downloaded tar file (openafs-1.2.2a-src.tar) into target +directory (c:\OpenAFS), the unzip routine will expand the source into a +subdirectory tree: + c:\OpenAFS\OpenAFS-1.2.2a\src + +Copy files NTMAKEFILE from 'src' to the AFS base directory: + +From a DOS command prompt window, enter the following copy commands: + +copy c:\OpenAFS\OpenAFS-1.2.2a\src\NTMAKEFILE c:\OpenAFS\OpenAFS-1.2.2a\. + +The AFS base directory should look something like the following: + +c:\OpenAFS\OpenAFS-1.2.2a\ + NTMakefile + src + +STEP B. Install compiler and development tools. + +Install a copy of Microsoft Visual C++ 5.0 or 6.0. The "Typical" install +setting is sufficient. + +(1) You can reduce the installation size by selecting "Custom" install +and remove all but the following Options: + + Microsoft Visual C++ + Data Access + +(2) When asked, Select to Register Environment Variables. + +(3) After rebooting you have to choice to install additional software +packages. It is not necessary to install these packages. + +STEP C. Map development drive letters. + +The following documentation will assume you are mapping the Y: drive to +the OpenAFS source directory and you are mapping X: drive to your +development tools directory. Other configurations will work, including +not mapping any drives, as long as the path assignments are consistent +and you don't exceed the maximum environment variable length. + +Y: drive mapping provides a consistent directory location to build from. +Building OpenAFS will require you to open up a command DOS prompt, +navigate to drive Y: and execute the nmake file. The source is based +from Y: drive and the generated files are based from Y:\DEST. If the OpenAFS +source tree is at a different location, you only need to re-map the +Y: drive. + +X: drive mapping shortens the length of several Environment variables +by mapping it to a directory where Visual Studio is installed. Although +this step is not important when using Windows NT or 2000 as a +development OS, it does reduce the chance of typing errors during +the configuration phase. + +From a DOS command window enter the following commands: + +SUBST y: c:\OpenAFS\OpenAFS-1.2.2a +SUBST x: "c:\Program Files\Microsoft Visual Studio\VC98" + +SUBST is persistent across DOS command prompts; that is, if you open up +another DOS command prompt the mapped drives are still defined. +However, if you reboot the mapped drives using SUBST will be lost. + +If you need to remove Y: drive mapping, execute the following command +from a DOS command prompt window: + +SUBST y: /d + +STEP D. Install SDK header files. + +Files from Microsoft's Platform SDK for NT or 98 are required to +complete a build on NT/2000. + +The header files that are required are found from a Microsoft SDK are: + + netspi.h + npapi.h + +These files come from Microsoft DDKs/SDKs as follows: + + January 1997 Windows NT Workstation DDK - /ddk/frc/network/inc/npapi.h + November 2001 Microsoft Platform SDK - install "samples" from "Core SDK" + samples/winbase/security/winnt/logonnp/npapi.h + July 1998 Windows 95 DDK - net/inc/netmpr.h and net/inc/netspi.h + July 1999 Windows 98 DDK - src/net/inc/netmpr.h and src/net/inc/netspi.h + - you need to install "Legacy and Related + driver samples" + +To Install Platform SDK from CDROM + + Run "setup.exe default.htm" from CDROM: + Select Microsoft Core SDK + Select Sample and Source + Select installation path x:\SDK + +To Install Windows SDK from WEB: + http://www.microsoft.com/sdk + +STEP E. Configure the OpenAFS build environment. + +The following environment variables should be set: + +SET AFSDEV_LIB=%LIB% +SET AFSROOT=Y: +SET SYS_NAME=i386_nt40 +SET _WIN32_IE=0x400 +SET MSSDK=X:\Sdk +SET MSTOOLS=X:\Sdk +SET MSVCDIR=X: +SET AFSDEV_BIN=X:\BIN +SET AFSDEV_BUILDTYPE=FREE +SET AFSDEV_INCLUDE=X:\Sdk\samples\winbase\security\winnt\logonNP;X:\Sdk\Include\ATL30;X:\Sdk\Include;%INCLUDE% + +Please do not include unnecessary spaces in AFSDEV_INLCUDE. + +Create a batch file (SETAFS.BAT) to make these settings that can be +executed when you bring up a DOS command prompt window. Environment +variables are not persistent, if you close the DOS command window +or reboot, the environment variables are lost and they must be +recreated when you open a new DOS command prompt window. + +HINT: SET AFSDEV_BUILDTYPE=CHECKED if you want debug information +included in your binaries. + +HINT: Adding drive mapping commands to the batch file makes it easy to +establish your development environment even if you logoff. I suggest +adding the following lines to the beginning of the batch file: + +SUBST y: /d +SUBST x: /d +SUBST y: c:\OpenAfs\OpenAFS-1.2.2a +SUBST x: "c:\Program Files\Microsoft Visual Studio\VC98" + +HINT: Windows 2000/NT provides an alternate way to set environment +variables in System Proprieties. These can be accessed from the system +control panel, advanced tab, Environment Variables. These are +persistent and will be reset every time a DOS command prompt window is +opened. + +STEP F. Set version and installation options + +Add a CellServDB file to install area. CellServDB contains the entries +for the various cell names. You can download a general purpose one +from: + http://grand.central.org/dl/cellservdb/CellServDB +then copy it to Y:\DEST\Wininstall\Config\CellServDB.GrandCentral + +Note: Create directory Y:\DEST\Wininstall\Config\ if it doesn't exist. + +Edit file Y:\src\config\NTMakefile.i386_nt40 + AFSPRODUCT_VERSION - Product version + CELLSERVDB_INSTALL - The default file name for the CellServDB + included in the install Package. + CELLNAME_DEFAULT - The default home cell name. + CELLSERVDB_WEB - The default web address to obtain CellServDB + +For example: in the file Y:\src\config\NTMakefile.i386_nt40 you would +see the following: + + AFSPRODUCT_VERSION=1.2.2a + CELLNAME_DEFAULT=home.cell.com + CELLSERVDB_INSTALL=CellServDB.GrandCentral + CELLSERVDB_WEB=http://grand.central.org/dl/cellservdb/CellServDB + +During the Open AFS installation process the user will be presented +with two choices for the CellServDB: Local copy (CELLSERVDB_INSTALL) and +one that can be downloaded from the web (CELLSERVDB_WEB). + +HINT: The product version number (AFSPRODUCT_VERSION) can be changed to +create a new version number. For example if you have added source +changes to OpenAFS-1.2.2a and you wanted to create a new version level, +you may want to use the following: AFSPRODUCT_VERSION=1.2.2b + +STEP G. Begin the build + +(1) From Windows 2000 open up a DOS prompt window. + +(2) Clean the work area. + + nmake /f NTMakefile clean + +(3) Build the complete Windows NT/2000 development environment. + + nmake /f NTMakefile install + +While the build is running you will see many compile warnings. This +behavior is normal; the build process is successful as long as the build +process doesn't terminate with an error ("nmake.exe return code 0x2") +and it displays 'Build Finished Successfully'. + +STEP H. Install InstallShield (optional). + +In order to build an install package for OpenAFS, InstallShield 5.5 +must be installed along with InstallShield East and West +multi-Language packs. + +(1) Install InstallShield (version between 5.0 and 5.5) + +For minimum installation choose "compact". + +(2) Install West Language Pack (5.5) + +(3) Install East Language Pack (5.5) + +NOTE: InstallShield's versions 6 and higher WILL NOT WORK for +Windows NT/2000 build process. + +(4) Add necessary DLL's to work with the InstallShield package. + +Two Microsoft DLL's are missing from the InstallShield package. These +DLL's must be copied to Y:\DEST\WinInstall\Config\: + SHLWAPI.DLL + WININET.DLL + +These files are only used during the installation, and they will not +be left on the target machine. They can be located at +%SystemRoot%\SYSTEM32. + +From a DOS command prompt window enter the following commands: + +copy %systemRoot%\System32\SHLWAPI.DLL y:\dest\wininstall\config\. +copy %systemRoot%\System32\WININET.DLL y:\dest\wininstall\config\. + +(5) Add two Environment variables to the bottom of the batch file, +SETAFS.BAT (see STEP E:). + +SET IS5ROOT="C:\Program Files\InstallShield\InstallShield 5.5 Professional Edition" +SET AFSDEV_INCLUDE=%AFSDEV_INCLUDE%;%IS5ROOT%\Include + +STEP I. Build Win2000 InstallShield package + +From the DOS command prompt window run: + + Y: + nmake /f NTMakefile media + +While the build is running you will see a few compile warnings. This +behavior is normal; the build process is successful as long as the build +process doesn't terminate with an error ("nmake.exe return code 0x2") +and it displays 'Install Script Finished Successfully'. + +STEP J. Build Win2000 InstallShield package for the Web + +InstallShield's PackageForTheWeb combines the installation files into a +single application file that will expand on execution and lead you +through the OpenAFS installation. + +Install PackageForTheWeb 3 from InstallShield + +Add Environment variables to the bottom of the batch file, SETAFS.BAT +(see STEP E:). + +SET ISWEB="C:\Program Files\InstallShield\PackageForTheWeb 3" + +From the DOS command prompt window run: + + Y: + nmake /f NTMakefile media + +While the build is running you will see a few compile warnings. This +behavior is normal; the build process is successful as long as the build +process doesn't terminate with an error ("nmake.exe return code 0x2") and +it displays 'Install Script Finished Successfully'. + +HINT: It is only necessary to run "nmake /f NTMakefile media" once, by +combining steps I & J. + +STEP K. Final Results + +The build process generates its binaries in Y:\DEST. The subdirectory +would look like the following: + +Y:\DEST + bin + etc + include + lib + root.client + root.server + WinInstall + +Y:\DEST\Bin - contains build utilities. +Y:\DEST\root.client - contains Open AFS binaries +Y:\DEST\root.server - contain Open AFS Server binaries +Y:\DEST\WinInstall\PackageWeb\AFSforWindows.exe - is the Web install +package for Open AFS. +Y:\DEST\WinInstall\ - are the install package files for Open AFS + +Step L. Creating a Debug Environment + +Instructions on building a debugging environment from Visual Studio C++ +workspace. This example give the user a way to step through the source +code for AFSCREDS.EXE. + +These instructions are to be followed after you have set up the +development environment. + +The following steps must be done before you can build a debug +environment: + +1. Set up the development environment as described above +2. set AFS_BUILDTYPE=CHECKED to get debug information. +3. You must use environment variables in System Properties +4. Do a complete build. + +To set the the environment variables in the System Properties: +1. Select the 'System' icon in the control Panel +2. Select the 'Advanced' tab +3. Select the 'Environment Variables' button +4. In the user area set all variables as you did above that +were used in the setafs.bat file. + +To build a new work space to debug afs_creds.exe: + +1. Create New Workspace - +Select from Microsoft Visual C++ toolbar file New +Select from 'new' Project Tab Makefile Project name: Creds +Location Y:\src\winnt\client_creds +Select OK + +From Dialog Box 'Makefile - Step 1 of 2' +command line= nmake /f"ntmakefile" install +Output = y:\dest\root.client\usr\vice\etc\AFSCREDS.EXE +Select NEXT + +Dialog Box 'Makefile - Step 2 of 2' +Command line= nmake /f"ntmakefile" install +Output = y:\dest\root.client\usr\vice\etc\AFSCREDS.EXE + +Select Finish + +Switch to FileView +Right click on 'Source Files' and select 'Add Files to folder', select +all *.cpp files. + +Right click on 'Header Files' and select 'Add Files to folder', select +all *.h files. + +Right click on 'creds files' and select 'New Folder' +Fill name in 'Build' + +From the toolbar select Build +Select 'Build All' + +You should see the following string when the compile is finished: +"afs_creds.exe - 0 errors(0), 0 warnings(s)" + +Press to execute afs_creds.exe. + +STEP M. Optional Items + +The build process has an error table that is compiled for many OpenAFS +applications. This table is generated by Unix based tools. It is not +normally necessary to modify this table so pre-generated source files +are included in the OpenAFS source. If you need to make modifications +in these areas the Unix base tools that run on Windows can be found on +the web. For example: + + http://cygwin.com/ + +Below is a short explanation how to update the error table. + +(1) Install flex and bison from a Unix based tool provider. + +(2) Make changes to the source files. + +There are two files in the source tree that are processed with lex +and yacc on UNIX systems, src/comerr/et_lex.lex.l and +src/comerr/error_table.y, that when processed produce the files +et_lex.lex_nt.c, error_table_nt.c, and error_table_nt.h. + +Since NT does not include lex and yacc or any equivalent tools, we +have provided the output files that lex and yacc produce (using Win32 +ports of flex and bison). This will allow builds to work for anyone +who does not need to change the .l and .y files. + +If you do need to change et_lex.lex.l, then you will need to install +Win32 port of flex on your system. Put flex.exe in a directory on the +path and rebuild. + +If you do need to change error_table.y, then you will need to install +a Win32 port of bison on your system. Put bison.exe in a directory on +the path, configure bison as explained in step 5, and rebuild. + +You can also attempt to use other replacements for lex and yacc. This +will require modifying the LEX and YACC settings in +/config/NTMakefile.i386_nt40. If the replacements require different +command line options than flex and bison, then you may also need to +change src/comerr/NTMakefile. + +(3) Generate new OpenAFS binaries + + +STEP N. Required patches for 1.2.2a and earlier releases + +There are two set of patches must be applied to 1.2.2a source to +successfully build the binaries: + +(1) Patches applied to 1.2.2a to build binaries, excluding install +package. + +diff -Nur --exclude-from=exclude bas/src/NTMakefile upd/src/NTMakefile +--- bas/src/NTMakefile Wed Nov 14 19:38:06 2001 ++++ upd/src/NTMakefile Mon Dec 3 14:41:12 2001 +@@ -471,6 +471,7 @@ + $(CD) $(OBJ)\$@ + $(NTMAKE) + $(CD) ..\.. ++ echo Build Finished Successfully + + install: start finale + +@@ -487,6 +488,7 @@ + $(CD) ..\..\..\.. + + media: InstallShield5 ++ echo Install Script Finished Successfully + + +(2) Patches applied to 1.2.2a to build install package. + +diff -Nur --exclude-from=exclude bas/src/WINNT/afsd/NTMakefile upd/src/WINNT/afsd/NTMakefile +--- bas/src/WINNT/afsd/NTMakefile Tue Nov 20 22:45:40 2001 ++++ upd/src/WINNT/afsd/NTMakefile Wed Dec 5 11:42:46 2001 +@@ -169,8 +169,8 @@ + $(EXEDIR)\tokens.exe \ + $(EXEDIR)\unlog.exe $(EXEDIR)\afsd.exe $(EXEDIR)\afsd_service.exe \ + $(EXEDIR)\fs.exe $(EXEDIR)\symlink.exe \ +- $(LOGON_DLLFILE) $(LOG95_DLLFILE) \ +- $(EXEDIR)\afsshare.exe \ ++ $(LOGON_DLLFILE) \ ++ $(EXEDIR)\afsshare.exe \ + $(DESTDIR)\bin\kpasswd.exe + + install9X: install_headers $(CONF_DLLFILE) \ + +diff -Nur --exclude-from=exclude bas/src/WINNT/install/InstallShield5/NTMakefile upd/src/WINNT/install/InstallShield5/NTMakefile +--- bas/src/WINNT/install/InstallShield5/NTMakefile Wed Nov 14 19:38:50 2001 ++++ upd/src/WINNT/install/InstallShield5/NTMakefile Mon Dec 3 16:43:08 2001 +@@ -60,7 +60,7 @@ + $(MKDIR) $(DESTDIR)\Wininstall\PackageWeb + ! ENDIF + $(DEL) /q $(DESTDIR)\Wininstall\PackageWeb\*.* +- $(ISWEB)\Pftwwiz.exe $(AFSROOT)\src\winnt\install\InstallShield5\PackageWeb.pfw -s -a ++ "$(ISWEB)\Pftwwiz.exe" $(AFSROOT)\src\winnt\install\InstallShield5\PackageWeb.pfw -s -a + !ENDIF + xcopy /s/e/y "Media\OpenAFS\Disk Images\disk1\*.*" $(DESTDIR)\WinInstall + copy AFS_component_version_number.txt $(DESTDIR)\WinInstall\Version.txt +diff -Nur --exclude-from=exclude bas/src/WINNT/afs_setup_utils/_isuser/_IsUser.RC upd/src/WINNT/afs_setup_utils/_isuser/_IsUser.RC +--- bas/src/WINNT/afs_setup_utils/_isuser/_IsUser.RC Thu Sep 6 20:54:58 2001 ++++ upd/src/WINNT/afs_setup_utils/_isuser/_IsUser.RC Mon Dec 3 15:11:46 2001 +@@ -10,7 +10,7 @@ + #define APSTUDIO_HIDDEN_SYMBOLS + #include "windows.h" + #undef APSTUDIO_HIDDEN_SYMBOLS +-#include <.\sdrc.h> ++#include + + ///////////////////////////////////////////////////////////////////////////// + #undef APSTUDIO_READONLY_SYMBOLS +diff -Nur --exclude-from=exclude bas/src/WINNT/afs_setup_utils/_isuser/_IsUser.dep upd/src/WINNT/afs_setup_utils/_isuser/_IsUser.dep +--- bas/src/WINNT/afs_setup_utils/_isuser/_IsUser.dep Thu Sep 6 20:54:58 2001 ++++ upd/src/WINNT/afs_setup_utils/_isuser/_IsUser.dep Wed Dec 31 16:00:00 1969 +@@ -1,5 +0,0 @@ +-# Microsoft Developer Studio Generated Dependency File, included by _IsUser.mak +- +-.\_Isuser.RC : \ +- ".\sdrc.h"\ +- +diff -Nur --exclude-from=exclude bas/src/WINNT/afs_setup_utils/_isuser/ntmakefile upd/src/WINNT/afs_setup_utils/_isuser/ntmakefile +--- bas/src/WINNT/afs_setup_utils/_isuser/ntmakefile Mon Sep 10 09:39:50 2001 ++++ upd/src/WINNT/afs_setup_utils/_isuser/ntmakefile Mon Dec 3 15:16:04 2001 +@@ -30,14 +30,6 @@ + "$(OUTDIR)" :: + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +-HEADERS = ".\sdrc.h" +- +-".\sdrc.h" : $(IS5ROOT)\INCLUDE\sdrc.h +- $(COPY) $(IS5ROOT)\INCLUDE\sdrc.h . +-! IF EXIST($(IS5ROOT)\Script\ISRT\Include\sdrc.h) +- $(COPY) $(IS5ROOT)\Script\ISRT\Include\sdrc.h . +-! ENDIF +- + CPP=cl.exe + CPP_PROJ=/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ISUSER_EXPORTS" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +@@ -85,20 +77,10 @@ + "$(INTDIR)\_isuser.obj" \ + "$(INTDIR)\_Isuser.res" + +-"$(OUTDIR)\_IsUser.dll" : "$(OUTDIR)" $(HEADERS) $(DEF_FILE) $(LINK32_OBJS) ++"$(OUTDIR)\_IsUser.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) + << +- +- +-!IF "$(NO_EXTERNAL_DEPS)" != "1" +-!IF EXISTS("_IsUser.dep") +-!INCLUDE "_IsUser.dep" +-!ELSE +-!MESSAGE Warning: cannot find "_IsUser.dep" +-!ENDIF +-!ENDIF +- + + SOURCE=.\_isuser.c diff --git a/src/WINNT/afsd/NTMakefile b/src/WINNT/afsd/NTMakefile index 9ac219fb3..adec9bef9 100644 --- a/src/WINNT/afsd/NTMakefile +++ b/src/WINNT/afsd/NTMakefile @@ -5,6 +5,7 @@ # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html +AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) /D"_AFXDLL" AFSDEV_NETGUI = 1 RELDIR=WINNT\afsd !INCLUDE ..\..\config\NTMakefile.$(SYS_NAME) @@ -17,6 +18,8 @@ EXEDIR = $(DESTDIR)\root.client\usr\vice\etc INCFILEDIR = $(DESTDIR)\include\afs # header file install directory +# afsdicon and below added for WINNT\extra support + INCFILES =\ $(INCFILEDIR)\afsd.h \ $(INCFILEDIR)\cm.h \ @@ -43,10 +46,27 @@ INCFILES =\ !IFDEF OSICRASH $(INCFILEDIR)\afsdcrash.h \ !ENDIF - $(INCFILEDIR)\cm_dns_private.h + $(INCFILEDIR)\cm_dns_private.h \ + $(INCFILEDIR)\lanahelper.h \ + $(INCFILEDIR)\afsdicon.h \ + $(INCFILEDIR)\cm_callback.h \ + $(INCFILEDIR)\cm_aclent.h \ + $(INCFILEDIR)\cm_volume.h \ + $(INCFILEDIR)\cm_dcache.h \ + $(INCFILEDIR)\cm_access.h \ + $(INCFILEDIR)\cm_vnodeops.h \ + $(INCFILEDIR)\cm_dir.h \ + $(INCFILEDIR)\cm_utils.h \ + $(INCFILEDIR)\cm_daemon.h \ + $(INCFILEDIR)\cm_ioctl.h \ + $(INCFILEDIR)\cm_dnlc.h \ + $(INCFILEDIR)\cm_buf.h \ + $(INCFILEDIR)\cm_freelance.h \ + $(INCFILEDIR)\afsd_eventlog.h \ + $(INCFILEDIR)\afsd_eventmessages.h IDLFILES =\ - afsrpc.h $(OUT)\afsrpc_c.c + afsrpc.h $(OUT)\afsrpc_c.obj CONFOBJS=$(OUT)\cm_config.obj \ $(OUT)\cm_dns.obj @@ -94,10 +114,15 @@ AFSDOBJS=\ !IFDEF OSICRASH $(OUT)\afsdcrash.obj \ !ENDIF - $(OUT)\cm_freelance.obj + $(OUT)\cm_freelance.obj \ + $(OUT)\lanahelper.obj \ + $(OUT)\afsd_eventlog.obj \ + $(OUT)\afsd_flushvol.obj + +$(AFSDOBJS): $(OUT)\cm_conn.obj: cm_conn.c - $(C2OBJ) -DAFS_PTHREAD_ENV $** + $(C2OBJ) -DAFS_PTHREAD_ENV /Fo$@ $** FSOBJS=$(OUT)\fs.obj $(OUT)\fs_utils.obj @@ -105,6 +130,12 @@ SLOBJS=$(OUT)\symlink.obj $(OUT)\fs_utils.obj ILIBDIR = $(DESTDIR)\lib +# +# Rules for message compiler info for logging events +# +$(INCFILEDIR)\afsd_eventmessages.h: afsd_eventmessages.mc + mc afsd_eventmessages.mc + ############################################################################ # # Flags for linking LOGON DLL'S @@ -136,6 +167,7 @@ MIDL_FLAGS=/app_config \ CONF_DLLFILE = $(DESTDIR)\root.client\usr\vice\etc\libafsconf.dll CONF_DLLLIBS = \ + dnsapi.lib \ $(DESTDIR)\lib\afs\afsutil.lib \ $(DESTDIR)\lib\afs\afsreg.lib @@ -155,6 +187,7 @@ LOGON_DLLOBJS =\ $(OUT)\afslogon.res LOGON_DLLLIBS =\ + dnsapi.lib \ $(DESTDIR)\lib\afsauthent.lib \ $(DESTDIR)\lib\libafsconf.lib @@ -174,6 +207,7 @@ LOG95_DLLOBJS =\ $(OUT)\afslog95.res LOG95_DLLLIBS =\ + dnsapi.lib \ $(DESTDIR)\lib\afsauthent.lib \ $(DESTDIR)\lib\libafsconf.lib @@ -225,6 +259,7 @@ install_libutils: install_headers $(CONF_DLLFILE) \ # assorted exe's EXELIBS = \ + dnsapi.lib \ $(DESTDIR)\lib\afs\afsauth.lib \ $(DESTDIR)\lib\afs\afskauth.lib \ $(DESTDIR)\lib\afs\afsprot.lib \ @@ -263,9 +298,11 @@ AFSD_EXEFILE = $(EXEDIR)\afsd.exe AFSD_EXELIBS =\ largeint.lib \ netapi32.lib \ - mpr.lib \ + mpr.lib \ + dnsapi.lib \ $(DESTDIR)\lib\libosi.lib \ $(DESTDIR)\lib\afsrpc.lib \ + $(DESTDIR)\lib\afsrx.lib \ $(DESTDIR)\lib\afsauthent.lib \ $(DESTDIR)\lib\afs\mtafsvldb.lib \ $(DESTDIR)\lib\afs\mtafsint.lib \ @@ -282,7 +319,7 @@ $(AFSD_EXEFILE): $(OUT)\afsd.obj $(AFSDOBJS) $(OUT)\afsd.res $(RXOBJS) # afsd_service.exe $(EXEDIR)\afsd_service.exe: $(OUT)\afsd_service.obj $(AFSDOBJS) $(OUT)\afsd_service.res $(RXOBJS) - $(EXECONLINK) $(AFSD_EXELIBS) + $(EXECONLINK) $(AFSD_EXELIBS) /NODEFAULTLIB:libc.lib /MAP $(EXEPREP) # fs.exe @@ -318,18 +355,22 @@ KPASSWD_OBJS =\ KPASSWD_LIBS =\ $(DESTDIR)\lib\afsauthent.lib \ $(DESTDIR)\lib\afsrpc.lib \ + $(DESTDIR)\lib\afsrx.lib \ $(DESTDIR)\lib\afs\afscmd.lib \ $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afs\afsutil.lib $(OUT)\kpasswd.obj: $(KAUTH)/kpasswd.c - $(C2OBJ) -DAFS_PTHREAD_ENV $** + $(C2OBJ) -DAFS_PTHREAD_ENV /Fo$@ $** $(OUT)\kkids.obj: $(KAUTH)/kkids.c - $(C2OBJ) -DAFS_PTHREAD_ENV $** + $(C2OBJ) -DAFS_PTHREAD_ENV /Fo$@ $** $(OUT)\kautils.obj: $(KAUTH)/kautils.c - $(C2OBJ) -DAFS_PTHREAD_ENV $** + $(C2OBJ) -DAFS_PTHREAD_ENV /Fo$@ $** + +$(OUT)\kpasswd.res: $(KAUTH)\kpasswd.rc + $(RC) /Fo$@ $** $(DESTDIR)\bin\kpasswd.exe: $(KPASSWD_OBJS) $(KPASSWD_LIBS) $(DEL) $(DESTDIR)\bin\kpasswd.exe @@ -340,30 +381,34 @@ $(DESTDIR)\bin\kpasswd.exe: $(KPASSWD_OBJS) $(KPASSWD_LIBS) ############################################################################ # generate versioninfo resources -$(OUT)\afsshare.res: AFS_component_version_number.h +$(OUT)\afsshare.res: afsshare.rc AFS_component_version_number.h -$(OUT)\fs.res: AFS_component_version_number.h +$(OUT)\fs.res: fs.rc AFS_component_version_number.h -$(OUT)\symlink.res: AFS_component_version_number.h +$(OUT)\symlink.res: symlink.rc AFS_component_version_number.h -$(OUT)\klog.res: AFS_component_version_number.h +$(OUT)\klog.res: klog.rc AFS_component_version_number.h -$(OUT)\tokens.res: AFS_component_version_number.h +$(OUT)\tokens.res: tokens.rc AFS_component_version_number.h -$(OUT)\unlog.res: AFS_component_version_number.h +$(OUT)\unlog.res: unlog.rc AFS_component_version_number.h -$(OUT)\afsd_service.res: AFS_component_version_number.h +afsd_eventmessages.rc: afsd_eventmessages.h -$(OUT)\afslogon.res: AFS_component_version_number.h +$(OUT)\afsd_service.res: afsd_service.rc afsd_eventmessages.rc AFS_component_version_number.h -$(OUT)\afslog95.res: AFS_component_version_number.h +$(OUT)\afslogon.res: afslogon.rc AFS_component_version_number.h -$(OUT)\libafsconf.res: AFS_component_version_number.h +$(OUT)\afslog95.res: afslog95.rc AFS_component_version_number.h +$(OUT)\libafsconf.res: libafsconf.rc AFS_component_version_number.h + +############################################################################ clean:: $(DEL) $(OUT)\*.res $(DEL) afsrpc.h $(DEL) afsrpc_?.* + $(DEL) afsd_eventmessages.h $(DEL) $(CONF_DLLFILE) $(DEL) $(LOGON_DLLFILE) $(DEL) $(LOG95_DLLFILE) diff --git a/src/WINNT/afsd/afsd_eventlog.c b/src/WINNT/afsd/afsd_eventlog.c new file mode 100644 index 000000000..10ecffd02 --- /dev/null +++ b/src/WINNT/afsd/afsd_eventlog.c @@ -0,0 +1,222 @@ +//////////////////////////////////////////////////////////////////// +// +// +// E V E N T L O G G I N G F U N C T I O N S +// +// +//////////////////////////////////////////////////////////////////// + + +#include +#include +#include +#include "afsd_eventlog.h" + +#define SZSERVICEPATH "System\\CurrentControlSet\\Services\\" +#define SZSERVICENAME "TransarcAFSDaemon" + +static CHAR szKeyName[] = "System\\CurrentControlSet\\Services\\EventLog\\Application\\TransarcAFSDaemon"; + +static BOOL GetServicePath(LPTSTR lpPathBuf, PDWORD pdwPathBufSize); +static BOOL AddEventSource(void); + +static BOOL +GetServicePath(LPTSTR lpPathBuf, PDWORD pdwPathBufSize) +{ + HKEY hKey = NULL; + UCHAR szBuf[MAX_PATH]; + DWORD dwData = 0; + BOOL bRet = TRUE; + + do { + // Prepare path in Registry + memset(szBuf, '\0', MAX_PATH); + strcpy(szBuf, SZSERVICEPATH); + strcat(szBuf, "TransarcAFSDaemon"); + + // Open key + if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, szBuf, 0, KEY_QUERY_VALUE, &hKey ) ) + { + bRet = FALSE; + break; + } + + // prepare user's buffer and read into it + dwData = *pdwPathBufSize; + memset(lpPathBuf, '\0', dwData); + if ( RegQueryValueEx( + hKey, // handle to key + "ImagePath", // value name + NULL, // reserved + NULL, // type buffer + (LPBYTE) lpPathBuf, // data buffer + &dwData)) // size of data buffer + { + bRet = FALSE; + break; + } + + *pdwPathBufSize = dwData; + + } while (0); + + if (hKey != NULL) + RegCloseKey(hKey); + + return bRet; +} + +// +// Ensure name for message file is in proper location in Registry. +// +static BOOL +AddEventSource() +{ + HKEY hKey = NULL; + UCHAR szBuf[MAX_PATH]; + DWORD dwData, dwDisposition; + BOOL bRet = TRUE; + + do { + // Let's see if key already exists as a subkey under the + // Application key in the EventLog registry key. If not, + // create it. + if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, szKeyName, 0, + KEY_QUERY_VALUE, &hKey ) ) + { + // nope - create it + if ( RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKeyName, 0, + NULL, REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, NULL, &hKey, + &dwDisposition)) + { + bRet = FALSE; + break; + } + + // Set the name of the message file + // Get "ImagePath" from TransarcAFSDaemon service + memset(szBuf, '\0', MAX_PATH); + dwData = MAX_PATH; + GetServicePath(szBuf, &dwData); + + // Add the name to the EventMessageFile subkey. + if ( RegSetValueEx( + hKey, // subkey handle + "EventMessageFile", // value name + 0, // must be zero + REG_EXPAND_SZ, // value type + (LPBYTE) szBuf, // pointer to value data + strlen(szBuf) + 1)) // length of value data + { + bRet = FALSE; + break; + } + + // Set the supported event types in the TypesSupported subkey. + dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | + EVENTLOG_INFORMATION_TYPE; + + if ( RegSetValueEx( + hKey, // subkey handle + "TypesSupported", // value name + 0, // must be zero + REG_DWORD, // value type + (LPBYTE) &dwData, // pointer to value data + sizeof(DWORD))) // length of value data + { + bRet = FALSE; + break; + } + } + + else + { + // key was opened - read it + memset(szBuf, '\0', MAX_PATH); + dwData = MAX_PATH; + if ( RegQueryValueEx( + hKey, // handle to key + "EventMessageFile", // value name + NULL, // reserved + NULL, // type buffer + (LPBYTE) szBuf, // data buffer + &dwData)) // size of data buffer + { + bRet = FALSE; + break; + } + } + + } while (0); + + if (hKey != NULL) + RegCloseKey(hKey); + + return bRet; +} + +// Log an event with a formatted system message as the (only) substitution +// string, from the given message ID. +VOID +LogEventMessage(WORD wEventType, DWORD dwEventID, DWORD dwMessageID) +{ + LPTSTR msgBuf; + + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_ALLOCATE_BUFFER, + NULL, dwMessageID, 0, (LPTSTR)&msgBuf, 0, NULL); + LogEvent(wEventType, dwEventID, msgBuf, NULL); + LocalFree(msgBuf); +} + +// +// Use the ReportEvent API to write an entry to the system event log. +// +#define MAXSTRINGARGS 100 +VOID +LogEvent(WORD wEventType, DWORD dwEventID, LPTSTR lpString, ...) +{ + va_list listStrings; + HANDLE hEventSource; + LPTSTR lpStrings[MAXSTRINGARGS]; + WORD wNumStrings; + + // Ensure that our event source is properly initialized. + if (!AddEventSource()) + return; + + // Get a handle to the event log. + hEventSource = RegisterEventSource(NULL, SZSERVICENAME); + if (hEventSource == NULL) + return; + + // Construct the array of substitution strings. + va_start(listStrings, lpString); + for (wNumStrings = 0; + lpString != NULL && wNumStrings < MAXSTRINGARGS; + wNumStrings++) + { + lpStrings[wNumStrings] = lpString; + // Advance to the next argument. + lpString = va_arg(listStrings, LPTSTR); + } + va_end(listStrings); + + // Make sure we were not given too many args. + if (wNumStrings >= MAXSTRINGARGS) + return; + + // Log the event. + ReportEvent(hEventSource, // handle of event source + wEventType, // event type + 0, // event category + dwEventID, // event ID + NULL, // current user's SID + wNumStrings, // strings in lpszStrings + 0, // no bytes of raw data + lpStrings, // array of error strings + NULL); // no raw data + + DeregisterEventSource(hEventSource); +} diff --git a/src/WINNT/afsd/afsd_eventlog.h b/src/WINNT/afsd/afsd_eventlog.h new file mode 100644 index 000000000..614d2d85b --- /dev/null +++ b/src/WINNT/afsd/afsd_eventlog.h @@ -0,0 +1,13 @@ +// This header contains needed definitions and declarations for afsd's +// event logging functions. + +#ifndef __AFSD_EVENTLOG_H_ +#define __AFSD_EVENTLOG_H_ 1 + +// Include the event log message definitions. +#include "afsd_eventmessages.h" + +VOID LogEventMessage(WORD wEventType, DWORD dwEventID, DWORD dwMessageID); +VOID LogEvent(WORD wEventType, DWORD dwEventID, LPTSTR lpString, ...); + +#endif /* __AFSD_EVENTLOG_H_ */ diff --git a/src/WINNT/afsd/afsd_eventmessages.mc b/src/WINNT/afsd/afsd_eventmessages.mc new file mode 100644 index 000000000..37f86ac9b --- /dev/null +++ b/src/WINNT/afsd/afsd_eventmessages.mc @@ -0,0 +1,109 @@ +;// +;// afsd_eventmessages.mc +;// +;// This file contains the message definitions for the +;// TransarcAFSDaemon service to facilitate system event logging. +;// +;// +; +;#ifndef __AFSD_EVENTMESSAGES_H_ +;#define __AFSD_EVENTMESSAGES_H_ 1 + +MessageIdTypedef=DWORD + +SeverityNames=(Success=0x0:STATUS_SEVERITY_SUCCESS + Informational=0x1:STATUS_SEVERITY_INFORMATIONAL + Warning=0x2:STATUS_SEVERITY_WARNING + Error=0x3:STATUS_SEVERITY_ERROR + ) + +FacilityNames=(System=0x0:FACILITY_SYSTEM + Runtime=0x2:FACILITY_RUNTIME + Stubs=0x3:FACILITY_STUBS + Io=0x4:FACILITY_IO_ERROR_CODE + ) + +LanguageNames=(English=0x409:MSG00409) + +MessageId=0x1 +Severity=Informational +Facility=System +SymbolicName=MSG_TIME_FLUSH_PER_VOLUME +Language=English +Elapsed time to flush AFS volume <%1> = %2 milliseconds. +. + +MessageId= +Severity=Informational +Facility=System +SymbolicName=MSG_TIME_FLUSH_TOTAL +Language=English +Total elapsed time to flush %1 AFS volume(s) = %2 milliseconds. +. + +MessageId= +Severity=Error +Facility=System +SymbolicName=MSG_FLUSH_NO_SHARE_NAME +Language=English +Cannot get AFS share name to flush volumes. +. + +MessageId= +Severity=Error +Facility=System +SymbolicName=MSG_FLUSH_BAD_SHARE_NAME +Language=English +Invalid share name %1; cannot flush volumes. +. + +MessageId= +Severity=Error +Facility=System +SymbolicName=MSG_FLUSH_NO_MEMORY +Language=English +Insufficient memory to flush volumes. +. + +MessageId= +Severity=Error +Facility=System +SymbolicName=MSG_FLUSH_OPEN_ENUM_ERROR +Language=English +Cannot open enumeration of network resources: %1 +. + +MessageId= +Severity=Error +Facility=System +SymbolicName=MSG_FLUSH_ENUM_ERROR +Language=English +Cannot enumerate network resources: %1 +. + +MessageId= +Severity=Warning +Facility=System +SymbolicName=MSG_FLUSH_FAILED +Language=English +Failed to flush volume %1. +. + +MessageId= +Severity=Error +Facility=System +SymbolicName=MSG_FLUSH_IMPERSONATE_ERROR +Language=English +Failed to impersonate logged-on user. +. + +MessageId= +Severity=Warning +Facility=System +SymbolicName=MSG_FLUSH_UNEXPECTED_EVENT +Language=English +Flush volumes thread received unrecognized event. +. + + +;#endif /* __AFSD_EVENTMESSAGES_H_ 1 */ diff --git a/src/WINNT/afsd/afsd_eventmessages.rc b/src/WINNT/afsd/afsd_eventmessages.rc new file mode 100644 index 000000000..6f3b1e6ba --- /dev/null +++ b/src/WINNT/afsd/afsd_eventmessages.rc @@ -0,0 +1,2 @@ +LANGUAGE 0x9,0x1 +1 11 MSG00409.bin diff --git a/src/WINNT/afsd/afsd_flushvol.c b/src/WINNT/afsd/afsd_flushvol.c new file mode 100644 index 000000000..d3abfbdeb --- /dev/null +++ b/src/WINNT/afsd/afsd_flushvol.c @@ -0,0 +1,483 @@ +// +// AFSD_FLUSHVOL.C +// +// Routines to handle flushing AFS volumes in response to +// System Power event notification such as Hibernate request. +// +///////////////////////////////////////////////////////////////////// + +#include +#include + +#include + +#include +#include +#include "afsd.h" +#include "afsd_init.h" +#include "smb.h" +#include +#include +#include + +#include + +#include + +#include "afsd_flushvol.h" +#include "afsd_eventlog.h" + +static FLUSHVOLTHREADINFO gThreadInfo = {0}; +static HANDLE gThreadHandle = NULL; + + +///////////////////////////////////////////////////////////////////// +// +// Call routine found in FS.EXE to flush volume. +// +// At entry, input param is UNC string for volume, +// e.g. '\\afs\all\athena.mit.edu\user\m\h\mholiday' +// +// I believe that success from 'pioctl' routine +// indicated by return value of zero (0). +// +afs_int32 +afsd_ServicePerformFlushVolumeCmd(char *data) +{ + register afs_int32 code; + struct ViceIoctl blob; + + memset(&blob, '\0', sizeof(blob)); + code = pioctl(data, VIOC_FLUSHVOLUME, &blob, 0); + + return code; +} + +BOOL +afsd_ServicePerformFlushVolumes() +{ + CONST CHAR COLON = ':'; + CONST CHAR SLASH = '\\'; + CONST DWORD NETRESBUFSIZE = 16384; + CHAR bufMessage[1024]; + UINT i; + DWORD dwServerSize; + DWORD dwRet; + DWORD dwCount; + DWORD dwNetResBufSize; + DWORD dwTotalVols = 0; + DWORD dwVolBegin, dwVolEnd; + DWORD dwFlushBegin, dwFlushEnd; + HANDLE hEnum; + LPNETRESOURCE lpNetResBuf, lpnr; + PCHAR pszShareName, pc; + afs_int32 afsRet = 0; + + // Determine the root share name (\\AFS\ALL or \\-AFS\ALL), + // and the length of the server name prefix. + pszShareName = smb_GetSharename(); + if (pszShareName == NULL) + { + LogEvent(EVENTLOG_ERROR_TYPE, MSG_FLUSH_NO_SHARE_NAME, NULL); + return FALSE; + } + pc = strrchr(pszShareName, SLASH); + if ((pc == NULL) || ((dwServerSize = pc - pszShareName) < 3)) + { + LogEvent(EVENTLOG_ERROR_TYPE, MSG_FLUSH_BAD_SHARE_NAME, + pszShareName, NULL); + free(pszShareName); + return FALSE; + } + + // Allocate a buffer to hold network resources returned by + // WNetEnumResource(). + lpNetResBuf = malloc(NETRESBUFSIZE); + if (lpNetResBuf == NULL) + { + // Out of memory, give up now. + LogEvent(EVENTLOG_ERROR_TYPE, MSG_FLUSH_NO_MEMORY, NULL); + free(pszShareName); + return FALSE; + } + + // Initialize the flush timer. Note that GetTickCount() returns + // the number of milliseconds since the system started, in a DWORD, + // so that the value wraps around every 49.7 days. We do not bother + // to handle the case where the flush elapsed time is greater than + // that. + dwFlushBegin = GetTickCount(); + + dwRet = WNetOpenEnum(RESOURCE_CONNECTED, RESOURCETYPE_ANY, 0, NULL, + &hEnum); + if (dwRet != NO_ERROR) + { + LogEventMessage(EVENTLOG_ERROR_TYPE, MSG_FLUSH_OPEN_ENUM_ERROR, + dwRet); + free(pszShareName); + return FALSE; + } + + // Loop to enumerate network resources, and flush those associated + // with AFS volumes. + while (1) + { + dwCount = -1; + memset(lpNetResBuf, 0, NETRESBUFSIZE); + dwNetResBufSize = NETRESBUFSIZE; + dwRet = WNetEnumResource(hEnum, &dwCount, + lpNetResBuf, &dwNetResBufSize); + if (dwRet != NO_ERROR) + break; + // Iterate over the returned network resources. + for (i = 0, lpnr = lpNetResBuf; i < dwCount; i++, lpnr++) + { + // Ensure resource has a remote name, and is connected. + if ((lpnr->lpRemoteName == NULL) || + (lpnr->dwScope != RESOURCE_CONNECTED)) + continue; + if ((_strnicmp(lpnr->lpRemoteName, pszShareName, + dwServerSize) == 0) && + (lpnr->lpRemoteName[dwServerSize] == SLASH)) + { + // got one! + // but we don't want to flush '\\[...]afs\all' + if (_stricmp(lpnr->lpRemoteName, + pszShareName) == 0) + continue; + ++dwTotalVols; + + dwVolBegin = GetTickCount(); + afsRet = afsd_ServicePerformFlushVolumeCmd(lpnr->lpRemoteName); + dwVolEnd = GetTickCount(); + if (afsRet == 0) + { + LogTimingEvent(MSG_TIME_FLUSH_PER_VOLUME, + lpnr->lpRemoteName, + dwVolEnd - dwVolBegin); + } + else + { + LogEvent(EVENTLOG_WARNING_TYPE, + MSG_FLUSH_FAILED, + lpnr->lpRemoteName, NULL); + } + } + } + } + WNetCloseEnum(hEnum); + free(lpNetResBuf); + free(pszShareName); + if (dwRet != ERROR_NO_MORE_ITEMS) + { + LogEventMessage(EVENTLOG_ERROR_TYPE, MSG_FLUSH_ENUM_ERROR, + dwRet); + return FALSE; + } + + dwFlushEnd = GetTickCount(); + + // display total volume count in Event Logger + sprintf(bufMessage, "%d", dwTotalVols); + LogTimingEvent(MSG_TIME_FLUSH_TOTAL, bufMessage, + dwFlushEnd - dwFlushBegin); + + return TRUE; +} + +// Report a timing event to the system event log. +// The lpszString1 argument is the first substitution string for the +// given event ID. The time argument will be converted into the +// second substitution string. +static VOID +LogTimingEvent(DWORD dwEventID, LPTSTR lpString1, DWORD dwTime) +{ + CHAR szTime[16]; + + sprintf(szTime, "%lu", dwTime); + LogEvent(EVENTLOG_INFORMATION_TYPE, dwEventID, lpString1, szTime, + NULL); +} + + +///////////////////////////////////////////////////////////////////// +// +// GetUserToken +// +// Obtain token for the currently logged-in user. +// +// This routine looks for a window which we 'know' belongs to +// the shell, and from there we follow a route which leads to +// getting a handle on an access token owned by the shell. +// +// The return value is either a handle to a suitable token, +// or else null. +// +// One of the times that this function might return null +// is when there is no logged-in user. Other cases include +// insufficient access to the desktop, etc. +// +// Disclaimer: +// Portions of this routine found in various newsgroups +// +HANDLE GetUserToken(DWORD access) +{ + HANDLE hTok = NULL; + DWORD pid = 0, tid = 0; + + // Try it the easy way first - look for a window owned by the shell on + // our current desktop. If we find one, use that to get the process id. + HWND shell = FindWindowEx(NULL, NULL, "Progman", NULL); + if (shell != NULL) + { + tid = GetWindowThreadProcessId(shell, &pid); + } + + // We are possibly running on a private window station and desktop: we must + // switch to the default (which we suppose is where we will find the + // running shell). + else + { + HWINSTA saveWinSta = GetProcessWindowStation(); + HDESK saveDesk = GetThreadDesktop(GetCurrentThreadId()); + HWINSTA winSta = NULL; + HDESK desk = NULL; + BOOL changeFlag = FALSE; + BOOL dummy = saveWinSta != NULL && + saveDesk != NULL && + (winSta = OpenWindowStation("WinSta0", FALSE, + MAXIMUM_ALLOWED)) != NULL && + (changeFlag = SetProcessWindowStation(winSta)) != 0 && + (desk = OpenDesktop("Default", 0, FALSE, + MAXIMUM_ALLOWED)) != NULL && + SetThreadDesktop(desk) != 0; + + // Now find the window and process on this desktop + shell = FindWindowEx(NULL, NULL, "Progman", NULL); + if (shell != NULL) + { + tid = GetWindowThreadProcessId(shell, &pid); + } + + // Restore our own window station and desktop + if (changeFlag) + { + SetProcessWindowStation(saveWinSta); + SetThreadDesktop(saveDesk); + } + + // Close temporary objects + if (winSta != NULL) + CloseWindowStation(winSta); + if (desk != NULL) + CloseDesktop(desk); + } + + // + // If we have a process id, use that to get the process handle and + // from there the process' access token. + // + if (pid != 0) + { + HANDLE hProc = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid); + if (hProc != NULL) + { + OpenProcessToken(hProc, access, &hTok) || (hTok = NULL); + CloseHandle(hProc); + } + } + + // Return token if we got one + return hTok; +} + +// impersonate logged-on user as client +BOOL +ImpersonateClient() +{ + DWORD dwDesiredAccess = TOKEN_ALL_ACCESS; + HANDLE hUserToken = GetUserToken(dwDesiredAccess); + + if (hUserToken == NULL) + return FALSE; + if (ImpersonateLoggedOnUser(hUserToken) == 0) + { + LogEvent(EVENTLOG_ERROR_TYPE, MSG_FLUSH_IMPERSONATE_ERROR, + NULL); + return FALSE; + } + return TRUE; +} + +///////////////////////////////////////////////////////////////////// +// +// Thread proc +// +DWORD WINAPI +afsd_ServiceFlushVolumesThreadProc(LPVOID lpParam) +{ + FLUSHVOLTHREADINFO ThreadInfo; + PFLUSHVOLTHREADINFO pThreadInfo = (PFLUSHVOLTHREADINFO) lpParam; + HANDLE arHandles[2] = {0}; + DWORD dwWaitState = 0; + + // thread running - get handles + ThreadInfo.hEventPowerEvent = pThreadInfo->hEventPowerEvent; + ThreadInfo.hEventResumeMain = pThreadInfo->hEventResumeMain; + ThreadInfo.hEventTerminate = pThreadInfo->hEventTerminate; + + // setup to wait + arHandles[0] = ThreadInfo.hEventTerminate; + arHandles[1] = ThreadInfo.hEventPowerEvent; + + // do stuff .. + while (1) + { + // wait for an event to happen + dwWaitState = WaitForMultipleObjectsEx(2, arHandles, FALSE, INFINITE, FALSE); + + switch (dwWaitState) + { + case WAIT_OBJECT_0: + // termination signaled + RevertToSelf(); + ExitThread(0); + break; + + case WAIT_OBJECT_0+1: + // Power event + // - flush 'em! + if (ImpersonateClient()) + { + afsd_ServicePerformFlushVolumes(); + } + // acknowledge event + ResetEvent(ThreadInfo.hEventPowerEvent); + break; + + case WAIT_ABANDONED_0: + case WAIT_ABANDONED_0+1: + case WAIT_IO_COMPLETION: + case WAIT_TIMEOUT: + // sno* + LogEvent(EVENTLOG_WARNING_TYPE, + MSG_FLUSH_UNEXPECTED_EVENT, NULL); + break; + + } // end switch + + // signal back to waiting mainline + SetEvent(ThreadInfo.hEventResumeMain); + + } // end while + + // I suppose we never get here + ExitThread(0); +} + +///////////////////////////////////////////////////////////////////// +// +// Mainline thread routines +// + +VOID +CheckAndCloseHandle(HANDLE thisHandle) +{ + if (thisHandle != NULL) + { + CloseHandle(thisHandle); + thisHandle = NULL; + } +} + +// +// Thread Creation +// +BOOL +PowerNotificationThreadCreate() +{ + BOOL bSuccess = FALSE; + DWORD dwThreadId = 0; + + do + { + // create power event notification event + // bManualReset=TRUE, bInitialState=FALSE + gThreadInfo.hEventPowerEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + if (gThreadInfo.hEventPowerEvent == NULL) + break; + + // create mainline resume event + // bManualReset=FALSE, bInitialState=FALSE + gThreadInfo.hEventResumeMain = CreateEvent(NULL, FALSE, FALSE, NULL); + if (gThreadInfo.hEventResumeMain == NULL) + break; + + // create thread terminate event + // bManualReset=FALSE, bInitialState=FALSE + gThreadInfo.hEventTerminate = CreateEvent(NULL, FALSE, FALSE, NULL); + if (gThreadInfo.hEventTerminate == NULL) + break; + + // good so far - create thread + gThreadHandle = CreateThread(NULL, 0, + afsd_ServiceFlushVolumesThreadProc, + (LPVOID) &gThreadInfo, + 0, &dwThreadId); + + if (!gThreadHandle) + break; + + bSuccess = TRUE; + + } while (0); + + + if (!bSuccess) + { + CheckAndCloseHandle(gThreadInfo.hEventPowerEvent); + CheckAndCloseHandle(gThreadInfo.hEventResumeMain); + CheckAndCloseHandle(gThreadInfo.hEventTerminate); + CheckAndCloseHandle(gThreadHandle); + } + + return bSuccess; +} + +// +// Thread Notification +// +BOOL +PowerNotificationThreadNotify() +{ + DWORD dwRet = 0; + BOOL bRet = FALSE; + + // Notify thread of power event, and wait 19 seconds + dwRet = SignalObjectAndWait( + gThreadInfo.hEventPowerEvent, // object to signal + gThreadInfo.hEventResumeMain, // object to watch + 19*1000, // timeout (ms) + FALSE // alertable + ); + + if (dwRet == WAIT_OBJECT_0) + bRet = TRUE; + + return bRet; +} + +// +// Thread Termination +// +VOID +PowerNotificationThreadExit() +{ + // ExitThread + if (gThreadHandle) + { + SetEvent(gThreadInfo.hEventTerminate); + CloseHandle(gThreadHandle); + } +} + diff --git a/src/WINNT/afsd/afsd_flushvol.h b/src/WINNT/afsd/afsd_flushvol.h new file mode 100644 index 000000000..ca632612b --- /dev/null +++ b/src/WINNT/afsd/afsd_flushvol.h @@ -0,0 +1,45 @@ +// +// AFSD_FLUSHVOL.H +// +// Include file for routines that handle flushing AFS volumes +// in response to System Power event notification such as +// Hibernate request. +// +///////////////////////////////////////////////////////////////////// + +#ifndef _AFSD_FLUSHVOL_H_ +#define _AFSD_FLUSHVOL_H_ + +#include +#include "fs_utils.h" + +// handles +typedef struct _tagFLUSHVOLTHREADINFO { + HANDLE hEventPowerEvent; + HANDLE hEventResumeMain; + HANDLE hEventTerminate; +} FLUSHVOLTHREADINFO, *PFLUSHVOLTHREADINFO; + +// invokes fs.exe pioctl +static afs_int32 afsd_ServicePerformFlushVolumeCmd(char *data); + +// thread callback +static DWORD WINAPI afsd_ServiceFlushVolumesThreadProc(LPVOID lpParameter); + +// helper function +static VOID CheckAndCloseHandle(HANDLE thisHandle); + +// thread construction/notification/destruction +BOOL PowerNotificationThreadCreate(VOID); +BOOL PowerNotificationThreadNotify(VOID); +VOID PowerNotificationThreadExit(VOID); + +// impersonation helper(s) +static HANDLE GetUserToken(DWORD access); +static BOOL ImpersonateClient(void); + +// event logging +static VOID LogTimingEvent(DWORD dwEventID, LPTSTR lpString1, DWORD dwTime); + +#endif // _AFSD_FLUSHVOL_H_ + diff --git a/src/WINNT/afsd/afsd_init.c b/src/WINNT/afsd/afsd_init.c index d7f351e41..e4949a830 100644 --- a/src/WINNT/afsd/afsd_init.c +++ b/src/WINNT/afsd/afsd_init.c @@ -27,9 +27,10 @@ #include "smb.h" #include "cm_rpc.h" +#include "lanahelper.h" -extern int RXAFSCB_ExecuteRequest(); -extern int RXSTATS_ExecuteRequest(); +extern int RXAFSCB_ExecuteRequest(struct rx_call *z_call); +extern int RXSTATS_ExecuteRequest(struct rx_call *z_call); extern afs_int32 cryptall; @@ -130,6 +131,9 @@ afsi_log(char *pattern, ...) sprintf(u, "%s: %s\n", t, s); if (afsi_file != INVALID_HANDLE_VALUE) WriteFile(afsi_file, u, strlen(u), &zilch, NULL); +#ifdef NOTSERVICE + printf("%s", u); +#endif } else { if (afsi_file != INVALID_HANDLE_VALUE) WriteFile(afsi_file, s, strlen(s), &zilch, NULL); @@ -175,6 +179,7 @@ int afsd_InitCM(char **reasonP) long stats; long traceBufSize; long ltt, ltto; + long rx_mtu, rx_nojumbo; char rootCellName[256]; struct rx_service *serverp; static struct rx_securityClass *nullServerSecurityClassp; @@ -225,12 +230,15 @@ int afsd_InitCM(char **reasonP) dummyLen = sizeof(LANadapter); code = RegQueryValueEx(parmKey, "LANadapter", NULL, NULL, (BYTE *) &LANadapter, &dummyLen); - if (code == ERROR_SUCCESS) + if (code == ERROR_SUCCESS) { afsi_log("LAN adapter number %d", LANadapter); - else { + if (LANadapter < 0 || LANadapter > MAX_LANA) + LANadapter = -1; + } else { LANadapter = -1; + } + if ( LANadapter == -1 ) afsi_log("Default LAN adapter number"); - } dummyLen = sizeof(cacheSize); code = RegQueryValueEx(parmKey, "CacheSize", NULL, NULL, @@ -450,33 +458,78 @@ int afsd_InitCM(char **reasonP) cm_NetBiosName[0] = 0; /* default off */ } + dummyLen = sizeof(smb_hideDotFiles); + code = RegQueryValueEx(parmKey, "HideDotFiles", NULL, NULL, + (BYTE *) &smb_hideDotFiles, &dummyLen); + if (code != ERROR_SUCCESS) { + smb_hideDotFiles = 1; /* default on */ + } + afsi_log("Dot files/dirs will %sbe marked hidden", + smb_hideDotFiles ? "" : "not "); + + dummyLen = sizeof(smb_maxMpxRequests); + code = RegQueryValueEx(parmKey, "MaxMpxRequests", NULL, NULL, + (BYTE *) &smb_maxMpxRequests, &dummyLen); + if (code != ERROR_SUCCESS) { + smb_maxMpxRequests = 50; + } + afsi_log("Maximum number of multiplexed sessions is %d", smb_maxMpxRequests); + + dummyLen = sizeof(smb_maxVCPerServer); + code = RegQueryValueEx(parmKey, "MaxVCPerServer", NULL, NULL, + (BYTE *) &smb_maxVCPerServer, &dummyLen); + if (code != ERROR_SUCCESS) { + smb_maxVCPerServer = 100; + } + afsi_log("Maximum number of VCs per server is %d", smb_maxVCPerServer); + + dummyLen = sizeof(rx_nojumbo); + code = RegQueryValueEx(parmKey, "RxNoJumbo", NULL, NULL, + (BYTE *) &rx_nojumbo, &dummyLen); + if (code != ERROR_SUCCESS) { + rx_nojumbo = 0; + } + if(rx_nojumbo) + afsi_log("RX Jumbograms are disabled"); + + dummyLen = sizeof(rx_mtu); + code = RegQueryValueEx(parmKey, "RxMaxMTU", NULL, NULL, + (BYTE *) &rx_mtu, &dummyLen); + if (code != ERROR_SUCCESS || !rx_mtu) { + rx_mtu = -1; + } + if(rx_mtu != -1) + afsi_log("RX maximum MTU is %d", rx_mtu); + RegCloseKey (parmKey); /* setup early variables */ /* These both used to be configurable. */ smb_UseV3 = 1; - buf_bufferSize = CM_CONFIGDEFAULT_BLOCKSIZE; + buf_bufferSize = CM_CONFIGDEFAULT_BLOCKSIZE; /* turn from 1024 byte units into memory blocks */ - cacheBlocks = (cacheSize * 1024) / buf_bufferSize; + cacheBlocks = (cacheSize * 1024) / buf_bufferSize; /* setup and enable debug log */ afsd_logp = osi_LogCreate("afsd", traceBufSize); afsi_log("osi_LogCreate log addr %x", (int)afsd_logp); - osi_LogEnable(afsd_logp); + osi_LogEnable(afsd_logp); logReady = 1; + osi_Log0(afsd_logp, "Log init"); + /* get network related info */ cm_noIPAddr = CM_MAXINTERFACE_ADDR; code = syscfg_GetIFInfo(&cm_noIPAddr, - cm_IPAddr, cm_SubnetMask, - cm_NetMtu, cm_NetFlags); + cm_IPAddr, cm_SubnetMask, + cm_NetMtu, cm_NetFlags); if ( (cm_noIPAddr <= 0) || (code <= 0 ) ) afsi_log("syscfg_GetIFInfo error code %d", code); else afsi_log("First Network address %x SubnetMask %x", - cm_IPAddr[0], cm_SubnetMask[0]); + cm_IPAddr[0], cm_SubnetMask[0]); /* * Save client configuration for GetCacheConfig requests @@ -491,9 +544,16 @@ int afsd_InitCM(char **reasonP) cm_initParams.setTime = 0; cm_initParams.memCache = 0; + /* Set RX parameters before initializing RX */ + if ( rx_nojumbo ) + rx_SetNoJumbo(); + + if ( rx_mtu != -1 ) + rx_SetMaxMTU(rx_mtu); + /* initialize RX, and tell it to listen to port 7001, which is used for - * callback RPC messages. - */ + * callback RPC messages. + */ code = rx_Init(htons(7001)); afsi_log("rx_Init code %x", code); if (code != 0) { @@ -506,8 +566,8 @@ int afsd_InitCM(char **reasonP) /* create an unauthenticated service #1 for callbacks */ nullServerSecurityClassp = rxnull_NewServerSecurityObject(); - serverp = rx_NewService(0, 1, "AFS", &nullServerSecurityClassp, 1, - RXAFSCB_ExecuteRequest); + serverp = rx_NewService(0, 1, "AFS", &nullServerSecurityClassp, 1, + RXAFSCB_ExecuteRequest); afsi_log("rx_NewService addr %x", (int)serverp); if (serverp == NULL) { *reasonP = "unknown error"; @@ -515,16 +575,16 @@ int afsd_InitCM(char **reasonP) } nullServerSecurityClassp = rxnull_NewServerSecurityObject(); - serverp = rx_NewService(0, RX_STATS_SERVICE_ID, "rpcstats", - &nullServerSecurityClassp, 1, RXSTATS_ExecuteRequest); + serverp = rx_NewService(0, RX_STATS_SERVICE_ID, "rpcstats", + &nullServerSecurityClassp, 1, RXSTATS_ExecuteRequest); afsi_log("rx_NewService addr %x", (int)serverp); if (serverp == NULL) { *reasonP = "unknown error"; return -1; } - /* start server threads, *not* donating this one to the pool */ - rx_StartServer(0); + /* start server threads, *not* donating this one to the pool */ + rx_StartServer(0); afsi_log("rx_StartServer"); /* init user daemon, and other packages */ @@ -534,21 +594,21 @@ int afsd_InitCM(char **reasonP) cm_InitConn(); - cm_InitCell(); - - cm_InitServer(); + cm_InitCell(); - cm_InitVolume(); + cm_InitServer(); - cm_InitIoctl(); + cm_InitVolume(); + + cm_InitIoctl(); - smb_InitIoctl(); + smb_InitIoctl(); - cm_InitCallback(); + cm_InitCallback(); - cm_InitSCache(stats); + cm_InitSCache(stats); - code = cm_InitDCache(0, cacheBlocks); + code = cm_InitDCache(0, cacheBlocks); afsi_log("cm_InitDCache code %x", code); if (code != 0) { *reasonP = "error initializing cache"; @@ -556,28 +616,33 @@ int afsd_InitCM(char **reasonP) } #ifdef AFS_AFSDB_ENV +#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x500 if (cm_InitDNS(cm_dnsEnabled) == -1) cm_dnsEnabled = 0; /* init failed, so deactivate */ afsi_log("cm_InitDNS %d", cm_dnsEnabled); +#endif #endif code = cm_GetRootCellName(rootCellName); - afsi_log("cm_GetRootCellName code %d rcn %s", code, - (code ? "" : rootCellName)); - if (code != 0 && !cm_freelanceEnabled) { + afsi_log("cm_GetRootCellName code %d, cm_freelanceEnabled= %d, rcn= %s", + code, cm_freelanceEnabled, (code ? "" : rootCellName)); + if (code != 0 && !cm_freelanceEnabled) + { *reasonP = "can't find root cell name in afsd.ini"; return -1; + } + else if (cm_freelanceEnabled) + cm_rootCellp = NULL; + + if (code == 0 && !cm_freelanceEnabled) + { + cm_rootCellp = cm_GetCell(rootCellName, CM_FLAG_CREATE); + afsi_log("cm_GetCell addr %x", (int)cm_rootCellp); + if (cm_rootCellp == NULL) + { + *reasonP = "can't find root cell in afsdcell.ini"; + return -1; } - else if (cm_freelanceEnabled) - cm_rootCellp = NULL; - - if (code == 0 && !cm_freelanceEnabled) { - cm_rootCellp = cm_GetCell(rootCellName, CM_FLAG_CREATE); - afsi_log("cm_GetCell addr %x", (int)cm_rootCellp); - if (cm_rootCellp == NULL) { - *reasonP = "can't find root cell in afsdcell.ini"; - return -1; - } } #ifdef AFS_FREELANCE_CLIENT @@ -597,30 +662,30 @@ int afsd_InitDaemons(char **reasonP) /* this should really be in an init daemon from here on down */ - if (!cm_freelanceEnabled) { - code = cm_GetVolumeByName(cm_rootCellp, cm_rootVolumeName, cm_rootUserp, - &req, CM_FLAG_CREATE, &cm_rootVolumep); - afsi_log("cm_GetVolumeByName code %x root vol %x", code, - (code ? (cm_volume_t *)-1 : cm_rootVolumep)); - if (code != 0) { + if (!cm_freelanceEnabled) { + code = cm_GetVolumeByName(cm_rootCellp, cm_rootVolumeName, cm_rootUserp, + &req, CM_FLAG_CREATE, &cm_rootVolumep); + afsi_log("cm_GetVolumeByName code %x root vol %x", code, + (code ? (cm_volume_t *)-1 : cm_rootVolumep)); + if (code != 0) { *reasonP = "can't find root volume in root cell"; return -1; - } } + } /* compute the root fid */ if (!cm_freelanceEnabled) { - cm_rootFid.cell = cm_rootCellp->cellID; - cm_rootFid.volume = cm_GetROVolumeID(cm_rootVolumep); - cm_rootFid.vnode = 1; - cm_rootFid.unique = 1; + cm_rootFid.cell = cm_rootCellp->cellID; + cm_rootFid.volume = cm_GetROVolumeID(cm_rootVolumep); + cm_rootFid.vnode = 1; + cm_rootFid.unique = 1; } else - cm_FakeRootFid(&cm_rootFid); + cm_FakeRootFid(&cm_rootFid); - code = cm_GetSCache(&cm_rootFid, &cm_rootSCachep, cm_rootUserp, &req); + code = cm_GetSCache(&cm_rootFid, &cm_rootSCachep, cm_rootUserp, &req); afsi_log("cm_GetSCache code %x scache %x", code, - (code ? (cm_scache_t *)-1 : cm_rootSCachep)); + (code ? (cm_scache_t *)-1 : cm_rootSCachep)); if (code != 0) { *reasonP = "unknown error"; return -1; @@ -636,27 +701,49 @@ int afsd_InitSMB(char **reasonP, void *aMBfunc) { char hostName[200]; char *ctemp; + lana_number_t lana; /* Do this last so that we don't handle requests before init is done. * Here we initialize the SMB listener. */ - if (!cm_NetBiosName[0]) - { - strcpy(hostName, cm_HostName); - ctemp = strchr(hostName, '.'); /* turn ntdfs.* into ntdfs */ - if (ctemp) *ctemp = 0; + if (LANadapter == -1) { + /* Find the default LAN adapter to use. First look for + * the adapter named AFS; otherwise, unless we are doing + * gateway service, look for any valid loopback adapter. + */ + lana = lana_FindLanaByName("AFS"); + if (lana == LANA_INVALID && !isGateway) + lana = lana_FindLoopback(); + if (lana != LANA_INVALID) + LANadapter = lana; + } + afsi_log("Lana %d", (int) lana); + /* If we are using a loopback adapter, we can use the preferred + * (but non-unique) server name; otherwise, we must fall back to + * the -AFS name. + */ + if (LANadapter >= 0 && lana_IsLoopback((lana_number_t) LANadapter)) { + if ( cm_NetBiosName[0] ) + strcpy(hostName, cm_NetBiosName); + else + strcpy(hostName, "AFS"); + } else { + if (!cm_NetBiosName[0]) + { + strcpy(hostName, cm_HostName); + ctemp = strchr(hostName, '.'); /* turn ntdfs.* into ntdfs */ + if (ctemp) *ctemp = 0; hostName[11] = 0; /* ensure that even after adding the -A, we * leave one byte free for the netbios server * type. */ - strcat(hostName, "-AFS"); - } else { - strcpy(hostName, cm_NetBiosName); + strcat(hostName, "-AFS"); + } else { + strcpy(hostName, cm_NetBiosName); + } + _strupr(hostName); } - _strupr(hostName); - - smb_Init(afsd_logp, hostName, smb_UseV3, LANadapter, numSvThreads, - aMBfunc); + smb_Init(afsd_logp, hostName, smb_UseV3, LANadapter, numSvThreads, aMBfunc); afsi_log("smb_Init"); return 0; diff --git a/src/WINNT/afsd/afsd_service.c b/src/WINNT/afsd/afsd_service.c index 3e491b484..c3013a979 100644 --- a/src/WINNT/afsd/afsd_service.c +++ b/src/WINNT/afsd/afsd_service.c @@ -28,6 +28,16 @@ #include #endif +/* +// The following is defined if you want to receive Power notifications, +// including Hibernation, and also subsequent flushing of AFS volumes +// +// #define REGISTER_POWER_NOTIFICATIONS +// +// Check +*/ +#include "afsd_flushvol.h" + extern void afsi_log(char *pattern, ...); HANDLE WaitToTerminate; @@ -88,54 +98,140 @@ static int DummyMessageBox(HWND h, LPCTSTR l1, LPCTSTR l2, UINT ui) static SERVICE_STATUS ServiceStatus; static SERVICE_STATUS_HANDLE StatusHandle; -void afsd_ServiceControlHandler(DWORD ctrlCode) +DWORD +afsd_ServiceFlushVolume(DWORD dwlpEventData) +{ + DWORD dwRet = ERROR_NETWORK_BUSY; /* or NO_ERROR */ + + /* + ** If UI bit is not set, user interaction is not possible + ** BUT, since we are a NON-interactive service, and therefore + ** have NO user I/O, it doesn't much matter. + ** This benign code left here as example of how to find this out + */ + BOOL bUI = (dwlpEventData & 1); + + /* flush volume */ + if ( PowerNotificationThreadNotify() ) + { + dwRet = NO_ERROR; + } + + else + { + /* flush was unsuccessful, or timeout - deny shutdown */ + dwRet = ERROR_NETWORK_BUSY; + } + + /* to deny hibernate, simply return + // any value besides NO_ERROR. + // For example: + // dwRet = ERROR_NETWORK_BUSY; + */ + + return dwRet; +} + +/* +** Extended ServiceControlHandler that provides Event types +** for monitoring Power events, for example. +*/ +DWORD +afsd_ServiceControlHandlerEx( + DWORD ctrlCode, + DWORD dwEventType, + LPVOID lpEventData, + LPVOID lpContext + ) { HKEY parmKey; DWORD dummyLen, doTrace; long code; + DWORD dwRet = ERROR_CALL_NOT_IMPLEMENTED; + + switch (ctrlCode) + { + case SERVICE_CONTROL_STOP: + /* Shutdown RPC */ + RpcMgmtStopServerListening(NULL); + + /* Force trace if requested */ + code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, + AFSConfigKeyName, + 0, KEY_QUERY_VALUE, &parmKey); + if (code != ERROR_SUCCESS) + goto doneTrace; + + dummyLen = sizeof(doTrace); + code = RegQueryValueEx(parmKey, "TraceOnShutdown", + NULL, NULL, + (BYTE *) &doTrace, &dummyLen); + RegCloseKey (parmKey); + if (code != ERROR_SUCCESS) + doTrace = 0; + if (doTrace) + afsd_ForceTrace(FALSE); + + doneTrace: + ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING; + ServiceStatus.dwWin32ExitCode = NO_ERROR; + ServiceStatus.dwCheckPoint = 1; + ServiceStatus.dwWaitHint = 10000; + ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_POWEREVENT; + SetServiceStatus(StatusHandle, &ServiceStatus); + SetEvent(WaitToTerminate); + dwRet = NO_ERROR; + break; + + case SERVICE_CONTROL_INTERROGATE: + ServiceStatus.dwCurrentState = SERVICE_RUNNING; + ServiceStatus.dwWin32ExitCode = NO_ERROR; + ServiceStatus.dwCheckPoint = 0; + ServiceStatus.dwWaitHint = 0; + ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_POWEREVENT; + SetServiceStatus(StatusHandle, &ServiceStatus); + dwRet = NO_ERROR; + break; - switch (ctrlCode) { - case SERVICE_CONTROL_STOP: - /* Shutdown RPC */ - RpcMgmtStopServerListening(NULL); - - /* Force trace if requested */ - code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, - AFSConfigKeyName, - 0, KEY_QUERY_VALUE, &parmKey); - if (code != ERROR_SUCCESS) - goto doneTrace; - - dummyLen = sizeof(doTrace); - code = RegQueryValueEx(parmKey, "TraceOnShutdown", - NULL, NULL, - (BYTE *) &doTrace, &dummyLen); - RegCloseKey (parmKey); - if (code != ERROR_SUCCESS) - doTrace = 0; - if (doTrace) - afsd_ForceTrace(FALSE); - -doneTrace: - ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING; - ServiceStatus.dwWin32ExitCode = NO_ERROR; - ServiceStatus.dwCheckPoint = 1; - ServiceStatus.dwWaitHint = 10000; - ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP; - SetServiceStatus(StatusHandle, &ServiceStatus); - SetEvent(WaitToTerminate); - break; - case SERVICE_CONTROL_INTERROGATE: - ServiceStatus.dwCurrentState = SERVICE_RUNNING; - ServiceStatus.dwWin32ExitCode = NO_ERROR; - ServiceStatus.dwCheckPoint = 0; - ServiceStatus.dwWaitHint = 0; - ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP; - SetServiceStatus(StatusHandle, &ServiceStatus); - break; /* XXX handle system shutdown */ /* XXX handle pause & continue */ - } + case SERVICE_CONTROL_POWEREVENT: + { + /* + ** dwEventType of this notification == WPARAM of WM_POWERBROADCAST + ** Return NO_ERROR == return TRUE for that message, i.e. accept request + ** Return any error code to deny request, + ** i.e. as if returning BROADCAST_QUERY_DENY + */ + switch((int) dwEventType) + { + case PBT_APMQUERYSUSPEND: + case PBT_APMQUERYSTANDBY: + +#ifdef REGISTER_POWER_NOTIFICATIONS + /* handle event */ + dwRet = afsd_ServiceFlushVolume((DWORD) lpEventData); +#else + dwRet = NO_ERROR; +#endif + break; + + /* allow remaining case PBT_WhatEver */ + case PBT_APMSUSPEND: + case PBT_APMSTANDBY: + case PBT_APMRESUMECRITICAL: + case PBT_APMRESUMESUSPEND: + case PBT_APMRESUMESTANDBY: + case PBT_APMBATTERYLOW: + case PBT_APMPOWERSTATUSCHANGE: + case PBT_APMOEMEVENT: + case PBT_APMRESUMEAUTOMATIC: + default: + dwRet = NO_ERROR; + } + } + } /* end switch(ctrlCode) */ + return dwRet; } #if 1 @@ -205,7 +301,7 @@ typedef BOOL ( APIENTRY * AfsdInitHook )(void); #define AFSD_INIT_HOOK "AfsdInitHook" #define AFSD_HOOK_DLL "afsdhook.dll" -void afsd_Main() +void afsd_Main(DWORD argc, LPTSTR *argv) { long code; char *reason; @@ -226,18 +322,22 @@ void afsd_Main() WaitToTerminate = CreateEvent(NULL, TRUE, FALSE, NULL); #ifndef NOTSERVICE - StatusHandle = RegisterServiceCtrlHandler(AFS_DAEMON_SERVICE_NAME, - (LPHANDLER_FUNCTION) afsd_ServiceControlHandler); + StatusHandle = RegisterServiceCtrlHandlerEx(AFS_DAEMON_SERVICE_NAME, + (LPHANDLER_FUNCTION_EX) afsd_ServiceControlHandlerEx, + NULL /* user context */ + ); ServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; ServiceStatus.dwServiceSpecificExitCode = 0; ServiceStatus.dwCurrentState = SERVICE_START_PENDING; ServiceStatus.dwWin32ExitCode = NO_ERROR; ServiceStatus.dwCheckPoint = 1; - ServiceStatus.dwWaitHint = 15000; - ServiceStatus.dwControlsAccepted = 0; + ServiceStatus.dwWaitHint = 30000; + /* accept Power Events */ + ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_POWEREVENT; SetServiceStatus(StatusHandle, &ServiceStatus); #endif + { HANDLE h; char *ptbuf[1]; h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME); @@ -246,6 +346,11 @@ void afsd_Main() DeregisterEventSource(h); } +#ifdef REGISTER_POWER_NOTIFICATIONS + /* create thread used to flush cache */ + PowerNotificationThreadCreate(); +#endif + afsi_start(); /* allow an exit to be called prior to any initialization */ @@ -294,10 +399,20 @@ void afsd_Main() if (code != 0) osi_panic(reason, __FILE__, __LINE__); +#ifndef NOTSERVICE + ServiceStatus.dwCheckPoint++; + ServiceStatus.dwWaitHint -= 5000; + SetServiceStatus(StatusHandle, &ServiceStatus); +#endif code = afsd_InitDaemons(&reason); if (code != 0) osi_panic(reason, __FILE__, __LINE__); +#ifndef NOTSERVICE + ServiceStatus.dwCheckPoint++; + ServiceStatus.dwWaitHint -= 5000; + SetServiceStatus(StatusHandle, &ServiceStatus); +#endif code = afsd_InitSMB(&reason, DummyMessageBox); if (code != 0) osi_panic(reason, __FILE__, __LINE__); @@ -307,7 +422,9 @@ void afsd_Main() ServiceStatus.dwWin32ExitCode = NO_ERROR; ServiceStatus.dwCheckPoint = 0; ServiceStatus.dwWaitHint = 0; - ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP; + + /* accept Power events */ + ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_POWEREVENT; SetServiceStatus(StatusHandle, &ServiceStatus); #endif { @@ -338,12 +455,21 @@ void afsd_Main() ServiceStatus.dwCheckPoint = 0; ServiceStatus.dwWaitHint = 0; ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP; + + /* also now accept Power events - shutdown maybe? */ + ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP; + +#ifdef REGISTER_POWER_NOTIFICATIONS + /* terminate thread used to flush cache */ + PowerNotificationThreadExit(); +#endif + SetServiceStatus(StatusHandle, &ServiceStatus); } DWORD __stdcall afsdMain_thread(void* notUsed) { - afsd_Main(); + afsd_Main(0, (LPTSTR*)NULL); return(0); } diff --git a/src/WINNT/afsd/cm.h b/src/WINNT/afsd/cm.h index c2e6f3eda..fe3fa4274 100644 --- a/src/WINNT/afsd/cm.h +++ b/src/WINNT/afsd/cm.h @@ -18,10 +18,10 @@ /* from .xg file */ /* FIXME: these were "long" but Windows NT wants "int" */ -int VL_GetEntryByID(struct rx_connection *, long, long, struct vldbentry *); +int VL_GetEntryByID(struct rx_connection *, afs_int32, afs_int32, struct vldbentry *); int VL_GetEntryByNameO(struct rx_connection *, char *, struct vldbentry *); int VL_ProbeServer(struct rx_connection *); -int VL_GetEntryBYIDN(struct rx_connection *, long, long, struct nvldbentry *); +int VL_GetEntryBYIDN(struct rx_connection *, afs_int32, afs_int32, struct nvldbentry *); int VL_GetEntryByNameN(struct rx_connection *, char *, struct nvldbentry *); /* from .xg file */ @@ -49,9 +49,9 @@ extern RXAFS_FetchStatus (struct rx_connection *, int StartRXAFS_StoreData (struct rx_call *, struct AFSFid *Fid, struct AFSStoreStatus *InStatus, - afs_int32 Pos, - afs_int32 Length, - afs_int32 FileLength); + afs_uint32 Pos, + afs_uint32 Length, + afs_uint32 FileLength); int EndRXAFS_StoreData(struct rx_call *, struct AFSFetchStatus *OutStatus, diff --git a/src/WINNT/afsd/cm_cell.c b/src/WINNT/afsd/cm_cell.c index 8752cb2dc..d8ca53ee3 100644 --- a/src/WINNT/afsd/cm_cell.c +++ b/src/WINNT/afsd/cm_cell.c @@ -86,6 +86,8 @@ cm_cell_t *cm_GetCell_Gen(char *namep, char *newnamep, long flags) memset(cp, 0, sizeof(*cp)); code = cm_SearchCellFile(namep, fullname, cm_AddCellProc, cp); if (code) { + afsi_log("in cm_GetCell_gen code= %d fullname= %s", code, fullname); + #ifdef AFS_AFSDB_ENV if (cm_dnsEnabled /*&& cm_DomainValid(namep)*/) code = cm_SearchCellByDNS(namep, fullname, &ttl, cm_AddCellProc, cp); diff --git a/src/WINNT/afsd/cm_config.c b/src/WINNT/afsd/cm_config.c index 37ed8897b..60105fc35 100644 --- a/src/WINNT/afsd/cm_config.c +++ b/src/WINNT/afsd/cm_config.c @@ -23,13 +23,19 @@ #include "cm_config.h" #ifdef AFS_AFSDB_ENV +#if !defined(DJGPP) && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x500 +#include +#define DNSAPI_ENV +#else #include "cm_dns.h" +#endif #include #endif char AFSConfigKeyName[] = "SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters"; +/* TODO: these should be pulled in from dirpath.h */ #define AFS_THISCELL "ThisCell" #define AFS_CELLSERVDB_UNIX "CellServDB" #define AFS_CELLSERVDB_NT "afsdcell.ini" @@ -46,6 +52,38 @@ extern int errno; #define AFS_CELLSERVDB AFS_CELLSERVDB_NT #endif /* DJGPP || WIN95 */ +DWORD TraceOption=1; + +#define TRACE_OPTION_EVENT 1 +#define ISLOGONTRACE(v) ( ((v) & TRACE_OPTION_EVENT)==TRACE_OPTION_EVENT) + +void DebugEvent0_local(char *a) +{ + HANDLE h; char *ptbuf[1]; + if (!ISLOGONTRACE(TraceOption)) + return; + h = RegisterEventSource(NULL, a); + ptbuf[0] = a; + ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, (const char **)ptbuf, NULL); + DeregisterEventSource(h); +} + +#define MAXBUF_ 131 + +void DebugEvent_local(char *a,char *b,...) +{ + HANDLE h; char *ptbuf[1],buf[MAXBUF_+1]; + va_list marker; + if (!ISLOGONTRACE(TraceOption)) + return; + h = RegisterEventSource(NULL, a); + va_start(marker,b); + _vsnprintf(buf,MAXBUF_,b,marker); + ptbuf[0] = buf; + ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, (const char **)ptbuf, NULL);\ + DeregisterEventSource(h); + va_end(marker); +} static long cm_ParsePair(char *lineBufferp, char *leftp, char *rightp) { @@ -128,8 +166,8 @@ long cm_SearchCellFile(char *cellNamep, char *newCellNamep, long ip_addr; int c1, c2, c3, c4; char aname[256]; -#endif char *afsconf_path; +#endif foundCell = 0; @@ -150,6 +188,7 @@ long cm_SearchCellFile(char *cellNamep, char *newCellNamep, tfilep = fopen(wdir, "r"); +#if defined(DJGPP) || defined(AFS_WIN95_ENV) if (!tfilep) { /* If we are using DJGPP client, cellservdb will be in afsconf dir. */ /* If we are in Win95 here, we are linking with klog etc. and are @@ -166,9 +205,16 @@ long cm_SearchCellFile(char *cellNamep, char *newCellNamep, tfilep = fopen(wdir, "r"); if (!tfilep) return -2; } +#else + /* If we are NT or higher, we don't do DJGPP, So just fail */ + if ( !tfilep ) + return -2; +#endif bestp = fopen(wdir, "r"); - + + DebugEvent_local("AFS- cm_searchfile fopen", "Handle[%x], wdir[%s]", bestp, wdir); + /* have we seen the cell line for the guy we're looking for? */ inRightCell = 0; while (1) { @@ -223,6 +269,8 @@ long cm_SearchCellFile(char *cellNamep, char *newCellNamep, strcpy(newCellNamep, lineBuffer+1); inRightCell = 1; tracking = 0; + DebugEvent_local("AFS- cm_searchfile is cell", "inRightCell[%x], linebuffer[%s]", + inRightCell, lineBuffer); } else if (strnicmp(lineBuffer+1, cellNamep, strlen(cellNamep)) == 0) { @@ -260,7 +308,15 @@ long cm_SearchCellFile(char *cellNamep, char *newCellNamep, if (inRightCell) { #if !defined(DJGPP) && !defined(AFS_WIN95_ENV) /* add the server to the VLDB list */ + WSASetLastError(0); thp = gethostbyname(valuep); + { + int iErr = 0; + iErr = WSAGetLastError(); + DebugEvent_local("AFS- cm_searchfile inRightCell", + "thp[%x], valuep[%s], WSAGetLastError[%d]", + thp, valuep, iErr); + } if (thp) { memcpy(&vlSockAddr.sin_addr.s_addr, thp->h_addr, sizeof(long)); @@ -300,29 +356,121 @@ long cm_SearchCellByDNS(char *cellNamep, char *newCellNamep, int *ttl, cm_configProc_t *procp, void *rockp) { #ifdef AFS_AFSDB_ENV - int rc; - int cellHosts[AFSMAXCELLHOSTS]; - int numServers; - int i; - struct sockaddr_in vlSockAddr; - - rc = getAFSServer(cellNamep, cellHosts, &numServers, ttl); - if (rc == 0 && numServers > 0) { /* found the cell */ - for (i = 0; i < numServers; i++) { - memcpy(&vlSockAddr.sin_addr.s_addr, &cellHosts[i], - sizeof(long)); +#ifndef DNSAPI_ENV + int rc; + int cellHosts[AFSMAXCELLHOSTS]; + int numServers; + int i; + struct sockaddr_in vlSockAddr; + + DebugEvent_local("AFS SearchCellDNS-","Doing search for [%s]", cellNamep); + rc = getAFSServer(cellNamep, cellHosts, &numServers, ttl); + if (rc == 0 && numServers > 0) { /* found the cell */ + for (i = 0; i < numServers; i++) { + memcpy(&vlSockAddr.sin_addr.s_addr, &cellHosts[i], + sizeof(long)); vlSockAddr.sin_family = AF_INET; /* sin_port supplied by connection code */ if (procp) (*procp)(rockp, &vlSockAddr, NULL); if(newCellNamep) strcpy(newCellNamep,cellNamep); - } - return 0; /* found cell */ - } - else -#endif /* AFS_AFSDB_ENV */ + } + return 0; /* found cell */ + } + else return -1; /* not found */ +#else /* DNSAPI_ENV */ + PDNS_RECORD pDnsCell, pDnsIter, pDnsVol,pDnsVolIter, pDnsCIter; + LPSTR vlServers[AFSMAXCELLHOSTS]; + IP4_ADDRESS vlAddrs[AFSMAXCELLHOSTS]; + WORD nvlServers; + DWORD wttl, i; + BOOL success; + struct sockaddr_in vlSockAddr; + + success = FALSE; + + /* query the AFSDB records of cell */ + if(DnsQuery_A(cellNamep, DNS_TYPE_AFSDB, DNS_QUERY_STANDARD, NULL, &pDnsCell, NULL) == ERROR_SUCCESS) { + + memset((void*) &vlSockAddr, 0, sizeof(vlSockAddr)); + + nvlServers = 0; wttl = 0; + + /* go through the returned records */ + for(pDnsIter = pDnsCell;pDnsIter; pDnsIter = pDnsIter->pNext) { + /* if we find an AFSDB record with Preference set to 1, we found a volserver */ + if(pDnsIter->wType == DNS_TYPE_AFSDB && pDnsIter->Data.Afsdb.wPreference == 1) { + vlServers[nvlServers++] = pDnsIter->Data.Afsdb.pNameExchange; + if(!wttl) wttl = pDnsIter->dwTtl; + if(nvlServers == AFSMAXCELLHOSTS) break; + } + } + + for(i=0;ipNext) { + if(pDnsIter->wType == DNS_TYPE_A) + /* check if its for one of the volservers */ + for(i=0;ipName, vlServers[i]) == 0) + vlAddrs[i] = pDnsIter->Data.A.IpAddress; + } + + for(i=0;ipNext) { + /* if we get an A record, keep it */ + if(pDnsVolIter->wType == DNS_TYPE_A && stricmp(vlServers[i], pDnsVolIter->pName)==0) { + vlAddrs[i] = pDnsVolIter->Data.A.IpAddress; + break; + } + /* if we get a CNAME, look for a corresponding A record */ + if(pDnsVolIter->wType == DNS_TYPE_CNAME && stricmp(vlServers[i], pDnsVolIter->pName)==0) { + for(pDnsCIter=pDnsVolIter; pDnsCIter; pDnsCIter=pDnsCIter->pNext) { + if(pDnsCIter->wType == DNS_TYPE_A && stricmp(pDnsVolIter->Data.CNAME.pNameHost, pDnsCIter->pName)==0) { + vlAddrs[i] = pDnsCIter->Data.A.IpAddress; + break; + } + } + if(vlAddrs[i]) break; + /* TODO: if the additional section is missing, then do another lookup for the CNAME */ + } + } + /* we are done with the volserver lookup */ + DnsRecordListFree(pDnsVol, DnsFreeRecordListDeep); + } + } + + /* if we found a volserver, then add it */ + if(vlAddrs[i]) { + vlSockAddr.sin_family = AF_INET; + vlSockAddr.sin_addr.s_addr = vlAddrs[i]; + if(procp) + (*procp)(rockp, &vlSockAddr, vlServers[i]); + success = TRUE; + } + } + + DnsRecordListFree(pDnsCell, DnsFreeRecordListDeep); + } + + if(!success) return -1; + else { + strcpy(newCellNamep, cellNamep); + if(ttl) *ttl = (int) wttl; + return 0; + } + +#endif /* DNSAPI_ENV */ +#else + return -1; /* not found */ +#endif /* AFS_AFSDB_ENV */ } #if !defined(DJGPP) && !defined(AFS_WIN95_ENV) diff --git a/src/WINNT/afsd/cm_conn.c b/src/WINNT/afsd/cm_conn.c index 97f6b3876..7d001e394 100644 --- a/src/WINNT/afsd/cm_conn.c +++ b/src/WINNT/afsd/cm_conn.c @@ -137,6 +137,7 @@ long cm_GetServerList(struct cm_fid *fidp, struct cm_user *userp, * * volSyncp and/or cbrp may also be NULL. */ +int cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, struct cm_fid *fidp, AFSVolSync *volSyncp, cm_callbackRequest_t *cbrp, long errorCode) diff --git a/src/WINNT/afsd/cm_vnodeops.c b/src/WINNT/afsd/cm_vnodeops.c index 98d26681e..4bf8e8ef5 100644 --- a/src/WINNT/afsd/cm_vnodeops.c +++ b/src/WINNT/afsd/cm_vnodeops.c @@ -1272,140 +1272,140 @@ long cm_NameI(cm_scache_t *rootSCachep, char *pathp, long flags, cm_HoldSCache(tscp); symlinkCount = 0; while (1) { - tc = *tp++; + tc = *tp++; - /* map Unix slashes into DOS ones so we can interpret Unix - * symlinks properly - */ - if (tc == '/') tc = '\\'; - - if (!haveComponent) { + /* map Unix slashes into DOS ones so we can interpret Unix + * symlinks properly + */ + if (tc == '/') tc = '\\'; + + if (!haveComponent) { if (tc == '\\') continue; - else if (tc == 0) { + else if (tc == 0) { if (phase == 1) { phase = 2; tp = pathp; continue; } - code = 0; - break; - } - else { + code = 0; + break; + } + else { haveComponent = 1; - cp = component; - *cp++ = tc; + cp = component; + *cp++ = tc; + } + } + else { + /* we have a component here */ + if (tc == 0 || tc == '\\') { + /* end of the component; we're at the last + * component if tc == 0. However, if the last + * is a symlink, we have more to do. + */ + *cp++ = 0; /* add null termination */ + extraFlag = 0; + if ((flags & CM_FLAG_DIRSEARCH) && tc == 0) + extraFlag = CM_FLAG_NOMOUNTCHASE; + code = cm_Lookup(tscp, component, + flags | extraFlag, + userp, reqp, &nscp); + + if (code) { + cm_ReleaseSCache(tscp); + if (psp) cm_FreeSpace(psp); + return code; + } + haveComponent = 0; /* component done */ + dirScp = tscp; /* for some symlinks */ + tscp = nscp; /* already held */ + if (tc == 0 && !(flags & CM_FLAG_FOLLOW) && phase == 2) { + code = 0; + cm_ReleaseSCache(dirScp); + break; + } + + /* now, if tscp is a symlink, we should follow + * it and assemble the path again. + */ + lock_ObtainMutex(&tscp->mx); + code = cm_SyncOp(tscp, NULL, userp, reqp, 0, + CM_SCACHESYNC_GETSTATUS + | CM_SCACHESYNC_NEEDCALLBACK); + if (code) { + lock_ReleaseMutex(&tscp->mx); + cm_ReleaseSCache(tscp); + cm_ReleaseSCache(dirScp); + break; + } + if (tscp->fileType == CM_SCACHETYPE_SYMLINK) { + /* this is a symlink; assemble a new buffer */ + lock_ReleaseMutex(&tscp->mx); + if (symlinkCount++ >= 16) { + cm_ReleaseSCache(tscp); + cm_ReleaseSCache(dirScp); + if (psp) cm_FreeSpace(psp); + return CM_ERROR_TOOBIG; } - } - else { - /* we have a component here */ - if (tc == 0 || tc == '\\') { - /* end of the component; we're at the last - * component if tc == 0. However, if the last - * is a symlink, we have more to do. - */ - *cp++ = 0; /* add null termination */ - extraFlag = 0; - if ((flags & CM_FLAG_DIRSEARCH) && tc == 0) - extraFlag = CM_FLAG_NOMOUNTCHASE; - code = cm_Lookup(tscp, component, - flags | extraFlag, - userp, reqp, &nscp); - if (code) { - cm_ReleaseSCache(tscp); - if (psp) cm_FreeSpace(psp); - return code; - } - haveComponent = 0; /* component done */ - dirScp = tscp; /* for some symlinks */ - tscp = nscp; /* already held */ - if (tc == 0 && !(flags & CM_FLAG_FOLLOW) && phase == 2) { - code = 0; - cm_ReleaseSCache(dirScp); - break; - } - - /* now, if tscp is a symlink, we should follow - * it and assemble the path again. - */ - lock_ObtainMutex(&tscp->mx); - code = cm_SyncOp(tscp, NULL, userp, reqp, 0, - CM_SCACHESYNC_GETSTATUS - | CM_SCACHESYNC_NEEDCALLBACK); - if (code) { - lock_ReleaseMutex(&tscp->mx); - cm_ReleaseSCache(tscp); - cm_ReleaseSCache(dirScp); - break; - } - if (tscp->fileType == CM_SCACHETYPE_SYMLINK) { - /* this is a symlink; assemble a new buffer */ - lock_ReleaseMutex(&tscp->mx); - if (symlinkCount++ >= 16) { - cm_ReleaseSCache(tscp); - cm_ReleaseSCache(dirScp); - if (psp) cm_FreeSpace(psp); - return CM_ERROR_TOOBIG; - } - if (tc == 0) restp = ""; - else restp = tp; - code = cm_AssembleLink(tscp, restp, - &linkScp, &tempsp, userp, reqp); - if (code) { - /* something went wrong */ - cm_ReleaseSCache(tscp); - cm_ReleaseSCache(dirScp); - break; - } - - /* otherwise, tempsp has the new path, - * and linkScp is the new root from - * which to interpret that path. - * Continue with the namei processing, - * also doing the bookkeeping for the - * space allocation and tracking the - * vnode reference counts. - */ - if (psp) cm_FreeSpace(psp); - psp = tempsp; - tp = psp->data; - cm_ReleaseSCache(tscp); - tscp = linkScp; /* already held - * by AssembleLink */ - /* now, if linkScp is null, that's - * AssembleLink's way of telling us that - * the sym link is relative to the dir - * containing the link. We have a ref - * to it in dirScp, and we hold it now - * and reuse it as the new spot in the - * dir hierarchy. - */ - if (tscp == NULL) { - cm_HoldSCache(dirScp); - tscp = dirScp; - } - } /* if we have a sym link */ - else { - /* not a symlink, we may be done */ - lock_ReleaseMutex(&tscp->mx); - if (tc == 0) { - if (phase == 1) { - phase = 2; - tp = pathp; - continue; - } - cm_ReleaseSCache(dirScp); - code = 0; - break; - } - } - cm_ReleaseSCache(dirScp); - } /* end of a component */ - else *cp++ = tc; - } /* we have a component */ - } /* big while loop over all components */ + if (tc == 0) restp = ""; + else restp = tp; + code = cm_AssembleLink(tscp, restp, &linkScp, &tempsp, userp, reqp); + if (code) { + /* something went wrong */ + cm_ReleaseSCache(tscp); + cm_ReleaseSCache(dirScp); + break; + } + + /* otherwise, tempsp has the new path, + * and linkScp is the new root from + * which to interpret that path. + * Continue with the namei processing, + * also doing the bookkeeping for the + * space allocation and tracking the + * vnode reference counts. + */ + if (psp) cm_FreeSpace(psp); + psp = tempsp; + tp = psp->data; + cm_ReleaseSCache(tscp); + tscp = linkScp; /* already held + * by AssembleLink */ + /* now, if linkScp is null, that's + * AssembleLink's way of telling us that + * the sym link is relative to the dir + * containing the link. We have a ref + * to it in dirScp, and we hold it now + * and reuse it as the new spot in the + * dir hierarchy. + */ + if (tscp == NULL) { + cm_HoldSCache(dirScp); + tscp = dirScp; + } + } /* if we have a sym link */ + else { + /* not a symlink, we may be done */ + lock_ReleaseMutex(&tscp->mx); + if (tc == 0) { + if (phase == 1) { + phase = 2; + tp = pathp; + continue; + } + cm_ReleaseSCache(dirScp); + code = 0; + break; + } + } + cm_ReleaseSCache(dirScp); + } /* end of a component */ + else *cp++ = tc; + } /* we have a component */ + } /* big while loop over all components */ /* already held */ - if (psp) cm_FreeSpace(psp); + if (psp) cm_FreeSpace(psp); if (code == 0) *outScpp = tscp; return code; } diff --git a/src/WINNT/afsd/fs_utils.c b/src/WINNT/afsd/fs_utils.c index 4979eafa8..064f1f986 100644 --- a/src/WINNT/afsd/fs_utils.c +++ b/src/WINNT/afsd/fs_utils.c @@ -130,12 +130,12 @@ struct hostent *hostutil_GetHostByName(char *namep) } /* get hostname or addr, given addr in network byte order */ -char *hostutil_GetNameByINet(long addr) +char *hostutil_GetNameByINet(afs_uint32 addr) { static char hostNameBuffer[256]; struct hostent *thp; - thp = gethostbyaddr((char *) &addr, sizeof(long), AF_INET); + thp = gethostbyaddr((char *) &addr, sizeof(afs_uint32), AF_INET); if (thp) strcpy(hostNameBuffer, thp->h_name); else { diff --git a/src/WINNT/afsd/fs_utils.h b/src/WINNT/afsd/fs_utils.h index cdac4fc8a..dabe1aeb6 100644 --- a/src/WINNT/afsd/fs_utils.h +++ b/src/WINNT/afsd/fs_utils.h @@ -25,7 +25,9 @@ /* Fake error code since NT errno.h doesn't define it */ #include -//extern char *hostutil_GetNameByINet(long addr); +#ifndef hostutil_GetNameByINet +extern char *hostutil_GetNameByINet(afs_uint32 addr); +#endif #ifndef hostutil_GetHostByName extern struct hostent *hostutil_GetHostByName(char *namep); diff --git a/src/WINNT/afsd/lanahelper.cpp b/src/WINNT/afsd/lanahelper.cpp new file mode 100644 index 000000000..eaeb323d6 --- /dev/null +++ b/src/WINNT/afsd/lanahelper.cpp @@ -0,0 +1,318 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "lanahelper.h" + + +extern "C" void afsi_log(...); + +static HRESULT getname_shellfolder(WCHAR *wGuid, WCHAR *wName, int NameSize) +{ + // This is the GUID for the network connections folder. It is constant. + // {7007ACC7-3202-11D1-AAD2-00805FC1270E} + const GUID CLSID_NetworkConnections = { + 0x7007ACC7, 0x3202, 0x11D1, { + 0xAA, 0xD2, 0x00, 0x80, 0x5F, 0xC1, 0x27, 0x0E + } + }; + LPITEMIDLIST pidl; + IShellFolder *pShellFolder; + IMalloc *pShellMalloc; + + // Build the display name in the form "::{GUID}". + if (wcslen(wGuid) >= MAX_PATH) + return E_INVALIDARG; + WCHAR szAdapterGuid[MAX_PATH + 2]; + swprintf(szAdapterGuid, L"::%ls", wGuid); + + // Initialize COM. + CoInitialize(NULL); + + // Get the shell allocator. + HRESULT hr = SHGetMalloc(&pShellMalloc); + if (SUCCEEDED(hr)) + // Create an instance of the network connections folder. + hr = CoCreateInstance(CLSID_NetworkConnections, NULL, + CLSCTX_INPROC_SERVER, IID_IShellFolder, + reinterpret_cast(&pShellFolder)); + if (SUCCEEDED(hr)) + hr = pShellFolder->ParseDisplayName(NULL, NULL, szAdapterGuid, NULL, + &pidl, NULL); + if (SUCCEEDED(hr)) { + // Get the display name; this returns the friendly name. + STRRET sName; + hr = pShellFolder->GetDisplayNameOf(pidl, SHGDN_NORMAL, &sName); + if (SUCCEEDED(hr)) + wcsncpy(wName, sName.pOleStr, NameSize); + pShellMalloc->Free(pidl); + } + + CoUninitialize(); + return hr; +} + +// Get the Connection Name for the given GUID. +extern "C" int lana_GetNameFromGuid(char *Guid, char **Name) +{ + typedef HRESULT (WINAPI *HrLanProcAddr)(GUID *, PCWSTR, PWSTR, LPDWORD); + HrLanProcAddr HrLanProc = NULL; + HMODULE hNetMan; + int size; + WCHAR *wGuid = NULL; + WCHAR wName[MAX_PATH]; + DWORD NameSize = (sizeof(wName) / sizeof(wName[0])); + HRESULT status; + + // Convert the Guid string to Unicode. First we ask only for the size + // of the converted string. Then we allocate a buffer of sufficient + // size to hold the result of the conversion. + size = MultiByteToWideChar(CP_ACP, 0, Guid, -1, NULL, 0); + wGuid = (WCHAR *) malloc(size * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, Guid, -1, wGuid, size); + + // First try the IShellFolder interface, which was unimplemented + // for the network connections folder before XP. + + /* XXX pbh 9/11/03 - revert to using the undocumented APIs on XP while + * waiting tohear back from PSS about the slow reboot issue. + * This is an ungly, misleading hack, but is minimally invasive + * and will be easy to rollback. + */ + + //status = getname_shellfolder(wGuid, wName, NameSize); + status = E_NOTIMPL; + + /* XXX end of pbh 9/11/03 temporary hack*/ + + if (status == E_NOTIMPL) { + // The IShellFolder interface is not implemented on this platform. + // Try the (undocumented) HrLanConnectionNameFromGuidOrPath API + // from the netman DLL. + afsi_log("IShellFolder API not implemented, trying HrLanConnectionNameFromGuidOrPath"); + hNetMan = LoadLibrary("netman.dll"); + if (hNetMan == NULL) { + free(wGuid); + return -1; + } + HrLanProc = + (HrLanProcAddr) GetProcAddress(hNetMan, + "HrLanConnectionNameFromGuidOrPath"); + if (HrLanProc == NULL) { + FreeLibrary(hNetMan); + free(wGuid); + return -1; + } + status = HrLanProc(NULL, wGuid, wName, &NameSize); + FreeLibrary(hNetMan); + } + free(wGuid); + if (FAILED(status)) { + afsi_log("lana_GetNameFromGuid: failed to get connection name (status %ld)", + status); + return -1; + } + + // Get the required buffer size, and then convert the string. + size = WideCharToMultiByte(CP_ACP, 0, wName, -1, NULL, 0, NULL, NULL); + *Name = (char *) malloc(size); + if (*Name == NULL) + return -1; + WideCharToMultiByte(CP_ACP, 0, wName, -1, *Name, size, NULL, NULL); + afsi_log("Connection name for %s is '%s'", Guid, *Name); + return 0; +} + +// Find the lana number for the given connection name. +extern "C" lana_number_t lana_FindLanaByName(const char *LanaName) +{ + const char RegNetBiosLinkageKeyName[] = + "System\\CurrentControlSet\\Services\\NetBios\\Linkage"; + HKEY hkey; + LONG status; + struct { + BYTE flags; + BYTE number; + } lanamap[MAX_LANA+1]; + DWORD lanamapsize = sizeof(lanamap); + DWORD type; + char *bindpaths = NULL; + DWORD bindpathsize; + int nlana; + int i; + char *guid; + char *name; + char *pBind; + char *p; + + // Open the NetBios Linkage key. + status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, RegNetBiosLinkageKeyName, 0, + KEY_QUERY_VALUE, &hkey); + + if (status != ERROR_SUCCESS) { + afsi_log("Failed to open NetBios Linkage key (status %ld)", status); + return LANA_INVALID; + } + + // Read the lana map. + status = RegQueryValueEx(hkey, "LanaMap", 0, &type, + (BYTE *) &lanamap, &lanamapsize); + if (status != ERROR_SUCCESS) { + afsi_log("Failed to read LanaMap (status %ld)", status); + RegCloseKey(hkey); + return LANA_INVALID; + } + if (lanamapsize == 0) { + afsi_log("No data in LanaMap"); + return LANA_INVALID; + } + nlana = lanamapsize / sizeof(lanamap[0]); + + // Get the bind paths for NetBios so we can match them up + // with the lana map. First we query for the size, so we + // can allocate an appropriate buffer. + status = RegQueryValueEx(hkey, "Bind", 0, &type, NULL, &bindpathsize); + if (status == ERROR_SUCCESS && bindpathsize != 0) { + bindpaths = (char *) malloc(bindpathsize * sizeof(char)); + if (bindpaths == NULL) { + afsi_log("Cannot allocate %ld bytes for bindpaths", bindpathsize); + RegCloseKey(hkey); + return LANA_INVALID; + } + status = RegQueryValueEx(hkey, "Bind", 0, &type, + (BYTE *) bindpaths, &bindpathsize); + } + RegCloseKey(hkey); + if (status != ERROR_SUCCESS) { + afsi_log("Failed to read bind paths (status %ld)", status); + if (bindpaths != NULL) + free(bindpaths); + return LANA_INVALID; + } + if (bindpathsize == 0) { + afsi_log("No bindpath data"); + if (bindpaths != NULL) + free(bindpaths); + return LANA_INVALID; + } + + // Iterate over the lana map entries and bind paths. + for (i = 0, pBind = bindpaths; i < nlana; + i++, pBind += strlen(pBind) + 1) { + // Ignore an invalid map entry. + if ((lanamap[i].flags & 1) == 0) + continue; + + // check for a IPv4 binding + if(!strstr(pBind,"_Tcpip_")) + continue; + + // Find the beginning of the GUID. + guid = strchr(pBind, '{'); + if (guid == NULL) + continue; // Malformed path entry? + guid = strdup(guid); + if (guid == NULL) + continue; + // Find the end of the GUID. + p = strchr(guid, '}'); + if (p == NULL) { + free(guid); // Malformed GUID? + continue; + } + *++p = '\0'; // Ignore anything after the GUID. + status = lana_GetNameFromGuid(guid, &name); + free(guid); + if (status == 0) { + status = strcmp(name, LanaName); + free(name); + if (status == 0) { + free(bindpaths); + afsi_log("lana_FindLanaByName: Found lana %d for %s", + lanamap[i].number, LanaName); + return lanamap[i].number; + } + } + } + free(bindpaths); + return LANA_INVALID; +} + +extern "C" lana_number_t lana_FindLoopback(void) +{ + NCB ncb; + LANA_ENUM lana_list; + int status; + int i; + + memset(&ncb, 0, sizeof(ncb)); + ncb.ncb_command = NCBENUM; + ncb.ncb_buffer = (UCHAR *) &lana_list; + ncb.ncb_length = sizeof(lana_list); + status = Netbios(&ncb); + if (status != 0) { + afsi_log("Netbios NCBENUM failed: status %ld", status); + return LANA_INVALID; + } + for (i = 0; i < lana_list.length; i++) { + if (lana_IsLoopback(lana_list.lana[i])) { + // Found one, return it. + afsi_log("lana_FindLoopback: Found LAN adapter %d", + lana_list.lana[i]); + return lana_list.lana[i]; + } + } + // Could not find a loopback adapter. + return LANA_INVALID; +} + +// Is the given lana a Windows Loopback Adapter? +extern "C" BOOL lana_IsLoopback(lana_number_t lana) +{ + NCB ncb; + struct { + ADAPTER_STATUS status; + NAME_BUFFER names[MAX_LANA+1]; + } astat; + unsigned char kWLA_MAC[6] = { 0x02, 0x00, 0x4c, 0x4f, 0x4f, 0x50 }; + int status; + + // Reset the adapter: in Win32, this is required for every process, and + // acts as an init call, not as a real hardware reset. + memset(&ncb, 0, sizeof(ncb)); + ncb.ncb_command = NCBRESET; + ncb.ncb_callname[0] = 100; + ncb.ncb_callname[2] = 100; + ncb.ncb_lana_num = lana; + status = Netbios(&ncb); + if (status == 0) + status = ncb.ncb_retcode; + if (status != 0) { + afsi_log("NCBRESET failed: lana %u, status %ld", lana, status); + return FALSE; + } + + // Use the NCBASTAT command to get the adapter address. + memset(&ncb, 0, sizeof(ncb)); + ncb.ncb_command = NCBASTAT; + ncb.ncb_lana_num = lana; + strcpy((char *) ncb.ncb_callname, "* "); + ncb.ncb_buffer = (UCHAR *) &astat; + ncb.ncb_length = sizeof(astat); + status = Netbios(&ncb); + if (status == 0) + status = ncb.ncb_retcode; + if (ncb.ncb_retcode != 0) { + afsi_log("NCBASTAT failed: lana %u, status %ld", lana, status); + return FALSE; + } + return (memcmp(astat.status.adapter_address, kWLA_MAC, 6) == 0); +} diff --git a/src/WINNT/afsd/lanahelper.h b/src/WINNT/afsd/lanahelper.h new file mode 100644 index 000000000..45264648b --- /dev/null +++ b/src/WINNT/afsd/lanahelper.h @@ -0,0 +1,21 @@ +#include + +#ifdef __cplusplus +extern "C" { +#endif + + typedef BYTE lana_number_t; + +#define LANA_INVALID 0xff + + int lana_GetNameFromGuid(char *Guid, char **Name); + + lana_number_t lana_FindLanaByName(const char *LanaName); + + lana_number_t lana_FindLoopback(void); + + BOOL lana_IsLoopback(lana_number_t lana); + +#ifdef __cplusplus +} +#endif diff --git a/src/WINNT/afsd/smb.c b/src/WINNT/afsd/smb.c index 0be9cff9d..ecb2ab41e 100644 --- a/src/WINNT/afsd/smb.c +++ b/src/WINNT/afsd/smb.c @@ -32,6 +32,7 @@ #include "afsd.h" #include "smb.h" +#include "lanahelper.h" /* These characters are illegal in Windows filenames */ static char *illegalChars = "\\/:*?\"<>|"; @@ -40,6 +41,7 @@ BOOL isWindows2000 = FALSE; smb_vc_t *dead_vcp = NULL; smb_vc_t *active_vcp = NULL; +/* TODO; logout mechanism needs to be thread-safe */ char *loggedOutName = NULL; smb_user_t *loggedOutUserp = NULL; unsigned long loggedOutTime; @@ -83,6 +85,9 @@ int smb_NumServerThreads; int numNCBs, numSessions; +int smb_maxVCPerServer; +int smb_maxMpxRequests; + #define NCBmax 100 EVENT_HANDLE NCBavails[NCBmax], NCBevents[NCBmax]; EVENT_HANDLE **NCBreturns; @@ -128,6 +133,9 @@ long smb_dirSearchCounter = 1; smb_dirSearch_t *smb_firstDirSearchp; smb_dirSearch_t *smb_lastDirSearchp; +/* hide dot files? */ +int smb_hideDotFiles; + /* global state about V3 protocols */ int smb_useV3; /* try to negotiate V3 */ @@ -145,7 +153,7 @@ long smb_localZero; /* Time difference for converting to kludge-GMT */ int smb_NowTZ; -char *smb_localNamep; +char *smb_localNamep = NULL; smb_vc_t *smb_allVCsp; @@ -158,6 +166,10 @@ void smb_DispatchPacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp, NCB *ncbp, raw_write_cont_t *rwcp); void smb_NetbiosInit(); #ifdef DJGPP +#ifndef AFS_WIN95_ENV +DWORD smb_ServerExceptionFilter(void); +#endif + extern char cm_HostName[]; extern char cm_confDir[]; #endif @@ -326,7 +338,7 @@ unsigned int smb_Attributes(cm_scache_t *scp) if (scp->fileType == CM_SCACHETYPE_DIRECTORY || scp->fileType == CM_SCACHETYPE_MOUNTPOINT) - attrs = 0x10; + attrs = SMB_ATTR_DIRECTORY; else attrs = 0; @@ -338,11 +350,33 @@ unsigned int smb_Attributes(cm_scache_t *scp) if ((scp->unixModeBits & 0222) == 0 || (scp->flags & CM_SCACHEFLAG_RO)) #endif if ((scp->unixModeBits & 0222) == 0) - attrs |= 1; /* turn on read-only flag */ + attrs |= SMB_ATTR_READONLY; /* turn on read-only flag */ return attrs; } +/* Check if the named file/dir is a dotfile/dotdir */ +/* String pointed to by lastComp can have leading slashes, but otherwise should have + no other patch components */ +unsigned int smb_IsDotFile(char *lastComp) { + char *s; + if(lastComp) { + /* skip over slashes */ + for(s=lastComp;*s && (*s == '\\' || *s == '/'); s++); + } + else + return 0; + + /* nulls, curdir and parent dir doesn't count */ + if(!*s) return 0; + if(*s == '.') { + if(!*(s + 1)) return 0; + if(*(s+1) == '.' && !*(s + 2)) return 0; + return 1; + } + return 0; +} + static int ExtractBits(WORD bits, short start, short len) { int end; @@ -814,6 +848,7 @@ smb_username_t *smb_FindUserByName(char *usern, char *machine, int flags) if (!unp && (flags & SMB_FLAG_CREATE)) { unp = malloc(sizeof(*unp)); memset(unp, 0, sizeof(*unp)); + unp->refCount = 1; unp->nextp = usernamesp; unp->name = strdup(usern); unp->machine = strdup(machine); @@ -904,6 +939,8 @@ char *smb_GetTIDPath(smb_vc_t *vcp, unsigned short tid) char *tpath; tidp = smb_FindTID(vcp, tid, 0); + if (!tidp) + return NULL; tpath = tidp->pathname; smb_ReleaseTID(tidp); return tpath; @@ -977,6 +1014,9 @@ void smb_ReleaseFID(smb_fid_t *fidp) smb_vc_t *vcp; smb_ioctl_t *ioctlp; + if (!fidp) + return NULL; + scp = NULL; lock_ObtainWrite(&smb_rctLock); osi_assert(fidp->refCount-- > 0); @@ -1159,7 +1199,8 @@ int smb_FindShare(smb_vc_t *vcp, smb_packet_t *inp, char *shareName, else smb_subst(p, var, sizeof(VNUserName), " "); - smb_ReleaseUID(uidp); + if (uidp) + smb_ReleaseUID(uidp); } else if (var = smb_stristr(p, VNLCUserName)) { uidp = smb_FindUID(vcp, ((smb_t *)inp)->uid, 0); @@ -1168,7 +1209,8 @@ int smb_FindShare(smb_vc_t *vcp, smb_packet_t *inp, char *shareName, else strcpy(temp, " "); _strlwr(temp); smb_subst(p, var, sizeof(VNLCUserName), temp); - smb_ReleaseUID(uidp); + if (uidp) + smb_ReleaseUID(uidp); } else if (var = smb_stristr(p, VNComputerName)) { sizeTemp = sizeof(temp); @@ -1370,7 +1412,8 @@ static smb_packet_t *GetPacket(void) lock_ObtainWrite(&smb_globalLock); tbp = smb_packetFreeListp; - if (tbp) smb_packetFreeListp = tbp->nextp; + if (tbp) + smb_packetFreeListp = tbp->nextp; lock_ReleaseWrite(&smb_globalLock); if (!tbp) { #ifndef DJGPP @@ -1389,6 +1432,7 @@ static smb_packet_t *GetPacket(void) tbp->oddByte = 0; tbp->ncb_length = 0; tbp->flags = 0; + tbp->spacep = NULL; #ifdef DJGPP npar = SMB_PACKETSIZE >> 4; /* number of paragraphs */ @@ -2275,12 +2319,12 @@ long smb_ReceiveNegotiate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) /* compute size of protocol entry */ entryLength = strlen(namep+1); - entryLength += 2; /* 0x02 bytes and null termination */ + entryLength += 2; /* 0x02 bytes and null termination */ - /* advance over this protocol entry */ + /* advance over this protocol entry */ namex += entryLength; - namep += entryLength; - tcounter++; /* which proto entry we're looking at */ + namep += entryLength; + tcounter++; /* which proto entry we're looking at */ } #ifndef NOMOREFILESFIX /* @@ -2289,6 +2333,7 @@ long smb_ReceiveNegotiate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) * ie. the order in which it sends us the protocol list. * * Special handling for Windows 2000 clients (defect 11765 ) + * Proto signature is the same for Win XP. */ if (tcounter == 6) { int i = 0; @@ -2317,8 +2362,7 @@ long smb_ReceiveNegotiate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) */ } } - // NOMOREFILESFIX -#endif +#endif /* NOMOREFILESFIX */ if (NTProtoIndex != -1) { protoIndex = NTProtoIndex; @@ -2338,13 +2382,13 @@ long smb_ReceiveNegotiate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) return CM_ERROR_INVAL; else if (NTProtoIndex != -1) { smb_SetSMBParm(outp, 0, protoIndex); - smb_SetSMBParmByte(outp, 1, 0); /* share level security, no passwd encrypt */ - smb_SetSMBParm(outp, 1, 8); /* max multiplexed requests */ - smb_SetSMBParm(outp, 2, 100); /* max VCs per consumer/server connection */ - smb_SetSMBParmLong(outp, 3, SMB_PACKETSIZE); /* xmit buffer size */ + smb_SetSMBParmByte(outp, 1, 0); /* share level security, no passwd encrypt */ + smb_SetSMBParm(outp, 1, smb_maxMpxRequests); /* max multiplexed requests */ + smb_SetSMBParm(outp, 2, smb_maxVCPerServer); /* max VCs per consumer/server connection */ + smb_SetSMBParmLong(outp, 3, SMB_PACKETSIZE); /* xmit buffer size */ smb_SetSMBParmLong(outp, 5, 65536); /* raw buffer size */ - smb_SetSMBParm(outp, 7, 1); /* next 2: session key */ - smb_SetSMBParm(outp, 8, 1); + smb_SetSMBParm(outp, 7, 1); /* next 2: session key */ + smb_SetSMBParm(outp, 8, 1); /* * Tried changing the capabilities to support for W2K - defect 117695 * Maybe something else needs to be changed here? @@ -2370,8 +2414,8 @@ long smb_ReceiveNegotiate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) smb_SetSMBParm(outp, 0, protoIndex); smb_SetSMBParm(outp, 1, 0); /* share level security, no passwd encrypt */ smb_SetSMBParm(outp, 2, SMB_PACKETSIZE); - smb_SetSMBParm(outp, 3, 8); /* max multiplexed requests */ - smb_SetSMBParm(outp, 4, 100); /* max VCs per consumer/server connection */ + smb_SetSMBParm(outp, 3, smb_maxMpxRequests); /* max multiplexed requests */ + smb_SetSMBParm(outp, 4, smb_maxVCPerServer); /* max VCs per consumer/server connection */ smb_SetSMBParm(outp, 5, 0); /* no support of block mode for read or write */ smb_SetSMBParm(outp, 6, 1); /* next 2: session key */ smb_SetSMBParm(outp, 7, 1); @@ -2578,27 +2622,29 @@ int smb_Get8Dot3MaskFromPath(unsigned char *maskp, unsigned char *pathp) /* names starting with a dot are illegal */ if (*tp == '.') valid8Dot3 = 0; - for(i=0;; i++) { + for(i=0;; i++) { tc = *tp++; - if (tc == 0) return valid8Dot3; - if (tc == '.' || tc == '"') break; - if (i < 8) *up++ = tc; - else valid8Dot3 = 0; - } + if (tc == 0) return valid8Dot3; + if (tc == '.' || tc == '"') break; + if (i < 8) *up++ = tc; + else valid8Dot3 = 0; + } - /* if we get here, tp point after the dot */ - up = maskp+8; /* ext goes here */ - for(i=0;;i++) { - tc = *tp++; - if (tc == 0) return valid8Dot3; - - /* too many dots */ - if (tc == '.' || tc == '"') valid8Dot3 = 0; + /* if we get here, tp point after the dot */ + up = maskp+8; /* ext goes here */ + for(i=0;;i++) { + tc = *tp++; + if (tc == 0) return valid8Dot3; - /* copy extension if not too long */ - if (i < 3) *up++ = tc; - else valid8Dot3 = 0; - } + /* too many dots */ + if (tc == '.' || tc == '"') valid8Dot3 = 0; + + /* copy extension if not too long */ + if (i < 3) *up++ = tc; + else valid8Dot3 = 0; + } + + /* unreachable */ } int smb_Match8Dot3Mask(char *unixNamep, char *maskp) @@ -2743,6 +2789,10 @@ long smb_ApplyDirListPatches(smb_dirListPatch_t **dirPatchespp, attr = smb_Attributes(scp); *dptr++ = attr; + /* check hidden attribute (the flag is only ON when dot file hiding is on ) */ + if( patchp->flags & SMB_DIRLISTPATCH_DOTFILE ) + attr |= SMB_ATTR_HIDDEN; + /* get dos time */ smb_SearchTimeFromUnixTime(&dosTime, scp->clientModTime); @@ -2853,11 +2903,11 @@ long smb_ReceiveCoreSearchDir(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *ou if (attribute & 0x8) return smb_ReceiveCoreSearchVolume(vcp, inp, outp); - osi_Log2(afsd_logp, "SMB receive search dir count %d |%s|", + osi_Log2(afsd_logp, "SMB receive search dir count %d [%s]", maxCount, osi_LogSaveString(afsd_logp, pathp)); if (*pathp == 0) { /* null pathp, treat as root dir */ - if (!(attribute & 0x10)) /* exclude dirs */ + if (!(attribute & SMB_ATTR_DIRECTORY)) /* exclude dirs */ return CM_ERROR_NOFILES; rootPath = 1; } @@ -3115,15 +3165,20 @@ long smb_ReceiveCoreSearchDir(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *ou actualName = shortName; } - if (dep->fid.vnode != 0 && smb_Match8Dot3Mask(actualName, mask)) { - /* this is one of the entries to use: it is not deleted - * and it matches the star pattern we're looking for. - */ + if (dep->fid.vnode != 0 && smb_Match8Dot3Mask(actualName, mask)) { + /* this is one of the entries to use: it is not deleted + * and it matches the star pattern we're looking for. + */ - /* Eliminate entries that don't match requested - attributes */ - if (!(dsp->attribute & 0x10)) /* no directories */ - { + /* Eliminate entries that don't match requested + attributes */ + + /* no hidden files */ + if(smb_hideDotFiles && !(dsp->attribute & SMB_ATTR_HIDDEN) && smb_IsDotFile(actualName)) + goto nextEntry; + + if (!(dsp->attribute & SMB_ATTR_DIRECTORY)) /* no directories */ + { /* We have already done the cm_TryBulkStat above */ fid.cell = scp->fid.cell; fid.volume = scp->fid.volume; @@ -3159,14 +3214,24 @@ long smb_ReceiveCoreSearchDir(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *ou * The replay will happen at a time when it is safe to * unlock the directory. */ - curPatchp = malloc(sizeof(*curPatchp)); - osi_QAdd((osi_queue_t **) &dirListPatchesp, &curPatchp->q); - curPatchp->dptr = op; - curPatchp->fid.cell = scp->fid.cell; - curPatchp->fid.volume = scp->fid.volume; - curPatchp->fid.vnode = ntohl(dep->fid.vnode); - curPatchp->fid.unique = ntohl(dep->fid.unique); - op += 9; /* skip attr, time, date and size */ + curPatchp = malloc(sizeof(*curPatchp)); + osi_QAdd((osi_queue_t **) &dirListPatchesp, &curPatchp->q); + curPatchp->dptr = op; + curPatchp->fid.cell = scp->fid.cell; + curPatchp->fid.volume = scp->fid.volume; + curPatchp->fid.vnode = ntohl(dep->fid.vnode); + curPatchp->fid.unique = ntohl(dep->fid.unique); + + /* do hidden attribute here since name won't be around when applying + * dir list patches + */ + + if ( smb_hideDotFiles && smb_IsDotFile(actualName) ) + curPatchp->flags = SMB_DIRLISTPATCH_DOTFILE; + else + curPatchp->flags = 0; + + op += 9; /* skip attr, time, date and size */ /* zero out name area. The spec says to pad with * spaces, but Samba doesn't, and neither do we. @@ -3458,7 +3523,7 @@ long smb_ReceiveCoreGetFileAttributes(smb_vc_t *vcp, smb_packet_t *inp, smb_pack */ spacep = inp->spacep; smb_StripLastComponent(spacep->data, &lastComp, pathp); - if (strcmp(lastComp, "\\desktop.ini") == 0) { + if (lastComp && stricmp(lastComp, "\\desktop.ini") == 0) { code = cm_NameI(rootScp, spacep->data, caseFold | CM_FLAG_DIRSEARCH | CM_FLAG_FOLLOW, userp, tidPathp, &req, &dscp); @@ -3500,13 +3565,21 @@ long smb_ReceiveCoreGetFileAttributes(smb_vc_t *vcp, smb_packet_t *inp, smb_pack return code; } +#ifdef undef + /* use smb_Attributes instead. Also the fact that a file is in a readonly volume + doesn't mean it shojuld be marked as RO */ + if (newScp->fileType == CM_SCACHETYPE_DIRECTORY || newScp->fileType == CM_SCACHETYPE_MOUNTPOINT) - attrs = 0x10; + attrs = SMB_ATTR_DIRECTORY; else attrs = 0; if ((newScp->unixModeBits & 0222) == 0 || (newScp->flags & CM_SCACHEFLAG_RO)) - attrs |= 1; /* turn on read-only flag */ + attrs |= SMB_ATTR_READONLY; /* turn on read-only flag */ +#else + attrs = smb_Attributes(newScp); +#endif + smb_SetSMBParm(outp, 0, attrs); smb_DosUTimeFromUnixTime(&dosTime, newScp->clientModTime); @@ -3564,11 +3637,21 @@ long smb_ReceiveCoreOpen(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) cm_InitReq(&req); - osi_Log0(afsd_logp, "SMB receive open"); - - pathp = smb_GetSMBData(inp, NULL); - pathp = smb_ParseASCIIBlock(pathp, NULL); + pathp = smb_GetSMBData(inp, NULL); + pathp = smb_ParseASCIIBlock(pathp, NULL); + osi_Log1(afsd_logp, "SMB receive open file [%s]", osi_LogSaveString(afsd_logp, pathp)); + +#ifdef DEBUG_VERBOSE + { + char *hexpath; + + hexpath = osi_HexifyString( pathp ); + DEBUG_EVENT2("AFS", "CoreOpen H[%s] A[%s]", hexpath, pathp); + free(hexpath); + } +#endif + share = smb_GetSMBParm(inp, 0); attribute = smb_GetSMBParm(inp, 1); @@ -3914,22 +3997,21 @@ long smb_ReceiveCoreRename(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) rock.hasTilde = ((strchr(oldLastNamep, '~') != NULL) ? 1 : 0); rock.newNamep = newLastNamep; - /* now search the dir for the pattern, and do the appropriate rename when - * found. - */ - thyper.LowPart = 0; /* search dir from here */ - thyper.HighPart = 0; - /* search for file to already exhist, if so return error*/ - + /* Check if the file already exists; if so return error */ code = cm_Lookup(newDscp,newLastNamep,CM_FLAG_CHECKPATH,userp,&req,&tmpscp); if((code != CM_ERROR_NOSUCHFILE) && (code != CM_ERROR_NOSUCHPATH) && (code != CM_ERROR_NOSUCHVOLUME) ) { cm_ReleaseSCache(tmpscp); return CM_ERROR_EXISTS; /* file exist, do not rename, also fixes move*/ } - code = cm_ApplyDir(oldDscp, smb_RenameProc, &rock, &thyper, userp, &req, NULL); - if (code == CM_ERROR_STOPNOW) + /* Now search the directory for the pattern, and do the appropriate rename when found */ + thyper.LowPart = 0; /* search dir from here */ + thyper.HighPart = 0; + + code = cm_ApplyDir(oldDscp, smb_RenameProc, &rock, &thyper, userp, &req, NULL); + + if (code == CM_ERROR_STOPNOW) code = 0; else if (code == 0) code = CM_ERROR_NOSUCHFILE; @@ -5127,7 +5209,17 @@ long smb_ReceiveCoreCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if (!smb_IsLegalFilename(lastNamep)) return CM_ERROR_BADNTFILENAME; - code = cm_Lookup(dscp, lastNamep, caseFold, userp, &req, &scp); + osi_Log1(afsd_logp, "SMB receive create [%s]", osi_LogSaveString( afsd_logp, pathp )); +#ifdef DEBUG_VERBOSE + { + char *hexp; + hexp = osi_HexifyString( lastNamep ); + DEBUG_EVENT2("AFS", "CoreCreate H[%s] A[%s]", hexp, lastNamep ); + free(hexp); + } +#endif + +code = cm_Lookup(dscp, lastNamep, caseFold, userp, &req, &scp); if (code && code != CM_ERROR_NOSUCHFILE) { cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); @@ -5410,6 +5502,10 @@ void smb_DispatchPacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp, } else { /* bad opcode, fail the request, after displaying it */ +#ifdef NOTSERVICE + smb_LogPacket(inp); +#endif /* NOTSERVICE */ + #ifndef DJGPP if (showErrors) { sprintf(tbuffer, "Received bad SMB req 0x%x", inp->inCom); @@ -5439,6 +5535,9 @@ void smb_DispatchPacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp, ReportEvent(h, EVENTLOG_ERROR_TYPE, 0, 1002, NULL, 1, ncbp->ncb_length, ptbuf, smbp); DeregisterEventSource(h); +#ifdef NOTSERVICE + smb_LogPacket(inp); +#endif /* NOTSERVICE */ #else /* DJGPP */ osi_Log1(afsd_logp, "Invalid SMB message, length %d", ncbp->ncb_length); @@ -5686,8 +5785,9 @@ void smb_Server(VOID *parmp) code = thrd_WaitForMultipleObjects_Event(numNCBs, NCBreturns[myIdx], FALSE, INFINITE); - if (code == WAIT_OBJECT_0) + if (code == WAIT_OBJECT_0) { continue; + } idx_NCB = code - WAIT_OBJECT_0; ncbp = NCBs[idx_NCB]; @@ -5705,7 +5805,8 @@ void smb_Server(VOID *parmp) case NRC_PENDING: /* Can this happen? Or is it just my - * UNIX paranoia? */ + * UNIX paranoia? + */ continue; case NRC_SCLOSED: @@ -5714,29 +5815,34 @@ void smb_Server(VOID *parmp) dead_sessions[idx_session] = TRUE; vcp = smb_FindVC(ncbp->ncb_lsn, 0, lanas[idx_session]); /* Should also release vcp. Also, would do - * sanity check that all TID's are gone. */ - if (dead_vcp) - osi_Log1(afsd_logp, - "dead_vcp already set, %x", - dead_vcp); - if (!dead_vcp - && !(vcp->flags & SMB_VCFLAG_ALREADYDEAD)) { - osi_Log2(afsd_logp, - "setting dead_vcp %x, user struct %x", - vcp, vcp->usersp); - dead_vcp = vcp; - vcp->flags |= SMB_VCFLAG_ALREADYDEAD; - } - if (vcp->justLoggedOut) { - loggedOut = 1; - loggedOutTime = vcp->logoffTime; - loggedOutName = - strdup(vcp->justLoggedOut->unp->name); - loggedOutUserp = vcp->justLoggedOut; - lock_ObtainWrite(&smb_rctLock); - loggedOutUserp->refCount++; - lock_ReleaseWrite(&smb_rctLock); - } + * sanity check that all TID's are gone. + * + * TODO: check if we could use LSNs[idx_session] instead, + * also cleanup after dead vcp + */ + if (vcp) { + if (dead_vcp) + osi_Log1(afsd_logp, + "dead_vcp already set, %x", + dead_vcp); + if (!dead_vcp && !(vcp->flags & SMB_VCFLAG_ALREADYDEAD)) { + osi_Log2(afsd_logp, + "setting dead_vcp %x, user struct %x", + vcp, vcp->usersp); + dead_vcp = vcp; + vcp->flags |= SMB_VCFLAG_ALREADYDEAD; + } + if (vcp->justLoggedOut) { + loggedOut = 1; + loggedOutTime = vcp->logoffTime; + loggedOutName = + strdup(vcp->justLoggedOut->unp->name); + loggedOutUserp = vcp->justLoggedOut; + lock_ObtainWrite(&smb_rctLock); + loggedOutUserp->refCount++; + lock_ReleaseWrite(&smb_rctLock); + } + } goto doneWithNCB; case NRC_INCOMP: @@ -5797,6 +5903,59 @@ void smb_Server(VOID *parmp) smb_maxObsConcurrentCalls = smb_concurrentCalls; vcp = smb_FindVC(ncbp->ncb_lsn, 0, ncbp->ncb_lana_num); + /* + * If at this point vcp is NULL (implies that packet was invalid) + * then we are in big trouble. This means either : + * a) we have the wrong NCB. + * b) Netbios screwed up the call. + * Obviously this implies that + * ( LSNs[idx_session] != ncbp->ncb_lsn || + * lanas[idx_session] != ncbp->ncb_lana_num ) + * Either way, we can't do anything with this packet. + * Log, sleep and resume. + */ + if(!vcp) { + HANDLE h; + char buf[1000]; + char *ptbuf[1]; + + sprintf(buf, + "Bad vcp!! : " + "LSNs[idx_session]=[%d]," + "lanas[idx_session]=[%d]," + "ncbp->ncb_lsn=[%d]," + "ncbp->ncb_lana_num=[%d]", + LSNs[idx_session], + lanas[idx_session], + ncbp->ncb_lsn, + ncbp->ncb_lana_num); + + ptbuf[0] = buf; + + h = RegisterEventSource(NULL,AFS_DAEMON_EVENT_NAME); + if(h) { + ReportEvent(h, EVENTLOG_ERROR_TYPE, 0, 1001, NULL,1,sizeof(*ncbp),ptbuf,(void*)ncbp); + DeregisterEventSource(h); + } + + /* Also log in the trace log. */ + osi_Log4(afsd_logp, "Server: BAD VCP!" + "LSNs[idx_session]=[%d]," + "lanas[idx_session]=[%d]," + "ncbp->ncb_lsn=[%d]," + "ncbp->ncb_lana_num=[%d]", + LSNs[idx_session], + lanas[idx_session], + ncbp->ncb_lsn, + ncbp->ncb_lana_num); + + /* thrd_Sleep(1000); Don't bother sleeping */ + thrd_SetEvent(SessionEvents[idx_session]); + smb_concurrentCalls--; + continue; + } + + vcp->errorCount = 0; bufp = (struct smb_packet *) ncbp->ncb_buffer; #ifdef DJGPP @@ -5811,6 +5970,10 @@ void smb_Server(VOID *parmp) smbp = (smb_t *)bufp->data; outbufp->flags = 0; +#if !defined(DJGPP) && !defined(AFS_WIN32_ENV) + __try + { +#endif if (smbp->com == 0x1d) { /* Special handling for Write Raw */ raw_write_cont_t rwc; @@ -5846,8 +6009,14 @@ void smb_Server(VOID *parmp) thrd_SetEvent(SessionEvents[idx_session]); } else { thrd_SetEvent(SessionEvents[idx_session]); + /* TODO: what else needs to be serialized? */ smb_DispatchPacket(vcp, bufp, outbufp, ncbp, NULL); } +#if !defined(DJGPP) && !defined(AFS_WIN95_ENV) + } + __except( smb_ServerExceptionFilter() ) { + } +#endif smb_concurrentCalls--; @@ -5856,6 +6025,34 @@ doneWithNCB: } } +/* + * Exception filter for the server threads. If an exception occurs in the + * dispatch routines, which is where exceptions are most common, then do a + * force trace and give control to upstream exception handlers. Useful for + * debugging. + */ +#if !defined(DJGPP) && !defined(AFS_WIN95_ENV) +DWORD smb_ServerExceptionFilter(void) { + /* While this is not the best time to do a trace, if it succeeds, then + * we have a trace (assuming tracing was enabled). Otherwise, this should + * throw a second exception. + */ + HANDLE h; + char *ptbuf[1]; + + ptbuf[0] = "Unhandled exception forcing trace"; + + h = RegisterEventSource(NULL,AFS_DAEMON_EVENT_NAME); + if(h) { + ReportEvent(h, EVENTLOG_ERROR_TYPE, 0, 1001, NULL,1,0,ptbuf,NULL); + DeregisterEventSource(h); + } + + afsd_ForceTrace(TRUE); + return EXCEPTION_CONTINUE_SEARCH; +} +#endif + /* * Create a new NCB and associated events, packet buffer, and "space" buffer. * If the number of server threads is M, and the number of live sessions is @@ -5904,6 +6101,10 @@ void smb_Listener(void *parmp) dos_ncb = ((smb_ncb_t *)ncbp)->dos_ncb; #endif /* DJGPP */ + /* retrieve computer name */ + GetComputerName(cname, &cnamelen); + _strupr(cname); + while (1) { memset(ncbp, 0, sizeof(NCB)); flags = 0; @@ -5969,9 +6170,8 @@ void smb_Listener(void *parmp) break; } } - /* get local name and compare */ - GetComputerName(cname, &cnamelen); - _strupr(cname); + + /* compare with local name */ if (!isGateway) if (strncmp(rname, cname, NCBNAMSZ) != 0) flags |= SMB_VCFLAG_REMOTECONN; @@ -5984,7 +6184,7 @@ void smb_Listener(void *parmp) sessionGen++; /* Log session startup */ -#ifdef NOSERVICE +#ifdef NOTSERVICE fprintf(stderr, "New session(ncb_lsn,ncb_lana_num) %d,%d starting from host " "%s\n", ncbp->ncb_lsn,ncbp->ncb_lana_num, rname); @@ -6021,17 +6221,29 @@ void smb_Listener(void *parmp) /* Allocate slot in session arrays */ /* Re-use dead session if possible, otherwise add one more */ - for (i = 0; i < numSessions; i++) { + /* But don't look at session[0], it is reserved */ + for (i = 1; i < numSessions; i++) { if (dead_sessions[i]) { dead_sessions[i] = FALSE; break; } } + + /* assert that we do not exceed the maximum number of sessions or NCBs. + * we should probably want to wait for a session to be freed in case + * we run out. + */ + + osi_assert(i < Sessionmax && numNCBs < NCBmax - 1); + LSNs[i] = ncbp->ncb_lsn; lanas[i] = ncbp->ncb_lana_num; if (i == numSessions) { /* Add new NCB for new session */ + + osi_Log1(afsd_logp, "smb_Listener creating new session %d", i); + InitNCBslot(numNCBs); numNCBs++; thrd_SetEvent(NCBavails[0]); @@ -6095,7 +6307,7 @@ void smb_NetbiosInit() #ifndef DJGPP if (smb_LANadapter == -1) { ncbp->ncb_command = NCBENUM; - ncbp->ncb_buffer = &lana_list; + ncbp->ncb_buffer = (PUCHAR)&lana_list; ncbp->ncb_length = sizeof(lana_list); code = Netbios(ncbp); if (code != 0) { @@ -6346,8 +6558,9 @@ void smb_Init(osi_log_t *logp, char *snamep, int useV3, int LANadapt, /* remember the name */ len = strlen(snamep); - smb_localNamep = malloc(len+1); - strcpy(smb_localNamep, snamep); + smb_localNamep = malloc(len+1); + strcpy(smb_localNamep, snamep); + afsi_log("smb_localNamep is >%s<", smb_localNamep); /* and the global lock */ lock_InitializeRWLock(&smb_globalLock, "smb global lock"); @@ -6439,7 +6652,7 @@ void smb_Init(osi_log_t *logp, char *snamep, int useV3, int LANadapt, smb_dispatchTable[0x0b].procp = smb_ReceiveCoreWrite; smb_dispatchTable[0x0c].procp = smb_ReceiveCoreLockRecord; smb_dispatchTable[0x0d].procp = smb_ReceiveCoreUnlockRecord; - smb_dispatchTable[0x0e].procp = smb_SendCoreBadOp; + smb_dispatchTable[0x0e].procp = smb_SendCoreBadOp; /* create temporary */ smb_dispatchTable[0x0f].procp = smb_ReceiveCoreCreate; smb_dispatchTable[0x10].procp = smb_ReceiveCoreCheckPath; smb_dispatchTable[0x11].procp = smb_SendCoreBadOp; /* process exit */ @@ -6611,11 +6824,92 @@ void smb_Shutdown(void) } #endif /* DJGPP */ +/* Get the UNC \\\ prefix. */ +char *smb_GetSharename() +{ + char *name; + + /* Make sure we have been properly initialized. */ + if (smb_localNamep == NULL) + return NULL; + + /* Allocate space for \\\, plus the + * terminator. + */ + name = malloc(strlen(smb_localNamep) + strlen("ALL") + 4); + sprintf(name, "\\\\%s\\%s", smb_localNamep, "ALL"); + return name; +} + +#ifdef NOTSERVICE + +void smb_LogPacket(smb_packet_t *packet) +{ + BYTE *vp, *cp; + unsigned length, paramlen, datalen, i, j; + char buf[81]; + char hex[]={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; + + if(!packet) return; + + osi_Log0(afsd_logp, "*** SMB packet dump ***"); + + vp = (BYTE *) packet->data; + + datalen = *((WORD*)(vp + (paramlen = ((unsigned)*(vp+20)) << 1))); + length = paramlen + 2 + datalen; + + + for(i=0;i < length; i+=16) + { + memset( buf, ' ', 80 ); + buf[80] = 0; + + itoa( i, buf, 16 ); + + buf[strlen(buf)] = ' '; + + cp = (BYTE*) buf + 7; + + for(j=0;j < 16 && (i+j)> 4]; + *(cp++) = hex[vp[i+j] & 0xf]; + *(cp++) = ' '; + + if(j==7) + { + *(cp++) = '-'; + *(cp++) = ' '; + } + } + + for(j=0;j < 16 && (i+j) vp[i+j] )? vp[i+j]:'.'; + if(j==7) + { + *(cp++) = ' '; + *(cp++) = '-'; + *(cp++) = ' '; + } + } + + *cp = 0; + + osi_Log0( afsd_logp, buf ); + } + + osi_Log0(afsd_logp, "*** End SMB packet dump ***"); + +} + +#endif /* NOTSERVICE */ + int smb_DumpVCP(FILE *outputFile, char *cookie) { int zilch; char output[1024]; - int i; smb_vc_t *vcp; diff --git a/src/WINNT/afsd/smb.h b/src/WINNT/afsd/smb.h index 874cfa568..e0663b702 100644 --- a/src/WINNT/afsd/smb.h +++ b/src/WINNT/afsd/smb.h @@ -258,6 +258,18 @@ typedef struct smb_fid { #define SMB_FID_LOOKSLIKECOPY (SMB_FID_LENGTHSETDONE | SMB_FID_MTIMESETDONE) #define SMB_FID_NTOPEN 0x100 /* have dscp and pathp */ +/* + * SMB file attributes + */ +#define SMB_ATTR_ARCHIVE 0x20 +#define SMB_ATTR_COMPRESSED 0x800 /* file or dir is compressed */ +#define SMB_ATTR_NORMAL 0x80 /* normal file. Only valid if used alone */ +#define SMB_ATTR_HIDDEN 0x2 /* hidden file for the purpose of dir listings */ +#define SMB_ATTR_READONLY 0x1 +#define SMB_ATTR_TEMPORARY 0x100 +#define SMB_ATTR_DIRECTORY 0x10 +#define SMB_ATTR_SYSTEM 0x4 + /* for tracking in-progress directory searches */ typedef struct smb_dirSearch { osi_queue_t q; /* queue of all outstanding cookies */ @@ -281,11 +293,16 @@ typedef struct smb_dirSearch { /* type for patching directory listings */ typedef struct smb_dirListPatch { osi_queue_t q; - char *dptr; /* ptr to attr, time, data, sizel, sizeh */ + char *dptr; /* ptr to attr, time, data, sizel, sizeh */ + long flags; /* flags. See below */ cm_fid_t fid; cm_dirEntry_t *dep; /* temp */ } smb_dirListPatch_t; +/* dirListPatch Flags */ +#define SMB_DIRLISTPATCH_DOTFILE 1 /* the file referenced is a dot file + Note: will not be set if smb_hideDotFiles is false */ + /* waiting lock list elements */ typedef struct smb_waitingLock { osi_queue_t q; @@ -428,6 +445,12 @@ extern osi_rwlock_t smb_rctLock; extern int smb_LogoffTokenTransfer; extern unsigned long smb_LogoffTransferTimeout; +extern int smb_maxVCPerServer; /* max # of VCs per server */ +extern int smb_maxMpxRequests; /* max # of mpx requests */ + +extern int smb_hideDotFiles; +extern unsigned int smb_IsDotFile(char *lastComp); + extern void smb_FormatResponsePacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *op); @@ -461,6 +484,8 @@ extern long smb_ReadData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count, extern BOOL smb_IsLegalFilename(char *filename); +extern char *smb_GetSharename(void); + /* include other include files */ #include "smb3.h" #include "smb_ioctl.h" @@ -468,4 +493,7 @@ extern BOOL smb_IsLegalFilename(char *filename); cm_user_t *smb_FindOrCreateUser(smb_vc_t *vcp, char *usern); +#ifdef NOTSERVICE +extern void smb_LogPacket(smb_packet_t *packet); +#endif /* NOTSERVICE */ #endif /* whole file */ diff --git a/src/WINNT/afsd/smb3.c b/src/WINNT/afsd/smb3.c index 7938f57a4..0a230d12d 100644 --- a/src/WINNT/afsd/smb3.c +++ b/src/WINNT/afsd/smb3.c @@ -7,8 +7,6 @@ * directory or online at http://www.openafs.org/dl/license10.html */ -//#define NOSERVICE 1 - #include #include @@ -70,7 +68,7 @@ unsigned long smb_ExtAttributes(cm_scache_t *scp) if (scp->fileType == CM_SCACHETYPE_DIRECTORY || scp->fileType == CM_SCACHETYPE_MOUNTPOINT) - attrs = 0x10; + attrs = SMB_ATTR_DIRECTORY; else attrs = 0; /* @@ -81,10 +79,10 @@ unsigned long smb_ExtAttributes(cm_scache_t *scp) if ((scp->unixModeBits & 0222) == 0 || (scp->flags & CM_SCACHEFLAG_RO)) #endif if ((scp->unixModeBits & 0222) == 0) - attrs |= 1; /* Read-only */ + attrs |= SMB_ATTR_READONLY; /* Read-only */ if (attrs == 0) - attrs = 0x80; /* FILE_ATTRIBUTE_NORMAL */ + attrs = SMB_ATTR_NORMAL; /* FILE_ATTRIBUTE_NORMAL */ return attrs; } @@ -164,6 +162,8 @@ long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t * if (!userp) userp = cm_NewUser(); lock_ObtainMutex(&vcp->mx); + if (!vcp->uidCounter) + vcp->uidCounter++; /* handle unlikely wraparounds */ newUid = (strlen(usern)==0)?0:vcp->uidCounter++; lock_ReleaseMutex(&vcp->mx); @@ -203,8 +203,9 @@ long smb_ReceiveV3UserLogoffX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *ou inp->flags |= SMB_PACKETFLAG_PROFILE_UPDATE_OK; /* find the tree and free it */ - uidp = smb_FindUID(vcp, ((smb_t *)inp)->uid, 0); - if (uidp) { + uidp = smb_FindUID(vcp, ((smb_t *)inp)->uid, 0); + /* TODO: smb_ReleaseUID() ? */ + if (uidp) { char *s1 = NULL, *s2 = NULL; if (s2 == NULL) s2 = " "; @@ -566,10 +567,15 @@ long smb_ReceiveV3Tran2A(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) parmCount, dataCount); } - /* now copy the parms and data */ + /* now copy the parms and data */ + if ( parmCount != 0 ) + { memcpy(((char *)asp->parmsp) + parmDisp, inp->data + parmOffset, parmCount); + } + if ( dataCount != 0 ) { memcpy(asp->datap + dataDisp, inp->data + dataOffset, dataCount); - + } + /* account for new bytes */ asp->curData += dataCount; asp->curParms += parmCount; @@ -581,10 +587,17 @@ long smb_ReceiveV3Tran2A(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) osi_QRemove((osi_queue_t **) &smb_tran2AssemblyQueuep, &asp->q); lock_ReleaseWrite(&smb_globalLock); - /* now dispatch it */ - osi_LogEvent("AFS-Dispatch-2[%s]",myCrt_2Dispatch(asp->opcode),"vcp[%x] lana[%d] lsn[%d]",(int)vcp,vcp->lana,vcp->lsn); - osi_Log4(afsd_logp,"AFS Server - Dispatch-2 %s vcp[%x] lana[%d] lsn[%d]",myCrt_2Dispatch(asp->opcode),vcp,vcp->lana,vcp->lsn); + /* now dispatch it */ + if ( asp->opcode >= 0 && asp->opcode < 20 && smb_tran2DispatchTable[asp->opcode].procp) { + osi_LogEvent("AFS-Dispatch-2[%s]",myCrt_2Dispatch(asp->opcode),"vcp[%x] lana[%d] lsn[%d]",(int)vcp,vcp->lana,vcp->lsn); + osi_Log4(afsd_logp,"AFS Server - Dispatch-2 %s vcp[%x] lana[%d] lsn[%d]",myCrt_2Dispatch(asp->opcode),vcp,vcp->lana,vcp->lsn); code = (*smb_tran2DispatchTable[asp->opcode].procp)(vcp, asp, outp); + } + else { + osi_LogEvent("AFS-Dispatch-2 [invalid]", NULL, "op[%x] vcp[%x] lana[%d] lsn[%d]", asp->opcode, vcp, vcp->lana, vcp->lsn); + osi_Log4(afsd_logp,"AFS Server - Dispatch-2 [INVALID] op[%x] vcp[%x] lana[%d] lsn[%d]", asp->opcode, vcp, vcp->lana, vcp->lsn); + code = CM_ERROR_BADOP; + } /* if an error is returned, we're supposed to send an error packet, * otherwise the dispatched function already did the data sending. @@ -707,7 +720,24 @@ long smb_ReceiveTran2Open(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op) return 0; } +#ifdef DEBUG_VERBOSE + { + char *hexp, *asciip; + asciip = (lastNamep ? lastNamep : pathp); + hexp = osi_HexifyString( asciip ); + DEBUG_EVENT2("AFS","T2Open H[%s] A[%s]", hexp, asciip); + free(hexp); + } +#endif + userp = smb_GetTran2User(vcp, p); + /* In the off chance that userp is NULL, we log and abandon */ + if(!userp) { + osi_Log1(afsd_logp, "ReceiveTran2Open user [%d] not resolvable", p->uid); + smb_FreeTran2Packet(outp); + return CM_ERROR_BADSMB; + } + tidPathp = smb_GetTIDPath(vcp, p->tid); dscp = NULL; @@ -776,7 +806,7 @@ long smb_ReceiveTran2Open(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op) } else openAction = 1; /* found existing file */ } - else if (!(openFun & 0x10)) { + else if (!(openFun & SMB_ATTR_DIRECTORY)) { /* don't create if not found */ if (dscp) cm_ReleaseSCache(dscp); osi_assert(scp == NULL); @@ -858,8 +888,8 @@ long smb_ReceiveTran2Open(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op) if (extraInfo) { outp->parmsp[parmSlot] = smb_Attributes(scp); parmSlot++; smb_SearchTimeFromUnixTime(&dosTime, scp->clientModTime); - outp->parmsp[parmSlot] = dosTime & 0xffff; parmSlot++; - outp->parmsp[parmSlot] = (dosTime>>16) & 0xffff; parmSlot++; + outp->parmsp[parmSlot] = (unsigned short)(dosTime & 0xffff); parmSlot++; + outp->parmsp[parmSlot] = (unsigned short)((dosTime>>16) & 0xffff); parmSlot++; outp->parmsp[parmSlot] = (unsigned short) (scp->length.LowPart & 0xffff); parmSlot++; outp->parmsp[parmSlot] = (unsigned short) ((scp->length.LowPart >> 16) & 0xffff); @@ -934,19 +964,19 @@ long smb_ReceiveTran2QFSInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t * case 2: /* volume info */ - qi.u.volumeInfo.vsn = 1234; - qi.u.volumeInfo.vnCount = 4; + qi.u.volumeInfo.vsn = 1234; + qi.u.volumeInfo.vnCount = 4; /* we're supposed to pad it out with zeroes to the end */ memset(&qi.u.volumeInfo.label, 0, sizeof(qi.u.volumeInfo.label)); - strcpy(qi.u.volumeInfo.label, "AFS"); + memcpy(qi.u.volumeInfo.label, "AFS", 4); break; case 0x102: /* FS volume info */ memset((char *)&qi.u.FSvolumeInfo.vct, 0, sizeof(FILETIME)); qi.u.FSvolumeInfo.vsn = 1234; - qi.u.FSvolumeInfo.vnCount = 4; - strcpy(qi.u.FSvolumeInfo.label, "AFS"); + qi.u.FSvolumeInfo.vnCount = 8; + memcpy(qi.u.FSvolumeInfo.label, "A\0F\0S\0\0", 8); break; case 0x103: @@ -1125,6 +1155,11 @@ long smb_ReceiveTran2QPathInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t } userp = smb_GetTran2User(vcp, p); + if(!userp) { + osi_Log1(afsd_logp, "ReceiveTran2QPathInfo unable to resolve user [%d]", p->uid); + smb_FreeTran2Packet(outp); + return CM_ERROR_BADSMB; + } tidPathp = smb_GetTIDPath(vcp, p->tid); @@ -1147,34 +1182,35 @@ long smb_ReceiveTran2QPathInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t smb_StripLastComponent(spacep->data, &lastComp, (char *)(&p->parmsp[3])); /* Make sure that lastComp is not NULL */ - if (lastComp) + if (lastComp) { if (strcmp(lastComp, "\\desktop.ini") == 0) { - code = cm_NameI(cm_rootSCachep, spacep->data, - CM_FLAG_CASEFOLD - | CM_FLAG_DIRSEARCH - | CM_FLAG_FOLLOW, - userp, tidPathp, &req, &dscp); - if (code == 0) { - if (dscp->fileType == CM_SCACHETYPE_MOUNTPOINT - && !dscp->mountRootFidp) - code = CM_ERROR_NOSUCHFILE; - else if (dscp->fileType == CM_SCACHETYPE_DIRECTORY) { - cm_buf_t *bp = buf_Find(dscp, &hzero); - if (bp) - buf_Release(bp); - else - code = CM_ERROR_NOSUCHFILE; - } - cm_ReleaseSCache(dscp); - if (code) { - cm_FreeSpace(spacep); - cm_ReleaseUser(userp); - smb_SendTran2Error(vcp, p, opx, code); - smb_FreeTran2Packet(outp); - return 0; - } - } - } + code = cm_NameI(cm_rootSCachep, spacep->data, + CM_FLAG_CASEFOLD + | CM_FLAG_DIRSEARCH + | CM_FLAG_FOLLOW, + userp, tidPathp, &req, &dscp); + if (code == 0) { + if (dscp->fileType == CM_SCACHETYPE_MOUNTPOINT + && !dscp->mountRootFidp) + code = CM_ERROR_NOSUCHFILE; + else if (dscp->fileType == CM_SCACHETYPE_DIRECTORY) { + cm_buf_t *bp = buf_Find(dscp, &hzero); + if (bp) + buf_Release(bp); + else + code = CM_ERROR_NOSUCHFILE; + } + cm_ReleaseSCache(dscp); + if (code) { + cm_FreeSpace(spacep); + cm_ReleaseUser(userp); + smb_SendTran2Error(vcp, p, opx, code); + smb_FreeTran2Packet(outp); + return 0; + } + } + } + } cm_FreeSpace(spacep); } @@ -1317,6 +1353,11 @@ long smb_ReceiveTran2QFileInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t outp->totalData = nbytesRequired; userp = smb_GetTran2User(vcp, p); + if(!userp) { + osi_Log1(afsd_logp, "ReceiveTran2QFileInfo unable to resolve user [%d]", p->uid); + code = CM_ERROR_BADSMB; + goto done; + } scp = fidp->scp; lock_ObtainMutex(&scp->mx); @@ -1423,6 +1464,11 @@ long smb_ReceiveTran2SetFileInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet outp->totalData = 0; userp = smb_GetTran2User(vcp, p); + if(!userp) { + osi_Log1(afsd_logp,"ReceiveTran2SetFileInfo unable to resolve user [%d]", p->uid); + code = CM_ERROR_BADSMB; + goto done; + } scp = fidp->scp; @@ -1447,10 +1493,12 @@ long smb_ReceiveTran2SetFileInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet attr.mask = 0; lastMod = *((FILETIME *)(p->datap + 16)); - /* when called as result of move a b, lastMod is (-1, -1). If the check for -1 is not present, timestamp - of the resulting file will be 1969 (-1) + /* when called as result of move a b, lastMod is (-1, -1). + * If the check for -1 is not present, timestamp + * of the resulting file will be 1969 (-1) */ - if (LargeIntegerNotEqualToZero(*((LARGE_INTEGER *)&lastMod)) && lastMod.dwLowDateTime != -1 && lastMod.dwHighDateTime != -1) { + if (LargeIntegerNotEqualToZero(*((LARGE_INTEGER *)&lastMod)) && + lastMod.dwLowDateTime != -1 && lastMod.dwHighDateTime != -1) { attr.mask |= CM_ATTRMASK_CLIENTMODTIME; smb_UnixTimeFromLargeSearchTime(&attr.clientModTime, &lastMod); @@ -1614,6 +1662,9 @@ long smb_ApplyV3DirListPatches(cm_scache_t *dscp, /* Copy attributes */ lattr = smb_ExtAttributes(scp); *((u_long *)dptr) = lattr; + /* merge in hidden (dot file) attribute */ + if( patchp->flags & SMB_DIRLISTPATCH_DOTFILE ) + lattr |= SMB_ATTR_HIDDEN; dptr += 4; } else { @@ -1660,6 +1711,9 @@ long smb_ApplyV3DirListPatches(cm_scache_t *dscp, /* finally copy out attributes as short */ attr = smb_Attributes(scp); + /* merge in hidden (dot file) attribute */ + if( patchp->flags & SMB_DIRLISTPATCH_DOTFILE ) + attr |= SMB_ATTR_HIDDEN; *dptr++ = attr & 0xff; *dptr++ = (attr >> 8) & 0xff; } @@ -1929,14 +1983,22 @@ long smb_ReceiveTran2SearchDir(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t osi_LogSaveString(afsd_logp, pathp)); /* bail out if request looks bad */ - if (p->opcode == 1 && !pathp) { - return CM_ERROR_BADSMB; - } + if (p->opcode == 1 && !pathp) { + smb_ReleaseDirSearch(dsp); + smb_FreeTran2Packet(outp); + return CM_ERROR_BADSMB; + } osi_Log2(afsd_logp, "T2 dir search cookie 0x%x, connection %d", nextCookie, dsp->cookie); - userp = smb_GetTran2User(vcp, p); + userp = smb_GetTran2User(vcp, p); + if (!userp) { + osi_Log1(afsd_logp, "T2 dir search unable to resolve user [%d]", p->uid); + smb_ReleaseDirSearch(dsp); + smb_FreeTran2Packet(outp); + return CM_ERROR_BADSMB; + } /* try to get the vnode for the path name next */ lock_ObtainMutex(&dsp->mx); @@ -2038,31 +2100,33 @@ long smb_ReceiveTran2SearchDir(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t curOffset.LowPart &= ~(2048-1); curOffset.LowPart |= temp; - /* check if we've returned all the names that will fit in the - * response packet; we check return count as well as the number - * of bytes requested. We check the # of bytes after we find - * the dir entry, since we'll need to check its size. - */ - if (returnedNames >= maxCount) break; + /* check if we've passed the dir's EOF */ + if (LargeIntegerGreaterThanOrEqualTo(curOffset, dirLength)) { + eos = 1; + break; + } + + /* check if we've returned all the names that will fit in the + * response packet; we check return count as well as the number + * of bytes requested. We check the # of bytes after we find + * the dir entry, since we'll need to check its size. + */ + if (returnedNames >= maxCount) { + break; + } - /* check if we've passed the dir's EOF */ - if (LargeIntegerGreaterThanOrEqualTo(curOffset, dirLength)) { - eos = 1; - break; - } - - /* see if we can use the bufferp we have now; compute in which - * page the current offset would be, and check whether that's - * the offset of the buffer we have. If not, get the buffer. - */ - thyper.HighPart = curOffset.HighPart; - thyper.LowPart = curOffset.LowPart & ~(buf_bufferSize-1); - if (!bufferp || !LargeIntegerEqualTo(thyper, bufferOffset)) { + /* see if we can use the bufferp we have now; compute in which + * page the current offset would be, and check whether that's + * the offset of the buffer we have. If not, get the buffer. + */ + thyper.HighPart = curOffset.HighPart; + thyper.LowPart = curOffset.LowPart & ~(buf_bufferSize-1); + if (!bufferp || !LargeIntegerEqualTo(thyper, bufferOffset)) { /* wrong buffer */ - if (bufferp) { - buf_Release(bufferp); - bufferp = NULL; - } + if (bufferp) { + buf_Release(bufferp); + bufferp = NULL; + } lock_ReleaseMutex(&scp->mx); lock_ObtainRead(&scp->bufCreateLock); code = buf_Get(scp, &thyper, &bufferp); @@ -2176,8 +2240,12 @@ long smb_ReceiveTran2SearchDir(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t /* Eliminate entries that don't match requested attributes */ - if (!(dsp->attribute & 0x10)) /* no directories */ - { + if (smb_hideDotFiles && !(dsp->attribute & SMB_ATTR_HIDDEN) && + smb_IsDotFile(dep->name)) + goto nextEntry; /* no hidden files */ + + if (!(dsp->attribute & SMB_ATTR_DIRECTORY)) /* no directories */ + { /* We have already done the cm_TryBulkStat above */ fid.cell = scp->fid.cell; fid.volume = scp->fid.volume; @@ -2282,6 +2350,13 @@ long smb_ReceiveTran2SearchDir(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t curPatchp->dptr = op; if (infoLevel >= 0x101) curPatchp->dptr += 8; + + if (smb_hideDotFiles && smb_IsDotFile(dep->name)) { + curPatchp->flags = SMB_DIRLISTPATCH_DOTFILE; + } + else + curPatchp->flags = 0; + curPatchp->fid.cell = scp->fid.cell; curPatchp->fid.volume = scp->fid.volume; curPatchp->fid.vnode = ntohl(dep->fid.vnode); @@ -2457,8 +2532,12 @@ long smb_ReceiveV3OpenX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if (lastNamep && strcmp(lastNamep, SMB_IOCTL_FILENAME) == 0) { /* special case magic file name for receiving IOCTL requests - * (since IOCTL calls themselves aren't getting through). - */ + * (since IOCTL calls themselves aren't getting through). + */ +#ifdef NOTSERVICE + osi_Log0(afsd_logp, "IOCTL Open"); +#endif + fidp = smb_FindFID(vcp, 0, SMB_FLAG_CREATE); smb_SetupIoctlFid(fidp, spacep); @@ -2491,7 +2570,16 @@ long smb_ReceiveV3OpenX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) return 0; } - userp = smb_GetUser(vcp, inp); +#ifdef DEBUG_VERBOSE + { + char *hexp, *asciip; + asciip = (lastNamep ? lastNamep : pathp ); + hexp = osi_HexifyString(asciip); + DEBUG_EVENT2("AFS", "V3Open H[%s] A[%s]", hexp, asciip ); + free(hexp); + } +#endif + userp = smb_GetUser(vcp, inp); dscp = NULL; tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); @@ -2887,9 +2975,16 @@ long smb_ReceiveV3SetAttributes(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t * if (searchTime != 0) { smb_UnixTimeFromSearchTime(&unixTime, searchTime); + + if ( unixTime != -1 ) { attrs.mask = CM_ATTRMASK_CLIENTMODTIME; attrs.clientModTime = unixTime; code = cm_SetAttr(scp, &attrs, userp, &req); + + osi_Log1(afsd_logp, "SMB receive V3SetAttributes [fid=%ld]", fid); + } else { + osi_Log1(afsd_logp, "**smb_UnixTimeFromSearchTime failed searchTime=%ld", searchTime); + } } else code = 0; @@ -2993,11 +3088,13 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) cm_scache_t *scp; /* file to create or open */ cm_attr_t setAttr; char *lastNamep; + char *treeStartp; unsigned short nameLength; unsigned int flags; unsigned int requestOpLock; unsigned int requestBatchOpLock; unsigned int mustBeDir; + unsigned int treeCreate; int realDirFlag; unsigned int desiredAccess; unsigned int extAttributes; @@ -3019,6 +3116,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) cm_InitReq(&req); + treeCreate = FALSE; foundscp = FALSE; scp = NULL; @@ -3071,6 +3169,9 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) spacep = inp->spacep; smb_StripLastComponent(spacep->data, &lastNamep, realPathp); + osi_Log1(afsd_logp,"NTCreateX for [%s]",osi_LogSaveString(afsd_logp,realPathp)); + osi_Log4(afsd_logp,"NTCreateX da=[%x] ea=[%x] cd=[%x] co=[%x]", desiredAccess, extAttributes, createDisp, createOptions); + if (lastNamep && strcmp(lastNamep, SMB_IOCTL_FILENAME) == 0) { /* special case magic file name for receiving IOCTL requests * (since IOCTL calls themselves aren't getting through). @@ -3107,19 +3208,41 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) return 0; } - userp = smb_GetUser(vcp, inp); +#ifdef DEBUG_VERBOSE + { + char *hexp, *asciip; + asciip = (lastNamep? lastNamep : realPathp); + hexp = osi_HexifyString( asciip ); + DEBUG_EVENT2("AFS", "NTCreateX H[%s] A[%s]", hexp, asciip); + free(hexp); + } +#endif + userp = smb_GetUser(vcp, inp); + if (!userp) { + osi_Log1(afsd_logp, "NTCreateX Invalid user [%d]", ((smb_t *) inp)->uid); + free(realPathp); + return CM_ERROR_INVAL; + } if (baseFid == 0) { baseDirp = cm_rootSCachep; tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); } else { - baseFidp = smb_FindFID(vcp, baseFid, 0); + baseFidp = smb_FindFID(vcp, baseFid, 0); + if (!baseFidp) { + osi_Log1(afsd_logp, "NTCreateX Invalid base fid [%d]", baseFid); + free(realPathp); + cm_ReleaseUser(userp); + return CM_ERROR_INVAL; + } baseDirp = baseFidp->scp; tidPathp = NULL; } - /* compute open mode */ + osi_Log1(afsd_logp, "NTCreateX tidPathp=[%s]", (tidPathp==NULL)?"null": osi_LogSaveString(afsd_logp,tidPathp)); + + /* compute open mode */ fidflags = 0; if (desiredAccess & DELETE) fidflags |= SMB_FID_OPENDELETE; @@ -3136,25 +3259,65 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if (code != 0 || (fidflags & (SMB_FID_OPENDELETE | SMB_FID_OPENWRITE))) { /* look up parent directory */ - code = cm_NameI(baseDirp, spacep->data, - CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD | CM_FLAG_CHECKPATH, - userp, tidPathp, &req, &dscp); + /* If we are trying to create a path (i.e. multiple nested directories), then we don't *need* + the immediate parent. We have to work our way up realPathp until we hit something that we + recognize. + */ + + while(1) { + char *tp; + + code = cm_NameI(baseDirp, spacep->data, + CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD, + userp, tidPathp, &req, &dscp); + + if(code && + (tp = strrchr(spacep->data,'\\')) && + (createDisp == 2) && + (realDirFlag == 1)) { + *tp++ = 0; + treeCreate = TRUE; + treeStartp = realPathp + (tp - spacep->data); + + if(*tp && !smb_IsLegalFilename(tp)) { + if(baseFid != 0) smb_ReleaseFID(baseFidp); + cm_ReleaseUser(userp); + free(realPathp); + return CM_ERROR_BADNTFILENAME; + } + } + else + break; + } - if (baseFid != 0) smb_ReleaseFID(baseFidp); + if (baseFid != 0) smb_ReleaseFID(baseFidp); - if (code) { - cm_ReleaseUser(userp); - free(realPathp); - return code; - } + if (code) { + osi_Log0(afsd_logp,"NTCreateX parent not found"); + cm_ReleaseUser(userp); + free(realPathp); + return code; + } - if (!lastNamep) lastNamep = realPathp; - else lastNamep++; + if(treeCreate && dscp->fileType == CM_SCACHETYPE_FILE) { + /* A file exists where we want a directory. */ + cm_ReleaseSCache(dscp); + cm_ReleaseUser(userp); + free(realPathp); + return CM_ERROR_EXISTS; + } - if (!smb_IsLegalFilename(lastNamep)) - return CM_ERROR_BADNTFILENAME; + if (!lastNamep) lastNamep = realPathp; + else lastNamep++; - if (!foundscp) { + if (!smb_IsLegalFilename(lastNamep)) { + cm_ReleaseSCache(dscp); + cm_ReleaseUser(userp); + free(realPathp); + return CM_ERROR_BADNTFILENAME; + } + + if (!foundscp && !treeCreate) { code = cm_Lookup(dscp, lastNamep, CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD, userp, &req, &scp); @@ -3175,7 +3338,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) * by dscp, or we may have found the file directly. If code is non-zero, * scp is NULL. */ - if (code == 0) { + if (code == 0 && !treeCreate) { code = cm_CheckNTOpen(scp, desiredAccess, createDisp, userp, &req); if (code) { @@ -3246,48 +3409,95 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) } } else { - /* create directory */ - osi_assert(dscp != NULL); - osi_Log1(afsd_logp, "smb_ReceiveNTCreateX creating directory %s", - osi_LogSaveString(afsd_logp, lastNamep)); + char *tp, *pp; + char *cp; /* This component */ + int clen; /* length of component */ + cm_scache_t *tscp; + int isLast = 0; + + /* create directory */ + if ( !treeCreate ) treeStartp = lastNamep; + osi_assert(dscp != NULL); + osi_Log1(afsd_logp, "smb_ReceiveNTCreateX creating directory [%s]", + osi_LogSaveString(afsd_logp, treeStartp)); openAction = 2; /* created directory */ + setAttr.mask = CM_ATTRMASK_CLIENTMODTIME; setAttr.clientModTime = time(NULL); - code = cm_MakeDir(dscp, lastNamep, 0, &setAttr, userp, &req); - if (code == 0 && (dscp->flags & CM_SCACHEFLAG_ANYWATCH)) - smb_NotifyChange(FILE_ACTION_ADDED, - FILE_NOTIFY_CHANGE_DIR_NAME, - dscp, lastNamep, NULL, TRUE); - if (code == 0 - || (code == CM_ERROR_EXISTS && createDisp != 2)) { - /* Not an exclusive create, and someone else tried - * creating it already, then we open it anyway. We - * don't bother retrying after this, since if this next - * fails, that means that the file was deleted after we - * started this call. - */ - code = cm_Lookup(dscp, lastNamep, CM_FLAG_CASEFOLD, - userp, &req, &scp); + + pp = treeStartp; + cp = spacep->data; + tscp = dscp; + + while(pp && *pp) { + tp = strchr(pp, '\\'); + if(!tp) { + strcpy(cp,pp); + isLast = 1; /* indicate last component. the supplied path never ends in a slash */ + } + else { + clen = tp - pp; + strncpy(cp,pp,clen); + *(cp + clen) = 0; + tp++; + } + pp = tp; + + if(clen == 0) continue; /* the supplied path can't have consecutive slashes either , but */ + + /* cp is the next component to be created. */ + code = cm_MakeDir(tscp, cp, 0, &setAttr, userp, &req); + if (code == 0 && (tscp->flags & CM_SCACHEFLAG_ANYWATCH)) + smb_NotifyChange(FILE_ACTION_ADDED, + FILE_NOTIFY_CHANGE_DIR_NAME, + tscp, cp, NULL, TRUE); + if (code == 0 || + (code == CM_ERROR_EXISTS && createDisp != 2)) { + /* Not an exclusive create, and someone else tried + * creating it already, then we open it anyway. We + * don't bother retrying after this, since if this next + * fails, that means that the file was deleted after we + * started this call. + */ + code = cm_Lookup(tscp, cp, CM_FLAG_CASEFOLD, + userp, &req, &scp); + } + if(code) break; + + if(!isLast) { /* for anything other than dscp, release it unless it's the last one */ + cm_ReleaseSCache(tscp); + tscp = scp; /* Newly created directory will be next parent */ + } } + + /* + if we get here and code == 0, then scp is the last directory created, and tscp is the + parent of scp. dscp got released if dscp != tscp. both tscp and scp are held. + */ + dscp = tscp; } if (code) { /* something went wrong creating or truncating the file */ if (scp) cm_ReleaseSCache(scp); + if (dscp) cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); free(realPathp); return code; } - /* make sure we have file vs. dir right */ + /* make sure we have file vs. dir right (only applies for single component case) */ if (realDirFlag == 0 && scp->fileType != CM_SCACHETYPE_FILE) { cm_ReleaseSCache(scp); + if (dscp) cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); free(realPathp); return CM_ERROR_ISDIR; } + /* (only applies to single component case) */ if (realDirFlag == 1 && scp->fileType == CM_SCACHETYPE_FILE) { cm_ReleaseSCache(scp); + if (dscp) cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); free(realPathp); return CM_ERROR_NOTDIR; @@ -3346,6 +3556,8 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) cm_ReleaseUser(userp); + /* Can't free realPathp if we get here since fidp->NTopen_wholepathp is pointing there */ + /* leave scp held since we put it in fidp->scp */ return 0; } @@ -3369,10 +3581,18 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out unsigned int requestOpLock; unsigned int requestBatchOpLock; unsigned int mustBeDir; + unsigned int extendedRespRequired; int realDirFlag; unsigned int desiredAccess; +#ifdef DEBUG_VERBOSE + unsigned int allocSize; + unsigned int shareAccess; +#endif unsigned int extAttributes; unsigned int createDisp; +#ifdef DEBUG_VERBOSE + unsigned int sdLen; +#endif unsigned int createOptions; int initialModeBits; unsigned short baseFid; @@ -3405,6 +3625,8 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out requestOpLock = flags & 0x02; requestBatchOpLock = flags & 0x04; mustBeDir = flags & 0x08; + extendedRespRequired = flags & 0x10; + /* * Why all of a sudden 32-bit FID? * We will reject all bits higher than 16. @@ -3413,11 +3635,26 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out return CM_ERROR_INVAL; baseFid = (unsigned short)lparmp[1]; desiredAccess = lparmp[2]; +#ifdef DEBUG_VERBOSE + allocSize = lparmp[3]; +#endif /* DEBUG_VERSOSE */ extAttributes = lparmp[5]; +#ifdef DEBUG_VEROSE + shareAccess = lparmp[6]; +#endif createDisp = lparmp[7]; createOptions = lparmp[8]; +#ifdef DEBUG_VERBOSE + sdLen = lparmp[9]; +#endif nameLength = lparmp[11]; +#ifdef DEBUG_VERBOSE + osi_Log4(afsd_logp,"NTTransCreate with da[%x],ea[%x],sa[%x],cd[%x]",desiredAccess,extAttributes,shareAccess,createDisp); + osi_Log2(afsd_logp,"... co[%x],sdl[%x],as[%x]",createOptions,sdLen,allocSize); + osi_Log1(afsd_logp,"... flags[%x]",flags); +#endif + /* mustBeDir is never set; createOptions directory bit seems to be * more important */ @@ -3449,14 +3686,35 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out * Will add it if necessary. */ +#ifdef DEBUG_VERBOSE + { + char *hexp, *asciip; + asciip = (lastNamep? lastNamep : realPathp); + hexp = osi_HexifyString( asciip ); + DEBUG_EVENT2("AFS", "NTTranCreate H[%s] A[%s]", hexp, asciip); + free(hexp); + } +#endif + userp = smb_GetUser(vcp, inp); + if(!userp) { + osi_Log1(afsd_logp, "NTTranCreate invalid user [%d]", ((smb_t *) inp)->uid); + free(realPathp); + return CM_ERROR_INVAL; + } if (baseFid == 0) { baseDirp = cm_rootSCachep; tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); } else { - baseFidp = smb_FindFID(vcp, baseFid, 0); + baseFidp = smb_FindFID(vcp, baseFid, 0); + if(!baseFidp) { + osi_Log1(afsd_logp, "NTTranCreate Invalid fid [%d]", baseFid); + free(realPathp); + cm_ReleaseUser(userp); + return CM_ERROR_INVAL; + } baseDirp = baseFidp->scp; tidPathp = NULL; } @@ -3664,53 +3922,107 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out /* set inp->fid so that later read calls in same msg can find fid */ inp->fid = fidp->fid; - /* out parms */ - parmOffset = 8*4 + 39; - parmOffset += 1; /* pad to 4 */ - dataOffset = parmOffset + 70; + /* check whether we are required to send an extended response */ + if (!extendedRespRequired) { + /* out parms */ + parmOffset = 8*4 + 39; + parmOffset += 1; /* pad to 4 */ + dataOffset = parmOffset + 70; + + parmSlot = 1; + outp->oddByte = 1; + /* Total Parameter Count */ + smb_SetSMBParmLong(outp, parmSlot, 70); parmSlot += 2; + /* Total Data Count */ + smb_SetSMBParmLong(outp, parmSlot, 0); parmSlot += 2; + /* Parameter Count */ + smb_SetSMBParmLong(outp, parmSlot, 70); parmSlot += 2; + /* Parameter Offset */ + smb_SetSMBParmLong(outp, parmSlot, parmOffset); parmSlot += 2; + /* Parameter Displacement */ + smb_SetSMBParmLong(outp, parmSlot, 0); parmSlot += 2; + /* Data Count */ + smb_SetSMBParmLong(outp, parmSlot, 0); parmSlot += 2; + /* Data Offset */ + smb_SetSMBParmLong(outp, parmSlot, dataOffset); parmSlot += 2; + /* Data Displacement */ + smb_SetSMBParmLong(outp, parmSlot, 0); parmSlot += 2; + smb_SetSMBParmByte(outp, parmSlot, 0); /* Setup Count */ + smb_SetSMBDataLength(outp, 70); - parmSlot = 1; - outp->oddByte = 1; - /* Total Parameter Count */ - smb_SetSMBParmLong(outp, parmSlot, 70); parmSlot += 2; - /* Total Data Count */ - smb_SetSMBParmLong(outp, parmSlot, 0); parmSlot += 2; - /* Parameter Count */ - smb_SetSMBParmLong(outp, parmSlot, 70); parmSlot += 2; - /* Parameter Offset */ - smb_SetSMBParmLong(outp, parmSlot, parmOffset); parmSlot += 2; - /* Parameter Displacement */ - smb_SetSMBParmLong(outp, parmSlot, 0); parmSlot += 2; - /* Data Count */ - smb_SetSMBParmLong(outp, parmSlot, 0); parmSlot += 2; - /* Data Offset */ - smb_SetSMBParmLong(outp, parmSlot, dataOffset); parmSlot += 2; - /* Data Displacement */ - smb_SetSMBParmLong(outp, parmSlot, 0); parmSlot += 2; - smb_SetSMBParmByte(outp, parmSlot, 0); /* Setup Count */ - smb_SetSMBDataLength(outp, 70); - - lock_ObtainMutex(&scp->mx); - outData = smb_GetSMBData(outp, NULL); - outData++; /* round to get to parmOffset */ - *outData = 0; outData++; /* oplock */ - *outData = 0; outData++; /* reserved */ - *((USHORT *)outData) = fidp->fid; outData += 2; /* fid */ - *((ULONG *)outData) = openAction; outData += 4; - *((ULONG *)outData) = 0; outData += 4; /* EA error offset */ - smb_LargeSearchTimeFromUnixTime(&ft, scp->clientModTime); - *((FILETIME *)outData) = ft; outData += 8; /* creation time */ - *((FILETIME *)outData) = ft; outData += 8; /* last access time */ - *((FILETIME *)outData) = ft; outData += 8; /* last write time */ - *((FILETIME *)outData) = ft; outData += 8; /* change time */ - *((ULONG *)outData) = smb_ExtAttributes(scp); outData += 4; - *((LARGE_INTEGER *)outData) = scp->length; outData += 8; /* alloc sz */ - *((LARGE_INTEGER *)outData) = scp->length; outData += 8; /* EOF */ - *((USHORT *)outData) = 0; outData += 2; /* filetype */ - *((USHORT *)outData) = 0; outData += 2; /* dev state */ - *((USHORT *)outData) = (scp->fileType == CM_SCACHETYPE_DIRECTORY); - outData += 2; /* is a dir? */ - lock_ReleaseMutex(&scp->mx); + lock_ObtainMutex(&scp->mx); + outData = smb_GetSMBData(outp, NULL); + outData++; /* round to get to parmOffset */ + *outData = 0; outData++; /* oplock */ + *outData = 0; outData++; /* reserved */ + *((USHORT *)outData) = fidp->fid; outData += 2; /* fid */ + *((ULONG *)outData) = openAction; outData += 4; + *((ULONG *)outData) = 0; outData += 4; /* EA error offset */ + smb_LargeSearchTimeFromUnixTime(&ft, scp->clientModTime); + *((FILETIME *)outData) = ft; outData += 8; /* creation time */ + *((FILETIME *)outData) = ft; outData += 8; /* last access time */ + *((FILETIME *)outData) = ft; outData += 8; /* last write time */ + *((FILETIME *)outData) = ft; outData += 8; /* change time */ + *((ULONG *)outData) = smb_ExtAttributes(scp); outData += 4; + *((LARGE_INTEGER *)outData) = scp->length; outData += 8; /* alloc sz */ + *((LARGE_INTEGER *)outData) = scp->length; outData += 8; /* EOF */ + *((USHORT *)outData) = 0; outData += 2; /* filetype */ + *((USHORT *)outData) = 0; outData += 2; /* dev state */ + *((USHORT *)outData) = (scp->fileType == CM_SCACHETYPE_DIRECTORY); + outData += 2; /* is a dir? */ + lock_ReleaseMutex(&scp->mx); + } else { + /* out parms */ + parmOffset = 8*4 + 39; + parmOffset += 1; /* pad to 4 */ + dataOffset = parmOffset + 104; + + parmSlot = 1; + outp->oddByte = 1; + /* Total Parameter Count */ + smb_SetSMBParmLong(outp, parmSlot, 101); parmSlot += 2; + /* Total Data Count */ + smb_SetSMBParmLong(outp, parmSlot, 0); parmSlot += 2; + /* Parameter Count */ + smb_SetSMBParmLong(outp, parmSlot, 101); parmSlot += 2; + /* Parameter Offset */ + smb_SetSMBParmLong(outp, parmSlot, parmOffset); parmSlot += 2; + /* Parameter Displacement */ + smb_SetSMBParmLong(outp, parmSlot, 0); parmSlot += 2; + /* Data Count */ + smb_SetSMBParmLong(outp, parmSlot, 0); parmSlot += 2; + /* Data Offset */ + smb_SetSMBParmLong(outp, parmSlot, dataOffset); parmSlot += 2; + /* Data Displacement */ + smb_SetSMBParmLong(outp, parmSlot, 0); parmSlot += 2; + smb_SetSMBParmByte(outp, parmSlot, 0); /* Setup Count */ + smb_SetSMBDataLength(outp, 105); + + lock_ObtainMutex(&scp->mx); + outData = smb_GetSMBData(outp, NULL); + outData++; /* round to get to parmOffset */ + *outData = 0; outData++; /* oplock */ + *outData = 1; outData++; /* response type */ + *((USHORT *)outData) = fidp->fid; outData += 2; /* fid */ + *((ULONG *)outData) = openAction; outData += 4; + *((ULONG *)outData) = 0; outData += 4; /* EA error offset */ + smb_LargeSearchTimeFromUnixTime(&ft, scp->clientModTime); + *((FILETIME *)outData) = ft; outData += 8; /* creation time */ + *((FILETIME *)outData) = ft; outData += 8; /* last access time */ + *((FILETIME *)outData) = ft; outData += 8; /* last write time */ + *((FILETIME *)outData) = ft; outData += 8; /* change time */ + *((ULONG *)outData) = smb_ExtAttributes(scp); outData += 4; + *((LARGE_INTEGER *)outData) = scp->length; outData += 8; /* alloc sz */ + *((LARGE_INTEGER *)outData) = scp->length; outData += 8; /* EOF */ + *((USHORT *)outData) = 0; outData += 2; /* filetype */ + *((USHORT *)outData) = 0; outData += 2; /* dev state */ + *((USHORT *)outData) = (scp->fileType == CM_SCACHETYPE_DIRECTORY); + outData += 1; /* is a dir? */ + memset(outData,0,24); outData += 24; /* Volume ID and file ID */ + *((ULONG *)outData) = 0x001f01ffL; outData += 4; /* Maxmimal access rights */ + *((ULONG *)outData) = 0; outData += 4; /* Guest Access rights */ + lock_ReleaseMutex(&scp->mx); + } osi_Log1(afsd_logp, "SMB NTTranCreate opening fid %d", fidp->fid); @@ -3718,6 +4030,7 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out cm_ReleaseUser(userp); + /* free(realPathp); Can't free realPathp here because fidp->NTopen_wholepathp points there */ /* leave scp held since we put it in fidp->scp */ return 0; } @@ -3733,10 +4046,16 @@ long smb_ReceiveNTTranNotifyChange(smb_vc_t *vcp, smb_packet_t *inp, filter = smb_GetSMBParm(inp, 19) | (smb_GetSMBParm(inp, 20) << 16); fid = smb_GetSMBParm(inp, 21); - watchtree = smb_GetSMBParm(inp, 22) && 0xffff; + watchtree = smb_GetSMBParm(inp, 22) && 0xffff; /* TODO: should this be 0xff ? */ + + fidp = smb_FindFID(vcp, fid, 0); + if (!fidp) { + osi_Log1(afsd_logp, "ERROR: NotifyChange given invalid fid [%d]", fid); + return CM_ERROR_BADFD; + } savedPacketp = smb_CopyPacket(inp); - savedPacketp->vcp = vcp; + savedPacketp->vcp = vcp; /* TODO: refcount vcp? */ lock_ObtainMutex(&smb_Dir_Watch_Lock); savedPacketp->nextp = smb_Directory_Watches; smb_Directory_Watches = savedPacketp; @@ -3903,7 +4222,7 @@ void smb_NotifyChange(DWORD action, DWORD notifyFilter, filter = smb_GetSMBParm(watch, 19) | (smb_GetSMBParm(watch, 20) << 16); fid = smb_GetSMBParm(watch, 21); - wtree = smb_GetSMBParm(watch, 22) & 0xffff; + wtree = smb_GetSMBParm(watch, 22) & 0xffff; /* TODO: should this be 0xff ? */ maxLen = smb_GetSMBOffsetParm(watch, 5, 1) | (smb_GetSMBOffsetParm(watch, 6, 1) << 16); vcp = watch->vcp; @@ -3916,6 +4235,11 @@ void smb_NotifyChange(DWORD action, DWORD notifyFilter, filter = 0x17; fidp = smb_FindFID(vcp, fid, 0); + if (!fidp) { + lastWatch = watch; + watch = watch->nextp; + continue; + } if (fidp->scp != dscp || (filter & notifyFilter) == 0 || (!isDirectParent && !wtree)) { @@ -4065,19 +4389,22 @@ long smb_ReceiveNTCancel(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) watchtree = smb_GetSMBParm(watch, 22) & 0xffff; fidp = smb_FindFID(vcp, fid, 0); - - osi_Log3(afsd_logp, "Cancelling change notification for fid %d wtree %d file %s", - fid, watchtree, - osi_LogSaveString(afsd_logp, (fidp)?fidp->NTopen_wholepathp:"")); - - scp = fidp->scp; - lock_ObtainMutex(&scp->mx); - if (watchtree) - scp->flags &= ~CM_SCACHEFLAG_WATCHEDSUBTREE; - else - scp->flags &= ~CM_SCACHEFLAG_WATCHED; - lock_ReleaseMutex(&scp->mx); - smb_ReleaseFID(fidp); + if (fidp) { + osi_Log3(afsd_logp, "Cancelling change notification for fid %d wtree %d file %s", + fid, watchtree, + osi_LogSaveString(afsd_logp, (fidp)?fidp->NTopen_wholepathp:"")); + + scp = fidp->scp; + lock_ObtainMutex(&scp->mx); + if (watchtree) + scp->flags &= ~CM_SCACHEFLAG_WATCHEDSUBTREE; + else + scp->flags &= ~CM_SCACHEFLAG_WATCHED; + lock_ReleaseMutex(&scp->mx); + smb_ReleaseFID(fidp); + } else { + osi_Log2(afsd_logp,"NTCancel unable to resolve fid [%d] in vcp[%x]", fid,vcp); + } /* assume STATUS32; return 0xC0000120 (CANCELED) */ replyWctp = watch->wctp; @@ -4108,7 +4435,6 @@ void smb3_Init() cm_user_t *smb_FindCMUserByName(/*smb_vc_t *vcp,*/ char *usern, char *machine) { - cm_user_t *userp; /*int newUid;*/ smb_username_t *unp; diff --git a/src/WINNT/afsd/smb_ioctl.c b/src/WINNT/afsd/smb_ioctl.c index 99b41e981..b8391d342 100644 --- a/src/WINNT/afsd/smb_ioctl.c +++ b/src/WINNT/afsd/smb_ioctl.c @@ -205,8 +205,8 @@ long smb_IoctlRead(smb_fid_t *fidp, smb_vc_t *vcp, smb_packet_t *inp, op = smb_GetSMBData(outp, NULL); *op++ = 1; - *op++ = count & 0xff; - *op++ = (count >> 8) & 0xff; + *op++ = (char)(count & 0xff); + *op++ = (char)((count >> 8) & 0xff); /* now copy the data into the response packet */ memcpy(op, iop->outCopied + iop->outAllocp, count); @@ -293,7 +293,7 @@ long smb_IoctlV3Read(smb_fid_t *fidp, smb_vc_t *vcp, smb_packet_t *inp, smb_pack osi_Log1(afsd_logp, "Ioctl no uid user %x no name", userp); } - smb_ReleaseUID(uidp); + if (uidp) smb_ReleaseUID(uidp); } iop->tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); @@ -381,10 +381,13 @@ long smb_IoctlReadRaw(smb_fid_t *fidp, smb_vc_t *vcp, smb_packet_t *inp, osi_Log3(afsd_logp, "Ioctl uid %d user %x name %s", uidp->userID, userp, osi_LogSaveString(afsd_logp, uidp->unp->name)); - else + else if (uidp) osi_Log2(afsd_logp, "Ioctl uid %d user %x no name", uidp->userID, userp); - smb_ReleaseUID(uidp); + else + osi_Log1(afsd_logp, "Ioctl no uid user %x no name", + userp); + if (uidp) smb_ReleaseUID(uidp); } iop->tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); diff --git a/src/WINNT/afssvrcfg/NTMakefile b/src/WINNT/afssvrcfg/NTMakefile index cccceceb8..b8f2c8c07 100644 --- a/src/WINNT/afssvrcfg/NTMakefile +++ b/src/WINNT/afssvrcfg/NTMakefile @@ -69,7 +69,7 @@ $(EXEFILE): $(EXEOBJS) $(EXELIBS) ############################################################################ # Definitions for generating versioninfo resource via RC -$(OUT)\afscfg_stub.res: AFS_component_version_number.h +$(OUT)\afscfg_stub.res:afscfg_stub.rc AFS_component_version_number.h ############################################################################ # Install target; primary makefile target @@ -82,7 +82,7 @@ install: $(EXEFILE) lang lang:: $(CD) lang - for /f %l in ('dir /B ??_??') do @$(NTLANG) %l $(MAKECMD) /nologo /f NTMakefile install + for /f %l in ('dir /B ??_??') do @$(NTLANG) %l $(MAKECMD) /nologo /e /f NTMakefile install $(CD) .. diff --git a/src/WINNT/afssvrcpa/NTMakefile b/src/WINNT/afssvrcpa/NTMakefile index 3c5210bc0..487e7b215 100644 --- a/src/WINNT/afssvrcpa/NTMakefile +++ b/src/WINNT/afssvrcpa/NTMakefile @@ -34,7 +34,7 @@ $(DLLFILE): $(DLLOBJS) ############################################################################ # Definitions for generating versioninfo resource via RC -$(OUT)\afssvrcpa_stub.res: AFS_component_version_number.h +$(OUT)\afssvrcpa_stub.res: afssvrcpa_stub.rc AFS_component_version_number.h ############################################################################ # Install target; primary makefile target @@ -47,7 +47,7 @@ install: $(DLLFILE) lang lang:: $(CD) lang - for /f %l in ('dir /B ??_??') do @$(NTLANG) %l $(MAKECMD) /nologo /f NTMakefile install + for /f %l in ('dir /B ??_??') do @$(NTLANG) %l $(MAKECMD) /nologo /e /f NTMakefile install $(CD) .. diff --git a/src/WINNT/client_config/NTMakefile b/src/WINNT/client_config/NTMakefile index a6c63f5b4..c18cee513 100644 --- a/src/WINNT/client_config/NTMakefile +++ b/src/WINNT/client_config/NTMakefile @@ -7,7 +7,7 @@ # include the AFSD source tree on our inclusion path -AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) -I..\afsd +AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) /D"_AFXDLL" -I..\afsd # include the primary makefile RELDIR=WINNT\client_config @@ -36,7 +36,10 @@ EXEOBJS = \ $(OUT)\dlg_diag.obj \ $(OUT)\dlg_misc.obj \ $(OUT)\isadmin.obj \ - $(OUT)\dlg_automap.obj + $(OUT)\dlg_automap.obj \ + $(OUT)\dlg_binding.obj \ + $(OUT)\RegistrySupport.obj \ + $(OUT)\getlana.obj EXEOBJSc = \ $(OUT)\cellservdb.obj @@ -52,7 +55,8 @@ AFSD= ..\afsd VCLIBS =\ comctl32.lib \ shell32.lib \ - mpr.lib + mpr.lib \ + netapi32.lib EXELIBS = \ $(DESTDIR)\lib\afs\TaLocale.lib \ @@ -131,61 +135,61 @@ lang:: en_US ja_JP ko_KR zh_TW zh_CN pt_BR es_ES de_DE en_US: $(CD) lang - $(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install + $(NTLANG) $@ $(MAKECMD) /nologo /e /f NTMakefile install $(CD) .. ja_JP: $(CD) lang - @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install + @$(NTLANG) $@ $(MAKECMD) /nologo /e /f NTMakefile install $(CD) .. ko_KR: $(CD) lang - @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install + @$(NTLANG) $@ $(MAKECMD) /nologo /e /f NTMakefile install $(CD) .. zh_CN: $(CD) lang - @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install + @$(NTLANG) $@ $(MAKECMD) /nologo /e /f NTMakefile install $(CD) .. zh_TW: $(CD) lang - @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install + @$(NTLANG) $@ $(MAKECMD) /nologo /e /f NTMakefile install $(CD) .. pt_BR: $(CD) lang - @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install + @$(NTLANG) $@ $(MAKECMD) /nologo /e /f NTMakefile install $(CD) .. es_ES: $(CD) lang - @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install + @$(NTLANG) $@ $(MAKECMD) /nologo /e /f NTMakefile install $(CD) .. de_DE: $(CD) lang - @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install + @$(NTLANG) $@ $(MAKECMD) /nologo /e /f NTMakefile install $(CD) .. -$(OUT)\afs_config_stub.res : AFS_component_version_number.h +$(OUT)\afs_config_stub.res : afs_config_stub.rc AFS_component_version_number.h clean:: $(DEL) $(COPYHEADERS) $(CD) lang - if exist $(NTLANG) $(NTLANG) en_US $(MAKECMD) /nologo /f NTMakefile clean - if exist $(NTLANG) $(NTLANG) ja_JP $(MAKECMD) /nologo /f NTMakefile clean - if exist $(NTLANG) $(NTLANG) ko_KR $(MAKECMD) /nologo /f NTMakefile clean - if exist $(NTLANG) $(NTLANG) zh_CN $(MAKECMD) /nologo /f NTMakefile clean - if exist $(NTLANG) $(NTLANG) zh_TW $(MAKECMD) /nologo /f NTMakefile clean - if exist $(NTLANG) $(NTLANG) pt_BR $(MAKECMD) /nologo /f NTMakefile clean - if exist $(NTLANG) $(NTLANG) es_ES $(MAKECMD) /nologo /f NTMakefile clean - if exist $(NTLANG) $(NTLANG) de_DE $(MAKECMD) /nologo /f NTMakefile clean + if exist $(NTLANG) $(NTLANG) en_US $(MAKECMD) /nologo /e /f NTMakefile clean + if exist $(NTLANG) $(NTLANG) ja_JP $(MAKECMD) /nologo /e /f NTMakefile clean + if exist $(NTLANG) $(NTLANG) ko_KR $(MAKECMD) /nologo /e /f NTMakefile clean + if exist $(NTLANG) $(NTLANG) zh_CN $(MAKECMD) /nologo /e /f NTMakefile clean + if exist $(NTLANG) $(NTLANG) zh_TW $(MAKECMD) /nologo /e /f NTMakefile clean + if exist $(NTLANG) $(NTLANG) pt_BR $(MAKECMD) /nologo /e /f NTMakefile clean + if exist $(NTLANG) $(NTLANG) es_ES $(MAKECMD) /nologo /e /f NTMakefile clean + if exist $(NTLANG) $(NTLANG) de_DE $(MAKECMD) /nologo /e /f NTMakefile clean $(CD) .. mkdir: -mkdir $(OUT)\lang cd lang - nmake /nologo /f ntmakefile SRC=$(SRC) OBJ=$(OBJ) mkdir + nmake /nologo /e /f ntmakefile SRC=$(SRC) OBJ=$(OBJ) mkdir cd .. diff --git a/src/WINNT/client_config/RegistrySupport.cpp b/src/WINNT/client_config/RegistrySupport.cpp new file mode 100644 index 000000000..cf87a181a --- /dev/null +++ b/src/WINNT/client_config/RegistrySupport.cpp @@ -0,0 +1,132 @@ +/*det + * Configuration Read/Modify Functions ________________________________________ + * + * Temporarily these just modify the local Registry. + * In the near future, they will modify the Registry on the + * gateway, if a gateway is being used. + * + */ + +#include +#include +//#include +#include +#include + +BOOL Config_ReadString (LPCTSTR pszLHS, LPTSTR pszRHS, size_t cchMax); + +extern TCHAR AFSConfigKeyName[] = TEXT("SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters"); + +void Config_GetGlobalDriveList (DRIVEMAPLIST *pDriveList) +{ + // Read the GlobalAutoMapper registry key + TCHAR szDriveToMapTo[5]; + DWORD dwResult; + TCHAR szKeyName[256]; + HKEY hKey; + DWORD dwIndex = 0; + DWORD dwDriveSize; + DWORD dwSubMountSize; + TCHAR szSubMount[256]; + DWORD dwType; + + if (!pDriveList) + return; + + memset(pDriveList, 0, sizeof(DRIVEMAPLIST)); + + lstrcpy(szKeyName, AFSConfigKeyName); + lstrcat(szKeyName, TEXT("\\GlobalAutoMapper")); + + dwResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKeyName, 0, KEY_QUERY_VALUE, &hKey); + if (dwResult != ERROR_SUCCESS) + return; + + // Get the drive map list so we can lookup the paths that go with our submounts + DRIVEMAPLIST DriveMapList; + memset(&DriveMapList, 0, sizeof(DRIVEMAPLIST)); + QueryDriveMapList (&DriveMapList); + + while (1) { + dwDriveSize = sizeof(szDriveToMapTo); + dwSubMountSize = sizeof(szSubMount); + + dwResult = RegEnumValue(hKey, dwIndex++, szDriveToMapTo, &dwDriveSize, 0, &dwType, (BYTE*)szSubMount, &dwSubMountSize); + if (dwResult != ERROR_SUCCESS) + break; + + szDriveToMapTo[0] = _totupper(szDriveToMapTo[0]); + + int nCurDrive = szDriveToMapTo[0] - TEXT('A'); + + pDriveList->aDriveMap[nCurDrive].chDrive = szDriveToMapTo[0]; + lstrcpy(pDriveList->aDriveMap[nCurDrive].szSubmount, szSubMount); + + // Find the path that goes with this submount + SubmountToPath (&DriveMapList, pDriveList->aDriveMap[nCurDrive].szMapping, szSubMount, FALSE); + } + + FreeDriveMapList(&DriveMapList); + + RegCloseKey(hKey); +} + +BOOL Config_ReadNum (LPCTSTR pszLHS, DWORD *pdwRHS) +{ + HKEY hk; + if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, AFSConfigKeyName, 0, KEY_QUERY_VALUE, &hk) != ERROR_SUCCESS) + return FALSE; + + DWORD dwSize = sizeof(*pdwRHS); + if (RegQueryValueEx (hk, pszLHS, NULL, NULL, (PBYTE)pdwRHS, &dwSize) != ERROR_SUCCESS) + { + RegCloseKey (hk); + return FALSE; + } + + RegCloseKey (hk); + return TRUE; +} + + +BOOL Config_ReadString (LPCTSTR pszLHS, LPTSTR pszRHS, size_t cchMax) +{ + HKEY hk; + if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, AFSConfigKeyName, 0, KEY_QUERY_VALUE, &hk) != ERROR_SUCCESS) + return FALSE; + + DWORD dwSize = sizeof(TCHAR) * cchMax; + if (RegQueryValueEx (hk, pszLHS, NULL, NULL, (PBYTE)pszRHS, &dwSize) != ERROR_SUCCESS) + { + RegCloseKey (hk); + return FALSE; + } + + RegCloseKey (hk); + return TRUE; +} + + +void Config_WriteNum (LPCTSTR pszLHS, DWORD dwRHS) +{ + HKEY hk; + DWORD dwDisp; + if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, AFSConfigKeyName, 0, TEXT("container"), 0, KEY_SET_VALUE, NULL, &hk, &dwDisp) == ERROR_SUCCESS) + { + RegSetValueEx (hk, pszLHS, NULL, REG_DWORD, (PBYTE)&dwRHS, sizeof(dwRHS)); + RegCloseKey (hk); + } +} + + +void Config_WriteString (LPCTSTR pszLHS, LPCTSTR pszRHS) +{ + HKEY hk; + DWORD dwDisp; + if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, AFSConfigKeyName, 0, TEXT("container"), 0, KEY_SET_VALUE, NULL, &hk, &dwDisp) == ERROR_SUCCESS) + { + RegSetValueEx (hk, pszLHS, NULL, REG_SZ, (PBYTE)pszRHS, sizeof(TCHAR) * (1+lstrlen(pszRHS))); + RegCloseKey (hk); + } +} + diff --git a/src/WINNT/client_config/config.cpp b/src/WINNT/client_config/config.cpp index 69b40c3f1..b9d82e78c 100644 --- a/src/WINNT/client_config/config.cpp +++ b/src/WINNT/client_config/config.cpp @@ -891,126 +891,3 @@ BOOL Config_SetReportSessionStartups (BOOL fFlag, ULONG *pStatus) return TRUE; } -void Config_GetGlobalDriveList (DRIVEMAPLIST *pDriveList) -{ - // Read the GlobalAutoMapper registry key - TCHAR szDriveToMapTo[5]; - DWORD dwResult; - TCHAR szKeyName[256]; - HKEY hKey; - DWORD dwIndex = 0; - DWORD dwDriveSize; - DWORD dwSubMountSize; - TCHAR szSubMount[256]; - DWORD dwType; - - if (!pDriveList) - return; - - memset(pDriveList, 0, sizeof(DRIVEMAPLIST)); - - lstrcpy(szKeyName, AFSConfigKeyName); - lstrcat(szKeyName, TEXT("\\GlobalAutoMapper")); - - dwResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKeyName, 0, KEY_QUERY_VALUE, &hKey); - if (dwResult != ERROR_SUCCESS) - return; - - // Get the drive map list so we can lookup the paths that go with our submounts - DRIVEMAPLIST DriveMapList; - memset(&DriveMapList, 0, sizeof(DRIVEMAPLIST)); - QueryDriveMapList (&DriveMapList); - - while (1) { - dwDriveSize = sizeof(szDriveToMapTo); - dwSubMountSize = sizeof(szSubMount); - - dwResult = RegEnumValue(hKey, dwIndex++, szDriveToMapTo, &dwDriveSize, 0, &dwType, (BYTE*)szSubMount, &dwSubMountSize); - if (dwResult != ERROR_SUCCESS) - break; - - szDriveToMapTo[0] = _totupper(szDriveToMapTo[0]); - - int nCurDrive = szDriveToMapTo[0] - TEXT('A'); - - pDriveList->aDriveMap[nCurDrive].chDrive = szDriveToMapTo[0]; - lstrcpy(pDriveList->aDriveMap[nCurDrive].szSubmount, szSubMount); - - // Find the path that goes with this submount - SubmountToPath (&DriveMapList, pDriveList->aDriveMap[nCurDrive].szMapping, szSubMount, FALSE); - } - - FreeDriveMapList(&DriveMapList); - - RegCloseKey(hKey); -} - - -/* - * Configuration Read/Modify Functions ________________________________________ - * - * Temporarily these just modify the local Registry. - * In the near future, they will modify the Registry on the - * gateway, if a gateway is being used. - * - */ - -BOOL Config_ReadNum (LPCTSTR pszLHS, DWORD *pdwRHS) -{ - HKEY hk; - if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, AFSConfigKeyName, 0, KEY_QUERY_VALUE, &hk) != ERROR_SUCCESS) - return FALSE; - - DWORD dwSize = sizeof(*pdwRHS); - if (RegQueryValueEx (hk, pszLHS, NULL, NULL, (PBYTE)pdwRHS, &dwSize) != ERROR_SUCCESS) - { - RegCloseKey (hk); - return FALSE; - } - - RegCloseKey (hk); - return TRUE; -} - - -BOOL Config_ReadString (LPCTSTR pszLHS, LPTSTR pszRHS, size_t cchMax) -{ - HKEY hk; - if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, AFSConfigKeyName, 0, KEY_QUERY_VALUE, &hk) != ERROR_SUCCESS) - return FALSE; - - DWORD dwSize = sizeof(TCHAR) * cchMax; - if (RegQueryValueEx (hk, pszLHS, NULL, NULL, (PBYTE)pszRHS, &dwSize) != ERROR_SUCCESS) - { - RegCloseKey (hk); - return FALSE; - } - - RegCloseKey (hk); - return TRUE; -} - - -void Config_WriteNum (LPCTSTR pszLHS, DWORD dwRHS) -{ - HKEY hk; - DWORD dwDisp; - if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, AFSConfigKeyName, 0, TEXT("container"), 0, KEY_SET_VALUE, NULL, &hk, &dwDisp) == ERROR_SUCCESS) - { - RegSetValueEx (hk, pszLHS, NULL, REG_DWORD, (PBYTE)&dwRHS, sizeof(dwRHS)); - RegCloseKey (hk); - } -} - - -void Config_WriteString (LPCTSTR pszLHS, LPCTSTR pszRHS) -{ - HKEY hk; - DWORD dwDisp; - if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, AFSConfigKeyName, 0, TEXT("container"), 0, KEY_SET_VALUE, NULL, &hk, &dwDisp) == ERROR_SUCCESS) - { - RegSetValueEx (hk, pszLHS, NULL, REG_SZ, (PBYTE)pszRHS, sizeof(TCHAR) * (1+lstrlen(pszRHS))); - RegCloseKey (hk); - } -} - diff --git a/src/WINNT/client_config/dlg_automap.cpp b/src/WINNT/client_config/dlg_automap.cpp index 7b65a571e..831fd31a1 100644 --- a/src/WINNT/client_config/dlg_automap.cpp +++ b/src/WINNT/client_config/dlg_automap.cpp @@ -33,6 +33,7 @@ enum DDDACTION { DDD_ADD, DDD_REMOVE }; * PROTOTYPES _________________________________________________________________ * */ +extern void GetNetbiosName(LPTSTR pszName, int type); void AutoMap_OnInitDialog (HWND hDlg); void AutoMap_OnAdd (HWND hDlg); @@ -449,7 +450,13 @@ void AutoMapEdit_OnInitDialog (HWND hDlg) SendMessage (hCombo, CB_SETCURSEL, iItemSel, 0); TCHAR szMapping[ MAX_PATH ]; +#ifdef NOLANA AdjustAfsPath (szMapping, ((pMap->szMapping[0]) ? pMap->szMapping : cm_slash_mount_root), TRUE, FALSE); +#else + memset(szMapping, '\0', sizeof(szMapping)); + szMapping[0] = '\\'; + GetNetbiosName(&szMapping[1], 0); +#endif SetDlgItemText (hDlg, IDC_PATH, szMapping); SetDlgItemText (hDlg, IDC_DESC, pMap->szSubmount); @@ -477,12 +484,25 @@ void AutoMapEdit_OnOK (HWND hDlg) return; } - if ( (lstrncmpi (pMap->szMapping, cm_slash_mount_root, lstrlen(cm_slash_mount_root))) && - (lstrncmpi (pMap->szMapping, cm_back_slash_mount_root, lstrlen(cm_back_slash_mount_root))) ) +#ifdef NOLANA + if ( (lstrncmpi (pMap->szMapping, cm_slash_mount_root, lstrlen(cm_slash_mount_root))) && + (lstrncmpi (pMap->szMapping, cm_back_slash_mount_root, lstrlen(cm_back_slash_mount_root))) ) + { + Message (MB_ICONHAND, GetErrorTitle(), IDS_BADMAP_DESC); + return; + } +#else + TCHAR szName[MAX_PATH]; + memset(szName, '\0', sizeof(szName)); + szName[0] = '\\'; + GetNetbiosName(&szName[1], 0); + + if ( lstrncmpi (pMap->szMapping, szName, lstrlen(szName) )) { Message (MB_ICONHAND, GetErrorTitle(), IDS_BADMAP_DESC); return; } +#endif // First get a proper submount if (pMap->szSubmount[0]) { diff --git a/src/WINNT/client_config/dlg_binding.cpp b/src/WINNT/client_config/dlg_binding.cpp new file mode 100644 index 000000000..91aafd226 --- /dev/null +++ b/src/WINNT/client_config/dlg_binding.cpp @@ -0,0 +1,266 @@ +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +extern "C" { +#include +#include +} +#include +#include "afs_config.h" +#include "getlana.h" + + +/* + * DEFINITIONS ________________________________________________________________ + * + */ + + +// Our dialog data +static BOOL fFirstTime = TRUE; +int nLanAdapter; +LANAINFO* lanainfo = NULL; + +int GetAdapterNumber(TCHAR*); + +/* + * PROTOTYPES _________________________________________________________________ + * + */ + +void Binding_OnInitDialog (HWND hDlg); +void Binding_OnOK(HWND hDlg); +void Binding_OnCancel(HWND hDlg); +BOOL Binding_OnApply(); + +BOOL isGateway = FALSE; +/* + * ROUTINES ___________________________________________________________________ + * + */ + +BOOL CALLBACK Binding_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp) +{ + switch (msg) + { + case WM_INITDIALOG: + Binding_OnInitDialog (hDlg); + break; + + case WM_CTLCOLORSTATIC: + if ((HWND)lp == GetDlgItem (hDlg, IDC_CHUNK_SIZE)) + { + if (IsWindowEnabled ((HWND)lp)) + { + static HBRUSH hbrStatic = CreateSolidBrush (GetSysColor (COLOR_WINDOW)); + SetTextColor ((HDC)wp, GetSysColor (COLOR_WINDOWTEXT)); + SetBkColor ((HDC)wp, GetSysColor (COLOR_WINDOW)); + return (BOOL)hbrStatic; + } + } + break; + + case WM_COMMAND: + switch (LOWORD(wp)) + { + case IDHELP: + Binding_DlgProc (hDlg, WM_HELP, 0, 0); + break; + + case IDOK: + Binding_OnOK(hDlg); + break; + + case IDCANCEL: + Binding_OnCancel(hDlg); + break; + case IDC_DEFAULTNIC: + if (HIWORD(wp) == BN_CLICKED) + { + TCHAR name[MAX_PATH]; + memset(name, 0, sizeof(name)); + if (IsDlgButtonChecked(hDlg,IDC_DEFAULTNIC)) + nLanAdapter=-1; + else + { + HWND hwndCombo = GetDlgItem(hDlg, IDC_NICSELECTION); + if (SendMessage(hwndCombo, CB_GETCURSEL, 0, 0) == CB_ERR) + SendMessage(hwndCombo, CB_SETCURSEL, (WPARAM)0, (LPARAM)0); + + TCHAR selected[MAX_PATH]; + memset(selected, 0, sizeof(selected)); + SendDlgItemMessage(hDlg, IDC_NICSELECTION, + WM_GETTEXT, sizeof(selected), + (LPARAM) selected); + + if (_tcslen(selected) <= 0) + + nLanAdapter = -1; + else + nLanAdapter = GetAdapterNumber(selected); + } + + GetAfsName(nLanAdapter, isGateway, name); + SetDlgItemText (hDlg, IDC_BINDING_MESSAGE, name); + EnableWindow(GetDlgItem(hDlg,IDC_NICSELECTION),(nLanAdapter!=-1)); + break; + } + case IDC_NICSELECTION: + if (HIWORD(wp) == CBN_SELCHANGE) + { + TCHAR name[MAX_PATH]; + TCHAR selected[MAX_PATH]; + memset(name, 0, sizeof(name)); + memset(selected, 0, sizeof(selected)); + HWND hwndCombo = GetDlgItem(hDlg, IDC_NICSELECTION); + int i = SendMessage(hwndCombo, CB_GETCURSEL, 0, 0); + if (i != CB_ERR) + SendMessage(hwndCombo, CB_GETLBTEXT, (WPARAM)i, + (LPARAM) selected); + + if (_tcslen(selected) <= 0) + nLanAdapter = -1; + else + nLanAdapter = GetAdapterNumber(selected); + + + GetAfsName(nLanAdapter, isGateway, name); + SetDlgItemText (hDlg, IDC_BINDING_MESSAGE, name); + break; + } + + } + break; + + case WM_HELP: + WinHelp (hDlg, g.szHelpFile, HELP_CONTEXT, IDH_AFSCONFIG_ADVANCED_MISC); + break; + } + + return FALSE; +} + + +void Binding_OnInitDialog (HWND hDlg) +{ + + TCHAR msg[MAX_PATH]; + TCHAR name[MAX_PATH]; + memset(msg, 0, sizeof(msg)); + memset(name, 0, sizeof(name)); + + if (fFirstTime) { + Config_GetLanAdapter(&g.Configuration.nLanAdapter); + nLanAdapter = g.Configuration.nLanAdapter; + isGateway = g.Configuration.fBeGateway; + fFirstTime = FALSE; + } + + lanainfo = GetLana(msg, NULL); + + if (!lanainfo && _tcslen(msg) > 0) + MessageBox(hDlg, msg, "LANA ERROR", MB_ICONERROR); + else + { + HWND hwndCombo = GetDlgItem(hDlg, IDC_NICSELECTION); + int index = 0; + TCHAR tmp[MAX_PATH]; + while (_tcslen(lanainfo[index].lana_name) > 0) + { + _stprintf(tmp, "%s (lana number = %d)", lanainfo[index].lana_name, + lanainfo[index].lana_number); + SendMessage(hwndCombo, CB_ADDSTRING, + 0, (LPARAM) tmp); + if (nLanAdapter == lanainfo[index].lana_number) + SendMessage(hwndCombo, CB_SELECTSTRING, (WPARAM)-1, + (LPARAM)tmp); + index++; + } + } + + + GetAfsName(nLanAdapter, isGateway, name); + SetDlgItemText (hDlg, IDC_BINDING_MESSAGE, name); + + CheckDlgButton (hDlg, IDC_DEFAULTNIC, (nLanAdapter==-1)); + + EnableWindow(GetDlgItem(hDlg,IDC_NICSELECTION),(nLanAdapter!=-1)); +} + +void Binding_OnOK (HWND hDlg) +{ + if (IsDlgButtonChecked(hDlg,IDC_DEFAULTNIC)) + nLanAdapter = -1; + else + { + TCHAR selected[MAX_PATH]; + memset(selected, 0, sizeof(selected)); + SendDlgItemMessage(hDlg, IDC_NICSELECTION, + WM_GETTEXT, sizeof(selected), + (LPARAM) selected); + + if (_tcslen(selected) <= 0) + { + MessageBox(hDlg, "Please select the NIC to bind to", "Error", MB_ICONERROR); + return; + } + + nLanAdapter = GetAdapterNumber(selected); + + } + + EndDialog(hDlg, IDOK); +} + + +BOOL Binding_OnApply() +{ + if (fFirstTime) + return TRUE; + + if (nLanAdapter != g.Configuration.nLanAdapter) { + if (!Config_SetLanAdapter (nLanAdapter)) + return FALSE; + g.Configuration.nLanAdapter = nLanAdapter; + } + + return TRUE; + + +} + +void Binding_OnCancel(HWND hDlg) +{ + fFirstTime = TRUE; + + if (lanainfo) + { + delete lanainfo; + lanainfo = NULL; + } + + EndDialog(hDlg, IDCANCEL); +} + + +int GetAdapterNumber(TCHAR* n) +{ + int index = 0; + while (_tcslen(lanainfo[index].lana_name) > 0) + { + if (_tcsncmp(lanainfo[index].lana_name, n, _tcslen(lanainfo[index].lana_name)) == 0) + { + return lanainfo[index].lana_number; + } + index++; + } + + return -1; + +} diff --git a/src/WINNT/client_config/dlg_misc.cpp b/src/WINNT/client_config/dlg_misc.cpp index a1d87595d..9fafc0f82 100644 --- a/src/WINNT/client_config/dlg_misc.cpp +++ b/src/WINNT/client_config/dlg_misc.cpp @@ -35,7 +35,9 @@ extern "C" { // Our dialog data BOOL fFirstTime = TRUE; +#if undef DWORD nLanAdapter; +#endif DWORD csecProbe; DWORD nThreads; DWORD nDaemons; @@ -95,6 +97,7 @@ BOOL CALLBACK Misc_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp) case IDCANCEL: Misc_OnCancel(hDlg); break; +#if undef case IDC_AUTOLANA: if (IsDlgButtonChecked(hDlg,IDC_AUTOLANA)) nLanAdapter=-1; @@ -102,6 +105,7 @@ BOOL CALLBACK Misc_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp) nLanAdapter=0; SP_SetPos (GetDlgItem (hDlg, IDC_LAN_ADAPTER),nLanAdapter); EnableWindow(GetDlgItem(hDlg,IDC_LAN_ADAPTER),(nLanAdapter!=-1)); +#endif } break; @@ -117,7 +121,9 @@ BOOL CALLBACK Misc_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp) void Misc_OnInitDialog (HWND hDlg) { if (fFirstTime) { +#if undef Config_GetLanAdapter(&g.Configuration.nLanAdapter); +#endif Config_GetProbeInt (&g.Configuration.csecProbe); Config_GetNumThreads (&g.Configuration.nThreads); Config_GetNumDaemons (&g.Configuration.nDaemons); @@ -125,7 +131,9 @@ void Misc_OnInitDialog (HWND hDlg) Config_GetRootVolume (g.Configuration.szRootVolume); Config_GetMountRoot (g.Configuration.szMountDir); +#if undef nLanAdapter = g.Configuration.nLanAdapter; +#endif csecProbe = g.Configuration.csecProbe; nThreads = g.Configuration.nThreads; nDaemons = g.Configuration.nDaemons; @@ -136,7 +144,9 @@ void Misc_OnInitDialog (HWND hDlg) fFirstTime = FALSE; } +#if undef CreateSpinner (GetDlgItem (hDlg, IDC_LAN_ADAPTER), 99, FALSE, nLANA_MIN, nLanAdapter, nLANA_MAX); +#endif CreateSpinner (GetDlgItem (hDlg, IDC_PROBE), 10, FALSE, csecPROBE_MIN, csecProbe, csecPROBE_MAX); CreateSpinner (GetDlgItem (hDlg, IDC_THREADS), 10, FALSE, cTHREADS_MIN, nThreads, cTHREADS_MAX); CreateSpinner (GetDlgItem (hDlg, IDC_DAEMONS), 10, FALSE, cDAEMONS_MIN, nDaemons, cDAEMONS_MAX); @@ -144,15 +154,18 @@ void Misc_OnInitDialog (HWND hDlg) SetDlgItemText (hDlg, IDC_SYSNAME, szSysName); SetDlgItemText (hDlg, IDC_ROOTVOLUME, szRootVolume); SetDlgItemText (hDlg, IDC_MOUNTDIR, szMountDir); +#if undef CheckDlgButton (hDlg, IDC_AUTOLANA, (nLanAdapter==-1)); EnableWindow(GetDlgItem(hDlg,IDC_LAN_ADAPTER),(nLanAdapter!=-1)); +#endif } void Misc_OnOK (HWND hDlg) { +#if undef nLanAdapter = (IsDlgButtonChecked(hDlg,IDC_AUTOLANA))?-1 :SP_GetPos (GetDlgItem (hDlg, IDC_LAN_ADAPTER)); - +#endif csecProbe = SP_GetPos (GetDlgItem (hDlg, IDC_PROBE)); nThreads = SP_GetPos (GetDlgItem (hDlg, IDC_THREADS)); @@ -172,11 +185,13 @@ BOOL Misc_OnApply() if (fFirstTime) return TRUE; +#if undef if (nLanAdapter != g.Configuration.nLanAdapter) { if (!Config_SetLanAdapter (nLanAdapter)) return FALSE; g.Configuration.nLanAdapter = nLanAdapter; } +#endif if (csecProbe != g.Configuration.csecProbe) { if (!Config_SetProbeInt (csecProbe)) diff --git a/src/WINNT/client_config/drivemap.cpp b/src/WINNT/client_config/drivemap.cpp index 9600bfe64..d5b6af836 100644 --- a/src/WINNT/client_config/drivemap.cpp +++ b/src/WINNT/client_config/drivemap.cpp @@ -24,6 +24,15 @@ extern "C" { #define DEBUG_VERBOSE #include +extern void Config_GetLanAdapter (ULONG *pnLanAdapter); +void GetNetbiosName(LPTSTR pszName, int type); +extern BOOL Config_ReadNum (LPCTSTR pszLHS, DWORD *pdwRHS); +extern BOOL Config_ReadString (LPCTSTR pszLHS, LPTSTR pszRHS, size_t cchMax); +extern void GetUncServerName(int lanaNumber, BOOL isGateway, TCHAR* name, int type); + +#define NETBIOS_NAME_FULL 0 +#define NETBIOS_NAME_SUFFIX 1 + /* * REGISTRY ___________________________________________________________________ * @@ -43,6 +52,7 @@ const TCHAR sAFSConfigKeyName[] = TEXT("SYSTEM\\CurrentControlSet\\Services\\Tra static TCHAR cszINIFILE[] = TEXT("afsdsbmt.ini"); static TCHAR cszSECTION_SUBMOUNTS[] = TEXT("AFS Submounts"); static TCHAR cszSECTION_MAPPINGS[] = TEXT("AFS Mappings"); +static TCHAR cszSECTION_ACTIVE[] = TEXT("AFS Active"); static TCHAR cszAUTOSUBMOUNT[] = TEXT("Auto"); static TCHAR cszLANMANDEVICE[] = TEXT("\\Device\\LanmanRedirector\\"); @@ -183,45 +193,8 @@ BOOL IsWindows2000 (void) void GetClientNetbiosName (LPTSTR pszName) { - *pszName = TEXT('\0'); - - if (IsWindowsNT()) - { - HKEY hk; - if (RegOpenKey (HKEY_LOCAL_MACHINE, TEXT("System\\CurrentControlSet\\Control\\ComputerName\\ComputerName"), &hk) == 0) - { - DWORD dwSize = MAX_PATH; - DWORD dwType = REG_SZ; - RegQueryValueEx (hk, TEXT("ComputerName"), NULL, &dwType, (PBYTE)pszName, &dwSize); - } - } - else // (!IsWindowsNT()) - { - HKEY hk; - if (RegOpenKey (HKEY_LOCAL_MACHINE, TEXT("System\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters"), &hk) == 0) - { - DWORD dwSize = MAX_PATH; - DWORD dwType = REG_SZ; - RegQueryValueEx (hk, TEXT("Gateway"), NULL, &dwType, (PBYTE)pszName, &dwSize); - } - } - - // Shorten the server name from its FQDN - // - for (LPTSTR pch = pszName; *pch; ++pch) - { - if (*pch == TEXT('.')) - { - *(LPTSTR)pch = TEXT('\0'); - break; - } - } - - // Form NetBIOS name from client's (possibly truncated) simple host name. - if (*pszName != TEXT('\0')) { - pszName[11] = TEXT('\0'); - lstrcat(pszName, TEXT("-AFS")); - } + *pszName = TEXT('\0'); + GetNetbiosName(pszName, NETBIOS_NAME_FULL); } @@ -423,6 +396,31 @@ void QueryDriveMapList_ReadMappings (PDRIVEMAPLIST pList) FreeStringMemory (mszLHS); } +BOOL ForceMapActive (TCHAR chDrive) +{ + TCHAR szDrive[2]; + TCHAR szActive[32]; + + szDrive[0] = chDrive; + szDrive[1] = 0; + + GetPrivateProfileString (cszSECTION_ACTIVE, szDrive, TEXT("0"), szActive, sizeof(szActive), cszINIFILE); + + if ( !lstrcmp(szActive,"1") || !lstrcmpi(szActive,"true") || !lstrcmpi(szActive,"on") || !lstrcmpi(szActive,"yes") ) + return TRUE; + return FALSE; +} + + +void WriteActiveMap (TCHAR chDrive, BOOL on) +{ + TCHAR szDrive[2]; + + szDrive[0] = chDrive; + szDrive[1] = 0; + + WritePrivateProfileString (cszSECTION_ACTIVE, szDrive, on ? "1" : "0", cszINIFILE); +} void QueryDriveMapList_WriteMappings (PDRIVEMAPLIST pList) { @@ -590,8 +588,11 @@ BOOL PathToSubmount (LPTSTR pszSubmount, LPTSTR pszMapping, LPTSTR pszSubmountRe IOInfo.out = (char *)OutData; IOInfo.out_size = PIOCTL_MAXSIZE; - ULONG status; - if ((status = pioctl (0, VIOC_MAKESUBMOUNT, &IOInfo, 1)) != 0) + ULONG status = pioctl (0, VIOC_MAKESUBMOUNT, &IOInfo, 1); + if (pStatus) + *pStatus = status; + + if (status) return FALSE; lstrcpy (pszSubmount, (LPCTSTR)OutData); @@ -713,11 +714,16 @@ void AdjustAfsPath (LPTSTR pszTarget, LPCTSTR pszSource, BOOL fWantAFS, BOOL fWa BOOL GetDriveSubmount (TCHAR chDrive, LPTSTR pszSubmountNow) { - TCHAR szDrive[] = TEXT("*:"); - szDrive[0] = chDrive; + TCHAR szDrive[] = TEXT("*:"); + szDrive[0] = chDrive; + + TCHAR szMapping[ MAX_PATH ] = TEXT(""); + LPTSTR pszSubmount = szMapping; + TCHAR szNetBiosName[32]; - TCHAR szMapping[ MAX_PATH ] = TEXT(""); - LPTSTR pszSubmount = szMapping; + memset(szNetBiosName, '\0', sizeof(szNetBiosName)); + GetNetbiosName(szNetBiosName, NETBIOS_NAME_SUFFIX); + _tcscat(szNetBiosName, TEXT("\\")); if (IsWindowsNT()) { @@ -762,11 +768,11 @@ BOOL GetDriveSubmount (TCHAR chDrive, LPTSTR pszSubmountNow) return FALSE; } for (++pszSubmount; *pszSubmount && (*pszSubmount != TEXT('\\')); ++pszSubmount) - if (!lstrncmpi (pszSubmount, TEXT("-afs\\"), lstrlen(TEXT("-afs\\")))) + if (!lstrncmpi (pszSubmount, szNetBiosName, lstrlen(szNetBiosName))) break; if ((!*pszSubmount) || (*pszSubmount == TEXT('\\'))) return FALSE; - pszSubmount += lstrlen("-afs\\"); + pszSubmount += lstrlen(szNetBiosName); } else // (!IsWindowsNT()) { @@ -778,11 +784,11 @@ BOOL GetDriveSubmount (TCHAR chDrive, LPTSTR pszSubmountNow) if (*(pszSubmount++) != TEXT('\\')) return FALSE; for ( ; *pszSubmount && (*pszSubmount != TEXT('\\')); ++pszSubmount) - if (!lstrncmpi (pszSubmount, TEXT("-afs\\"), lstrlen(TEXT("-afs\\")))) + if (!lstrncmpi (pszSubmount, szNetBiosName, lstrlen(szNetBiosName))) break; if ((!*pszSubmount) || (*pszSubmount == TEXT('\\'))) return FALSE; - pszSubmount += lstrlen("-afs\\"); + pszSubmount += lstrlen(szNetBiosName); } if (!pszSubmount || !*pszSubmount) @@ -912,12 +918,15 @@ void DoUnMapShare(BOOL drivemap) //disconnect drivemap DWORD res; DWORD cbBuffer=16384; DWORD cEntries=-1; - GetComputerName(szMachine,&rc); CHAR *pSubmount=""; + + memset(szMachine, '\0', sizeof(szMachine)); + GetNetbiosName(szMachine, NETBIOS_NAME_FULL); + // Initialize the data structure if ((res=WNetOpenEnum(RESOURCE_CONNECTED,RESOURCETYPE_DISK,RESOURCEUSAGE_CONNECTABLE,lpnr,&hEnum))!=NO_ERROR) return; - sprintf(szPath,"\\\\%s-afs\\",szMachine); + sprintf(szPath,"\\\\%s\\",szMachine); _strlwr(szPath); lpnrLocal=(LPNETRESOURCE) GlobalAlloc(GPTR,cbBuffer); do { @@ -953,9 +962,12 @@ BOOL DoMapShareChange() DWORD res; DWORD cbBuffer=16384; DWORD cEntries=-1; - GetComputerName(szMachine,&rc); CHAR szUser[MAXRANDOMNAMELEN]; - // Initialize the data structure + + memset(szMachine, '\0', sizeof(szMachine)); + GetNetbiosName(szMachine, NETBIOS_NAME_FULL); + + // Initialize the data structure if (!IsServiceActive()) return TRUE; memset (&List, 0x00, sizeof(DRIVEMAPLIST)); @@ -965,7 +977,7 @@ BOOL DoMapShareChange() if ((res=WNetOpenEnum(RESOURCE_CONNECTED,RESOURCETYPE_DISK,RESOURCEUSAGE_CONNECTABLE,lpnr,&hEnum))!=NO_ERROR) return FALSE; lpnrLocal=(LPNETRESOURCE) GlobalAlloc(GPTR,cbBuffer); - sprintf(szPath,"\\\\%s-afs\\",szMachine); + sprintf(szPath,"\\\\%s\\",szMachine); _strlwr(szPath); do { memset(lpnrLocal,0,cbBuffer); @@ -997,7 +1009,7 @@ BOOL DoMapShareChange() } while (res!=ERROR_NO_MORE_ITEMS); GlobalFree((HGLOBAL)lpnrLocal); WNetCloseEnum(hEnum); - sprintf(szPath,"\\\\%s-afs\\all",szMachine); + sprintf(szPath,"\\\\%s\\all",szMachine); cbBuffer=MAXRANDOMNAMELEN-1; // Lets connect all submounts that weren't connectd CHAR * pUser = NULL; @@ -1024,11 +1036,10 @@ BOOL DoMapShareChange() BOOL DoMapShare() { DRIVEMAPLIST List; - TCHAR szMachine[ MAX_PATH ]; DWORD rc=28; BOOL bMappedAll=FALSE; CHAR * pUser = NULL; - GetComputerName(szMachine,&rc); + // Initialize the data structure DEBUG_EVENT0("AFS DoMapShare"); QueryDriveMapList (&List); @@ -1060,11 +1071,21 @@ BOOL DoMapShare() } for (TCHAR chDrive = chDRIVE_A; chDrive <= chDRIVE_Z; ++chDrive) { - if (List.aDriveMap[chDrive-chDRIVE_A].fActive) + if (List.aDriveMap[chDrive-chDRIVE_A].fActive || + ForceMapActive(chDrive)) { + TCHAR szSubmount[ MAX_PATH ]; + if (List.aDriveMap[chDrive-chDRIVE_A].szSubmount[0]) + lstrcpy(szSubmount,List.aDriveMap[chDrive-chDRIVE_A].szSubmount); + else if (!PathToSubmount (szSubmount, List.aDriveMap[chDrive-chDRIVE_A].szMapping, NULL, NULL)) + continue; + + BOOL fPersistent = List.aDriveMap[chDrive-chDRIVE_A].fPersistent; + if (RWLogonOption(TRUE,LOGON_OPTION_HIGHSECURITY)) + fPersistent = FALSE; DWORD res=MountDOSDrive(chDrive - ,List.aDriveMap[chDrive-chDRIVE_A].szSubmount - ,List.aDriveMap[chDrive-chDRIVE_A].fPersistent); + ,szSubmount + ,fPersistent,pUser); } } return TRUE; @@ -1102,7 +1123,7 @@ BOOL GlobalMountDrive() if (dwResult != ERROR_SUCCESS) { if (dwResult != ERROR_NO_MORE_ITEMS) { - DEBUG_EVENT1("AFS DriveMap","Failed to read \\GlobalAutoMapper values: %d",dwResult); + DEBUG_EVENT1("AFS DriveMap","Failed to read GlobalAutoMapper values: %d",dwResult); } break; } @@ -1128,14 +1149,17 @@ DWORD MountDOSDrive(char chDrive,const char *szSubmount,BOOL bPersistent,const c nr.lpRemoteName=szPath; nr.dwDisplayType = RESOURCEDISPLAYTYPE_SHARE; DWORD res=WNetAddConnection2(&nr,NULL,pUsername,(bPersistent)?CONNECT_UPDATE_PROFILE:0); - DEBUG_EVENT3("AFS DriveMap","Mount %s Remote[%s]=%x",(bPersistent)?"Persistant" : "NonPresistant",szPath,res); + DEBUG_EVENT5("AFS DriveMap","Mount %s Local[%s] Remote[%s] User[%s]=%x", + (bPersistent)?"Persistant" : "NonPresistant", + szDrive,szPath,pUsername?pUsername:"NULL",res); return res; } DWORD DisMountDOSDriveFull(const char *szPath,BOOL bForce) { DWORD res=WNetCancelConnection(szPath,bForce); - DEBUG_EVENT2("AFS DriveMap","Dismount Remote[%s]=%x",szPath,res); + DEBUG_EVENT3("AFS DriveMap","%sDismount Remote[%s]=%x", + bForce ? "Forced " : "",szPath,res); return (res==ERROR_NOT_CONNECTED)?NO_ERROR:res; } @@ -1155,3 +1179,38 @@ DWORD DisMountDOSDrive(const char chDrive,BOOL bForce) sprintf(szPath,"%c:",chDrive); return DisMountDOSDriveFull(szPath,bForce); } + +void GetNetbiosName(LPTSTR pszName, int type) +{ + DWORD LanAdapter; + DWORD dwIsGateWay = 0; + TCHAR name[MAX_PATH]; + TCHAR *Ptr; + + memset(name, '\0', sizeof(name)); + if (!IsWindowsNT()) + { + if (type == NETBIOS_NAME_SUFFIX) + { + _tcscpy(pszName, TEXT("-afs")); + return; + } + Config_ReadString (TEXT("Gateway"), pszName, MAX_PATH); + if (strlen(pszName) == 0) + { + strcpy(pszName, TEXT("unknown")); + return; + } + _tcscat(pszName, TEXT("-afs")); + return; + } + if (!Config_ReadNum (TEXT("IsGateway"), &dwIsGateWay)) + dwIsGateWay = 0; + memset(name, 0, sizeof(name)); + if (!Config_ReadNum (TEXT("LANadapter"), &LanAdapter)) + LanAdapter = -1; + GetUncServerName(LanAdapter, dwIsGateWay, name, type); + _tcscpy(pszName, name); + return; +} + diff --git a/src/WINNT/client_config/drivemap.h b/src/WINNT/client_config/drivemap.h index f694eb389..9165d1121 100644 --- a/src/WINNT/client_config/drivemap.h +++ b/src/WINNT/client_config/drivemap.h @@ -96,6 +96,10 @@ DWORD MountDOSDrive(char chDrive,const char *szSubmount,BOOL bPresistant=TRUE,co DWORD DisMountDOSDrive(const char *szSubmount,BOOL bForce=TRUE); DWORD DisMountDOSDrive(char chDrive,BOOL bForce=TRUE); DWORD DisMountDOSDriveFull(const char *pPath,BOOL bForce=TRUE); + +void WriteActiveMap(TCHAR chDrive, BOOL bOn); +BOOL ForceMapActive(TCHAR chDrive); + #ifndef DRIVEMAP_DEF_H extern void TestAndDoUnMapShare(); extern TCHAR pUserName[]; diff --git a/src/WINNT/client_config/getlana.cpp b/src/WINNT/client_config/getlana.cpp new file mode 100644 index 000000000..6ff3ab2e1 --- /dev/null +++ b/src/WINNT/client_config/getlana.cpp @@ -0,0 +1,436 @@ +// getlana.cpp : Defines the entry point for the console application. +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#define LANA_INVALID 0xff +using namespace std; +BOOL lana_IsLoopback(lana_number_t lana, TCHAR*); +lana_number_t lana_FindLoopback(TCHAR*); + + + +// Use the IShellFolder API to get the connection name for the given Guid. +static HRESULT getname_shellfolder(WCHAR *wGuid, WCHAR *wName, int NameSize) +{ + // This is the GUID for the network connections folder. It is constant. + // {7007ACC7-3202-11D1-AAD2-00805FC1270E} + const GUID CLSID_NetworkConnections = { + 0x7007ACC7, 0x3202, 0x11D1, { + 0xAA, 0xD2, 0x00, 0x80, 0x5F, 0xC1, 0x27, 0x0E + } + }; + LPITEMIDLIST pidl; + IShellFolder *pShellFolder; + IMalloc *pShellMalloc; + + // Build the display name in the form "::{GUID}". + if (wcslen(wGuid) >= MAX_PATH) + return E_INVALIDARG; + WCHAR szAdapterGuid[MAX_PATH + 2]; + swprintf(szAdapterGuid, L"::%ls", wGuid); + + // Initialize COM. + CoInitialize(NULL); + + // Get the shell allocator. + HRESULT hr = SHGetMalloc(&pShellMalloc); + if (SUCCEEDED(hr)) + { + // Create an instance of the network connections folder. + hr = CoCreateInstance(CLSID_NetworkConnections, NULL, + CLSCTX_INPROC_SERVER, IID_IShellFolder, + reinterpret_cast(&pShellFolder)); + } + if (SUCCEEDED(hr)) + hr = pShellFolder->ParseDisplayName(NULL, NULL, szAdapterGuid, NULL, + &pidl, NULL); + if (SUCCEEDED(hr)) + { + // Get the display name; this returns the friendly name. + STRRET sName; + hr = pShellFolder->GetDisplayNameOf(pidl, SHGDN_NORMAL, &sName); + if (SUCCEEDED(hr)) + wcsncpy(wName, sName.pOleStr, NameSize); + pShellMalloc->Free(pidl); + } + + CoUninitialize(); + return hr; +} + +// Get the Connection Name for the given GUID. +static int lana_GetNameFromGuid(char *Guid, char **Name) +{ + typedef HRESULT (WINAPI *HrLanProcAddr)(GUID *, PCWSTR, PWSTR, LPDWORD); + HrLanProcAddr HrLanProc = NULL; + HMODULE hNetMan; + int size; + WCHAR *wGuid = NULL; + WCHAR wName[MAX_PATH]; + DWORD NameSize = (sizeof(wName) / sizeof(wName[0])); + HRESULT status; + + // Convert the Guid string to Unicode. First we ask only for the size + // of the converted string. Then we allocate a buffer of sufficient + // size to hold the result of the conversion. + size = MultiByteToWideChar(CP_ACP, 0, Guid, -1, NULL, 0); + wGuid = (WCHAR *) malloc(size * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, Guid, -1, wGuid, size); + + // First try the IShellFolder interface, which was unimplemented + // for the network connections folder before XP. + status = getname_shellfolder(wGuid, wName, NameSize); + if (status == E_NOTIMPL) + { + // The IShellFolder interface is not implemented on this platform. + // Try the (undocumented) HrLanConnectionNameFromGuidOrPath API + // from the netman DLL. + hNetMan = LoadLibrary("netman.dll"); + if (hNetMan == NULL) + { + free(wGuid); + return -1; + } + HrLanProc = + (HrLanProcAddr) GetProcAddress(hNetMan, + "HrLanConnectionNameFromGuidOrPath"); + if (HrLanProc == NULL) + { + FreeLibrary(hNetMan); + free(wGuid); + return -1; + } + // Super Secret Microsoft Call + status = HrLanProc(NULL, wGuid, wName, &NameSize); + FreeLibrary(hNetMan); + } + free(wGuid); + if (FAILED(status)) + { + cerr << "lana_GetNameFromGuid: failed to get connection name (status " + << status << ")\r\n"; + return -1; + } + + // Get the required buffer size, and then convert the string. + size = WideCharToMultiByte(CP_ACP, 0, wName, -1, NULL, 0, NULL, NULL); + *Name = (char *) malloc(size); + if (*Name == NULL) + return -1; + WideCharToMultiByte(CP_ACP, 0, wName, -1, *Name, size, NULL, NULL); + return 0; +} + +LANAINFO* GetLana(TCHAR* msg, const char *LanaName) +{ + const char RegNetBiosLinkageKeyName[] = + "System\\CurrentControlSet\\Services\\NetBios\\Linkage"; + HKEY hkey; + LONG status; + struct { + BYTE flags; + BYTE number; + } lanamap[MAX_LANA+1]; + DWORD lanamapsize = sizeof(lanamap); + DWORD type; + char *bindpaths = NULL; + DWORD bindpathsize; + int nlana; + int i; + char *guid; + char *name; + char *pBind; + char *p; + + LANAINFO* lanainfo; + + // Open the NetBios Linkage key. + status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, RegNetBiosLinkageKeyName, 0, + KEY_QUERY_VALUE, &hkey); + + if (status != ERROR_SUCCESS) + { + _stprintf(msg, _T("Failed to open NetBios Linkage key (status %d)"), status); + return NULL; + } + + // Read the lana map. + status = RegQueryValueEx(hkey, "LanaMap", 0, &type, + (BYTE *) &lanamap, &lanamapsize); + if (status != ERROR_SUCCESS) + { + _stprintf(msg, _T("Failed to read LanaMap (status %d)"), status); + RegCloseKey(hkey); + return NULL; + } + if (lanamapsize == 0) + { + _stprintf(msg, _T("No data in LanaMap")); + return NULL; + } + nlana = lanamapsize / sizeof(lanamap[0]); + + // Get the bind paths for NetBios so we can match them up + // with the lana map. First we query for the size, so we + // can allocate an appropriate buffer. + status = RegQueryValueEx(hkey, "Bind", 0, &type, NULL, &bindpathsize); + if (status == ERROR_SUCCESS && bindpathsize != 0) + { + bindpaths = (char *) malloc(bindpathsize * sizeof(char)); + if (bindpaths == NULL) + { + _stprintf(msg, _T("Cannot allocate %d bytes for bindpaths"), bindpathsize); + + RegCloseKey(hkey); + return NULL; + } + status = RegQueryValueEx(hkey, "Bind", 0, &type, + (BYTE *) bindpaths, &bindpathsize); + } + RegCloseKey(hkey); + if (status != ERROR_SUCCESS) + { + _stprintf(msg, _T("Failed to read bind paths (status %d)"), status); + if (bindpaths != NULL) + free(bindpaths); + return NULL; + } + if (bindpathsize == 0) + { + _stprintf(msg, _T("No bindpath data")); + if (bindpaths != NULL) + free(bindpaths); + return NULL; + } + + if (LanaName) + { + lanainfo = new LANAINFO[1]; + lanainfo[0].lana_number = LANA_INVALID; + memset(lanainfo[0].lana_name, 0, sizeof(lanainfo[0].lana_name)); + } + else + { + lanainfo = new LANAINFO[nlana+1]; + memset(lanainfo, 0, sizeof(LANAINFO) * nlana); + } + int index = 0; + for (i = 0, pBind = bindpaths; i < nlana; + i++, pBind += strlen(pBind) + 1) + { + // Ignore an invalid map entry. + if ((lanamap[i].flags & 1) == 0) + continue; + // Find the beginning of the GUID. + guid = strchr(pBind, '{'); + if (guid == NULL) + continue; // Malformed path entry? + guid = strdup(guid); + if (guid == NULL) + continue; + // Find the end of the GUID. + p = strchr(guid, '}'); + if (p == NULL) + { + free(guid); // Malformed GUID? + continue; + } + *++p = '\0'; // Ignore anything after the GUID. + status = lana_GetNameFromGuid(guid, &name); + if (status == 0) + { + if (LanaName) + { + if (strcmp(name, LanaName) ==0) + { + lanainfo[index].lana_number = lanamap[i].number; + _tcscpy(lanainfo[index].lana_name ,name); + free(name); + free(guid); + break; + } + } + else + { + lanainfo[index].lana_number = lanamap[i].number; + _tcscpy(lanainfo[index].lana_name ,name); + free(name); + index++; + } + } + + free(guid); + } + free(bindpaths); + return lanainfo; +} + + +lana_number_t lana_FindLoopback(TCHAR* msg) +{ + NCB ncb; + LANA_ENUM lana_list; + int status; + int i; + + memset(&ncb, 0, sizeof(ncb)); + ncb.ncb_command = NCBENUM; + ncb.ncb_buffer = (UCHAR *) &lana_list; + ncb.ncb_length = sizeof(lana_list); + status = Netbios(&ncb); + if (status != 0) { + _stprintf(msg, _T("Netbios NCBENUM failed: status %ld"), status); + return LANA_INVALID; + } + + for (i = 0; i < lana_list.length; i++) { + if (lana_IsLoopback(lana_list.lana[i], msg)) { + // Found one, return it. + return lana_list.lana[i]; + } + } + // Could not find a loopback adapter. + return LANA_INVALID; +} + + +// Is the given lana a Windows Loopback Adapter? +BOOL lana_IsLoopback(lana_number_t lana, TCHAR* msg) +{ + NCB ncb; + struct { + ADAPTER_STATUS status; + NAME_BUFFER names[MAX_LANA+1]; + } astat; + unsigned char kWLA_MAC[6] = { 0x02, 0x00, 0x4c, 0x4f, 0x4f, 0x50 }; + int status; + + // Reset the adapter: in Win32, this is required for every process, and + // acts as an init call, not as a real hardware reset. + memset(&ncb, 0, sizeof(ncb)); + ncb.ncb_command = NCBRESET; + ncb.ncb_callname[0] = 100; + ncb.ncb_callname[2] = 100; + ncb.ncb_lana_num = lana; + status = Netbios(&ncb); + if (status == 0) + status = ncb.ncb_retcode; + if (status != 0) { + sprintf(msg, "NCBRESET failed: lana %u, status %ld", lana, status); + return FALSE; + } + + // Use the NCBASTAT command to get the adapter address. + memset(&ncb, 0, sizeof(ncb)); + ncb.ncb_command = NCBASTAT; + ncb.ncb_lana_num = lana; + strcpy((char *) ncb.ncb_callname, "* "); + ncb.ncb_buffer = (UCHAR *) &astat; + ncb.ncb_length = sizeof(astat); + status = Netbios(&ncb); + if (status == 0) + status = ncb.ncb_retcode; + if (ncb.ncb_retcode != 0) { + sprintf(msg, "NCBASTAT failed: lana %u, status %ld", lana, status); + return FALSE; + } + return (memcmp(astat.status.adapter_address, kWLA_MAC, 6) == 0); +} + +#define NETBIOS_NAME_FULL 0 +#define NETBIOS_NAME_SUFFIX 1 +#define AFSCONFIGKEYNAME TEXT("SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters") + +void GetUncServerName(int lanaNumber, BOOL isGateway, TCHAR* name, int type) +{ + lana_number_t lana = LANA_INVALID; + LANAINFO* lanainfo; + WSADATA WSAjunk; + char cm_HostName[MAX_PATH]; + TCHAR tmpName[MAX_PATH]; + TCHAR msg[MAX_PATH]; + memset(msg, 0, sizeof(msg)); + memset(tmpName, 0, sizeof(tmpName)); + memset(cm_HostName, 0, sizeof(cm_HostName)); + WSAStartup(0x0101, &WSAjunk); + + if (lanaNumber == -1) { + /* Find the default LAN adapter to use. First look for + * the adapter named AFS; otherwise, unless we are doing + * gateway service, look for any valid loopback adapter. + */ + lanainfo = GetLana(msg, "AFS"); + if (lanainfo) + { + lana = lanainfo[0].lana_number; + delete lanainfo; + } + if (lana == LANA_INVALID && !isGateway) + lana = lana_FindLoopback(msg); + if (lana != LANA_INVALID) + lanaNumber = lana; + } + /* If we are using a loopback adapter, we can use the preferred + * (but non-unique) server name; otherwise, we must fall back to + * the -AFS name. + */ + if (lanaNumber >= 0 && lana_IsLoopback(lanaNumber, msg)) + { + HKEY parmKey; + char mountRoot[MAX_PATH+1]; + char *pmount=mountRoot; + DWORD len=sizeof(mountRoot)-1; + printf("int mountroot \n"); + if ((RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSCONFIGKEYNAME,0, KEY_QUERY_VALUE, &parmKey)!= ERROR_SUCCESS) + || (RegQueryValueEx(parmKey, "Mountroot", NULL, NULL,(LPBYTE)(mountRoot), &len)!= ERROR_SUCCESS) + || (len > sizeof(mountRoot)-1) + ) + strcpy(mountRoot, "afs"); + RegCloseKey(parmKey); + mountRoot[len]=0; /*safety see ms-help://MS.MSDNQTR.2002OCT.1033/sysinfo/base/regqueryvalueex.htm*/ + if ((*pmount=='/') || (*pmount='\\')) + pmount++; + + _tcscpy(name, pmount); + } else { + gethostname(cm_HostName, sizeof(cm_HostName)); + _tcscpy(tmpName, cm_HostName); + char* ctemp = _tcschr(tmpName, '.'); /* turn ntdfs.* into ntdfs */ + if (ctemp) *ctemp = 0; + tmpName[11] = 0; /* ensure that even after adding the -A, we + * leave one byte free for the netbios server + * type. + */ + if (type == NETBIOS_NAME_FULL) { + _tcscat(tmpName, _T("-afs")); + _tcscpy(name, tmpName); + } else { + _tcscpy(name, _T("-afs")); + } + } +} + +void GetAfsName(int lanaNumber, BOOL isGateway, TCHAR* name) +{ + + GetUncServerName(lanaNumber, isGateway, name, NETBIOS_NAME_FULL); + _stprintf(name, _T("Your UNC name to reach the root of AFS is \\\\%s\\all"), name); +} + diff --git a/src/WINNT/client_config/getlana.h b/src/WINNT/client_config/getlana.h new file mode 100644 index 000000000..abb265942 --- /dev/null +++ b/src/WINNT/client_config/getlana.h @@ -0,0 +1,24 @@ +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +#ifndef GETLANA_H +#define GETLANA_H + +typedef BYTE lana_number_t; +struct LANAINFO + { + lana_number_t lana_number; + TCHAR lana_name[MAX_PATH]; + }; + + LANAINFO * GetLana(TCHAR* msg, const char *LanaName); + + void GetAfsName(int lanaNumber, BOOL isGateway, TCHAR* name); + +#endif \ No newline at end of file diff --git a/src/WINNT/client_config/lang/en_US/afs_config.rc b/src/WINNT/client_config/lang/en_US/afs_config.rc index 22ffcc101..cdc0fae85 100644 --- a/src/WINNT/client_config/lang/en_US/afs_config.rc +++ b/src/WINNT/client_config/lang/en_US/afs_config.rc @@ -136,7 +136,7 @@ BEGIN IDC_WARN,13,193,193,17 END -IDD_ADVANCED_NT DIALOG DISCARDABLE 0, 0, 220, 225 +IDD_ADVANCED_NT DIALOG DISCARDABLE 0, 0, 220, 247 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Advanced" FONT 9, "MS Shell Dlg" @@ -146,8 +146,8 @@ BEGIN EDITTEXT IDC_CHUNK_SIZE,88,62,32,13,ES_AUTOHSCROLL | ES_READONLY EDITTEXT IDC_STAT_ENTRIES,88,83,32,13,ES_AUTOHSCROLL PUSHBUTTON "&Logon...",IDC_LOGON_PARMS,13,128,56,14 - PUSHBUTTON "&Global Drives...",IDC_AUTOMAP_PARMS,13,173,56,14 - PUSHBUTTON "&Miscellaneous...",IDC_MISC_PARMS,13,195,56,14 + PUSHBUTTON "&Global Drives...",IDC_AUTOMAP_PARMS,13,172,56,14 + PUSHBUTTON "&Miscellaneous...",IDC_MISC_PARMS,13,216,56,14 GROUPBOX "Cache Configuration",IDC_STATIC,7,7,206,100 LTEXT "&Cache Size:",IDC_STATIC,13,23,71,8 LTEXT "kb",IDC_INUSE,136,23,68,8 @@ -156,17 +156,20 @@ BEGIN LTEXT "&Status Cache:",IDC_STATIC,13,85,71,8 LTEXT "entries",IDC_STATIC,136,85,68,8 LTEXT "Cache &Path:",IDC_STATIC,13,44,71,8 - GROUPBOX "Additional Advanced Parameters",IDC_STATIC,7,114,206, - 104 - LTEXT "Create global AFS drive mappings.",IDC_STATIC,74,176, + GROUPBOX "Additional Advanced Parameters",IDC_STATIC,7,118,206, + 122 + LTEXT "Create global AFS drive mappings.",IDC_STATIC,74,174, 132,10 - LTEXT "Adjust integrated logon settings.",IDC_STATIC,74,132, + LTEXT "Adjust integrated logon settings.",IDC_STATIC,74,130, 133,10 LTEXT "Set various other advanced parameters.",IDC_STATIC,74, - 199,132,10 + 218,132,10 PUSHBUTTON "&Diagnostic...",IDC_DIAG_PARMS,13,150,56,14 LTEXT "Enable settings for problem debugging.",IDC_STATIC,74, - 153,132,10 + 152,132,10 + PUSHBUTTON "&Binding...",IDC_BINDING_PARMS,13,194,56,14 + LTEXT "Adjust network adapter binding settings.",IDC_STATIC,74, + 196,133,10 END IDD_PREFS_EDIT DIALOG DISCARDABLE 0, 0, 251, 123 @@ -347,34 +350,30 @@ BEGIN PUSHBUTTON "&Remove",IDC_REMOVE,157,227,50,14 END -IDD_MISC_CONFIG_PARMS DIALOG DISCARDABLE 0, 0, 220, 193 +IDD_MISC_CONFIG_PARMS DIALOG DISCARDABLE 0, 0, 220, 170 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Miscellaneous Configuration" FONT 8, "MS Sans Serif" BEGIN - EDITTEXT IDC_LAN_ADAPTER,162,22,32,13,ES_AUTOHSCROLL - EDITTEXT IDC_PROBE,90,40,32,13,ES_AUTOHSCROLL - EDITTEXT IDC_THREADS,90,60,32,13,ES_AUTOHSCROLL - EDITTEXT IDC_DAEMONS,90,80,32,13,ES_AUTOHSCROLL - EDITTEXT IDC_SYSNAME,90,100,83,13,ES_AUTOHSCROLL - EDITTEXT IDC_MOUNTDIR,90,120,83,13,ES_AUTOHSCROLL - EDITTEXT IDC_ROOTVOLUME,90,140,83,13,ES_AUTOHSCROLL - DEFPUSHBUTTON "OK",IDOK,55,172,50,14 - PUSHBUTTON "Cancel",IDCANCEL,109,172,50,14 - PUSHBUTTON "Help",9,163,172,50,14 - GROUPBOX "Parameters",IDC_STATIC,7,7,206,156 - LTEXT "&Probe Interval:",IDC_STATIC,15,42,71,8 - LTEXT "seconds",IDC_STATIC,138,42,68,8 - LTEXT "&Background Threads:",IDC_STATIC,15,62,71,8 - LTEXT "threads",IDC_STATIC,138,62,68,8 - LTEXT "S&ervice Threads:",IDC_STATIC,15,82,71,8 - LTEXT "threads",IDC_STATIC,138,82,68,8 - LTEXT "S&ystem Name:",IDC_STATIC,15,102,71,8 - LTEXT "&Mount Directory:",IDC_STATIC,15,122,71,8 - LTEXT "&Root Volume:",IDC_STATIC,15,141,71,8 - CONTROL "Automatic Lana scan",IDC_AUTOLANA,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,19,22,82,10 - RTEXT "Lana Number:",IDC_STATICLANA,106,24,53,8 + EDITTEXT IDC_PROBE,90,16,32,13,ES_AUTOHSCROLL + EDITTEXT IDC_THREADS,90,36,32,13,ES_AUTOHSCROLL + EDITTEXT IDC_DAEMONS,90,56,32,13,ES_AUTOHSCROLL + EDITTEXT IDC_SYSNAME,90,76,83,13,ES_AUTOHSCROLL + EDITTEXT IDC_MOUNTDIR,90,96,83,13,ES_AUTOHSCROLL + EDITTEXT IDC_ROOTVOLUME,90,116,83,13,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",IDOK,55,143,50,14 + PUSHBUTTON "Cancel",IDCANCEL,109,143,50,14 + PUSHBUTTON "Help",9,163,143,50,14 + GROUPBOX "Parameters",IDC_STATIC,7,7,206,130 + LTEXT "&Probe Interval:",IDC_STATIC,15,18,71,8 + LTEXT "seconds",IDC_STATIC,138,18,68,8 + LTEXT "&Background Threads:",IDC_STATIC,15,38,71,8 + LTEXT "threads",IDC_STATIC,138,38,68,8 + LTEXT "S&ervice Threads:",IDC_STATIC,15,58,71,8 + LTEXT "threads",IDC_STATIC,138,58,68,8 + LTEXT "S&ystem Name:",IDC_STATIC,15,78,71,8 + LTEXT "&Mount Directory:",IDC_STATIC,15,98,71,8 + LTEXT "&Root Volume:",IDC_STATIC,15,117,71,8 END IDD_DIAG_PARMS DIALOG DISCARDABLE 0, 0, 217, 135 @@ -447,6 +446,23 @@ BEGIN GROUPBOX "Global AFS Drive",IDC_STATIC,7,7,232,80 END +IDD_BINDING_CONFIG_PARAMS DIALOG DISCARDABLE 0, 0, 220, 149 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Binding" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Use Default NIC",IDC_DEFAULTNIC,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,14,82,10 + COMBOBOX IDC_NICSELECTION,15,41,159,66,CBS_DROPDOWN | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "OK",IDOK,55,128,50,14 + PUSHBUTTON "Cancel",IDCANCEL,109,128,50,14 + PUSHBUTTON "Help",9,163,128,50,14 + GROUPBOX "Network Adapter Selection (NIC):",IDC_STATIC,7,5,206,57 + LTEXT "Select the NIC to Bind to:",IDC_STATICLANA,15,29,78,8 + LTEXT "",IDC_BINDING_MESSAGE,7,68,206,41 +END + ///////////////////////////////////////////////////////////////////////////// // @@ -501,7 +517,7 @@ BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 213 TOPMARGIN, 7 - BOTTOMMARGIN, 218 + BOTTOMMARGIN, 240 END IDD_PREFS_EDIT, DIALOG @@ -589,7 +605,7 @@ BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 213 TOPMARGIN, 7 - BOTTOMMARGIN, 186 + BOTTOMMARGIN, 163 END IDD_DIAG_PARMS, DIALOG @@ -615,6 +631,14 @@ BEGIN TOPMARGIN, 7 BOTTOMMARGIN, 162 END + + IDD_BINDING_CONFIG_PARAMS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 213 + TOPMARGIN, 7 + BOTTOMMARGIN, 142 + END END #endif // APSTUDIO_INVOKED diff --git a/src/WINNT/client_config/lang/zh_CN/afs_config.rc b/src/WINNT/client_config/lang/zh_CN/afs_config.rc index 3175ff120..3641987d3 100644 --- a/src/WINNT/client_config/lang/zh_CN/afs_config.rc +++ b/src/WINNT/client_config/lang/zh_CN/afs_config.rc @@ -7,762 +7,762 @@ * directory or online at http://www.openafs.org/dl/license10.html */ -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include -#ifndef APSTUDIO_INVOKED -#define AFS_VERINFO_FILE_DESCRIPTION "AFS ¿Í»§»úÅäÖÃ" +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include +#ifndef APSTUDIO_INVOKED +#define AFS_VERINFO_FILE_DESCRIPTION "AFS ¿Í»§»úÅäÖÃ" #define AFS_VERINFO_NAME "afs_config" #define AFS_VERINFO_FILENAME "afs_config.exe" #define AFS_VERINFO_LANG_CODE 0x804 #define AFS_VERINFO_CHARSET 936 -#include "AFS_component_version_number.h" -#include "..\..\config\NTVersioninfo.rc" -#endif // APSTUDIO_INVOKED - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Chinese (P.R.C.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) -#ifdef _WIN32 -LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_GENERAL_NT DIALOG DISCARDABLE 0, 0, 220, 225 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Ò»°ã" -FONT 9, "ËÎÌå" -BEGIN - GROUPBOX "¿Í»§»úÅäÖÃ",IDC_STATIC,7,7,206,142 - LTEXT "µ¥ÔªÃû(&C)£º",IDC_STATIC,13,23,44,8 - EDITTEXT IDC_CELL,62,22,114,13,ES_LOWERCASE | ES_AUTOHSCROLL - CONTROL "µÇ¼µ½ Windows ʱ»ñµÃ AFS ÁîÅÆ",IDC_LOGON,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,50,193,10 - CONTROL "Ìṩ AFS Light Íø¹Ø(&P)",IDC_GATEWAY,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,72,193,10 - CONTROL "ÔÚÈÎÎñÀ¸ÖÐÏÔʾ AFS ¿Í»§»úͼ±ê(&I)",IDC_TRAYICON,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,95,193,10 - LTEXT "×¢Ò⣺ÓÉÓÚûÓÐÔËÐÐ AFS ¿Í»§»ú·þÎñ£¬½«½ûÓÃÕâЩ¿ØÖÆ¡£", - IDC_WARN,13,124,193,17 - GROUPBOX "¿Í»§»ú״̬",IDC_STATIC,7,157,206,61 - LTEXT "(²éѯµ±Ç°×´Ì¬)",IDC_STATUS,13,172,193,17 - PUSHBUTTON "Æô¶¯·þÎñ(&S)",IDC_SERVICE_START,88,195,57,14 - PUSHBUTTON "Í£Ö¹·þÎñ(&T)",IDC_SERVICE_STOP,149,195,57,14 -END - -IDD_GENERAL_95 DIALOG DISCARDABLE 0, 0, 245, 145 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Ò»°ã" -FONT 9, "ËÎÌå" -BEGIN - GROUPBOX "¿Í»§»úÅäÖÃ",IDC_STATIC,7,7,231,131 - LTEXT "Íø¹Ø(&G)£º",IDC_STATIC,13,28,45,8 - EDITTEXT IDC_GATEWAY,63,27,104,13,ES_AUTOHSCROLL - PUSHBUTTON "ÏÖÔÚÁ¬½Ó(&N)",IDC_GATEWAY_CONN,172,27,57,14 - LTEXT "µ¥ÔªÃû(&C)£º",IDC_STATIC,13,51,45,8 - EDITTEXT IDC_CELL,63,49,104,13,ES_LOWERCASE | ES_AUTOHSCROLL | - WS_DISABLED | NOT WS_TABSTOP - CONTROL "µÇ¼µ½ Windows ʱ»ñµÃ AFS ÁîÅÆ",IDC_LOGON,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,73,193,10 - CONTROL "ÔÚÈÎÎñÀ¸ÖÐÏÔʾ AFS Light ͼ±ê(&H)",IDC_TRAYICON,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,93,193,10 - LTEXT "×¢Ò⣺ÓÉÓÚ AFS ¿Í»§»úûÓÐÁ¬½ÓÖÁ AFS Íø¹Ø£¬½«½ûÓÃÕâЩ¿ØÖÆ¡£", - IDC_WARN,13,114,219,17 -END - -IDD_PREFS_NT DIALOG DISCARDABLE 0, 0, 220, 225 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Ê×Ñ¡Ïî" -FONT 9, "ËÎÌå" -BEGIN - GROUPBOX "·þÎñÆ÷Ê×Ñ¡Ïî",-1,7,7,206,211 - CONTROL "ÏÔʾÎļþ·þÎñÆ÷Ê×Ñ¡Ïî(&F)",IDC_SHOW_FS,"Button", - BS_AUTORADIOBUTTON,13,21,193,10 - CONTROL "ÏÔʾ¾íλÖ÷þÎñÆ÷Ê×Ñ¡Ïî(&V)",IDC_SHOW_VLS,"Button", - BS_AUTORADIOBUTTON,13,34,193,10 - CONTROL "",IDC_LIST,"FastList",WS_BORDER | WS_TABSTOP | 0xb,13, - 49,173,120 - PUSHBUTTON "Ìí¼Ó(&A)...",IDC_ADD,84,172,50,14 - PUSHBUTTON "¸ü¸Ä(&C)...",IDC_EDIT,137,172,50,14 - PUSHBUTTON "^",IDC_UP,191,97,15,14,BS_ICON - PUSHBUTTON "v",IDC_DOWN,191,117,15,14,BS_ICON - PUSHBUTTON "µ¼Èë(&I)...",IDC_IMPORT,13,172,50,14 - LTEXT "×¢Ò⣺ÓÉÓÚûÓÐÔËÐÐ AFS ¿Í»§»ú·þÎñ£¬½«½ûÓÃÕâЩ¿ØÖÆ¡£", - IDC_WARN,13,193,193,17 -END - -IDD_HOSTS_NT DIALOG DISCARDABLE 0, 0, 220, 225 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "AFS µ¥Ôª" -FONT 9, "ËÎÌå" -BEGIN - GROUPBOX "AFS µ¥Ôª",IDC_STATIC,7,7,206,211 - CONTROL "",IDC_LIST,"FastList",WS_BORDER | WS_TABSTOP | 0x11b,13, - 21,193,168 - PUSHBUTTON "Ìí¼Ó(&A)...",IDC_ADD,51,195,50,14 - PUSHBUTTON "¸ü¸Ä(&C)...",IDC_EDIT,104,195,50,14 - PUSHBUTTON "³ýÈ¥(&R)",IDC_REMOVE,157,195,50,14 -END - -IDD_DRIVES_NT DIALOG DISCARDABLE 0, 0, 220, 225 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "ÅÌ·û" -FONT 9, "ËÎÌå" -BEGIN - GROUPBOX "ÅÌ·û",IDC_STATIC,7,7,206,211 - CONTROL "",IDC_LIST,"CheckList",WS_BORDER | WS_TABSTOP | 0x153, - 13,32,193,135 - PUSHBUTTON "Ìí¼Ó(&A)...",IDC_ADD,69,171,48,14 - PUSHBUTTON "¸ü¸Ä(&C)...",IDC_EDIT,120,171,42,14 - PUSHBUTTON "³ýÈ¥(&R)",IDC_REMOVE,165,171,42,14 - LTEXT "½«ÅÌ·ûÓ³ÉäÖÁ AFS ÖеÄ·¾¶£º",IDC_STATIC,13,21,193,8 - PUSHBUTTON "¸ß¼¶(&V)...",IDC_ADVANCED,13,171,53,14 - LTEXT "×¢Ò⣺ÓÉÓÚûÓÐÔËÐÐ AFS ¿Í»§»ú·þÎñ£¬½«½ûÓÃÕâЩ¿ØÖÆ¡£", - IDC_WARN,13,193,193,17 -END - -IDD_ADVANCED_NT DIALOG DISCARDABLE 0, 0, 220, 225 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "¸ß¼¶" -FONT 9, "ËÎÌå" -BEGIN - EDITTEXT IDC_CACHE_SIZE,88,21,32,13,ES_AUTOHSCROLL - EDITTEXT IDC_CACHE_PATH,88,41,83,13,ES_AUTOHSCROLL - EDITTEXT IDC_CHUNK_SIZE,88,62,32,13,ES_AUTOHSCROLL | ES_READONLY - EDITTEXT IDC_STAT_ENTRIES,88,83,32,13,ES_AUTOHSCROLL - PUSHBUTTON "µÇ¼(&L)...",IDC_LOGON_PARMS,13,128,68,14 - PUSHBUTTON "È«¾ÖÇý¶¯Æ÷(&G)...",IDC_AUTOMAP_PARMS,13,173,68,14 - PUSHBUTTON "ÔÓÏî(&M)...",IDC_MISC_PARMS,13,195,68,14 - GROUPBOX "¸ßËÙ»º´æÅäÖÃ",IDC_STATIC,7,7,206,100 - LTEXT "¸ßËÙ»º´æ´óС(&C)£º",IDC_STATIC,13,23,71,8 - LTEXT "KB",IDC_INUSE,136,23,68,8 - LTEXT "¿é´óС(&H)£º",IDC_STATIC,13,64,71,8 - LTEXT "KB",IDC_STATIC,136,64,68,8 - LTEXT "״̬¸ßËÙ»º´æ(&S)£º",IDC_STATIC,13,85,71,8 - LTEXT "ÌõÄ¿",IDC_STATIC,136,85,68,8 - LTEXT "¸ßËÙ»º´æÂ·¾¶(&P)£º",IDC_STATIC,13,44,71,8 - GROUPBOX "¸½¼Ó¸ß¼¶²ÎÊý",IDC_STATIC,7,114,206,104 - LTEXT "´´½¨È«¾Ö AFS Çý¶¯Æ÷Ó³Éä¡£",IDC_STATIC,86,176,120,10 - LTEXT "µ÷Õû¼¯³ÉµÇ¼ÉèÖá£",IDC_STATIC,86,132,120,10 - LTEXT "ÉèÖÃÆäËü¸ß¼¶²ÎÊý¡£",IDC_STATIC,86,199,120,10 - PUSHBUTTON "Õï¶Ï(&D)...",IDC_DIAG_PARMS,13,150,68,14 - LTEXT "ÆôÓÃÎÊÌâµ÷ÊÔÉèÖá£",IDC_STATIC,86,153,120,10 -END - -IDD_PREFS_EDIT DIALOG DISCARDABLE 0, 0, 251, 123 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Ö¸¶¨·þÎñÆ÷µÄÓÅÏȼ¶" -FONT 9, "ËÎÌå" -BEGIN - LTEXT "¿ÉΪ´Ë AFS µ¥ÔªÖеķþÎñÆ÷Ö¸¶¨ÓÅÏȼ¶ÅÅÐò¡£µ±²éÕÒ AFS ÖеÄÊý¾Ýʱ£¬½«Ê×ÏȲéѯÓÅÏȼ¶½Ï¸ßµÄ·þÎñÆ÷¡£", - IDC_STATIC,7,7,237,17 - LTEXT "·þÎñÆ÷(&S)£º",IDC_STATIC,7,38,51,8 - LTEXT "ÅÅÐò(&R)£º",IDC_STATIC,7,54,51,8 - EDITTEXT IDC_SERVER,63,36,80,13,ES_AUTOHSCROLL - EDITTEXT IDC_RANK,63,52,36,13,ES_AUTOHSCROLL - LTEXT "ÇÏÃÅ£ºÔÚʹÓá°µ¼È롱°´Å¥ÒÔ¶ÁÈ¡Îı¾ÎļþÖ¸¶¨µÄ·þÎñÆ÷ºÍËüÃǵÄÅÅÐòʱ£¬¿Éͬʱָ¶¨¼¸¸ö·þÎñÆ÷µÄÅÅÐò¡£", - IDC_STATIC,7,76,237,18 - PUSHBUTTON "È¡Ïû",IDCANCEL,140,102,50,14 - PUSHBUTTON "È·¶¨",IDOK,86,102,50,14 - PUSHBUTTON "°ïÖú",9,194,102,50,14 -END - -IDD_CELL_EDIT DIALOG DISCARDABLE 0, 0, 244, 223 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "µ¥ÔªÌØÐÔ" -FONT 9, "ËÎÌå" -BEGIN - LTEXT "´ËÒ³ÃæÉϵÄÐÅÏ¢½«¸æËß AFS ÈçºÎÁªÏµÖ¸¶¨µÄµ¥Ôª¡£", - IDC_STATIC,4,4,226,8 - LTEXT "AFS µ¥Ôª(&A)£º",IDC_STATIC,4,24,58,8 - EDITTEXT IDC_CELL,62,22,105,13,ES_LOWERCASE | ES_AUTOHSCROLL - LTEXT "ÃèÊö(&D)£º",IDC_STATIC,4,41,38,8 - EDITTEXT IDC_COMMENT,62,39,171,13,ES_AUTOHSCROLL - GROUPBOX "·þÎñÆ÷",IDC_STATIC,4,61,236,158 - CONTROL "",IDC_LIST,"FastList",WS_BORDER | WS_TABSTOP | 0x1b,13, - 76,217,117 - PUSHBUTTON "Ìí¼Ó(&A)...",IDC_ADD,75,198,50,14 - PUSHBUTTON "¸ü¸Ä(&C)...",IDC_EDIT,128,198,50,14 - PUSHBUTTON "³ýÈ¥(&R)",IDC_REMOVE,181,198,50,14 -END - -IDD_SERVER_EDIT DIALOG DISCARDABLE 0, 0, 251, 112 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Ìí¼Ó£¯±à¼­·þÎñÆ÷" -FONT 9, "ËÎÌå" -BEGIN - LTEXT "ÔÚÖ¸¶¨µ¥ÔªÖÐÊäÈë¾íλÖ÷þÎñÆ÷µÄÃû³Æ¡£",IDC_STATIC,7,7, - 237,8 - LTEXT "·þÎñÆ÷Ãû(&N)£º",IDC_STATIC,7,31,53,8 - EDITTEXT IDC_COMMENT,75,29,156,13,ES_AUTOHSCROLL - LTEXT "·þÎñÆ÷µØÖ·(&A)£º",IDC_STATIC,7,52,64,8 - CONTROL "ʹÓÃÌØ¶¨µØÖ·(&U)£º",IDC_ADDR_SPECIFIC,"Button", - BS_AUTORADIOBUTTON,75,52,83,10 - CONTROL "×Ô¶¯²éÕÒµØÖ·(&L)",IDC_ADDR_LOOKUP,"Button", - BS_AUTORADIOBUTTON,75,66,111,10 - CONTROL "",IDC_SERVER,"SockAddr",WS_BORDER | WS_TABSTOP,163,51, - 65,13 - PUSHBUTTON "È¡Ïû",IDCANCEL,140,91,50,14 - PUSHBUTTON "È·¶¨",IDOK,86,91,50,14 - PUSHBUTTON "°ïÖú",9,194,91,50,14 -END - -IDD_DRIVE_EDIT DIALOG DISCARDABLE 0, 0, 297, 156 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Ó³ÉäÅÌ·û" -FONT 9, "ËÎÌå" -BEGIN - LTEXT "¿ÉÓ³É伯Ëã»úÉϵÄÅÌ·ûÖÁ AFS ÖеÄ·¾¶¡£",IDC_STATIC,7,7, - 283,8 - LTEXT "ÀýÈ磬Èç¹ûÓ³ÉäÇý¶¯Æ÷ Q ÖÁ /afs/acme.com/usr/bob£¬Ôò AFS µÄ /afs/acme.com/usr/bob/* ÖеĿÉÓÃÎļþ½«ÔÚÄú¼ÆËã»úµÄ Q:\\ Ŀ¼Ï¿ɼû¡£", - IDC_STATIC,7,26,283,16 - LTEXT "ÅÌ·û(&D)£º",IDC_STATIC,14,59,58,8 - COMBOBOX IDC_DRIVE,77,57,63,206,CBS_DROPDOWNLIST | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - LTEXT "AFS ·¾¶(&P)£º",IDC_STATIC,14,77,58,8 - EDITTEXT IDC_PATH,77,75,168,13,ES_AUTOHSCROLL - LTEXT "ÃèÊö(&E)£º",IDC_STATIC,14,96,58,8 - EDITTEXT IDC_DESC,77,94,72,13,ES_AUTOHSCROLL - CONTROL "µÇ¼ʱ»Ö¸´Ó³Éä(&R)",IDC_PERSISTENT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,77,112,188,10 - PUSHBUTTON "È¡Ïû",IDCANCEL,186,135,50,14 - PUSHBUTTON "È·¶¨",IDOK,132,135,50,14 - PUSHBUTTON "°ïÖú",9,240,135,50,14 -END - -IDD_SUBMOUNTS DIALOG DISCARDABLE 0, 0, 244, 198 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "×Ó°²×°" -FONT 9, "ËÎÌå" -BEGIN - LTEXT "ÄúµÄ¼ÆËã»ú¿ÉÌṩ AFS ÖеÄ×Ó°²×°--ÍøÂç¹²Ïí¡£",IDC_STATIC, - 4,4,196,8 - GROUPBOX "×Ó°²×°",IDC_STATIC,4,26,236,168 - LTEXT "ÏÂÁÐ×Ó°²×°´Ó´Ë¼ÆËã»úÉϹ²Ïí£º",IDC_STATIC,10,42,176,8 - CONTROL "",IDC_LIST,"FastList",WS_BORDER | WS_TABSTOP | 0x413,10, - 54,223,115 - PUSHBUTTON "Ìí¼Ó(&A)...",IDC_ADD,78,173,50,14 - PUSHBUTTON "¸ü¸Ä(&C)...",IDC_EDIT,131,173,50,14 - PUSHBUTTON "³ýÈ¥(&R)",IDC_REMOVE,184,173,50,14 -END - -IDD_SUBMOUNT_EDIT DIALOG DISCARDABLE 0, 0, 270, 112 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Ö¸¶¨×Ó°²×°" -FONT 9, "ËÎÌå" -BEGIN - LTEXT "ʹÓà Windows ÍøÂ磬×Ó°²×°ÈÃÄú¹²ÏíÒ»¸ö×ÓĿ¼Ê÷¡£", - IDC_STATIC,7,7,256,8 - LTEXT "×Ó°²×°(&S)£º",IDC_STATIC,7,27,53,8 - LTEXT "AFS ·¾¶(&P)£º",IDC_STATIC,7,43,53,8 - EDITTEXT IDC_SUBMOUNT,63,25,80,13,ES_AUTOHSCROLL - EDITTEXT IDC_MAPPING,63,41,181,13,ES_AUTOHSCROLL - LTEXT "Ϊ×Ó°²×°ÊäÈë¶ÌÃû£¬²¢ÇÒµ±³öÏÖÌáʾʱÊäÈëÒ»¸öÈ« AFS ·¾¶¡£AFS ·¾¶¿ÉÒÔ""\\afs""¿ªÊ¼(Èç¹û²»ÊÇ£¬""\\afs""½«×Ô¶¯Ìí¼Ó)¡£", - IDC_STATIC,7,64,256,18 - PUSHBUTTON "È¡Ïû",IDCANCEL,159,91,50,14 - PUSHBUTTON "È·¶¨",IDOK,105,91,50,14 - PUSHBUTTON "°ïÖú",9,213,91,50,14 -END - -IDD_DRIVES_95 DIALOG DISCARDABLE 0, 0, 245, 145 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "ÅÌ·û" -FONT 9, "ËÎÌå" -BEGIN - GROUPBOX "ÅÌ·û",IDC_STATIC,7,7,231,131 - CONTROL "",IDC_LIST,"CheckList",WS_BORDER | WS_TABSTOP | 0x153, - 13,32,219,60 - PUSHBUTTON "Ìí¼Ó(&A)...",IDC_ADD,83,95,48,14 - PUSHBUTTON "¸ü¸Ä(&C)...",IDC_EDIT,134,95,48,14 - PUSHBUTTON "³ýÈ¥(&R)",IDC_REMOVE,184,95,48,14 - LTEXT "½«ÅÌ·ûÓ³ÉäÖÁ AFS ÖеÄ·¾¶£º",IDC_STATIC,13,21,193,8 - LTEXT "×¢Ò⣺ÓÉÓÚ AFS ¿Í»§»úûÓÐÁ¬½ÓÖÁ AFS Íø¹Ø£¬½«½ûÓÃÕâЩ¿ØÖÆ¡£", - IDC_WARN,13,116,219,17 -END - -IDD_HOSTS_95 DIALOG DISCARDABLE 0, 0, 245, 145 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "AFS µ¥Ôª" -FONT 9, "ËÎÌå" -BEGIN - GROUPBOX "AFS µ¥Ôª",IDC_STATIC,7,7,231,131 - CONTROL "",IDC_LIST,"FastList",WS_BORDER | WS_TABSTOP | 0x11b,13, - 19,218,94 - PUSHBUTTON "Ìí¼Ó(&A)...",IDC_ADD,75,116,50,14 - PUSHBUTTON "¸ü¸Ä(&C)...",IDC_EDIT,128,116,50,14 - PUSHBUTTON "³ýÈ¥(&R)",IDC_REMOVE,181,116,50,14 -END - -IDD_STARTSTOP DIALOGEX 0, 0, 219, 48 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION -EXSTYLE WS_EX_TOOLWINDOW -CAPTION "AFS ¿Í»§»ú·þÎñ" -FONT 9, "ËÎÌå", 0, 0, 0x1 -BEGIN - GROUPBOX "",IDC_STATIC,4,0,211,44 - ICON IDI_MAIN,IDC_STATIC,14,15,20,20 - LTEXT "ÇëµÈ´ý£»AFS ¿Í»§»ú·þÎñÕýÔÚÆô¶¯...",IDC_STARTING,46,20, - 157,8 - LTEXT "ÇëµÈ´ý£»AFS ¿Í»§»ú·þÎñÕýÔÚÍ£Ö¹...",IDC_STOPPING,46,20, - 157,8 -END - -IDD_HOSTS_CCENTER DIALOG DISCARDABLE 0, 0, 220, 256 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Ò»°ã" -FONT 9, "ËÎÌå" -BEGIN - GROUPBOX "ȱʡµ¥Ôª",IDC_STATIC,7,7,206,54 - LTEXT "ÊäÈëÒª¹ÜÀíµÄȱʡ AFS µ¥ÔªÃû£º",IDC_STATIC,14,19,164,8 - LTEXT "ȱʡµ¥Ôª£º",IDC_STATIC,14,37,44,8 - EDITTEXT IDC_CELL,65,35,141,14,ES_LOWERCASE | ES_AUTOHSCROLL - GROUPBOX "AFS µ¥Ôª",IDC_STATIC,7,69,206,180 - CONTROL "",IDC_LIST,"FastList",WS_BORDER | WS_TABSTOP | 0x11b,13, - 84,193,137 - PUSHBUTTON "Ìí¼Ó(&A)...",IDC_ADD,51,227,50,14 - PUSHBUTTON "¸ü¸Ä(&C)...",IDC_EDIT,104,227,50,14 - PUSHBUTTON "³ýÈ¥(&R)",IDC_REMOVE,157,227,50,14 -END - -IDD_MISC_CONFIG_PARMS DIALOG DISCARDABLE 0, 0, 220, 193 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "ÔÓÏîÅäÖÃ" -FONT 8, "System" -BEGIN - EDITTEXT IDC_LAN_ADAPTER,90,20,32,13,ES_AUTOHSCROLL - EDITTEXT IDC_PROBE,90,40,32,13,ES_AUTOHSCROLL - EDITTEXT IDC_THREADS,90,60,32,13,ES_AUTOHSCROLL - EDITTEXT IDC_DAEMONS,90,80,32,13,ES_AUTOHSCROLL - EDITTEXT IDC_SYSNAME,90,100,83,13,ES_AUTOHSCROLL - EDITTEXT IDC_MOUNTDIR,90,120,83,13,ES_AUTOHSCROLL - EDITTEXT IDC_ROOTVOLUME,90,140,83,13,ES_AUTOHSCROLL - DEFPUSHBUTTON "È·¶¨",IDOK,55,172,50,14 - PUSHBUTTON "È¡Ïû",IDCANCEL,109,172,50,14 - PUSHBUTTON "°ïÖú",9,163,172,50,14 - GROUPBOX "²ÎÊý",IDC_STATIC,7,7,206,156 - LTEXT "¼ì²â¼ä¸ô(&P)£º",IDC_STATIC,15,42,71,8 - LTEXT "Ãë",IDC_STATIC,138,42,68,8 - LTEXT "ºǫ́Ïß³Ì(&B)£º",IDC_STATIC,15,62,71,8 - LTEXT "Ïß³Ì",IDC_STATIC,138,62,68,8 - LTEXT "·þÎñÏß³Ì(&E)£º",IDC_STATIC,15,82,71,8 - LTEXT "Ïß³Ì",IDC_STATIC,138,82,68,8 - LTEXT "ϵͳÃû³Æ(&Y)£º",IDC_STATIC,15,102,71,8 - LTEXT "°²×°Ä¿Â¼(&M)£º",IDC_STATIC,15,122,71,8 - LTEXT "LAN ÊÊÅäÆ÷ºÅ(&L)£º",IDC_STATIC,15,22,71,8 - LTEXT "¸ù¾í(&R)£º",IDC_STATIC,15,141,71,8 -END - -IDD_DIAG_PARMS DIALOG DISCARDABLE 0, 0, 217, 135 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Õï¶ÏÅäÖÃ" -FONT 8, "System" -BEGIN - EDITTEXT IDC_TRACE_LOG_BUF_SIZE,112,20,32,13,ES_AUTOHSCROLL - DEFPUSHBUTTON "È·¶¨",IDOK,52,114,50,14 - PUSHBUTTON "È¡Ïû",IDCANCEL,106,114,50,14 - PUSHBUTTON "°ïÖú",9,160,114,50,14 - GROUPBOX "¸ú×ÙÈÕÖ¾²ÎÊý",IDC_STATIC,7,7,203,54 - LTEXT "»º³åÇø´óС(&B)£º",IDC_STATIC,13,22,73,8 - LTEXT "KB",IDC_STATIC,155,24,9,8 - GROUPBOX "ʼþÈÕÖ¾²ÎÊý",IDC_STATIC,7,69,203,35 - COMBOBOX IDC_TRAP_ON_PANIC,112,40,32,61,CBS_DROPDOWNLIST | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "½ô¼±Çé¿öϵ÷ÓÃÏÝÚå(&T)£º",IDC_STATIC,13,42,93,8 - LTEXT "±¨¸æ»á»°Æô¶¯£º",IDC_STATIC,13,86,79,8 - COMBOBOX IDC_REPORT_SESSION_STARTUPS,112,84,32,64, - CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP -END - -IDD_LOGIN_CONFIG_PARMS DIALOG DISCARDABLE 0, 0, 186, 92 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "µÇ¼ÅäÖÃ" -FONT 8, "System" -BEGIN - EDITTEXT IDC_LOGIN_RETRY_INTERVAL,117,18,32,13,ES_AUTOHSCROLL - COMBOBOX IDC_FAIL_SILENTLY,117,39,32,40,CBS_DROPDOWNLIST | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - DEFPUSHBUTTON "È·¶¨",IDOK,21,71,50,14 - PUSHBUTTON "È¡Ïû",IDCANCEL,75,71,50,14 - PUSHBUTTON "°ïÖú",9,129,71,50,14 - LTEXT "µÇÂ¼ÖØÊÔ¼ä¸ô(&L)£º",IDC_STATIC,13,20,98,8 - GROUPBOX "²ÎÊý",IDC_STATIC,7,7,172,54 - LTEXT "µÇ¼ʧ°Ü£¬ÎÞÈκÎÌáʾ(&F)£º",IDC_STATIC,13,41,98,8 -END - -IDD_GLOBAL_DRIVES DIALOG DISCARDABLE 0, 0, 253, 169 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "È«¾ÖÇý¶¯Æ÷" -FONT 8, "System" -BEGIN - DEFPUSHBUTTON "¹Ø±Õ",IDOK,141,148,50,14 - PUSHBUTTON "°ïÖú",9,196,148,50,14 - PUSHBUTTON "Ìí¼Ó(&A)",IDC_ADD,108,117,42,14 - GROUPBOX "È«¾ÖÓ³Éä AFS Çý¶¯Æ÷",IDC_STATIC,7,7,239,133 - CONTROL "",IDC_GLOBAL_DRIVE_LIST,"FastList",WS_BORDER | - WS_TABSTOP | 0x1b,14,20,226,89 - PUSHBUTTON "¸ü¸Ä(&C)",IDC_CHANGE,153,117,42,14 - PUSHBUTTON "³ýÈ¥(&R)",IDC_REMOVE,198,117,42,14 -END - -IDD_GLOBAL_DRIVES_ADDEDIT DIALOG DISCARDABLE 0, 0, 247, 118 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Ó³ÉäÈ«¾ÖÇý¶¯Æ÷" -FONT 8, "System" -BEGIN - COMBOBOX IDC_DRIVE,63,23,63,206,CBS_DROPDOWNLIST | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_PATH,63,42,168,13,ES_AUTOHSCROLL - EDITTEXT IDC_DESC,63,62,72,13,ES_AUTOHSCROLL - DEFPUSHBUTTON "È·¶¨",IDOK,82,96,50,14 - PUSHBUTTON "È¡Ïû",IDCANCEL,136,96,50,14 - PUSHBUTTON "°ïÖú",9,190,96,50,14 - LTEXT "ÅÌ·û(&D)£º",IDC_STATIC,12,25,48,8 - LTEXT "AFS ·¾¶(&P)£º",IDC_STATIC,12,44,48,8 - LTEXT "ÃèÊö(&E)£º",IDC_STATIC,12,64,48,8 - GROUPBOX "È«¾Ö AFS Çý¶¯Æ÷",IDC_STATIC,7,7,232,80 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_GENERAL_NT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 213 - TOPMARGIN, 7 - BOTTOMMARGIN, 218 - END - - IDD_GENERAL_95, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 238 - TOPMARGIN, 7 - BOTTOMMARGIN, 138 - END - - IDD_PREFS_NT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 213 - TOPMARGIN, 7 - BOTTOMMARGIN, 218 - END - - IDD_HOSTS_NT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 213 - TOPMARGIN, 7 - BOTTOMMARGIN, 218 - END - - IDD_DRIVES_NT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 213 - TOPMARGIN, 7 - BOTTOMMARGIN, 218 - END - - IDD_ADVANCED_NT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 213 - TOPMARGIN, 7 - BOTTOMMARGIN, 218 - END - - IDD_PREFS_EDIT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 244 - TOPMARGIN, 7 - BOTTOMMARGIN, 116 - END - - IDD_CELL_EDIT, DIALOG - BEGIN - LEFTMARGIN, 4 - RIGHTMARGIN, 240 - TOPMARGIN, 4 - BOTTOMMARGIN, 219 - END - - IDD_SERVER_EDIT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 244 - TOPMARGIN, 7 - BOTTOMMARGIN, 105 - END - - IDD_DRIVE_EDIT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 290 - TOPMARGIN, 7 - BOTTOMMARGIN, 149 - END - - IDD_SUBMOUNTS, DIALOG - BEGIN - LEFTMARGIN, 4 - RIGHTMARGIN, 240 - TOPMARGIN, 4 - BOTTOMMARGIN, 194 - END - - IDD_SUBMOUNT_EDIT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 263 - TOPMARGIN, 7 - BOTTOMMARGIN, 105 - END - - IDD_DRIVES_95, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 238 - TOPMARGIN, 7 - BOTTOMMARGIN, 138 - END - - IDD_HOSTS_95, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 238 - TOPMARGIN, 7 - BOTTOMMARGIN, 138 - END - - IDD_STARTSTOP, DIALOG - BEGIN - LEFTMARGIN, 4 - RIGHTMARGIN, 215 - TOPMARGIN, 4 - BOTTOMMARGIN, 44 - END - - IDD_HOSTS_CCENTER, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 213 - TOPMARGIN, 7 - BOTTOMMARGIN, 249 - END - - IDD_MISC_CONFIG_PARMS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 213 - TOPMARGIN, 7 - BOTTOMMARGIN, 186 - END - - IDD_DIAG_PARMS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 210 - TOPMARGIN, 7 - BOTTOMMARGIN, 128 - END - - IDD_LOGIN_CONFIG_PARMS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 179 - TOPMARGIN, 7 - BOTTOMMARGIN, 85 - END - - IDD_GLOBAL_DRIVES, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 246 - TOPMARGIN, 7 - BOTTOMMARGIN, 162 - END -END -#endif // APSTUDIO_INVOKED - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include \r\n" - "#ifndef APSTUDIO_INVOKED\r\n" - "#define AFS_VERINFO_FILE_DESCRIPTION ""AFS ¿Í»§»úÅäÖÃ""\r\n" - "#include ""AFS_component_version_number.h""\r\n" - "#include ""..\\..\\config\\NTVersioninfo.rc""\r\n" - "#endif // APSTUDIO_INVOKED\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_MAIN ICON DISCARDABLE "afs_config.ico" -IDI_UP ICON DISCARDABLE "up.ico" -IDI_DOWN ICON DISCARDABLE "down.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_TITLE_NT "AFS ¿Í»§»úÅäÖÃ" - IDS_TITLE_95 "AFS Light ÅäÖÃ" - IDS_STATE_STOPPED "AFS ¿Í»§»ú·þÎñµ±Ç°ÎªÍ£Ö¹×´Ì¬¡£" - IDS_STATE_RUNNING "AFS ¿Í»§»ú·þÎñÕýÔÚÕý³£ÔËÐС£" - IDS_STATE_STARTING "ÇëµÈ´ý£»AFS ¿Í»§»ú·þÎñÕýÔÚÆô¶¯..." - IDS_STATE_STOPPING "ÇëµÈ´ý£»AFS ¿Í»§»ú·þÎñÕýÔÚÍ£Ö¹..." - IDS_STATE_UNKNOWN "AFS ¿Í»§»ú·þÎñûÓÐÊʵ±ÅäÖá£" - IDS_SERVICE_FAIL_START "AFS ¿Í»§»ú·þÎñ²»Äܳɹ¦Æô¶¯¡£Äú¿ÉÄÜûÓÐȨÏÞÀ´Ö´Ðд˲Ù×÷¡£\n\n´íÎó 0x%1¡£" - IDS_SERVICE_FAIL_STOP "AFS ¿Í»§»ú·þÎñ²»Äܳɹ¦Í£Ö¹¡£Äú¿ÉÄÜûÓÐȨÏÞÀ´Ö´Ðд˲Ù×÷¡£\n\n´íÎó 0x%1¡£" - IDS_WARN_STOPPED "ÓÉÓÚ AFS ¿Í»§»ú·þÎñûÓÐÔËÐУ¬²»Äܸü¸Ä½ûÓõĿØÖÆ¡£" - IDS_WARN_ADMIN "ÓÉÓÚÄúûÓÐÒÔ¹ÜÀíÔ±Éí·ÝµÇ¼ÖÁ Windows£¬²»Äܸü¸Ä½ûÓõĿØÖÆ¡£" - IDS_CELL_UNKNOWN "(δ֪)" - IDS_GATEWAY_UNKNOWN "(δ֪)" -END - -STRINGTABLE DISCARDABLE -BEGIN - IDS_BADLOOKUP_DESC "Windows ÕÒ²»µ½ %1 µÄÍøÂçµØÖ·¡£¼ì²éÒÔÈ·±£ÊäÈëÁËÕýÈ·µÄ»úÆ÷Ãû¡£" - IDS_NEWSUB_DESC "µ±Á¬½ÓÍøÂçÇý¶¯Æ÷ʱ£¬AFS ÎÞ·¨Ê¹ÓÃÖ¸¶¨µÄÃèÊö¡£\n\nÖ¸¶¨µÄÃèÊöÒÑʹÓÃÔÚ²»Í¬µÄ AFS ·¾¶ÖС£" - IDS_BADSUB_DESC "²»ÄÜʹÓÃÄúÊäÈëµÄÅÌ·ûÃèÊö¡£\n\nÅÌ·ûÃèÊö²»Äܳ¬¹ý 12 ¸ö×Ö·û£¬²¢ÇÒ²»Äܰüº¬¿Õ¸ñ»òÖÆ±í·û¡£" - IDS_BADGATEWAY_DESC "AFS ÎÞ·¨Á¬½ÓÖÁÄúÖ¸¶¨µÄÍø¹Ø»úÆ÷¡£\n\n¼ì²éÒÔÈ·±£ÊäÈëÁíÍâÕýÈ·µÄÍø¹ØÉ豸Ãû³Æ¡£" - IDS_BADGWCELL_DESC "ÕÒ²»µ½Ö¸¶¨µÄÍø¹Ø»úÆ÷ʹÓÃµÄ AFS µ¥ÔªµÄÅäÖÃÐÅÏ¢¡£\n\nÈç¹ûÄúÒªÔÚеĵ¥ÔªÖÐÅäÖà AFS ¿Í»§»ú£¬±ØÐëʹÓá°AFS µ¥Ôª¡±±êÇ©ÒÔÌí¼Ó¸Ãе¥ÔªµÄÅäÖÃÐÅÏ¢¡£\n\nµ¥Ôª£º%1" - IDS_TITLE_CAUTION_NT "×¢Òâ - AFS ¿Í»§»úÅäÖÃ" - IDS_TITLE_CAUTION_95 "×¢Òâ - AFS Light" - IDS_TITLE_ERROR_NT "³ö´í - AFS ¿Í»§»úÅäÖÃ" - IDS_TITLE_ERROR_95 "³ö´í - AFS Light ÅäÖÃ" - IDS_SHRINKCACHE "µ± AFS ¿Í»§»ú·þÎñÕýÔÚÔËÐÐʱ²»ÄܼõÉÙ AFS ¿Í»§»ú¸ßËÙ»º´æµÄ´óС¡£\n\nÒª¼õÉÙ¸ßËÙ»º´æµÄ´óС£¬Ê×ÏÈÔÚ¡°Ò»°ã¡±±êÇ©ÉÏʹÓá°Í£Ö¹·þÎñ¡±°´Å¥Í£Ö¹ AFS ¿Í»§»ú·þÎñ¡£" - IDS_BADCELL_DESC_CC "ÔÚÄúÊäÈëµÄ AFS µ¥ÔªÖÐÕÒ²»µ½ÅäÖÃÐÅÏ¢¡£\n\n+" -END - -STRINGTABLE DISCARDABLE -BEGIN - IDS_STOP_DESC "Èç¹ûÍ£Ö¹ AFS ¿Í»§»ú·þÎñ£¬´æ´¢ÔÚ AFS ÖеÄÎļþ½«²»¿É´Ó´Ë¼ÆËã»úÖдæÈ¡¡£\n\nÈ·ÈÏҪֹͣ·þÎñÂð?" - IDS_PREFCOL_SERVER "·þÎñÆ÷" - IDS_PREFCOL_RANK "ÅÅÐò" - IDS_TIP_PREFS "ÇÏÃÅ£ºµ±´Ó AFS ¶ÁÈ¡Îļþʱ£¬µÍÅÅÐòÊýµÄ·þÎñÆ÷½«»ñµÃ¸ßÓÅÏȼ¶¡£" - IDS_PREFERROR_RESOLVE "AFS ÕÒ²»µ½ÃûΪ %1 µÄ·þÎñÆ÷¡£Çë¼ì²éÒÔÈ·±£ÊäÈëÕýÈ·µÄ·þÎñÆ÷¡£" - IDS_FILTER_TXT "Îı¾Îļþ(*.TXT)£»*.TXT£»" - IDS_HOSTREM_MANY "ÄúÒÑÑ¡Ôñ³ýÈ¥ÓйØÑ¡¶¨µÄ AFS µ¥ÔªµÄËùÓÐÁ¬½ÓÐÅÏ¢¡£\n\nÈ·ÈÏÒª³ýÈ¥ÕâЩÌõÄ¿Âð?" - IDS_HOSTREM_ONE "ÄúÒÑÑ¡Ôñ³ýÈ¥ÓÐ¹Ø AFS µ¥Ôª %1 µÄËùÓÐÁ¬½ÓÐÅÏ¢¡£\n\nÈ·ÈÏÒª³ýÈ¥ÕâЩÌõÄ¿Âð?" - IDS_CELLEDIT_TITLE "%1 - ÌØÐÔ" - IDS_CELLADD_TITLE "н¨µ¥Ôª" - IDS_SVRCOL_SERVER "µØÖ·" - IDS_SVRCOL_COMMENT "·þÎñÆ÷Ãû" - IDS_TIP_DRIVES "ÇÏÃÅ£ºÑ¡ÖÐÓ³ÉäÅÌ·ûÅԵĸ´Ñ¡¿ò£¬Á¬½ÓÍøÂçÇý¶¯Æ÷Ó³Éä¡£" - IDS_MAP_LETTER "Çý¶¯Æ÷ *:" -END - -STRINGTABLE DISCARDABLE -BEGIN - IDS_DRIVE_MAP "Çý¶¯Æ÷ %1: \t%2" - IDS_ERROR_MAP "Ó³ÉäÍøÂçÇý¶¯Æ÷³ö´í" - IDS_ERROR_MAP_DESC "AFS ÎÞ·¨Ó³ÉäÍøÂçÇý¶¯Æ÷ÖÁ AFS ÖеÄ·¾¶¡£¼ì²éÒÔÈ·±£ÅÌ·ûµ±Ç°Ã»ÓÐʹÓá£\n\n´íÎó£º0x%1¡£" - IDS_ERROR_UNMAP "Ó³ÉäÍøÂçÇý¶¯Æ÷³ö´í" - IDS_ERROR_UNMAP_DESC "AFS ÎÞ·¨¶Ï¿ªÓëÖ¸¶¨ÍøÂçÇý¶¯Æ÷µÄÓ³Éä¡£¼ì²éÒÔÈ·±£ÅÌ·ûµ±Ç°Ã»ÓÐʹÓá£\n\n´íÎó£º0x%1¡£" - IDS_ADDSERVER_TITLE "Ìí¼Ó·þÎñÆ÷" - IDS_EDITSERVER_TITLE "±à¼­·þÎñÆ÷" - IDS_SUBCOL_SHARE "×Ó°²×°" - IDS_SUBCOL_PATH "AFS ·¾¶" - IDS_SUBMOUNTS_TITLE "×Ó°²×°" - IDS_BADCELL_DESC "ÔÚÄúÊäÈëµÄ AFS µ¥ÔªÖÐÕÒ²»µ½ÅäÖÃÐÅÏ¢¡£\n\n+" - IDS_BADCELL_DESC2 "¼ì²éÒÔÈ·±£ÄúÕýÈ·ÊäÈëÁ˵¥ÔªµÄÃû³Æ¡£Èç¹ûÄúÒªÔÚеĵ¥ÔªÖÐÅäÖà AFS ¿Í»§»ú£¬Äú±ØÐëʹÓá°AFS µ¥Ôª¡±±êÇ©ÒÔÌí¼Ó¸Ãе¥ÔªµÄÅäÖÃÐÅÏ¢¡£" - IDS_KB_IN_USE "KB (%1 KB ÕýÔÚʹÓÃ)" - IDS_NOGATEWAY_TITLE "ÎÞЧ AFS Íø¹Ø" - IDS_NOGATEWAY_DESC "ÓÉÓÚÄúûÓÐÖ¸¶¨ AFS Íø¹Ø£¬²»ÄÜÅäÖà AFS Light¡£\n\nÇëÔÚÌṩµÄÇøÓòÖÐÊäÈë AFS Íø¹ØµÄÃû³Æ»ò IP µØÖ·¡£" -END - -STRINGTABLE DISCARDABLE -BEGIN - IDS_NOCELL_DESC "ÓÉÓÚÄúûÓÐÖ¸¶¨ AFS µ¥Ôª£¬²»ÄÜÅäÖà AFS ¿Í»§»ú¡£\n\nÇëÔÚÌṩµÄÇøÓòÖÐÊäÈë AFS µ¥ÔªµÄÃû³Æ¡£" - IDS_STOPPED_NOCELL "ÔÚÆô¶¯ AFS ¿Í»§»ú·þÎñ֮ǰ£¬±ØÐëÖ¸¶¨ AFS µ¥Ôª¡£" - IDS_OKSTOP_DESC "ûÓÐÔËÐÐ AFS ¿Í»§»ú·þÎñ¡£ÔÚûÓÐÆô¶¯ AFS ¿Í»§»ú·þÎñ֮ǰ£¬´æ´¢ÔÚ AFS ÖеÄÎļþ½«²»¿É´æÈ¡¡£\n\nÏÖÔÚÆô¶¯·þÎñÂð? " - IDS_BADMAP_DESC "ÓÉÓÚ·¾¶Ã»ÓÐÒÔ""\\afs""¿ªÊ¼£¬AFS ²»ÄÜÓ³ÉäÅÌ·ûÖÁÖ¸¶¨µÄ·¾¶¡£\n\nÈ·±£ÄúËùÊäÈëµÄ·¾¶ÊÇÒÔ""\\afs""¿ªÊ¼µÄ£¬²¢ÖØÊÔÒ»´Î¡£" - IDS_RESTART_TITLE "AFS ¿Í»§»úÅäÖÃ" - IDS_RESTART_DESC "ÔÚ AFS ¿Í»§»ú·þÎñÍ£Ö¹²¢ÖØÐÂÆô¶¯Ö®Ç°£¬ÄúËù×öµÄһЩ¸ü¸Ä½«²»»áÉúЧ¡£\n\nÏÖÔÚÍ£Ö¹²¢ÖØÐÂÆô¶¯·þÎñÂð? " - IDS_KB_ONLY "KB" - IDS_FAILCONFIG_AUTHENT "µ±ÔڵǼʱ³¢ÊÔÆôÓûò½ûÓÃÈÏ֤ʱ³ö´í¡£\n\n´íÎó %1" - IDS_FAILCONFIG_PREFS "ÄúÖ¸¶¨µÄһЩ·þÎñÆ÷ÅÅÐòÓÅÏȼ¶²»ÄÜʹÓá£\n\n´íÎó %1" - IDS_FAILCONFIG_CACHE "²»ÄÜʹÓÃÄúÊäÈëµÄ AFS ¿Í»§»ú¸ßËÙ»º´æ´óС¡£\n\n´íÎó %1" - IDS_FAILCONFIG_PROBE "²»ÄÜʹÓÃÄúÊäÈëµÄ AFS ¿Í»§»ú¼ì²â¼ä¸ô¡£\n\n´íÎó %1" - IDS_FAILCONFIG_SYSNAME "²»ÄÜʹÓÃÄúÊäÈëµÄ AFS ¿Í»§»úϵͳÃû¡£\n\n´íÎó %1" -END - -STRINGTABLE DISCARDABLE -BEGIN - IDS_BADCELL_DESC_CC2 "Çë¼ì²éµ¥ÔªÃûÈ·±£ÄúÒÑÊäÈëÕýÈ·¡£Èç¹ûÔÚ AFS µ¥ÔªÁбíÖÐûÓгöÏÖÕýÈ·µÄµ¥ÔªÃû£¬ÇëʹÓá°Ìí¼Ó¡±°´Å¥Îª¸Ãµ¥Ôª´´½¨Ò»¸öÌõÄ¿¡£" - IDS_NOCELL_DESC_CC "²»ÄÜÅäÖà AFS ¿ØÖÆÖÐÐÄ£¬ÒòΪÄú»¹Ã»ÓÐÖ¸¶¨È±Ê¡µÄ AFS µ¥Ôª¡£\n\nÇëÔÚÌṩµÄÇøÓòÖÐÊäÈë AFS µ¥ÔªÃû¡£" - IDS_TITLE_CAUTION_CCENTER "×¢Òâ - AFS ¿ØÖÆÖÐÐÄÌØÐÔ" - IDS_TITLE_ERROR_CCENTER "³ö´í - AFS ¿ØÖÆÖÐÐÄÌØÐÔ" - IDS_TITLE_CCENTER "AFS ¿ØÖÆÖÐÐÄÌØÐÔ" - IDS_YES "ÊÇ" - IDS_NO "·ñ" - IDS_DRIVE "Çý¶¯Æ÷" -END - -#endif // Chinese (P.R.C.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +#include "AFS_component_version_number.h" +#include "..\..\config\NTVersioninfo.rc" +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Chinese (P.R.C.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) +#ifdef _WIN32 +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_GENERAL_NT DIALOG DISCARDABLE 0, 0, 220, 225 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ò»°ã" +FONT 9, "ËÎÌå" +BEGIN + GROUPBOX "¿Í»§»úÅäÖÃ",IDC_STATIC,7,7,206,142 + LTEXT "µ¥ÔªÃû(&C)£º",IDC_STATIC,13,23,44,8 + EDITTEXT IDC_CELL,62,22,114,13,ES_LOWERCASE | ES_AUTOHSCROLL + CONTROL "µÇ¼µ½ Windows ʱ»ñµÃ AFS ÁîÅÆ",IDC_LOGON,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,50,193,10 + CONTROL "Ìṩ AFS Light Íø¹Ø(&P)",IDC_GATEWAY,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,72,193,10 + CONTROL "ÔÚÈÎÎñÀ¸ÖÐÏÔʾ AFS ¿Í»§»úͼ±ê(&I)",IDC_TRAYICON,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,95,193,10 + LTEXT "×¢Ò⣺ÓÉÓÚûÓÐÔËÐÐ AFS ¿Í»§»ú·þÎñ£¬½«½ûÓÃÕâЩ¿ØÖÆ¡£", + IDC_WARN,13,124,193,17 + GROUPBOX "¿Í»§»ú״̬",IDC_STATIC,7,157,206,61 + LTEXT "(²éѯµ±Ç°×´Ì¬)",IDC_STATUS,13,172,193,17 + PUSHBUTTON "Æô¶¯·þÎñ(&S)",IDC_SERVICE_START,88,195,57,14 + PUSHBUTTON "Í£Ö¹·þÎñ(&T)",IDC_SERVICE_STOP,149,195,57,14 +END + +IDD_GENERAL_95 DIALOG DISCARDABLE 0, 0, 245, 145 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ò»°ã" +FONT 9, "ËÎÌå" +BEGIN + GROUPBOX "¿Í»§»úÅäÖÃ",IDC_STATIC,7,7,231,131 + LTEXT "Íø¹Ø(&G)£º",IDC_STATIC,13,28,45,8 + EDITTEXT IDC_GATEWAY,63,27,104,13,ES_AUTOHSCROLL + PUSHBUTTON "ÏÖÔÚÁ¬½Ó(&N)",IDC_GATEWAY_CONN,172,27,57,14 + LTEXT "µ¥ÔªÃû(&C)£º",IDC_STATIC,13,51,45,8 + EDITTEXT IDC_CELL,63,49,104,13,ES_LOWERCASE | ES_AUTOHSCROLL | + WS_DISABLED | NOT WS_TABSTOP + CONTROL "µÇ¼µ½ Windows ʱ»ñµÃ AFS ÁîÅÆ",IDC_LOGON,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,73,193,10 + CONTROL "ÔÚÈÎÎñÀ¸ÖÐÏÔʾ AFS Light ͼ±ê(&H)",IDC_TRAYICON,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,93,193,10 + LTEXT "×¢Ò⣺ÓÉÓÚ AFS ¿Í»§»úûÓÐÁ¬½ÓÖÁ AFS Íø¹Ø£¬½«½ûÓÃÕâЩ¿ØÖÆ¡£", + IDC_WARN,13,114,219,17 +END + +IDD_PREFS_NT DIALOG DISCARDABLE 0, 0, 220, 225 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ê×Ñ¡Ïî" +FONT 9, "ËÎÌå" +BEGIN + GROUPBOX "·þÎñÆ÷Ê×Ñ¡Ïî",-1,7,7,206,211 + CONTROL "ÏÔʾÎļþ·þÎñÆ÷Ê×Ñ¡Ïî(&F)",IDC_SHOW_FS,"Button", + BS_AUTORADIOBUTTON,13,21,193,10 + CONTROL "ÏÔʾ¾íλÖ÷þÎñÆ÷Ê×Ñ¡Ïî(&V)",IDC_SHOW_VLS,"Button", + BS_AUTORADIOBUTTON,13,34,193,10 + CONTROL "",IDC_LIST,"FastList",WS_BORDER | WS_TABSTOP | 0xb,13, + 49,173,120 + PUSHBUTTON "Ìí¼Ó(&A)...",IDC_ADD,84,172,50,14 + PUSHBUTTON "¸ü¸Ä(&C)...",IDC_EDIT,137,172,50,14 + PUSHBUTTON "^",IDC_UP,191,97,15,14,BS_ICON + PUSHBUTTON "v",IDC_DOWN,191,117,15,14,BS_ICON + PUSHBUTTON "µ¼Èë(&I)...",IDC_IMPORT,13,172,50,14 + LTEXT "×¢Ò⣺ÓÉÓÚûÓÐÔËÐÐ AFS ¿Í»§»ú·þÎñ£¬½«½ûÓÃÕâЩ¿ØÖÆ¡£", + IDC_WARN,13,193,193,17 +END + +IDD_HOSTS_NT DIALOG DISCARDABLE 0, 0, 220, 225 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "AFS µ¥Ôª" +FONT 9, "ËÎÌå" +BEGIN + GROUPBOX "AFS µ¥Ôª",IDC_STATIC,7,7,206,211 + CONTROL "",IDC_LIST,"FastList",WS_BORDER | WS_TABSTOP | 0x11b,13, + 21,193,168 + PUSHBUTTON "Ìí¼Ó(&A)...",IDC_ADD,51,195,50,14 + PUSHBUTTON "¸ü¸Ä(&C)...",IDC_EDIT,104,195,50,14 + PUSHBUTTON "³ýÈ¥(&R)",IDC_REMOVE,157,195,50,14 +END + +IDD_DRIVES_NT DIALOG DISCARDABLE 0, 0, 220, 225 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "ÅÌ·û" +FONT 9, "ËÎÌå" +BEGIN + GROUPBOX "ÅÌ·û",IDC_STATIC,7,7,206,211 + CONTROL "",IDC_LIST,"CheckList",WS_BORDER | WS_TABSTOP | 0x153, + 13,32,193,135 + PUSHBUTTON "Ìí¼Ó(&A)...",IDC_ADD,69,171,48,14 + PUSHBUTTON "¸ü¸Ä(&C)...",IDC_EDIT,120,171,42,14 + PUSHBUTTON "³ýÈ¥(&R)",IDC_REMOVE,165,171,42,14 + LTEXT "½«ÅÌ·ûÓ³ÉäÖÁ AFS ÖеÄ·¾¶£º",IDC_STATIC,13,21,193,8 + PUSHBUTTON "¸ß¼¶(&V)...",IDC_ADVANCED,13,171,53,14 + LTEXT "×¢Ò⣺ÓÉÓÚûÓÐÔËÐÐ AFS ¿Í»§»ú·þÎñ£¬½«½ûÓÃÕâЩ¿ØÖÆ¡£", + IDC_WARN,13,193,193,17 +END + +IDD_ADVANCED_NT DIALOG DISCARDABLE 0, 0, 220, 225 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "¸ß¼¶" +FONT 9, "ËÎÌå" +BEGIN + EDITTEXT IDC_CACHE_SIZE,88,21,32,13,ES_AUTOHSCROLL + EDITTEXT IDC_CACHE_PATH,88,41,83,13,ES_AUTOHSCROLL + EDITTEXT IDC_CHUNK_SIZE,88,62,32,13,ES_AUTOHSCROLL | ES_READONLY + EDITTEXT IDC_STAT_ENTRIES,88,83,32,13,ES_AUTOHSCROLL + PUSHBUTTON "µÇ¼(&L)...",IDC_LOGON_PARMS,13,128,68,14 + PUSHBUTTON "È«¾ÖÇý¶¯Æ÷(&G)...",IDC_AUTOMAP_PARMS,13,173,68,14 + PUSHBUTTON "ÔÓÏî(&M)...",IDC_MISC_PARMS,13,195,68,14 + GROUPBOX "¸ßËÙ»º´æÅäÖÃ",IDC_STATIC,7,7,206,100 + LTEXT "¸ßËÙ»º´æ´óС(&C)£º",IDC_STATIC,13,23,71,8 + LTEXT "KB",IDC_INUSE,136,23,68,8 + LTEXT "¿é´óС(&H)£º",IDC_STATIC,13,64,71,8 + LTEXT "KB",IDC_STATIC,136,64,68,8 + LTEXT "״̬¸ßËÙ»º´æ(&S)£º",IDC_STATIC,13,85,71,8 + LTEXT "ÌõÄ¿",IDC_STATIC,136,85,68,8 + LTEXT "¸ßËÙ»º´æÂ·¾¶(&P)£º",IDC_STATIC,13,44,71,8 + GROUPBOX "¸½¼Ó¸ß¼¶²ÎÊý",IDC_STATIC,7,114,206,104 + LTEXT "´´½¨È«¾Ö AFS Çý¶¯Æ÷Ó³Éä¡£",IDC_STATIC,86,176,120,10 + LTEXT "µ÷Õû¼¯³ÉµÇ¼ÉèÖá£",IDC_STATIC,86,132,120,10 + LTEXT "ÉèÖÃÆäËü¸ß¼¶²ÎÊý¡£",IDC_STATIC,86,199,120,10 + PUSHBUTTON "Õï¶Ï(&D)...",IDC_DIAG_PARMS,13,150,68,14 + LTEXT "ÆôÓÃÎÊÌâµ÷ÊÔÉèÖá£",IDC_STATIC,86,153,120,10 +END + +IDD_PREFS_EDIT DIALOG DISCARDABLE 0, 0, 251, 123 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ö¸¶¨·þÎñÆ÷µÄÓÅÏȼ¶" +FONT 9, "ËÎÌå" +BEGIN + LTEXT "¿ÉΪ´Ë AFS µ¥ÔªÖеķþÎñÆ÷Ö¸¶¨ÓÅÏȼ¶ÅÅÐò¡£µ±²éÕÒ AFS ÖеÄÊý¾Ýʱ£¬½«Ê×ÏȲéѯÓÅÏȼ¶½Ï¸ßµÄ·þÎñÆ÷¡£", + IDC_STATIC,7,7,237,17 + LTEXT "·þÎñÆ÷(&S)£º",IDC_STATIC,7,38,51,8 + LTEXT "ÅÅÐò(&R)£º",IDC_STATIC,7,54,51,8 + EDITTEXT IDC_SERVER,63,36,80,13,ES_AUTOHSCROLL + EDITTEXT IDC_RANK,63,52,36,13,ES_AUTOHSCROLL + LTEXT "ÇÏÃÅ£ºÔÚʹÓá°µ¼È롱°´Å¥ÒÔ¶ÁÈ¡Îı¾ÎļþÖ¸¶¨µÄ·þÎñÆ÷ºÍËüÃǵÄÅÅÐòʱ£¬¿Éͬʱָ¶¨¼¸¸ö·þÎñÆ÷µÄÅÅÐò¡£", + IDC_STATIC,7,76,237,18 + PUSHBUTTON "È¡Ïû",IDCANCEL,140,102,50,14 + PUSHBUTTON "È·¶¨",IDOK,86,102,50,14 + PUSHBUTTON "°ïÖú",9,194,102,50,14 +END + +IDD_CELL_EDIT DIALOG DISCARDABLE 0, 0, 244, 223 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "µ¥ÔªÌØÐÔ" +FONT 9, "ËÎÌå" +BEGIN + LTEXT "´ËÒ³ÃæÉϵÄÐÅÏ¢½«¸æËß AFS ÈçºÎÁªÏµÖ¸¶¨µÄµ¥Ôª¡£", + IDC_STATIC,4,4,226,8 + LTEXT "AFS µ¥Ôª(&A)£º",IDC_STATIC,4,24,58,8 + EDITTEXT IDC_CELL,62,22,105,13,ES_LOWERCASE | ES_AUTOHSCROLL + LTEXT "ÃèÊö(&D)£º",IDC_STATIC,4,41,38,8 + EDITTEXT IDC_COMMENT,62,39,171,13,ES_AUTOHSCROLL + GROUPBOX "·þÎñÆ÷",IDC_STATIC,4,61,236,158 + CONTROL "",IDC_LIST,"FastList",WS_BORDER | WS_TABSTOP | 0x1b,13, + 76,217,117 + PUSHBUTTON "Ìí¼Ó(&A)...",IDC_ADD,75,198,50,14 + PUSHBUTTON "¸ü¸Ä(&C)...",IDC_EDIT,128,198,50,14 + PUSHBUTTON "³ýÈ¥(&R)",IDC_REMOVE,181,198,50,14 +END + +IDD_SERVER_EDIT DIALOG DISCARDABLE 0, 0, 251, 112 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ìí¼Ó£¯±à¼­·þÎñÆ÷" +FONT 9, "ËÎÌå" +BEGIN + LTEXT "ÔÚÖ¸¶¨µ¥ÔªÖÐÊäÈë¾íλÖ÷þÎñÆ÷µÄÃû³Æ¡£",IDC_STATIC,7,7, + 237,8 + LTEXT "·þÎñÆ÷Ãû(&N)£º",IDC_STATIC,7,31,53,8 + EDITTEXT IDC_COMMENT,75,29,156,13,ES_AUTOHSCROLL + LTEXT "·þÎñÆ÷µØÖ·(&A)£º",IDC_STATIC,7,52,64,8 + CONTROL "ʹÓÃÌØ¶¨µØÖ·(&U)£º",IDC_ADDR_SPECIFIC,"Button", + BS_AUTORADIOBUTTON,75,52,83,10 + CONTROL "×Ô¶¯²éÕÒµØÖ·(&L)",IDC_ADDR_LOOKUP,"Button", + BS_AUTORADIOBUTTON,75,66,111,10 + CONTROL "",IDC_SERVER,"SockAddr",WS_BORDER | WS_TABSTOP,163,51, + 65,13 + PUSHBUTTON "È¡Ïû",IDCANCEL,140,91,50,14 + PUSHBUTTON "È·¶¨",IDOK,86,91,50,14 + PUSHBUTTON "°ïÖú",9,194,91,50,14 +END + +IDD_DRIVE_EDIT DIALOG DISCARDABLE 0, 0, 297, 156 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ó³ÉäÅÌ·û" +FONT 9, "ËÎÌå" +BEGIN + LTEXT "¿ÉÓ³É伯Ëã»úÉϵÄÅÌ·ûÖÁ AFS ÖеÄ·¾¶¡£",IDC_STATIC,7,7, + 283,8 + LTEXT "ÀýÈ磬Èç¹ûÓ³ÉäÇý¶¯Æ÷ Q ÖÁ /afs/acme.com/usr/bob£¬Ôò AFS µÄ /afs/acme.com/usr/bob/* ÖеĿÉÓÃÎļþ½«ÔÚÄú¼ÆËã»úµÄ Q:\\ Ŀ¼Ï¿ɼû¡£", + IDC_STATIC,7,26,283,16 + LTEXT "ÅÌ·û(&D)£º",IDC_STATIC,14,59,58,8 + COMBOBOX IDC_DRIVE,77,57,63,206,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + LTEXT "AFS ·¾¶(&P)£º",IDC_STATIC,14,77,58,8 + EDITTEXT IDC_PATH,77,75,168,13,ES_AUTOHSCROLL + LTEXT "ÃèÊö(&E)£º",IDC_STATIC,14,96,58,8 + EDITTEXT IDC_DESC,77,94,72,13,ES_AUTOHSCROLL + CONTROL "µÇ¼ʱ»Ö¸´Ó³Éä(&R)",IDC_PERSISTENT,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,77,112,188,10 + PUSHBUTTON "È¡Ïû",IDCANCEL,186,135,50,14 + PUSHBUTTON "È·¶¨",IDOK,132,135,50,14 + PUSHBUTTON "°ïÖú",9,240,135,50,14 +END + +IDD_SUBMOUNTS DIALOG DISCARDABLE 0, 0, 244, 198 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "×Ó°²×°" +FONT 9, "ËÎÌå" +BEGIN + LTEXT "ÄúµÄ¼ÆËã»ú¿ÉÌṩ AFS ÖеÄ×Ó°²×°--ÍøÂç¹²Ïí¡£",IDC_STATIC, + 4,4,196,8 + GROUPBOX "×Ó°²×°",IDC_STATIC,4,26,236,168 + LTEXT "ÏÂÁÐ×Ó°²×°´Ó´Ë¼ÆËã»úÉϹ²Ïí£º",IDC_STATIC,10,42,176,8 + CONTROL "",IDC_LIST,"FastList",WS_BORDER | WS_TABSTOP | 0x413,10, + 54,223,115 + PUSHBUTTON "Ìí¼Ó(&A)...",IDC_ADD,78,173,50,14 + PUSHBUTTON "¸ü¸Ä(&C)...",IDC_EDIT,131,173,50,14 + PUSHBUTTON "³ýÈ¥(&R)",IDC_REMOVE,184,173,50,14 +END + +IDD_SUBMOUNT_EDIT DIALOG DISCARDABLE 0, 0, 270, 112 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ö¸¶¨×Ó°²×°" +FONT 9, "ËÎÌå" +BEGIN + LTEXT "ʹÓà Windows ÍøÂ磬×Ó°²×°ÈÃÄú¹²ÏíÒ»¸ö×ÓĿ¼Ê÷¡£", + IDC_STATIC,7,7,256,8 + LTEXT "×Ó°²×°(&S)£º",IDC_STATIC,7,27,53,8 + LTEXT "AFS ·¾¶(&P)£º",IDC_STATIC,7,43,53,8 + EDITTEXT IDC_SUBMOUNT,63,25,80,13,ES_AUTOHSCROLL + EDITTEXT IDC_MAPPING,63,41,181,13,ES_AUTOHSCROLL + LTEXT "Ϊ×Ó°²×°ÊäÈë¶ÌÃû£¬²¢ÇÒµ±³öÏÖÌáʾʱÊäÈëÒ»¸öÈ« AFS ·¾¶¡£AFS ·¾¶¿ÉÒÔ""\\afs""¿ªÊ¼(Èç¹û²»ÊÇ£¬""\\afs""½«×Ô¶¯Ìí¼Ó)¡£", + IDC_STATIC,7,64,256,18 + PUSHBUTTON "È¡Ïû",IDCANCEL,159,91,50,14 + PUSHBUTTON "È·¶¨",IDOK,105,91,50,14 + PUSHBUTTON "°ïÖú",9,213,91,50,14 +END + +IDD_DRIVES_95 DIALOG DISCARDABLE 0, 0, 245, 145 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "ÅÌ·û" +FONT 9, "ËÎÌå" +BEGIN + GROUPBOX "ÅÌ·û",IDC_STATIC,7,7,231,131 + CONTROL "",IDC_LIST,"CheckList",WS_BORDER | WS_TABSTOP | 0x153, + 13,32,219,60 + PUSHBUTTON "Ìí¼Ó(&A)...",IDC_ADD,83,95,48,14 + PUSHBUTTON "¸ü¸Ä(&C)...",IDC_EDIT,134,95,48,14 + PUSHBUTTON "³ýÈ¥(&R)",IDC_REMOVE,184,95,48,14 + LTEXT "½«ÅÌ·ûÓ³ÉäÖÁ AFS ÖеÄ·¾¶£º",IDC_STATIC,13,21,193,8 + LTEXT "×¢Ò⣺ÓÉÓÚ AFS ¿Í»§»úûÓÐÁ¬½ÓÖÁ AFS Íø¹Ø£¬½«½ûÓÃÕâЩ¿ØÖÆ¡£", + IDC_WARN,13,116,219,17 +END + +IDD_HOSTS_95 DIALOG DISCARDABLE 0, 0, 245, 145 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "AFS µ¥Ôª" +FONT 9, "ËÎÌå" +BEGIN + GROUPBOX "AFS µ¥Ôª",IDC_STATIC,7,7,231,131 + CONTROL "",IDC_LIST,"FastList",WS_BORDER | WS_TABSTOP | 0x11b,13, + 19,218,94 + PUSHBUTTON "Ìí¼Ó(&A)...",IDC_ADD,75,116,50,14 + PUSHBUTTON "¸ü¸Ä(&C)...",IDC_EDIT,128,116,50,14 + PUSHBUTTON "³ýÈ¥(&R)",IDC_REMOVE,181,116,50,14 +END + +IDD_STARTSTOP DIALOGEX 0, 0, 219, 48 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION +EXSTYLE WS_EX_TOOLWINDOW +CAPTION "AFS ¿Í»§»ú·þÎñ" +FONT 9, "ËÎÌå", 0, 0, 0x1 +BEGIN + GROUPBOX "",IDC_STATIC,4,0,211,44 + ICON IDI_MAIN,IDC_STATIC,14,15,20,20 + LTEXT "ÇëµÈ´ý£»AFS ¿Í»§»ú·þÎñÕýÔÚÆô¶¯...",IDC_STARTING,46,20, + 157,8 + LTEXT "ÇëµÈ´ý£»AFS ¿Í»§»ú·þÎñÕýÔÚÍ£Ö¹...",IDC_STOPPING,46,20, + 157,8 +END + +IDD_HOSTS_CCENTER DIALOG DISCARDABLE 0, 0, 220, 256 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ò»°ã" +FONT 9, "ËÎÌå" +BEGIN + GROUPBOX "ȱʡµ¥Ôª",IDC_STATIC,7,7,206,54 + LTEXT "ÊäÈëÒª¹ÜÀíµÄȱʡ AFS µ¥ÔªÃû£º",IDC_STATIC,14,19,164,8 + LTEXT "ȱʡµ¥Ôª£º",IDC_STATIC,14,37,44,8 + EDITTEXT IDC_CELL,65,35,141,14,ES_LOWERCASE | ES_AUTOHSCROLL + GROUPBOX "AFS µ¥Ôª",IDC_STATIC,7,69,206,180 + CONTROL "",IDC_LIST,"FastList",WS_BORDER | WS_TABSTOP | 0x11b,13, + 84,193,137 + PUSHBUTTON "Ìí¼Ó(&A)...",IDC_ADD,51,227,50,14 + PUSHBUTTON "¸ü¸Ä(&C)...",IDC_EDIT,104,227,50,14 + PUSHBUTTON "³ýÈ¥(&R)",IDC_REMOVE,157,227,50,14 +END + +IDD_MISC_CONFIG_PARMS DIALOG DISCARDABLE 0, 0, 220, 193 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "ÔÓÏîÅäÖÃ" +FONT 8, "System" +BEGIN + EDITTEXT IDC_LAN_ADAPTER,90,20,32,13,ES_AUTOHSCROLL + EDITTEXT IDC_PROBE,90,40,32,13,ES_AUTOHSCROLL + EDITTEXT IDC_THREADS,90,60,32,13,ES_AUTOHSCROLL + EDITTEXT IDC_DAEMONS,90,80,32,13,ES_AUTOHSCROLL + EDITTEXT IDC_SYSNAME,90,100,83,13,ES_AUTOHSCROLL + EDITTEXT IDC_MOUNTDIR,90,120,83,13,ES_AUTOHSCROLL + EDITTEXT IDC_ROOTVOLUME,90,140,83,13,ES_AUTOHSCROLL + DEFPUSHBUTTON "È·¶¨",IDOK,55,172,50,14 + PUSHBUTTON "È¡Ïû",IDCANCEL,109,172,50,14 + PUSHBUTTON "°ïÖú",9,163,172,50,14 + GROUPBOX "²ÎÊý",IDC_STATIC,7,7,206,156 + LTEXT "¼ì²â¼ä¸ô(&P)£º",IDC_STATIC,15,42,71,8 + LTEXT "Ãë",IDC_STATIC,138,42,68,8 + LTEXT "ºǫ́Ïß³Ì(&B)£º",IDC_STATIC,15,62,71,8 + LTEXT "Ïß³Ì",IDC_STATIC,138,62,68,8 + LTEXT "·þÎñÏß³Ì(&E)£º",IDC_STATIC,15,82,71,8 + LTEXT "Ïß³Ì",IDC_STATIC,138,82,68,8 + LTEXT "ϵͳÃû³Æ(&Y)£º",IDC_STATIC,15,102,71,8 + LTEXT "°²×°Ä¿Â¼(&M)£º",IDC_STATIC,15,122,71,8 + LTEXT "LAN ÊÊÅäÆ÷ºÅ(&L)£º",IDC_STATIC,15,22,71,8 + LTEXT "¸ù¾í(&R)£º",IDC_STATIC,15,141,71,8 +END + +IDD_DIAG_PARMS DIALOG DISCARDABLE 0, 0, 217, 135 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Õï¶ÏÅäÖÃ" +FONT 8, "System" +BEGIN + EDITTEXT IDC_TRACE_LOG_BUF_SIZE,112,20,32,13,ES_AUTOHSCROLL + DEFPUSHBUTTON "È·¶¨",IDOK,52,114,50,14 + PUSHBUTTON "È¡Ïû",IDCANCEL,106,114,50,14 + PUSHBUTTON "°ïÖú",9,160,114,50,14 + GROUPBOX "¸ú×ÙÈÕÖ¾²ÎÊý",IDC_STATIC,7,7,203,54 + LTEXT "»º³åÇø´óС(&B)£º",IDC_STATIC,13,22,73,8 + LTEXT "KB",IDC_STATIC,155,24,9,8 + GROUPBOX "ʼþÈÕÖ¾²ÎÊý",IDC_STATIC,7,69,203,35 + COMBOBOX IDC_TRAP_ON_PANIC,112,40,32,61,CBS_DROPDOWNLIST | + CBS_SORT | WS_VSCROLL | WS_TABSTOP + LTEXT "½ô¼±Çé¿öϵ÷ÓÃÏÝÚå(&T)£º",IDC_STATIC,13,42,93,8 + LTEXT "±¨¸æ»á»°Æô¶¯£º",IDC_STATIC,13,86,79,8 + COMBOBOX IDC_REPORT_SESSION_STARTUPS,112,84,32,64, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP +END + +IDD_LOGIN_CONFIG_PARMS DIALOG DISCARDABLE 0, 0, 186, 92 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "µÇ¼ÅäÖÃ" +FONT 8, "System" +BEGIN + EDITTEXT IDC_LOGIN_RETRY_INTERVAL,117,18,32,13,ES_AUTOHSCROLL + COMBOBOX IDC_FAIL_SILENTLY,117,39,32,40,CBS_DROPDOWNLIST | + CBS_SORT | WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "È·¶¨",IDOK,21,71,50,14 + PUSHBUTTON "È¡Ïû",IDCANCEL,75,71,50,14 + PUSHBUTTON "°ïÖú",9,129,71,50,14 + LTEXT "µÇÂ¼ÖØÊÔ¼ä¸ô(&L)£º",IDC_STATIC,13,20,98,8 + GROUPBOX "²ÎÊý",IDC_STATIC,7,7,172,54 + LTEXT "µÇ¼ʧ°Ü£¬ÎÞÈκÎÌáʾ(&F)£º",IDC_STATIC,13,41,98,8 +END + +IDD_GLOBAL_DRIVES DIALOG DISCARDABLE 0, 0, 253, 169 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "È«¾ÖÇý¶¯Æ÷" +FONT 8, "System" +BEGIN + DEFPUSHBUTTON "¹Ø±Õ",IDOK,141,148,50,14 + PUSHBUTTON "°ïÖú",9,196,148,50,14 + PUSHBUTTON "Ìí¼Ó(&A)",IDC_ADD,108,117,42,14 + GROUPBOX "È«¾ÖÓ³Éä AFS Çý¶¯Æ÷",IDC_STATIC,7,7,239,133 + CONTROL "",IDC_GLOBAL_DRIVE_LIST,"FastList",WS_BORDER | + WS_TABSTOP | 0x1b,14,20,226,89 + PUSHBUTTON "¸ü¸Ä(&C)",IDC_CHANGE,153,117,42,14 + PUSHBUTTON "³ýÈ¥(&R)",IDC_REMOVE,198,117,42,14 +END + +IDD_GLOBAL_DRIVES_ADDEDIT DIALOG DISCARDABLE 0, 0, 247, 118 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ó³ÉäÈ«¾ÖÇý¶¯Æ÷" +FONT 8, "System" +BEGIN + COMBOBOX IDC_DRIVE,63,23,63,206,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_PATH,63,42,168,13,ES_AUTOHSCROLL + EDITTEXT IDC_DESC,63,62,72,13,ES_AUTOHSCROLL + DEFPUSHBUTTON "È·¶¨",IDOK,82,96,50,14 + PUSHBUTTON "È¡Ïû",IDCANCEL,136,96,50,14 + PUSHBUTTON "°ïÖú",9,190,96,50,14 + LTEXT "ÅÌ·û(&D)£º",IDC_STATIC,12,25,48,8 + LTEXT "AFS ·¾¶(&P)£º",IDC_STATIC,12,44,48,8 + LTEXT "ÃèÊö(&E)£º",IDC_STATIC,12,64,48,8 + GROUPBOX "È«¾Ö AFS Çý¶¯Æ÷",IDC_STATIC,7,7,232,80 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_GENERAL_NT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 213 + TOPMARGIN, 7 + BOTTOMMARGIN, 218 + END + + IDD_GENERAL_95, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 238 + TOPMARGIN, 7 + BOTTOMMARGIN, 138 + END + + IDD_PREFS_NT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 213 + TOPMARGIN, 7 + BOTTOMMARGIN, 218 + END + + IDD_HOSTS_NT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 213 + TOPMARGIN, 7 + BOTTOMMARGIN, 218 + END + + IDD_DRIVES_NT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 213 + TOPMARGIN, 7 + BOTTOMMARGIN, 218 + END + + IDD_ADVANCED_NT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 213 + TOPMARGIN, 7 + BOTTOMMARGIN, 218 + END + + IDD_PREFS_EDIT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 244 + TOPMARGIN, 7 + BOTTOMMARGIN, 116 + END + + IDD_CELL_EDIT, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 240 + TOPMARGIN, 4 + BOTTOMMARGIN, 219 + END + + IDD_SERVER_EDIT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 244 + TOPMARGIN, 7 + BOTTOMMARGIN, 105 + END + + IDD_DRIVE_EDIT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 290 + TOPMARGIN, 7 + BOTTOMMARGIN, 149 + END + + IDD_SUBMOUNTS, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 240 + TOPMARGIN, 4 + BOTTOMMARGIN, 194 + END + + IDD_SUBMOUNT_EDIT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 263 + TOPMARGIN, 7 + BOTTOMMARGIN, 105 + END + + IDD_DRIVES_95, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 238 + TOPMARGIN, 7 + BOTTOMMARGIN, 138 + END + + IDD_HOSTS_95, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 238 + TOPMARGIN, 7 + BOTTOMMARGIN, 138 + END + + IDD_STARTSTOP, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 215 + TOPMARGIN, 4 + BOTTOMMARGIN, 44 + END + + IDD_HOSTS_CCENTER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 213 + TOPMARGIN, 7 + BOTTOMMARGIN, 249 + END + + IDD_MISC_CONFIG_PARMS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 213 + TOPMARGIN, 7 + BOTTOMMARGIN, 186 + END + + IDD_DIAG_PARMS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 210 + TOPMARGIN, 7 + BOTTOMMARGIN, 128 + END + + IDD_LOGIN_CONFIG_PARMS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 85 + END + + IDD_GLOBAL_DRIVES, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 246 + TOPMARGIN, 7 + BOTTOMMARGIN, 162 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include \r\n" + "#ifndef APSTUDIO_INVOKED\r\n" + "#define AFS_VERINFO_FILE_DESCRIPTION ""AFS ¿Í»§»úÅäÖÃ""\r\n" + "#include ""AFS_component_version_number.h""\r\n" + "#include ""..\\..\\config\\NTVersioninfo.rc""\r\n" + "#endif // APSTUDIO_INVOKED\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_MAIN ICON DISCARDABLE "afs_config.ico" +IDI_UP ICON DISCARDABLE "up.ico" +IDI_DOWN ICON DISCARDABLE "down.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_TITLE_NT "AFS ¿Í»§»úÅäÖÃ" + IDS_TITLE_95 "AFS Light ÅäÖÃ" + IDS_STATE_STOPPED "AFS ¿Í»§»ú·þÎñµ±Ç°ÎªÍ£Ö¹×´Ì¬¡£" + IDS_STATE_RUNNING "AFS ¿Í»§»ú·þÎñÕýÔÚÕý³£ÔËÐС£" + IDS_STATE_STARTING "ÇëµÈ´ý£»AFS ¿Í»§»ú·þÎñÕýÔÚÆô¶¯..." + IDS_STATE_STOPPING "ÇëµÈ´ý£»AFS ¿Í»§»ú·þÎñÕýÔÚÍ£Ö¹..." + IDS_STATE_UNKNOWN "AFS ¿Í»§»ú·þÎñûÓÐÊʵ±ÅäÖá£" + IDS_SERVICE_FAIL_START "AFS ¿Í»§»ú·þÎñ²»Äܳɹ¦Æô¶¯¡£Äú¿ÉÄÜûÓÐȨÏÞÀ´Ö´Ðд˲Ù×÷¡£\n\n´íÎó 0x%1¡£" + IDS_SERVICE_FAIL_STOP "AFS ¿Í»§»ú·þÎñ²»Äܳɹ¦Í£Ö¹¡£Äú¿ÉÄÜûÓÐȨÏÞÀ´Ö´Ðд˲Ù×÷¡£\n\n´íÎó 0x%1¡£" + IDS_WARN_STOPPED "ÓÉÓÚ AFS ¿Í»§»ú·þÎñûÓÐÔËÐУ¬²»Äܸü¸Ä½ûÓõĿØÖÆ¡£" + IDS_WARN_ADMIN "ÓÉÓÚÄúûÓÐÒÔ¹ÜÀíÔ±Éí·ÝµÇ¼ÖÁ Windows£¬²»Äܸü¸Ä½ûÓõĿØÖÆ¡£" + IDS_CELL_UNKNOWN "(δ֪)" + IDS_GATEWAY_UNKNOWN "(δ֪)" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BADLOOKUP_DESC "Windows ÕÒ²»µ½ %1 µÄÍøÂçµØÖ·¡£¼ì²éÒÔÈ·±£ÊäÈëÁËÕýÈ·µÄ»úÆ÷Ãû¡£" + IDS_NEWSUB_DESC "µ±Á¬½ÓÍøÂçÇý¶¯Æ÷ʱ£¬AFS ÎÞ·¨Ê¹ÓÃÖ¸¶¨µÄÃèÊö¡£\n\nÖ¸¶¨µÄÃèÊöÒÑʹÓÃÔÚ²»Í¬µÄ AFS ·¾¶ÖС£" + IDS_BADSUB_DESC "²»ÄÜʹÓÃÄúÊäÈëµÄÅÌ·ûÃèÊö¡£\n\nÅÌ·ûÃèÊö²»Äܳ¬¹ý 12 ¸ö×Ö·û£¬²¢ÇÒ²»Äܰüº¬¿Õ¸ñ»òÖÆ±í·û¡£" + IDS_BADGATEWAY_DESC "AFS ÎÞ·¨Á¬½ÓÖÁÄúÖ¸¶¨µÄÍø¹Ø»úÆ÷¡£\n\n¼ì²éÒÔÈ·±£ÊäÈëÁíÍâÕýÈ·µÄÍø¹ØÉ豸Ãû³Æ¡£" + IDS_BADGWCELL_DESC "ÕÒ²»µ½Ö¸¶¨µÄÍø¹Ø»úÆ÷ʹÓÃµÄ AFS µ¥ÔªµÄÅäÖÃÐÅÏ¢¡£\n\nÈç¹ûÄúÒªÔÚеĵ¥ÔªÖÐÅäÖà AFS ¿Í»§»ú£¬±ØÐëʹÓá°AFS µ¥Ôª¡±±êÇ©ÒÔÌí¼Ó¸Ãе¥ÔªµÄÅäÖÃÐÅÏ¢¡£\n\nµ¥Ôª£º%1" + IDS_TITLE_CAUTION_NT "×¢Òâ - AFS ¿Í»§»úÅäÖÃ" + IDS_TITLE_CAUTION_95 "×¢Òâ - AFS Light" + IDS_TITLE_ERROR_NT "³ö´í - AFS ¿Í»§»úÅäÖÃ" + IDS_TITLE_ERROR_95 "³ö´í - AFS Light ÅäÖÃ" + IDS_SHRINKCACHE "µ± AFS ¿Í»§»ú·þÎñÕýÔÚÔËÐÐʱ²»ÄܼõÉÙ AFS ¿Í»§»ú¸ßËÙ»º´æµÄ´óС¡£\n\nÒª¼õÉÙ¸ßËÙ»º´æµÄ´óС£¬Ê×ÏÈÔÚ¡°Ò»°ã¡±±êÇ©ÉÏʹÓá°Í£Ö¹·þÎñ¡±°´Å¥Í£Ö¹ AFS ¿Í»§»ú·þÎñ¡£" + IDS_BADCELL_DESC_CC "ÔÚÄúÊäÈëµÄ AFS µ¥ÔªÖÐÕÒ²»µ½ÅäÖÃÐÅÏ¢¡£\n\n+" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STOP_DESC "Èç¹ûÍ£Ö¹ AFS ¿Í»§»ú·þÎñ£¬´æ´¢ÔÚ AFS ÖеÄÎļþ½«²»¿É´Ó´Ë¼ÆËã»úÖдæÈ¡¡£\n\nÈ·ÈÏҪֹͣ·þÎñÂð?" + IDS_PREFCOL_SERVER "·þÎñÆ÷" + IDS_PREFCOL_RANK "ÅÅÐò" + IDS_TIP_PREFS "ÇÏÃÅ£ºµ±´Ó AFS ¶ÁÈ¡Îļþʱ£¬µÍÅÅÐòÊýµÄ·þÎñÆ÷½«»ñµÃ¸ßÓÅÏȼ¶¡£" + IDS_PREFERROR_RESOLVE "AFS ÕÒ²»µ½ÃûΪ %1 µÄ·þÎñÆ÷¡£Çë¼ì²éÒÔÈ·±£ÊäÈëÕýÈ·µÄ·þÎñÆ÷¡£" + IDS_FILTER_TXT "Îı¾Îļþ(*.TXT)£»*.TXT£»" + IDS_HOSTREM_MANY "ÄúÒÑÑ¡Ôñ³ýÈ¥ÓйØÑ¡¶¨µÄ AFS µ¥ÔªµÄËùÓÐÁ¬½ÓÐÅÏ¢¡£\n\nÈ·ÈÏÒª³ýÈ¥ÕâЩÌõÄ¿Âð?" + IDS_HOSTREM_ONE "ÄúÒÑÑ¡Ôñ³ýÈ¥ÓÐ¹Ø AFS µ¥Ôª %1 µÄËùÓÐÁ¬½ÓÐÅÏ¢¡£\n\nÈ·ÈÏÒª³ýÈ¥ÕâЩÌõÄ¿Âð?" + IDS_CELLEDIT_TITLE "%1 - ÌØÐÔ" + IDS_CELLADD_TITLE "н¨µ¥Ôª" + IDS_SVRCOL_SERVER "µØÖ·" + IDS_SVRCOL_COMMENT "·þÎñÆ÷Ãû" + IDS_TIP_DRIVES "ÇÏÃÅ£ºÑ¡ÖÐÓ³ÉäÅÌ·ûÅԵĸ´Ñ¡¿ò£¬Á¬½ÓÍøÂçÇý¶¯Æ÷Ó³Éä¡£" + IDS_MAP_LETTER "Çý¶¯Æ÷ *:" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_DRIVE_MAP "Çý¶¯Æ÷ %1: \t%2" + IDS_ERROR_MAP "Ó³ÉäÍøÂçÇý¶¯Æ÷³ö´í" + IDS_ERROR_MAP_DESC "AFS ÎÞ·¨Ó³ÉäÍøÂçÇý¶¯Æ÷ÖÁ AFS ÖеÄ·¾¶¡£¼ì²éÒÔÈ·±£ÅÌ·ûµ±Ç°Ã»ÓÐʹÓá£\n\n´íÎó£º0x%1¡£" + IDS_ERROR_UNMAP "Ó³ÉäÍøÂçÇý¶¯Æ÷³ö´í" + IDS_ERROR_UNMAP_DESC "AFS ÎÞ·¨¶Ï¿ªÓëÖ¸¶¨ÍøÂçÇý¶¯Æ÷µÄÓ³Éä¡£¼ì²éÒÔÈ·±£ÅÌ·ûµ±Ç°Ã»ÓÐʹÓá£\n\n´íÎó£º0x%1¡£" + IDS_ADDSERVER_TITLE "Ìí¼Ó·þÎñÆ÷" + IDS_EDITSERVER_TITLE "±à¼­·þÎñÆ÷" + IDS_SUBCOL_SHARE "×Ó°²×°" + IDS_SUBCOL_PATH "AFS ·¾¶" + IDS_SUBMOUNTS_TITLE "×Ó°²×°" + IDS_BADCELL_DESC "ÔÚÄúÊäÈëµÄ AFS µ¥ÔªÖÐÕÒ²»µ½ÅäÖÃÐÅÏ¢¡£\n\n+" + IDS_BADCELL_DESC2 "¼ì²éÒÔÈ·±£ÄúÕýÈ·ÊäÈëÁ˵¥ÔªµÄÃû³Æ¡£Èç¹ûÄúÒªÔÚеĵ¥ÔªÖÐÅäÖà AFS ¿Í»§»ú£¬Äú±ØÐëʹÓá°AFS µ¥Ôª¡±±êÇ©ÒÔÌí¼Ó¸Ãе¥ÔªµÄÅäÖÃÐÅÏ¢¡£" + IDS_KB_IN_USE "KB (%1 KB ÕýÔÚʹÓÃ)" + IDS_NOGATEWAY_TITLE "ÎÞЧ AFS Íø¹Ø" + IDS_NOGATEWAY_DESC "ÓÉÓÚÄúûÓÐÖ¸¶¨ AFS Íø¹Ø£¬²»ÄÜÅäÖà AFS Light¡£\n\nÇëÔÚÌṩµÄÇøÓòÖÐÊäÈë AFS Íø¹ØµÄÃû³Æ»ò IP µØÖ·¡£" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_NOCELL_DESC "ÓÉÓÚÄúûÓÐÖ¸¶¨ AFS µ¥Ôª£¬²»ÄÜÅäÖà AFS ¿Í»§»ú¡£\n\nÇëÔÚÌṩµÄÇøÓòÖÐÊäÈë AFS µ¥ÔªµÄÃû³Æ¡£" + IDS_STOPPED_NOCELL "ÔÚÆô¶¯ AFS ¿Í»§»ú·þÎñ֮ǰ£¬±ØÐëÖ¸¶¨ AFS µ¥Ôª¡£" + IDS_OKSTOP_DESC "ûÓÐÔËÐÐ AFS ¿Í»§»ú·þÎñ¡£ÔÚûÓÐÆô¶¯ AFS ¿Í»§»ú·þÎñ֮ǰ£¬´æ´¢ÔÚ AFS ÖеÄÎļþ½«²»¿É´æÈ¡¡£\n\nÏÖÔÚÆô¶¯·þÎñÂð? " + IDS_BADMAP_DESC "ÓÉÓÚ·¾¶Ã»ÓÐÒÔ""\\afs""¿ªÊ¼£¬AFS ²»ÄÜÓ³ÉäÅÌ·ûÖÁÖ¸¶¨µÄ·¾¶¡£\n\nÈ·±£ÄúËùÊäÈëµÄ·¾¶ÊÇÒÔ""\\afs""¿ªÊ¼µÄ£¬²¢ÖØÊÔÒ»´Î¡£" + IDS_RESTART_TITLE "AFS ¿Í»§»úÅäÖÃ" + IDS_RESTART_DESC "ÔÚ AFS ¿Í»§»ú·þÎñÍ£Ö¹²¢ÖØÐÂÆô¶¯Ö®Ç°£¬ÄúËù×öµÄһЩ¸ü¸Ä½«²»»áÉúЧ¡£\n\nÏÖÔÚÍ£Ö¹²¢ÖØÐÂÆô¶¯·þÎñÂð? " + IDS_KB_ONLY "KB" + IDS_FAILCONFIG_AUTHENT "µ±ÔڵǼʱ³¢ÊÔÆôÓûò½ûÓÃÈÏ֤ʱ³ö´í¡£\n\n´íÎó %1" + IDS_FAILCONFIG_PREFS "ÄúÖ¸¶¨µÄһЩ·þÎñÆ÷ÅÅÐòÓÅÏȼ¶²»ÄÜʹÓá£\n\n´íÎó %1" + IDS_FAILCONFIG_CACHE "²»ÄÜʹÓÃÄúÊäÈëµÄ AFS ¿Í»§»ú¸ßËÙ»º´æ´óС¡£\n\n´íÎó %1" + IDS_FAILCONFIG_PROBE "²»ÄÜʹÓÃÄúÊäÈëµÄ AFS ¿Í»§»ú¼ì²â¼ä¸ô¡£\n\n´íÎó %1" + IDS_FAILCONFIG_SYSNAME "²»ÄÜʹÓÃÄúÊäÈëµÄ AFS ¿Í»§»úϵͳÃû¡£\n\n´íÎó %1" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BADCELL_DESC_CC2 "Çë¼ì²éµ¥ÔªÃûÈ·±£ÄúÒÑÊäÈëÕýÈ·¡£Èç¹ûÔÚ AFS µ¥ÔªÁбíÖÐûÓгöÏÖÕýÈ·µÄµ¥ÔªÃû£¬ÇëʹÓá°Ìí¼Ó¡±°´Å¥Îª¸Ãµ¥Ôª´´½¨Ò»¸öÌõÄ¿¡£" + IDS_NOCELL_DESC_CC "²»ÄÜÅäÖà AFS ¿ØÖÆÖÐÐÄ£¬ÒòΪÄú»¹Ã»ÓÐÖ¸¶¨È±Ê¡µÄ AFS µ¥Ôª¡£\n\nÇëÔÚÌṩµÄÇøÓòÖÐÊäÈë AFS µ¥ÔªÃû¡£" + IDS_TITLE_CAUTION_CCENTER "×¢Òâ - AFS ¿ØÖÆÖÐÐÄÌØÐÔ" + IDS_TITLE_ERROR_CCENTER "³ö´í - AFS ¿ØÖÆÖÐÐÄÌØÐÔ" + IDS_TITLE_CCENTER "AFS ¿ØÖÆÖÐÐÄÌØÐÔ" + IDS_YES "ÊÇ" + IDS_NO "·ñ" + IDS_DRIVE "Çý¶¯Æ÷" +END + +#endif // Chinese (P.R.C.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/WINNT/client_config/resource.h b/src/WINNT/client_config/resource.h index a12b165c4..ef79161ce 100644 --- a/src/WINNT/client_config/resource.h +++ b/src/WINNT/client_config/resource.h @@ -105,6 +105,7 @@ #define IDD_LOGIN_CONFIG_PARMS 119 #define IDD_GLOBAL_DRIVES 120 #define IDD_GLOBAL_DRIVES_ADDEDIT 121 +#define IDD_BINDING_CONFIG_PARAMS 122 #define IDC_STATUS 1000 #define IDC_SERVICE_STOP 1001 #define IDC_SERVICE_START 1002 @@ -154,8 +155,9 @@ #define IDC_ADDR_LOOKUP 1049 #define IDC_LOGON_PARMS 1049 #define IDC_TRACE_LOG_BUF_SIZE 1050 -#define IDC_AUTOMAP_PARMS 1050 +#define IDC_AUTOMAP_PARMS 1051 #define IDC_LOGIN_RETRY_INTERVAL 1052 +#define IDC_BINDING_PARMS 1053 #define IDC_TRAP_ON_PANIC 1054 #define IDC_REPORT_SESSION_STARTUPS 1055 #define IDC_FAIL_SILENTLY 1056 @@ -164,8 +166,11 @@ #define IDC_DIAG_PARMS 1060 #define IDC_ROOTVOLUME 1061 #define IDC_AUTOLANA 1062 +#define IDC_DEFAULTNIC 1062 #define IDC_STATICLANA 1063 #define IDC_STATICSUBMOUNT 1064 +#define IDC_NICSELECTION 1065 +#define IDC_BINDING_MESSAGE 1066 #define IDC_STATIC -1 // Next default values for new objects @@ -174,9 +179,9 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 #define _APS_3D_CONTROLS 1 -#define _APS_NEXT_RESOURCE_VALUE 122 +#define _APS_NEXT_RESOURCE_VALUE 123 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1064 +#define _APS_NEXT_CONTROL_VALUE 1067 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/src/WINNT/client_config/tab_advanced.cpp b/src/WINNT/client_config/tab_advanced.cpp index e1530ebfb..4bd024529 100644 --- a/src/WINNT/client_config/tab_advanced.cpp +++ b/src/WINNT/client_config/tab_advanced.cpp @@ -58,6 +58,9 @@ extern BOOL Logon_OnApply(); extern BOOL CALLBACK Diag_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp); extern BOOL Diag_OnApply(); +// From binding_misc.cpp +extern BOOL Binding_OnApply(); +extern BOOL CALLBACK Binding_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp); /* * ROUTINES ___________________________________________________________________ @@ -109,6 +112,10 @@ BOOL CALLBACK AdvancedTab_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp) ModalDialog(IDD_MISC_CONFIG_PARMS, hDlg, (DLGPROC)Misc_DlgProc); break; + case IDC_BINDING_PARMS: + ModalDialog(IDD_BINDING_CONFIG_PARAMS, hDlg, (DLGPROC)Binding_DlgProc); + break; + case IDC_LOGON_PARMS: ModalDialog(IDD_LOGIN_CONFIG_PARMS, hDlg, (DLGPROC)Logon_DlgProc); break; @@ -229,6 +236,9 @@ BOOL AdvancedTab_OnApply (HWND hDlg) if (!Misc_OnApply()) return FALSE; + if (!Binding_OnApply()) + return FALSE; + if (!Logon_OnApply()) return FALSE; diff --git a/src/WINNT/client_config/tab_drives.cpp b/src/WINNT/client_config/tab_drives.cpp index 501aa0d79..5c2d1c95f 100644 --- a/src/WINNT/client_config/tab_drives.cpp +++ b/src/WINNT/client_config/tab_drives.cpp @@ -394,6 +394,7 @@ BOOL CALLBACK DriveEdit_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp) return FALSE; } +extern void GetNetbiosName(LPTSTR pszName, int type); void DriveEdit_OnInitDialog (HWND hDlg) { @@ -434,7 +435,14 @@ void DriveEdit_OnInitDialog (HWND hDlg) SendMessage (hCombo, CB_SETCURSEL, iItemSel, 0); TCHAR szMapping[ MAX_PATH ]; +#ifdef NOLANA AdjustAfsPath (szMapping, ((pMap->szMapping[0]) ? pMap->szMapping : cm_slash_mount_root), TRUE, FALSE); +#else + memset(szMapping, '\0', sizeof(szMapping)); + szMapping[0] = '\\'; + GetNetbiosName(&szMapping[1], 0); +#endif + CHAR msg[256], msgf[256]; if (GetDlgItemText(hDlg,IDC_STATICSUBMOUNT,(LPSTR)msg,sizeof(msg)-1)>0) { diff --git a/src/WINNT/client_creds/Makefile b/src/WINNT/client_creds/Makefile index 1b213b072..36cfec813 100644 --- a/src/WINNT/client_creds/Makefile +++ b/src/WINNT/client_creds/Makefile @@ -55,7 +55,7 @@ cflags = $(cflags) -DSTRICT guilflags = $(guilflags) -MACHINE:$(CPU) cflags = $(cflags) -Zi -Od -DDEBUG -D_DEBUG -DDBG -lflags = $(lflags) -debug:full -debugtype:both +lflags = $(lflags) -debug:full .rc.res : $(rc) $(rcflags) $(rcvars) $*.rc diff --git a/src/WINNT/client_creds/NTMakefile b/src/WINNT/client_creds/NTMakefile index 2d6567c7d..1483edb3d 100644 --- a/src/WINNT/client_creds/NTMakefile +++ b/src/WINNT/client_creds/NTMakefile @@ -7,8 +7,7 @@ # include the AFSD source tree on our inclusion path -AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) -I..\afsd -I..\client_config - +AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) /D"_AFXDLL" -I..\afsd -I..\client_config -I..\kfw\inc\loadfuncs -I..\kfw\inc\krb5 -I..\kfw\inc\leash # include the primary makefile RELDIR=WINNT\client_creds @@ -35,6 +34,9 @@ EXEOBJS = \ $(OUT)\trayicon.obj \ $(OUT)\window.obj +EXECOBJS = \ + $(OUT)\afskfw.obj + EXERES = \ $(OUT)\afscreds_stub.res @@ -47,14 +49,18 @@ AFSAPPLIBOBJS= \ $(OUT)\subclass.obj CLIENTOBJS = \ - $(OUT)\drivemap.obj + $(OUT)\drivemap.obj \ + $(OUT)\RegistrySupport.obj \ + $(OUT)\getlana.obj VCLIBS =\ + iphlpapi.lib \ comctl32.lib \ shell32.lib \ uuid.lib \ ole32.lib \ - mpr.lib + mpr.lib \ + netapi32.lib EXELIBS = \ $(DESTDIR)\lib\afs\afspioctl.lib \ @@ -93,9 +99,12 @@ $(AFSDOBJS): $(AFSD)\$$(@B).c $(EXEOBJS): $$(@B).cpp $(C2OBJ) -I$*(*D) -I$(AFSAPPLIB) $** +$(EXECOBJS): $$(@B).c + $(C2OBJ) -I$*(*D) -I$(AFSAPPLIB) $** + ############################################################################ -$(EXEFILE) : $(EXEOBJS) $(EXERES) $(AFSAPPLIBOBJS) $(AFSDOBJS) $(CLIENTOBJS) $(EXELIBS) +$(EXEFILE) : $(EXEOBJS) $(EXECOBJS) $(EXERES) $(AFSAPPLIBOBJS) $(AFSDOBJS) $(CLIENTOBJS) $(EXELIBS) $(EXEGUILINK) $(VCLIBS) $(EXEPREP) diff --git a/src/WINNT/client_creds/advtab.cpp b/src/WINNT/client_creds/advtab.cpp index dc1827e1e..108972b20 100644 --- a/src/WINNT/client_creds/advtab.cpp +++ b/src/WINNT/client_creds/advtab.cpp @@ -13,7 +13,9 @@ extern "C" { } #include "afscreds.h" - +#ifdef USE_KFW +#include "afskrb5.h" +#endif /* * PROTOTYPES _________________________________________________________________ @@ -245,6 +247,10 @@ void Advanced_OnChangeService (HWND hDlg, WORD wCmd) SetWindowLong (hDlg, DWL_USER, TRUE); Advanced_OnServiceTimer (hDlg); Advanced_StartTimer (hDlg); +#ifdef USE_KFW + if ( wCmd == IDC_SERVICE_START && KRB5_is_available() && KRB5_wait_for_service_start() ) + KRB5_AFS_renew_tokens_for_all_cells(); +#endif /* USE_KFW */ } else { diff --git a/src/WINNT/client_creds/afscreds.h b/src/WINNT/client_creds/afscreds.h index a2f7999c5..90d94892d 100644 --- a/src/WINNT/client_creds/afscreds.h +++ b/src/WINNT/client_creds/afscreds.h @@ -63,6 +63,7 @@ extern "C" { #define cszSHORTCUT_NAME TEXT("AFS Credentials.lnk") +#define AFSCREDS_SHORTCUT_OPTIONS TEXT("-A -M -N -Q") /* * VARIABLES __________________________________________________________________ @@ -102,6 +103,8 @@ extern GLOBALS g; #define cminREMIND_TEST 1 // test every minute for expired creds #define cminREMIND_WARN 15 // warn if creds expire in 15 minutes +#define cminRENEW 20 // renew creds when there are 20 minutes remaining +#define cminMINLIFE 30 // minimum life of Kerberos creds #define cmsecMOUSEOVER 1000 // retest freq when mouse is over tray icon #define cmsecSERVICE 2000 // retest freq when starting/stopping service diff --git a/src/WINNT/client_creds/afskfw-int.h b/src/WINNT/client_creds/afskfw-int.h new file mode 100644 index 000000000..828724d43 --- /dev/null +++ b/src/WINNT/client_creds/afskfw-int.h @@ -0,0 +1,278 @@ +/* + * Copyright (c) 2003 SkyRope, LLC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of Skyrope, LLC nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission from Skyrope, LLC. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Portions of this code are derived from portions of the MIT + * Leash Ticket Manager and LoadFuncs utilities. For these portions the + * following copyright applies. + * + * Copyright (c) 2003,2004 by the Massachusetts Institute of Technology. + * All rights reserved. + * + * Export of this software from the United States of America may + * require a specific license from the United States Government. + * It is the responsibility of any person or organization contemplating + * export to obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. Furthermore if you modify this software you must label + * your software as modified software and not distribute it in such a + * fashion that it might be confused with the original M.I.T. software. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + * + */ + +#ifndef AFSKRB5_INT_H +#define AFSKRB5_INT_H + +#include +#ifdef USE_MS2MIT +#define SECURITY_WIN32 +#include +#include +#endif /* USE_MS2MIT */ +#include +#include +#include +#include + +#ifdef USE_MS2MIT +#include +#endif /* USE_MS2MIT */ + +#include +#include + +#include + +/* Defined in the KRBV4W32 version of krb.h but not the Kerberos V version */ +/* Required for some of the loadfuncs headers */ +typedef struct ktext far *KTEXT; +typedef struct ktext far *KTEXT_FP; +#include + +/* AFS has its own version of com_err.h */ +typedef afs_int32 errcode_t; + +#include +#include +#include +#include +#include +#include +#include + +// service definitions +#define SERVICE_DLL "advapi32.dll" +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); + +#define KRB5_DEFAULT_LIFE 60*60*10 /* 10 hours */ +#define LSA_CCNAME "MSLSA:" + +#define PROBE_USERNAME "OPENAFS-KDC-PROBE" +#define PROBE_PASSWORD_LEN 16 + +#define MAXCELLCHARS 64 +#define MAXHOSTCHARS 64 +#define MAXHOSTSPERCELL 8 +#define TRANSARCAFSDAEMON "TransarcAFSDaemon" +typedef struct { + char name[MAXCELLCHARS]; + short numServers; + short flags; + struct sockaddr_in hostAddr[MAXHOSTSPERCELL]; + char hostName[MAXHOSTSPERCELL][MAXHOSTCHARS]; + char *linkedCell; +} afsconf_cell; + +struct ktc_token { + time_t startTime; + time_t endTime; + struct ktc_encryptionKey sessionKey; + short kvno; /* XXX UNALIGNED */ + int ticketLen; + char ticket[MAXKTCTICKETLEN]; +}; + +#define KTC_ERROR 11862784L +#define KTC_TOOBIG 11862785L +#define KTC_INVAL 11862786L +#define KTC_NOENT 11862787L +#define KTC_PIOCTLFAIL 11862788L +#define KTC_NOPIOCTL 11862789L +#define KTC_NOCELL 11862790L +#define KTC_NOCM 11862791L + +/* User Query data structures and functions */ + +struct textField { + char * buf; /* Destination buffer address */ + int len; /* Destination buffer length */ + char * label; /* Label for this field */ + char * def; /* Default response for this field */ + int echo; /* 0 = no, 1 = yes, 2 = asterisks */ +}; + +#define ID_TEXT 150 +#define ID_MID_TEXT 300 + +struct principal_ccache_data { + struct principal_ccache_data * next; + char * principal; + char * ccache_name; + int from_lsa; + int expired; + int expiration_time; + int renew; +}; + +struct cell_principal_map { + struct cell_principal_map * next; + char * cell; + char * principal; + int active; +}; + +/* 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 + ) +); +#define CCAPI_DLL "krbcc32.dll" + +/* Function Prototypes */ +DWORD GetServiceStatus(LPSTR, LPSTR, DWORD *); +void KFW_AFS_error(LONG, LPCSTR); + +void UnloadFuncs(FUNC_INFO [], HINSTANCE); +int LoadFuncs(const char*, FUNC_INFO [], HINSTANCE*, int*, int, int, int); +int KFW_get_ccache(krb5_context, krb5_principal, krb5_ccache *); +int KFW_error(krb5_error_code, LPCSTR, int, krb5_context *, krb5_ccache *); +int KFW_kinit(krb5_context, krb5_ccache, HWND, char *, char *, krb5_deltat, + DWORD, DWORD, krb5_deltat, DWORD, DWORD); +int KFW_AFS_get_cred(char *, char *, char *, char *, int, char **); +int KFW_renew(krb5_context, krb5_ccache); +int KFW_destroy(krb5_context, krb5_ccache); +BOOL KFW_ms2mit(krb5_context, krb5_ccache, BOOL); +int KFW_AFS_unlog(void); +int KFW_AFS_klog(krb5_context, krb5_ccache, char*, char*, char*, int); +void KFW_import_ccache_data(void); +void KFW_import_windows_lsa(void); +BOOL MSLSA_IsKerberosLogon(); +#endif /* AFSKFW_INT_H */ diff --git a/src/WINNT/client_creds/afskfw.c b/src/WINNT/client_creds/afskfw.c new file mode 100644 index 000000000..92a902be3 --- /dev/null +++ b/src/WINNT/client_creds/afskfw.c @@ -0,0 +1,3281 @@ +/* + * Copyright (c) 2003 SkyRope, LLC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of Skyrope, LLC nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission from Skyrope, LLC. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Portions of this code are derived from portions of the MIT + * Leash Ticket Manager and LoadFuncs utilities. For these portions the + * following copyright applies. + * + * Copyright (c) 2003,2004 by the Massachusetts Institute of Technology. + * All rights reserved. + * + * Export of this software from the United States of America may + * require a specific license from the United States Government. + * It is the responsibility of any person or organization contemplating + * export to obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. Furthermore if you modify this software you must label + * your software as modified software and not distribute it in such a + * fashion that it might be confused with the original M.I.T. software. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + * + */ + + +#define USE_MS2MIT +#define USE_KRB4 +#include "afskfw-int.h" +#include "afskfw.h" +#include "creds.h" + +#include + +/* + * TIMING _____________________________________________________________________ + * + */ + +#define cminREMIND_TEST 1 // test every minute for expired creds +#define cminREMIND_WARN 15 // warn if creds expire in 15 minutes +#define cminRENEW 20 // renew creds when there are 20 minutes remaining +#define cminMINLIFE 30 // minimum life of Kerberos creds + +#define c100ns1SECOND (LONGLONG)10000000 +#define cmsec1SECOND 1000 +#define cmsec1MINUTE 60000 +#define csec1MINUTE 60 + +/* Function Pointer Declarations for Delayed Loading */ +// 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); + +// leash functions +DECL_FUNC_PTR(Leash_get_default_lifetime); +DECL_FUNC_PTR(Leash_get_default_forwardable); +DECL_FUNC_PTR(Leash_get_default_renew_till); +DECL_FUNC_PTR(Leash_get_default_noaddresses); +DECL_FUNC_PTR(Leash_get_default_proxiable); +DECL_FUNC_PTR(Leash_get_default_publicip); +DECL_FUNC_PTR(Leash_get_default_use_krb4); +DECL_FUNC_PTR(Leash_get_default_life_min); +DECL_FUNC_PTR(Leash_get_default_life_max); +DECL_FUNC_PTR(Leash_get_default_renew_min); +DECL_FUNC_PTR(Leash_get_default_renew_max); +DECL_FUNC_PTR(Leash_get_default_renewable); + +// 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_build_principal_ext); +DECL_FUNC_PTR(krb5_cc_get_name); +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_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_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_free_addresses); +DECL_FUNC_PTR(krb5_c_random_make_octets); + +// Krb524 functions +DECL_FUNC_PTR(krb524_init_ets); +DECL_FUNC_PTR(krb524_convert_creds_kdc); + +// krb4 functions +DECL_FUNC_PTR(krb_get_cred); +DECL_FUNC_PTR(tkt_string); +DECL_FUNC_PTR(krb_get_tf_realm); +DECL_FUNC_PTR(krb_mk_req); + +// ComErr functions +DECL_FUNC_PTR(com_err); +DECL_FUNC_PTR(error_message); + +// Profile functions +DECL_FUNC_PTR(profile_init); +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_release_string); + +// Service functions +DECL_FUNC_PTR(OpenSCManagerA); +DECL_FUNC_PTR(OpenServiceA); +DECL_FUNC_PTR(QueryServiceStatus); +DECL_FUNC_PTR(CloseServiceHandle); +#ifdef USE_MS2MIT +DECL_FUNC_PTR(LsaNtStatusToWinError); +#endif /* USE_MS2MIT */ + +#ifdef USE_MS2MIT +// LSA Functions +DECL_FUNC_PTR(LsaConnectUntrusted); +DECL_FUNC_PTR(LsaLookupAuthenticationPackage); +DECL_FUNC_PTR(LsaCallAuthenticationPackage); +DECL_FUNC_PTR(LsaFreeReturnBuffer); +DECL_FUNC_PTR(LsaGetLogonSessionData); +#endif /* USE_MS2MIT */ + +// AFS36 Token Functions +DECL_FUNC_PTR(ktc_ListTokens); +DECL_FUNC_PTR(ktc_GetToken); +DECL_FUNC_PTR(ktc_SetToken); +DECL_FUNC_PTR(ktc_ForgetAllTokens); + +// AFS36 Config Functions +DECL_FUNC_PTR(cm_SearchCellFile); +DECL_FUNC_PTR(cm_GetRootCellName); + +// 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 leash_fi[] = { + MAKE_FUNC_INFO(Leash_get_default_lifetime), + MAKE_FUNC_INFO(Leash_get_default_renew_till), + MAKE_FUNC_INFO(Leash_get_default_forwardable), + MAKE_FUNC_INFO(Leash_get_default_noaddresses), + MAKE_FUNC_INFO(Leash_get_default_proxiable), + MAKE_FUNC_INFO(Leash_get_default_publicip), + MAKE_FUNC_INFO(Leash_get_default_use_krb4), + MAKE_FUNC_INFO(Leash_get_default_life_min), + MAKE_FUNC_INFO(Leash_get_default_life_max), + MAKE_FUNC_INFO(Leash_get_default_renew_min), + MAKE_FUNC_INFO(Leash_get_default_renew_max), + MAKE_FUNC_INFO(Leash_get_default_renewable), + 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_build_principal_ext), + MAKE_FUNC_INFO(krb5_cc_get_name), + 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_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_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_free_addresses), + MAKE_FUNC_INFO(krb5_c_random_make_octets), + END_FUNC_INFO +}; + +FUNC_INFO k4_fi[] = { + MAKE_FUNC_INFO(krb_get_cred), + MAKE_FUNC_INFO(krb_get_tf_realm), + MAKE_FUNC_INFO(krb_mk_req), + MAKE_FUNC_INFO(tkt_string), + 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_release), + MAKE_FUNC_INFO(profile_get_subsection_names), + MAKE_FUNC_INFO(profile_free_list), + MAKE_FUNC_INFO(profile_get_string), + 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), +#ifdef USE_MS2MIT + MAKE_FUNC_INFO(LsaNtStatusToWinError), +#endif /* USE_MS2MIT */ + END_FUNC_INFO +}; + +#ifdef USE_MS2MIT +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 +}; +#endif /* USE_MS2MIT */ + +FUNC_INFO afst_fi[] = { + MAKE_FUNC_INFO(ktc_ListTokens), + MAKE_FUNC_INFO(ktc_GetToken), + MAKE_FUNC_INFO(ktc_SetToken), + MAKE_FUNC_INFO(ktc_ForgetAllTokens), + END_FUNC_INFO +}; + +FUNC_INFO afsc_fi[] = { + MAKE_FUNC_INFO(cm_SearchCellFile), + MAKE_FUNC_INFO(cm_GetRootCellName), + END_FUNC_INFO +}; + +/* Static Prototypes */ +static char *afs_realm_of_cell(afsconf_cell *); +static long get_cellconfig_callback(void *, struct sockaddr_in *, char *); +static int get_cellconfig(char *, afsconf_cell *, char *); +static krb5_error_code KRB5_CALLCONV KRB5_prompter( krb5_context context, + void *data, const char *name, const char *banner, int num_prompts, + krb5_prompt prompts[]); + + +/* Static Declarations */ +static int inited = 0; +static int mid_cnt = 0; +static struct textField * mid_tb = NULL; +static HINSTANCE hKrb5 = 0; +static HINSTANCE hKrb4 = 0; +static HINSTANCE hKrb524 = 0; +#ifdef USE_MS2MIT +static HINSTANCE hSecur32 = 0; +#endif /* USE_MS2MIT */ +static HINSTANCE hAdvApi32 = 0; +static HINSTANCE hAfsTokens = 0; +static HINSTANCE hAfsConf = 0; +static HINSTANCE hComErr = 0; +static HINSTANCE hService = 0; +static HINSTANCE hProfile = 0; +static HINSTANCE hLeash = 0; +static HINSTANCE hCCAPI = 0; +static struct principal_ccache_data * princ_cc_data = NULL; +static struct cell_principal_map * cell_princ_map = NULL; + +void +KFW_initialize(void) +{ + static int inited = 0; + if ( !inited ) { + inited = 1; + LoadFuncs(KRB5_DLL, k5_fi, &hKrb5, 0, 1, 0, 0); + LoadFuncs(KRB4_DLL, k4_fi, &hKrb5, 0, 1, 0, 0); + LoadFuncs(COMERR_DLL, ce_fi, &hComErr, 0, 0, 1, 0); + LoadFuncs(SERVICE_DLL, service_fi, &hService, 0, 1, 0, 0); +#ifdef USE_MS2MIT + LoadFuncs(SECUR32_DLL, lsa_fi, &hSecur32, 0, 1, 1, 1); +#endif /* USE_MS2MIT */ + LoadFuncs(KRB524_DLL, k524_fi, &hKrb524, 0, 1, 1, 1); + LoadFuncs(PROFILE_DLL, profile_fi, &hProfile, 0, 1, 0, 0); + LoadFuncs(AFSTOKENS_DLL, afst_fi, &hAfsTokens, 0, 1, 0, 0); + LoadFuncs(AFSCONF_DLL, afsc_fi, &hAfsConf, 0, 1, 0, 0); + LoadFuncs(LEASH_DLL, leash_fi, &hLeash, 0, 1, 0, 0); + LoadFuncs(CCAPI_DLL, ccapi_fi, &hCCAPI, 0, 1, 0, 0); + + if ( KFW_is_available() ) { + char rootcell[MAXCELLCHARS+1]; +#ifdef USE_MS2MIT + KFW_import_windows_lsa(); +#endif /* USE_MS2MIT */ + KFW_import_ccache_data(); + KFW_AFS_renew_expiring_credentials(); + + /* WIN32 NOTE: no way to get max chars */ + if (!pcm_GetRootCellName(rootcell)) + KFW_AFS_renew_token_for_cell(rootcell); + } + } +} + +void +KFW_cleanup(void) +{ + if (hKrb5) + FreeLibrary(hKrb5); + if (hKrb4) + FreeLibrary(hKrb4); + if (hProfile) + FreeLibrary(hProfile); + if (hAfsTokens) + FreeLibrary(hAfsTokens); + if (hAfsConf) + FreeLibrary(hAfsConf); + if (hComErr) + FreeLibrary(hComErr); + if (hService) + FreeLibrary(hService); +#ifdef USE_MS2MIT + if (hSecur32) + FreeLibrary(hSecur32); +#endif /* USE_MS2MIT */ + if (hKrb524) + FreeLibrary(hKrb524); + if (hLeash) + FreeLibrary(hLeash); + if (hCCAPI) + FreeLibrary(hCCAPI); +} + +int +KFW_is_available(void) +{ + KFW_initialize(); + if ( hKrb5 && hComErr && hService && +#ifdef USE_MS2MIT + hSecur32 && +#endif /* USE_MS2MIT */ + hKrb524 && + hProfile && hAfsTokens && hAfsConf ) + return TRUE; + return FALSE; +} + +int +KRB5_error(krb5_error_code rc, LPCSTR FailedFunctionName, + int FreeContextFlag, krb5_context * ctx, + krb5_ccache * cache) +{ + char message[256]; + const char *errText; + int krb5Error = ((int)(rc & 255)); + + /* + switch (krb5Error) + { + // Wrong password + case 31: + case 8: + return; + } + */ + + errText = perror_message(rc); + _snprintf(message, sizeof(message), + "%s\n(Kerberos error %ld)\n\n%s failed", + errText, + krb5Error, + FailedFunctionName); + + if ( IsDebuggerPresent() ) + OutputDebugString(message); + + MessageBox(NULL, message, "Kerberos Five", MB_OK | MB_ICONERROR | + MB_TASKMODAL | + MB_SETFOREGROUND); + if (FreeContextFlag == 1) + { + if (ctx && *ctx != NULL) + { + if (cache && *cache != NULL) { + pkrb5_cc_close(*ctx, *cache); + *cache = NULL; + } + + pkrb5_free_context(*ctx); + *ctx = NULL; + } + } + + return rc; +} + +void +KFW_AFS_update_princ_ccache_data(krb5_context ctx, krb5_ccache cc, int lsa) +{ + struct principal_ccache_data * next = princ_cc_data; + krb5_principal principal = 0; + char * pname = NULL; + const char * ccname = NULL; + krb5_error_code code = 0; + krb5_error_code cc_code = 0; + krb5_cc_cursor cur; + krb5_creds creds; + krb5_flags flags=0; + krb5_timestamp now; + + if (ctx == 0 || cc == 0) + return; + + code = pkrb5_cc_get_principal(ctx, cc, &principal); + if ( code ) return; + + code = pkrb5_unparse_name(ctx, principal, &pname); + if ( code ) goto cleanup; + + ccname = pkrb5_cc_get_name(ctx, cc); + if (!ccname) goto cleanup; + + // Search the existing list to see if we have a match + if ( next ) { + for ( ; next ; next = next->next ) { + if ( !strcmp(next->principal,pname) && !strcmp(next->ccache_name, ccname) ) + break; + } + } + + // If not, match add a new node to the beginning of the list and assign init it + if ( !next ) { + next = (struct principal_ccache_data *) malloc(sizeof(struct principal_ccache_data)); + next->next = princ_cc_data; + princ_cc_data = next; + next->principal = _strdup(pname); + next->ccache_name = _strdup(ccname); + next->from_lsa = lsa; + next->expired = 1; + next->expiration_time = 0; + next->renew = 0; + } + + flags = 0; // turn off OPENCLOSE mode + code = pkrb5_cc_set_flags(ctx, cc, flags); + if ( code ) goto cleanup; + + code = pkrb5_timeofday(ctx, &now); + + cc_code = pkrb5_cc_start_seq_get(ctx, cc, &cur); + + while (!(cc_code = pkrb5_cc_next_cred(ctx, cc, &cur, &creds))) { + if ( creds.ticket_flags & TKT_FLG_INITIAL ) { + int valid; + // we found the ticket we are looking for + // check validity of timestamp + // We add a 5 minutes fudge factor to compensate for potential + // clock skew errors between the KDC and client OS + + valid = ((creds.times.starttime > 0) && + now >= (creds.times.starttime - 300) && + now < (creds.times.endtime + 300) && + !(creds.ticket_flags & TKT_FLG_INVALID)); + + if ( next->from_lsa) { + next->expired = 0; + next->expiration_time = creds.times.endtime; + next->renew = 1; + } else if ( valid ) { + next->expired = 0; + next->expiration_time = creds.times.endtime; + next->renew = (creds.times.renew_till > creds.times.endtime) && + (creds.ticket_flags & TKT_FLG_RENEWABLE); + } else { + next->expired = 1; + next->expiration_time = 0; + next->renew = 0; + } + + pkrb5_free_cred_contents(ctx, &creds); + cc_code = KRB5_CC_END; + break; + } + pkrb5_free_cred_contents(ctx, &creds); + } + + if (cc_code == KRB5_CC_END) { + code = pkrb5_cc_end_seq_get(ctx, cc, &cur); + if (code) goto cleanup; + } + + cleanup: + flags = KRB5_TC_OPENCLOSE; //turn on OPENCLOSE + code = pkrb5_cc_set_flags(ctx, cc, flags); + + if ( pname ) + pkrb5_free_unparsed_name(ctx,pname); + if ( principal ) + pkrb5_free_principal(ctx,principal); +} + +int +KFW_AFS_find_ccache_for_principal(krb5_context ctx, char * principal, char **ccache, int valid_only) +{ + struct principal_ccache_data * next = princ_cc_data; + char * response = NULL; + + if ( !principal || !ccache ) + return 0; + + while ( next ) { + if ( (!valid_only || !next->expired) && !strcmp(next->principal,principal) ) { + if (response) { + // we always want to prefer the MS Kerberos LSA cache or + // the cache afscreds created specifically for the principal + // if the current entry is either one, drop the previous find + if ( next->from_lsa || !strcmp(next->ccache_name,principal) ) + free(response); + } + response = _strdup(next->ccache_name); + // MS Kerberos LSA is our best option so use it and quit + if ( next->from_lsa ) + break; + } + next = next->next; + } + + if ( response ) { + *ccache = response; + return 1; + } + return 0; +} + +void +KFW_AFS_delete_princ_ccache_data(krb5_context ctx, char * pname, char * ccname) +{ + struct principal_ccache_data ** next = &princ_cc_data; + + if ( !pname && !ccname ) + return; + + while ( (*next) ) { + if ( !strcmp((*next)->principal,pname) || + !strcmp((*next)->ccache_name,ccname) ) { + void * temp; + free((*next)->principal); + free((*next)->ccache_name); + temp = (*next); + (*next) = (*next)->next; + free(temp); + } + } +} + +void +KFW_AFS_update_cell_princ_map(krb5_context ctx, char * cell, char *pname, int active) +{ + struct cell_principal_map * next = cell_princ_map; + + // Search the existing list to see if we have a match + if ( next ) { + for ( ; next ; next = next->next ) { + if ( !strcmp(next->cell, cell) ) { + if ( !strcmp(next->principal,pname) ) { + next->active = active; + break; + } else { + // OpenAFS currently has a restriction of one active token per cell + // Therefore, whenever we update the table with a new active cell we + // must mark all of the other principal to cell entries as inactive. + if (active) + next->active = 0; + } + } + } + } + + // If not, match add a new node to the beginning of the list and assign init it + if ( !next ) { + next = (struct cell_principal_map *) malloc(sizeof(struct cell_principal_map)); + next->next = cell_princ_map; + cell_princ_map = next; + next->principal = _strdup(pname); + next->cell = _strdup(cell); + next->active = active; + } +} + +void +KFW_AFS_delete_cell_princ_maps(krb5_context ctx, char * pname, char * cell) +{ + struct cell_principal_map ** next = &cell_princ_map; + + if ( !pname && !cell ) + return; + + while ( (*next) ) { + if ( !strcmp((*next)->principal,pname) || + !strcmp((*next)->cell,cell) ) { + void * temp; + free((*next)->principal); + free((*next)->cell); + temp = (*next); + (*next) = (*next)->next; + free(temp); + } + } +} + +// Returns (if possible) a principal which has been known in +// the past to have been used to obtain tokens for the specified +// cell. +// TODO: Attempt to return one which has not yet expired by checking +// the principal/ccache data +int +KFW_AFS_find_principals_for_cell(krb5_context ctx, char * cell, char **principals[], int active_only) +{ + struct cell_principal_map * next_map = cell_princ_map; + const char * princ = NULL; + int count = 0, i; + + if ( !cell ) + return 0; + + while ( next_map ) { + if ( (!active_only || next_map->active) && !strcmp(next_map->cell,cell) ) { + count++; + } + next_map = next_map->next; + } + + if ( !principals ) + return count; + + *principals = (char **) malloc(sizeof(char *) * count); + for ( next_map = cell_princ_map, i=0 ; next_map && inext ) + { + if ( (!active_only || next_map->active) && !strcmp(next_map->cell,cell) ) { + (*principals)[i++] = _strdup(next_map->principal); + } + } + return count; +} + +int +KFW_AFS_find_cells_for_princ(krb5_context ctx, char * pname, char **cells[], int active_only) +{ + int count = 0, i; + struct cell_principal_map * next_map = cell_princ_map; + const char * princ = NULL; + + if ( !pname ) + return 0; + + while ( next_map ) { + if ( (!active_only || next_map->active) && !strcmp(next_map->principal,pname) ) { + count++; + } + next_map = next_map->next; + } + + if ( !cells ) + return count; + + *cells = (char **) malloc(sizeof(char *) * count); + for ( next_map = cell_princ_map, i=0 ; next_map && inext ) + { + if ( (!active_only || next_map->active) && !strcmp(next_map->principal,pname) ) { + (*cells)[i++] = _strdup(next_map->cell); + } + } + return count; +} + +/* Given a principal return an existing ccache or create one and return */ +int +KFW_get_ccache(krb5_context alt_ctx, krb5_principal principal, krb5_ccache * cc) +{ + krb5_context ctx; + char * pname = 0; + char * ccname = 0; + krb5_error_code code; + + if ( alt_ctx ) { + ctx = alt_ctx; + } else { + code = pkrb5_init_context(&ctx); + if (code) goto cleanup; + } + + if ( principal ) { + code = pkrb5_unparse_name(ctx, principal, &pname); + if (code) goto cleanup; + + if ( !KFW_AFS_find_ccache_for_principal(ctx,pname,&ccname,TRUE) && + !KFW_AFS_find_ccache_for_principal(ctx,pname,&ccname,FALSE)) { + ccname = (char *)malloc(strlen(pname) + 5); + sprintf(ccname,"API:%s",pname); + } + code = pkrb5_cc_resolve(ctx, ccname, cc); + } else { + code = pkrb5_cc_default(ctx, cc); + if (code) goto cleanup; + } + + cleanup: + if (ccname) + free(ccname); + if (pname) + pkrb5_free_unparsed_name(ctx,pname); + if (ctx && (ctx != alt_ctx)) + pkrb5_free_context(ctx); + return(code); +} + +#ifdef USE_MS2MIT +// Import Microsoft Credentials into a new MIT ccache +void +KFW_import_windows_lsa(void) +{ + krb5_context ctx = 0; + krb5_ccache cc = 0; + krb5_principal princ = 0; + char * pname = NULL; + krb5_data * realm; + krb5_error_code code; + char cell[128]=""; + int i; + + if ( !MSLSA_IsKerberosLogon() ) + return; + + code = pkrb5_init_context(&ctx); + if (code) goto cleanup; + + code = pkrb5_cc_resolve(ctx, LSA_CCNAME, &cc); + if (code) goto cleanup; + + KFW_AFS_update_princ_ccache_data(ctx, cc, TRUE); + + code = pkrb5_cc_get_principal(ctx, cc, &princ); + if ( code ) goto cleanup; + + code = pkrb5_unparse_name(ctx,princ,&pname); + if ( code ) goto cleanup; + + realm = krb5_princ_realm(ctx, princ); + for ( i=0; ilength; i++ ) { + cell[i] = tolower(realm->data[i]); + } + cell[i] = '\0'; + + code = KFW_AFS_klog(ctx, cc, "afs", cell, realm->data, pLeash_get_default_lifetime()); + if ( IsDebuggerPresent() ) { + char message[256]; + sprintf(message,"KFW_AFS_klog() returns: %d\n",code); + OutputDebugString(message); + } + if ( code ) goto cleanup; + + KFW_AFS_update_cell_princ_map(ctx, cell, pname, TRUE); + + cleanup: + if (pname) + pkrb5_free_unparsed_name(ctx,pname); + if (princ) + pkrb5_free_principal(ctx,princ); + if (cc) + pkrb5_cc_close(ctx,cc); + if (ctx) + pkrb5_free_context(ctx); +} +#endif /* USE_MS2MIT */ + +// If there are existing MIT credentials, copy them to a new +// ccache named after the principal + +// Enumerate all existing MIT ccaches and construct entries +// in the principal_ccache table + +// Enumerate all existing AFS Tokens and construct entries +// in the cell_principal table +void +KFW_import_ccache_data(void) +{ + krb5_context ctx = 0; + krb5_ccache cc = 0; + krb5_principal principal = 0; + krb5_creds creds; + krb5_error_code code; + krb5_error_code cc_code; + krb5_cc_cursor cur; + apiCB * cc_ctx = 0; + struct _infoNC ** pNCi = NULL; + int i, j, flags; + + if ( !pcc_initialize ) + return; + + if ( IsDebuggerPresent() ) + OutputDebugString("KFW_import_ccache_data()\n"); + + code = pcc_initialize(&cc_ctx, CC_API_VER_2, NULL, NULL); + if (code) goto cleanup; + + code = pcc_get_NC_info(cc_ctx, &pNCi); + if (code) goto cleanup; + + code = pkrb5_init_context(&ctx); + if (code) goto cleanup; + + for ( i=0; pNCi[i]; i++ ) { + if ( pNCi[i]->vers != CC_CRED_V5 ) + continue; + if ( IsDebuggerPresent() ) { + OutputDebugString("Principal: "); + OutputDebugString(pNCi[i]->principal); + OutputDebugString(" in ccache "); + OutputDebugString(pNCi[i]->name); + OutputDebugString("\n"); + } + if ( strcmp(pNCi[i]->name,pNCi[i]->principal) + && strcmp(pNCi[i]->name,LSA_CCNAME) + ) { + int found = 0; + krb5_ccache oldcc = 0; + for ( j=0; pNCi[j]; j++ ) { + if (!strcmp(pNCi[j]->name,pNCi[i]->principal)) { + found = 1; + break; + } + } + if (found) + continue; + + if ( IsDebuggerPresent() ) + OutputDebugString("copying ccache data to new ccache\n"); + + code = pkrb5_cc_resolve(ctx, pNCi[i]->principal, &cc); + if (code) goto loop_cleanup; + code = pkrb5_parse_name(ctx, pNCi[i]->principal, &principal); + if (code) goto loop_cleanup; + code = pkrb5_cc_initialize(ctx, cc, principal); + if (code) goto loop_cleanup; + code = pkrb5_cc_resolve(ctx, pNCi[i]->name, &oldcc); + if (code) goto loop_cleanup; + code = pkrb5_cc_copy_creds(ctx,oldcc,cc); + if (code) { + code = pkrb5_cc_close(ctx,cc); + cc = 0; + code = pkrb5_cc_close(ctx,oldcc); + cc = 0; + KRB5_error(code, "krb5_cc_copy_creds", 0, NULL, NULL); + continue; + } + code = pkrb5_cc_close(ctx,oldcc); + } else { + code = pkrb5_cc_resolve(ctx, pNCi[i]->name, &cc); + if (code) goto loop_cleanup; + } + + flags = 0; // turn off OPENCLOSE mode + code = pkrb5_cc_set_flags(ctx, cc, flags); + if ( code ) goto cleanup; + + KFW_AFS_update_princ_ccache_data(ctx, cc, !strcmp(pNCi[i]->name,LSA_CCNAME)); + + cc_code = pkrb5_cc_start_seq_get(ctx, cc, &cur); + + while (!(cc_code = pkrb5_cc_next_cred(ctx, cc, &cur, &creds))) { + krb5_data * sname = krb5_princ_name(ctx, creds.server); + krb5_data * cell = krb5_princ_component(ctx, creds.server, 1); + krb5_data * realm = krb5_princ_realm(ctx, creds.server); + if ( sname && cell && !strcmp("afs",sname->data) ) { + struct ktc_principal aserver; + struct ktc_principal aclient; + struct ktc_token atoken; + int active = TRUE; + + if ( IsDebuggerPresent() ) { + OutputDebugString("Found AFS ticket: "); + OutputDebugString(sname->data); + if ( cell->data ) { + OutputDebugString("/"); + OutputDebugString(cell->data); + } + OutputDebugString("@"); + OutputDebugString(realm->data); + OutputDebugString("\n"); + } + + memset(&aserver, '\0', sizeof(aserver)); + strcpy(aserver.name, sname->data); + strcpy(aserver.cell, cell->data); + + code = pktc_GetToken(&aserver, &atoken, sizeof(atoken), &aclient); + if (!code) { + // Found a token in AFS Client Server which matches + char pname[128], *p, *q; + for ( p=pname, q=aclient.name; *q; p++, q++) + *p = *q; + for ( *p++ = '@', q=aclient.cell; *q; p++, q++) + *p = toupper(*q); + *p = '\0'; + + if ( IsDebuggerPresent() ) { + OutputDebugString("Found AFS token: "); + OutputDebugString(pname); + OutputDebugString("\n"); + } + + if ( strcmp(pname,pNCi[i]->principal) ) + active = FALSE; + KFW_AFS_update_cell_princ_map(ctx, cell->data, pNCi[i]->principal, active); + } else { + // Attempt to import it + KFW_AFS_update_cell_princ_map(ctx, cell->data, pNCi[i]->principal, active); + + if ( IsDebuggerPresent() ) { + OutputDebugString("Calling KFW_AFS_klog() to obtain token\n"); + } + + code = KFW_AFS_klog(ctx, cc, "afs", cell->data, realm->data, pLeash_get_default_lifetime()); + if ( IsDebuggerPresent() ) { + char message[256]; + sprintf(message,"KFW_AFS_klog() returns: %d\n",code); + OutputDebugString(message); + } + } + } else if ( IsDebuggerPresent() ) { + OutputDebugString("Found ticket: "); + OutputDebugString(sname->data); + if ( cell && cell->data ) { + OutputDebugString("/"); + OutputDebugString(cell->data); + } + OutputDebugString("@"); + OutputDebugString(realm->data); + OutputDebugString("\n"); + } + pkrb5_free_cred_contents(ctx, &creds); + } + + if (cc_code == KRB5_CC_END) { + cc_code = pkrb5_cc_end_seq_get(ctx, cc, &cur); + if (cc_code) goto loop_cleanup; + } + + loop_cleanup: + flags = KRB5_TC_OPENCLOSE; //turn on OPENCLOSE + code = pkrb5_cc_set_flags(ctx, cc, flags); + if (cc) { + pkrb5_cc_close(ctx,cc); + cc = 0; + } + } + + cleanup: + if (principal) + pkrb5_free_principal(ctx,principal); + if (ctx) + pkrb5_free_context(ctx); + if (pNCi) + pcc_free_NC_info(cc_ctx, &pNCi); + if (cc_ctx) + pcc_shutdown(&cc_ctx); +} + + +int +KFW_AFS_get_cred(char * username, + char * instance, + char * cell, + char * password, + int lifetime, + char ** reasonP ) +{ + krb5_context ctx = 0; + krb5_ccache cc = 0; + char * realm = 0; + char ** realmlist = 0; + krb5_principal principal = 0; + char * pname = 0; + krb5_error_code code; + char local_cell[MAXCELLCHARS+1]; + char **cells = NULL; + int cell_count=0; + afsconf_cell cellconfig; + + if ( IsDebuggerPresent() ) { + OutputDebugString("KFW_AFS_get_cred for token "); + OutputDebugString(username); + if ( instance ) { + OutputDebugString("/"); + OutputDebugString(instance); + } + OutputDebugString("@"); + OutputDebugString(cell); + OutputDebugString("\n"); + } + + code = pkrb5_init_context(&ctx); + if ( code ) goto cleanup; + + code = get_cellconfig( cell, (void*)&cellconfig, local_cell); + if ( code ) goto cleanup; + + realm = afs_realm_of_cell(&cellconfig); // do not free + + if ( IsDebuggerPresent() ) { + OutputDebugString("Realm: "); + OutputDebugString(realm); + OutputDebugString("\n"); + } + + code = pkrb5_build_principal(ctx, &principal, strlen(realm), + realm, username, + (instance && instance[0]) ? instance : NULL, + NULL); + + code = KFW_get_ccache(ctx, principal, &cc); + if ( code ) goto cleanup; + + code = pkrb5_unparse_name(ctx, principal, &pname); + if ( code ) goto cleanup; + + if ( lifetime == 0 ) + lifetime = pLeash_get_default_lifetime(); + + code = KFW_kinit(ctx, cc, HWND_DESKTOP, + pname, + password, + lifetime, + pLeash_get_default_forwardable(), + pLeash_get_default_proxiable(), + pLeash_get_default_renewable() ? pLeash_get_default_renew_till() : 0, + pLeash_get_default_noaddresses(), + pLeash_get_default_publicip()); + if ( IsDebuggerPresent() ) { + char message[256]; + sprintf(message,"KFW_kinit() returns: %d\n",code); + OutputDebugString(message); + } + if ( code ) goto cleanup; + + KFW_AFS_update_princ_ccache_data(ctx, cc, FALSE); + + code = KFW_AFS_klog(ctx, cc, "afs", cell, realm, lifetime); + if ( IsDebuggerPresent() ) { + char message[256]; + sprintf(message,"KFW_AFS_klog() returns: %d\n",code); + OutputDebugString(message); + } + if ( code ) goto cleanup; + + KFW_AFS_update_cell_princ_map(ctx, cell, pname, TRUE); + + // Attempt to obtain new tokens for other cells supported by the same + // principal + cell_count = KFW_AFS_find_cells_for_princ(ctx, pname, &cells, TRUE); + if ( cell_count > 1 ) { + while ( cell_count-- ) { + if ( strcmp(cells[cell_count],cell) ) { + if ( IsDebuggerPresent() ) { + char message[256]; + sprintf(message,"found another cell for the same principal: %s\n",cell); + OutputDebugString(message); + } + code = get_cellconfig( cells[cell_count], (void*)&cellconfig, local_cell); + if ( code ) continue; + + realm = afs_realm_of_cell(&cellconfig); // do not free + if ( IsDebuggerPresent() ) { + OutputDebugString("Realm: "); + OutputDebugString(realm); + OutputDebugString("\n"); + } + + code = KFW_AFS_klog(ctx, cc, "afs", cells[cell_count], realm, lifetime); + if ( IsDebuggerPresent() ) { + char message[256]; + sprintf(message,"KFW_AFS_klog() returns: %d\n",code); + OutputDebugString(message); + } + } + free(cells[cell_count]); + } + free(cells); + } else if ( cell_count == 1 ) { + free(cells[0]); + free(cells); + } + + cleanup: + if ( pname ) + pkrb5_free_unparsed_name(ctx,pname); + if ( cc ) + pkrb5_cc_close(ctx, cc); + + if ( code && reasonP ) { + *reasonP = (char *)perror_message(code); + } + return(code); +} + +int +KFW_AFS_destroy_tickets_for_cell(char * cell) +{ + krb5_context ctx = 0; + krb5_error_code code; + int count; + char ** principals = NULL; + + if ( IsDebuggerPresent() ) { + OutputDebugString("KFW_AFS_destroy_ticets_for_cell: "); + OutputDebugString(cell); + OutputDebugString("\n"); + } + + code = pkrb5_init_context(&ctx); + if (code) ctx = 0; + + count = KFW_AFS_find_principals_for_cell(ctx, cell, &principals, FALSE); + if ( count > 0 ) { + krb5_principal princ = 0; + krb5_ccache cc = 0; + + while ( count-- ) { + int cell_count = KFW_AFS_find_cells_for_princ(ctx, principals[count], NULL, TRUE); + if ( cell_count > 1 ) { + // TODO - What we really should do here is verify whether or not any of the + // other cells which use this principal to obtain its credentials actually + // have valid tokens or not. If they are currently using these credentials + // we will skip them. For the time being we assume that if there is an active + // map in the table that they are actively being used. + goto loop_cleanup; + } + + code = pkrb5_parse_name(ctx, principals[count], &princ); + if (code) goto loop_cleanup; + + code = KFW_get_ccache(ctx, princ, &cc); + if (code) goto loop_cleanup; + + code = pkrb5_cc_destroy(ctx, cc); + if (!code) cc = 0; + + loop_cleanup: + if ( cc ) { + pkrb5_cc_close(ctx, cc); + cc = 0; + } + if ( princ ) { + pkrb5_free_principal(ctx, princ); + princ = 0; + } + + KFW_AFS_update_cell_princ_map(ctx, cell, principals[count], FALSE); + free(principals[count]); + } + free(principals); + } + pkrb5_free_context(ctx); + return 0; +} + +int +KFW_AFS_renew_expiring_credentials(void) +{ + krb5_error_code code = 0; + krb5_context ctx = 0; + krb5_ccache cc = 0; + krb5_timestamp now; + struct principal_ccache_data * pcc_next = princ_cc_data; + int cell_count; + char ** cells=NULL; + const char * realm = NULL; + char local_cell[MAXCELLCHARS+1]=""; + afsconf_cell cellconfig; + + if ( pcc_next == NULL ) // nothing to do + return 0; + + if ( IsDebuggerPresent() ) { + OutputDebugString("KFW_AFS_renew_expiring_credentials\n"); + } + + code = pkrb5_init_context(&ctx); + if (code) goto cleanup; + + code = pkrb5_timeofday(ctx, &now); + if (code) goto cleanup; + + for ( ; pcc_next ; pcc_next = pcc_next->next ) { + if ( pcc_next->expired ) + continue; + + if ( now >= (pcc_next->expiration_time) ) { + if ( !pcc_next->from_lsa ) { + pcc_next->expired = 1; + continue; + } + } + + if ( pcc_next->renew && now >= (pcc_next->expiration_time - cminRENEW * csec1MINUTE) ) { + code = pkrb5_cc_resolve(ctx, pcc_next->ccache_name, &cc); + if ( code ) + goto loop_cleanup; + code = KFW_renew(ctx,cc); +#ifdef USE_MS2MIT + if ( code && pcc_next->from_lsa) + goto loop_cleanup; +#endif /* USE_MS2MIT */ + + + KFW_AFS_update_princ_ccache_data(ctx, cc, pcc_next->from_lsa); + if (code) goto loop_cleanup; + + // Attempt to obtain new tokens for other cells supported by the same + // principal + cell_count = KFW_AFS_find_cells_for_princ(ctx, pcc_next->principal, &cells, TRUE); + if ( cell_count > 0 ) { + while ( cell_count-- ) { + if ( IsDebuggerPresent() ) { + OutputDebugString("Cell: "); + OutputDebugString(cells[cell_count]); + OutputDebugString("\n"); + } + code = get_cellconfig( cells[cell_count], (void*)&cellconfig, local_cell); + if ( code ) continue; + realm = afs_realm_of_cell(&cellconfig); // do not free + if ( IsDebuggerPresent() ) { + OutputDebugString("Realm: "); + OutputDebugString(realm); + OutputDebugString("\n"); + } + code = KFW_AFS_klog(ctx, cc, "afs", cells[cell_count], (char *)realm, pLeash_get_default_lifetime()); + if ( IsDebuggerPresent() ) { + char message[256]; + sprintf(message,"KFW_AFS_klog() returns: %d\n",code); + OutputDebugString(message); + } + free(cells[cell_count]); + } + free(cells); + } + } + + loop_cleanup: + if ( cc ) { + pkrb5_cc_close(ctx,cc); + cc = 0; + } + } + + cleanup: + if ( cc ) + pkrb5_cc_close(ctx,cc); + if ( ctx ) + pkrb5_free_context(ctx); + + return 0; +} + + +BOOL +KFW_AFS_renew_token_for_cell(char * cell) +{ + krb5_error_code code = 0; + krb5_context ctx = 0; + int count; + char ** principals = NULL; + + if ( IsDebuggerPresent() ) { + OutputDebugString("KFW_AFS_renew_token_for_cell:"); + OutputDebugString(cell); + OutputDebugString("\n"); + } + + code = pkrb5_init_context(&ctx); + if (code) goto cleanup; + + count = KFW_AFS_find_principals_for_cell(ctx, cell, &principals, TRUE); + if ( count > 0 ) { + krb5_principal princ = 0; + krb5_principal service = 0; + krb5_creds mcreds, creds; + krb5_ccache cc = 0; + const char * realm = NULL; + afsconf_cell cellconfig; + char local_cell[MAXCELLCHARS+1]; + + while ( count-- ) { + code = pkrb5_parse_name(ctx, principals[count], &princ); + if (code) goto loop_cleanup; + + code = KFW_get_ccache(ctx, princ, &cc); + if (code) goto loop_cleanup; + + code = get_cellconfig( cell, (void*)&cellconfig, local_cell); + if ( code ) goto loop_cleanup; + + realm = afs_realm_of_cell(&cellconfig); // do not free + if ( IsDebuggerPresent() ) { + OutputDebugString("Realm: "); + OutputDebugString(realm); + OutputDebugString("\n"); + } + + code = pkrb5_build_principal(ctx, &service, strlen(realm), + realm, "afs", cell, NULL); + if (!code) { + memset(&mcreds, 0, sizeof(krb5_creds)); + mcreds.client = princ; + mcreds.server = service; + + code = pkrb5_cc_retrieve_cred(ctx, cc, 0, &mcreds, &creds); + if (!code) { + if ( IsDebuggerPresent() ) { + char * cname, *sname; + pkrb5_unparse_name(ctx, creds.client, &cname); + pkrb5_unparse_name(ctx, creds.server, &sname); + OutputDebugString("Removing credential for client \""); + OutputDebugString(cname); + OutputDebugString("\" and service \""); + OutputDebugString(sname); + OutputDebugString("\"\n"); + pkrb5_free_unparsed_name(ctx,cname); + pkrb5_free_unparsed_name(ctx,sname); + } + + code = pkrb5_cc_remove_cred(ctx, cc, 0, &creds); + pkrb5_free_principal(ctx, creds.client); + pkrb5_free_principal(ctx, creds.server); + } + } + code = KFW_AFS_klog(ctx, cc, "afs", cell, (char *)realm, pLeash_get_default_lifetime()); + if ( IsDebuggerPresent() ) { + char message[256]; + sprintf(message,"KFW_AFS_klog() returns: %d\n",code); + OutputDebugString(message); + } + + loop_cleanup: + if (cc) { + pkrb5_cc_close(ctx, cc); + cc = 0; + } + if (princ) { + pkrb5_free_principal(ctx, princ); + princ = 0; + } + if (service) { + pkrb5_free_principal(ctx, service); + princ = 0; + } + + KFW_AFS_update_cell_princ_map(ctx, cell, principals[count], code ? FALSE : TRUE); + free(principals[count]); + } + free(principals); + } else + code = -1; // we did not renew the tokens + + cleanup: + pkrb5_free_context(ctx); + return (code ? FALSE : TRUE); + +} + +int +KFW_AFS_renew_tokens_for_all_cells(void) +{ + struct cell_principal_map * next = cell_princ_map; + + if ( IsDebuggerPresent() ) + OutputDebugString("KFW_AFS_renew_tokens_for_all()\n"); + + if ( !next ) + return 0; + + for ( ; next ; next = next->next ) { + if ( next->active ) + KFW_AFS_renew_token_for_cell(next->cell); + } + return 0; +} + +int +KFW_renew(krb5_context alt_ctx, krb5_ccache alt_cc) +{ + krb5_error_code code = 0; + krb5_context ctx = 0; + krb5_ccache cc = 0; + krb5_principal me = 0; + krb5_principal server = 0; + krb5_creds my_creds; + krb5_data *realm = 0; + + memset(&my_creds, 0, sizeof(krb5_creds)); + + if ( alt_ctx ) { + ctx = alt_ctx; + } else { + code = pkrb5_init_context(&ctx); + if (code) goto cleanup; + } + + if ( alt_cc ) { + cc = alt_cc; + } else { + code = pkrb5_cc_default(ctx, &cc); + if (code) goto cleanup; + } + + code = pkrb5_cc_get_principal(ctx, cc, &me); + if (code) goto cleanup; + + realm = krb5_princ_realm(ctx, me); + + code = pkrb5_build_principal_ext(ctx, &server, + realm->length,realm->data, + KRB5_TGS_NAME_SIZE, KRB5_TGS_NAME, + realm->length,realm->data, + 0); + if ( code ) + goto cleanup; + + if ( IsDebuggerPresent() ) { + char * cname, *sname; + pkrb5_unparse_name(ctx, me, &cname); + pkrb5_unparse_name(ctx, server, &sname); + OutputDebugString("Renewing credential for client \""); + OutputDebugString(cname); + OutputDebugString("\" and service \""); + OutputDebugString(sname); + OutputDebugString("\"\n"); + pkrb5_free_unparsed_name(ctx,cname); + pkrb5_free_unparsed_name(ctx,sname); + } + + my_creds.client = me; + my_creds.server = server; + + code = pkrb5_get_renewed_creds(ctx, &my_creds, me, cc, NULL); + if (code) { + if ( IsDebuggerPresent() ) { + char message[256]; + sprintf(message,"krb5_get_renewed_creds() failed: %d\n",code); + OutputDebugString(message); + } + goto cleanup; + } + + code = pkrb5_cc_initialize(ctx, cc, me); + if (code) { + if ( IsDebuggerPresent() ) { + char message[256]; + sprintf(message,"krb5_cc_initialize() failed: %d\n",code); + OutputDebugString(message); + } + goto cleanup; + } + + code = pkrb5_cc_store_cred(ctx, cc, &my_creds); + if (code) { + if ( IsDebuggerPresent() ) { + char message[256]; + sprintf(message,"krb5_cc_store_cred() failed: %d\n",code); + OutputDebugString(message); + } + goto cleanup; + } + + cleanup: + if (my_creds.client == me) + my_creds.client = 0; + if (my_creds.server == server) + my_creds.server = 0; + pkrb5_free_cred_contents(ctx, &my_creds); + if (me) + pkrb5_free_principal(ctx, me); + if (server) + pkrb5_free_principal(ctx, server); + if (cc && (cc != alt_cc)) + pkrb5_cc_close(ctx, cc); + if (ctx && (ctx != alt_ctx)) + pkrb5_free_context(ctx); + return(code); +} + +int +KFW_kinit( krb5_context alt_ctx, + krb5_ccache alt_cc, + HWND hParent, + char *principal_name, + char *password, + krb5_deltat lifetime, + DWORD forwardable, + DWORD proxiable, + krb5_deltat renew_life, + DWORD addressless, + DWORD publicIP + ) +{ + krb5_error_code code = 0; + krb5_context ctx = 0; + krb5_ccache cc = 0; + krb5_principal me = 0; + char* name = 0; + krb5_creds my_creds; + krb5_get_init_creds_opt options; + krb5_address ** addrs = NULL; + int i = 0, addr_count = 0; + + if (!pkrb5_init_context) + return 0; + + pkrb5_get_init_creds_opt_init(&options); + memset(&my_creds, 0, sizeof(my_creds)); + + if (alt_ctx) + { + ctx = alt_ctx; + } + else + { + code = pkrb5_init_context(&ctx); + if (code) goto cleanup; + } + + if ( alt_cc ) { + cc = alt_cc; + } else { + code = pkrb5_cc_default(ctx, &cc); + if (code) goto cleanup; + } + + code = pkrb5_parse_name(ctx, principal_name, &me); + if (code) + goto cleanup; + + code = pkrb5_unparse_name(ctx, me, &name); + if (code) + goto cleanup; + + if (lifetime == 0) + lifetime = pLeash_get_default_lifetime(); + else + lifetime *= 5*60; + + if (renew_life > 0) + renew_life *= 5*60; + + if (lifetime) + pkrb5_get_init_creds_opt_set_tkt_life(&options, lifetime); + pkrb5_get_init_creds_opt_set_forwardable(&options, + forwardable ? 1 : 0); + pkrb5_get_init_creds_opt_set_proxiable(&options, + proxiable ? 1 : 0); + pkrb5_get_init_creds_opt_set_renew_life(&options, + renew_life); + if (addressless) + pkrb5_get_init_creds_opt_set_address_list(&options,NULL); + else { + if (publicIP) + { + // we are going to add the public IP address specified by the user + // to the list provided by the operating system + krb5_address ** local_addrs=NULL; + DWORD netIPAddr; + + pkrb5_os_localaddr(ctx, &local_addrs); + while ( local_addrs[i++] ); + addr_count = i + 1; + + addrs = (krb5_address **) malloc((addr_count+1) * sizeof(krb5_address *)); + if ( !addrs ) { + pkrb5_free_addresses(ctx, local_addrs); + goto cleanup; + } + memset(addrs, 0, sizeof(krb5_address *) * (addr_count+1)); + i = 0; + while ( local_addrs[i] ) { + addrs[i] = (krb5_address *)malloc(sizeof(krb5_address)); + if (addrs[i] == NULL) { + pkrb5_free_addresses(ctx, local_addrs); + goto cleanup; + } + + addrs[i]->magic = local_addrs[i]->magic; + addrs[i]->addrtype = local_addrs[i]->addrtype; + addrs[i]->length = local_addrs[i]->length; + addrs[i]->contents = (unsigned char *)malloc(addrs[i]->length); + if (!addrs[i]->contents) { + pkrb5_free_addresses(ctx, local_addrs); + goto cleanup; + } + + memcpy(addrs[i]->contents,local_addrs[i]->contents, + local_addrs[i]->length); /* safe */ + i++; + } + pkrb5_free_addresses(ctx, local_addrs); + + addrs[i] = (krb5_address *)malloc(sizeof(krb5_address)); + if (addrs[i] == NULL) + goto cleanup; + + addrs[i]->magic = KV5M_ADDRESS; + addrs[i]->addrtype = AF_INET; + addrs[i]->length = 4; + addrs[i]->contents = (unsigned char *)malloc(addrs[i]->length); + if (!addrs[i]->contents) + goto cleanup; + + netIPAddr = htonl(publicIP); + memcpy(addrs[i]->contents,&netIPAddr,4); + + pkrb5_get_init_creds_opt_set_address_list(&options,addrs); + + } + } + + code = pkrb5_get_init_creds_password(ctx, + &my_creds, + me, + password, // password + KRB5_prompter, // prompter + hParent, // prompter data + 0, // start time + 0, // service name + &options); + if (code) + goto cleanup; + + code = pkrb5_cc_initialize(ctx, cc, me); + if (code) + goto cleanup; + + code = pkrb5_cc_store_cred(ctx, cc, &my_creds); + if (code) + goto cleanup; + + cleanup: + if ( addrs ) { + for ( i=0;icontents ) + free(addrs[i]->contents); + free(addrs[i]); + } + } + } + if (my_creds.client == me) + my_creds.client = 0; + pkrb5_free_cred_contents(ctx, &my_creds); + if (name) + pkrb5_free_unparsed_name(ctx, name); + if (me) + pkrb5_free_principal(ctx, me); + if (cc && (cc != alt_cc)) + pkrb5_cc_close(ctx, cc); + if (ctx && (ctx != alt_ctx)) + pkrb5_free_context(ctx); + return(code); +} + + +int +KFW_kdestroy(krb5_context alt_ctx, krb5_ccache alt_cc) +{ + krb5_context ctx; + krb5_ccache cc; + krb5_error_code code; + + if (alt_ctx) + { + ctx = alt_ctx; + } + else + { + code = pkrb5_init_context(&ctx); + if (code) goto cleanup; + } + + if ( alt_cc ) { + cc = alt_cc; + } else { + code = pkrb5_cc_default(ctx, &cc); + if (code) goto cleanup; + } + + code = pkrb5_cc_destroy(ctx, cc); + if ( !code ) cc = 0; + + cleanup: + if (cc && (cc != alt_cc)) + pkrb5_cc_close(ctx, cc); + if (ctx && (ctx != alt_ctx)) + pkrb5_free_context(ctx); + + return(code); +} + + +#ifdef USE_MS2MIT +static BOOL +GetSecurityLogonSessionData(PSECURITY_LOGON_SESSION_DATA * ppSessionData) +{ + NTSTATUS Status = 0; + HANDLE TokenHandle; + TOKEN_STATISTICS Stats; + DWORD ReqLen; + BOOL Success; + + if (!ppSessionData) + return FALSE; + *ppSessionData = NULL; + + Success = OpenProcessToken( GetCurrentProcess(), TOKEN_QUERY, &TokenHandle ); + if ( !Success ) + return FALSE; + + Success = GetTokenInformation( TokenHandle, TokenStatistics, &Stats, sizeof(TOKEN_STATISTICS), &ReqLen ); + CloseHandle( TokenHandle ); + if ( !Success ) + return FALSE; + + Status = pLsaGetLogonSessionData( &Stats.AuthenticationId, ppSessionData ); + if ( FAILED(Status) || !ppSessionData ) + return FALSE; + + return TRUE; +} + +// +// MSLSA_IsKerberosLogon() does not validate whether or not there are valid tickets in the +// cache. It validates whether or not it is reasonable to assume that if we +// attempted to retrieve valid tickets we could do so. Microsoft does not +// automatically renew expired tickets. Therefore, the cache could contain +// expired or invalid tickets. Microsoft also caches the user's password +// and will use it to retrieve new TGTs if the cache is empty and tickets +// are requested. + +static BOOL +MSLSA_IsKerberosLogon(VOID) +{ + PSECURITY_LOGON_SESSION_DATA pSessionData = NULL; + BOOL Success = FALSE; + + if ( GetSecurityLogonSessionData(&pSessionData) ) { + if ( pSessionData->AuthenticationPackage.Buffer ) { + WCHAR buffer[256]; + WCHAR *usBuffer; + int usLength; + + Success = FALSE; + usBuffer = (pSessionData->AuthenticationPackage).Buffer; + usLength = (pSessionData->AuthenticationPackage).Length; + if (usLength < 256) + { + lstrcpynW (buffer, usBuffer, usLength); + lstrcatW (buffer,L""); + if ( !lstrcmpW(L"Kerberos",buffer) ) + Success = TRUE; + } + } + pLsaFreeReturnBuffer(pSessionData); + } + return Success; +} +#endif /* USE_MS2MIT */ + +static BOOL CALLBACK +MultiInputDialogProc( HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam) +{ + int i; + + switch ( message ) { + case WM_INITDIALOG: + if ( GetDlgCtrlID((HWND) wParam) != ID_MID_TEXT ) + { + SetFocus(GetDlgItem( hDialog, ID_MID_TEXT)); + return FALSE; + } + for ( i=0; i < mid_cnt ; i++ ) { + if (mid_tb[i].echo == 0) + SendDlgItemMessage(hDialog, ID_MID_TEXT+i, EM_SETPASSWORDCHAR, 32, 0); + else if (mid_tb[i].echo == 2) + SendDlgItemMessage(hDialog, ID_MID_TEXT+i, EM_SETPASSWORDCHAR, '*', 0); + } + return TRUE; + + case WM_COMMAND: + switch ( LOWORD(wParam) ) { + case IDOK: + for ( i=0; i < mid_cnt ; i++ ) { + if ( !GetDlgItemText(hDialog, ID_MID_TEXT+i, mid_tb[i].buf, mid_tb[i].len) ) + *mid_tb[i].buf = '\0'; + } + /* fallthrough */ + case IDCANCEL: + EndDialog(hDialog, LOWORD(wParam)); + return TRUE; + } + } + return FALSE; +} + +static LPWORD +lpwAlign( LPWORD lpIn ) +{ + ULONG ul; + + ul = (ULONG) lpIn; + ul += 3; + ul >>=2; + ul <<=2; + return (LPWORD) ul;; +} + +/* + * dialog widths are measured in 1/4 character widths + * dialog height are measured in 1/8 character heights + */ + +static LRESULT +MultiInputDialog( HINSTANCE hinst, HWND hwndOwner, + char * ptext[], int numlines, int width, + int tb_cnt, struct textField * tb) +{ + HGLOBAL hgbl; + LPDLGTEMPLATE lpdt; + LPDLGITEMTEMPLATE lpdit; + LPWORD lpw; + LPWSTR lpwsz; + LRESULT ret; + int nchar, i, pwid; + + hgbl = GlobalAlloc(GMEM_ZEROINIT, 4096); + if (!hgbl) + return -1; + + mid_cnt = tb_cnt; + mid_tb = tb; + + lpdt = (LPDLGTEMPLATE)GlobalLock(hgbl); + + // Define a dialog box. + + lpdt->style = WS_POPUP | WS_BORDER | WS_SYSMENU + | DS_MODALFRAME | WS_CAPTION | DS_CENTER + | DS_SETFOREGROUND | DS_3DLOOK + | DS_SETFONT | DS_FIXEDSYS | DS_NOFAILCREATE; + lpdt->cdit = numlines + (2 * tb_cnt) + 2; // number of controls + lpdt->x = 10; + lpdt->y = 10; + lpdt->cx = 20 + width * 4; + lpdt->cy = 20 + (numlines + tb_cnt + 4) * 14; + + lpw = (LPWORD) (lpdt + 1); + *lpw++ = 0; // no menu + *lpw++ = 0; // predefined dialog box class (by default) + + lpwsz = (LPWSTR) lpw; + nchar = MultiByteToWideChar (CP_ACP, 0, "", -1, lpwsz, 128); + lpw += nchar; + *lpw++ = 8; // font size (points) + lpwsz = (LPWSTR) lpw; + nchar = MultiByteToWideChar (CP_ACP, 0, "MS Shell Dlg", + -1, lpwsz, 128); + lpw += nchar; + + //----------------------- + // Define an OK button. + //----------------------- + lpw = lpwAlign (lpw); // align DLGITEMTEMPLATE on DWORD boundary + lpdit = (LPDLGITEMTEMPLATE) lpw; + lpdit->style = WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON | WS_TABSTOP | WS_BORDER; + lpdit->dwExtendedStyle = 0; + lpdit->x = (lpdt->cx - 14)/4 - 20; + lpdit->y = 10 + (numlines + tb_cnt + 2) * 14; + lpdit->cx = 40; + lpdit->cy = 14; + lpdit->id = IDOK; // OK button identifier + + lpw = (LPWORD) (lpdit + 1); + *lpw++ = 0xFFFF; + *lpw++ = 0x0080; // button class + + lpwsz = (LPWSTR) lpw; + nchar = MultiByteToWideChar (CP_ACP, 0, "OK", -1, lpwsz, 50); + lpw += nchar; + *lpw++ = 0; // no creation data + + //----------------------- + // Define an Cancel button. + //----------------------- + lpw = lpwAlign (lpw); // align DLGITEMTEMPLATE on DWORD boundary + lpdit = (LPDLGITEMTEMPLATE) lpw; + lpdit->style = WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP | WS_BORDER; + lpdit->dwExtendedStyle = 0; + lpdit->x = (lpdt->cx - 14)*3/4 - 20; + lpdit->y = 10 + (numlines + tb_cnt + 2) * 14; + lpdit->cx = 40; + lpdit->cy = 14; + lpdit->id = IDCANCEL; // CANCEL button identifier + + lpw = (LPWORD) (lpdit + 1); + *lpw++ = 0xFFFF; + *lpw++ = 0x0080; // button class + + lpwsz = (LPWSTR) lpw; + nchar = MultiByteToWideChar (CP_ACP, 0, "Cancel", -1, lpwsz, 50); + lpw += nchar; + *lpw++ = 0; // no creation data + + /* Add controls for preface data */ + for ( i=0; istyle = WS_CHILD | WS_VISIBLE | SS_LEFT; + lpdit->dwExtendedStyle = 0; + lpdit->x = 10; + lpdit->y = 10 + i * 14; + lpdit->cx = strlen(ptext[i]) * 4 + 10; + lpdit->cy = 14; + lpdit->id = ID_TEXT + i; // text identifier + + lpw = (LPWORD) (lpdit + 1); + *lpw++ = 0xFFFF; + *lpw++ = 0x0082; // static class + + lpwsz = (LPWSTR) lpw; + nchar = MultiByteToWideChar (CP_ACP, 0, ptext[i], + -1, lpwsz, 2*width); + lpw += nchar; + *lpw++ = 0; // no creation data + } + + for ( i=0, pwid = 0; istyle = WS_CHILD | WS_VISIBLE | SS_LEFT; + lpdit->dwExtendedStyle = 0; + lpdit->x = 10; + lpdit->y = 10 + (numlines + i + 1) * 14; + lpdit->cx = pwid * 4; + lpdit->cy = 14; + lpdit->id = ID_TEXT + numlines + i; // text identifier + + lpw = (LPWORD) (lpdit + 1); + *lpw++ = 0xFFFF; + *lpw++ = 0x0082; // static class + + lpwsz = (LPWSTR) lpw; + nchar = MultiByteToWideChar (CP_ACP, 0, tb[i].label ? tb[i].label : "", + -1, lpwsz, 128); + lpw += nchar; + *lpw++ = 0; // no creation data + + /*----------------------- + * Define an edit control. + *-----------------------*/ + lpw = lpwAlign (lpw); /* align DLGITEMTEMPLATE on DWORD boundary */ + lpdit = (LPDLGITEMTEMPLATE) lpw; + lpdit->style = WS_CHILD | WS_VISIBLE | ES_LEFT | WS_TABSTOP | WS_BORDER | (tb[i].echo == 1 ? 0L : ES_PASSWORD); + lpdit->dwExtendedStyle = 0; + lpdit->x = 10 + (pwid + 1) * 4; + lpdit->y = 10 + (numlines + i + 1) * 14; + lpdit->cx = (width - (pwid + 1)) * 4; + lpdit->cy = 14; + lpdit->id = ID_MID_TEXT + i; // identifier + + lpw = (LPWORD) (lpdit + 1); + *lpw++ = 0xFFFF; + *lpw++ = 0x0081; // edit class + + lpwsz = (LPWSTR) lpw; + nchar = MultiByteToWideChar (CP_ACP, 0, tb[i].def ? tb[i].def : "", + -1, lpwsz, 128); + lpw += nchar; + *lpw++ = 0; // no creation data + } + + GlobalUnlock(hgbl); + ret = DialogBoxIndirect(hinst, (LPDLGTEMPLATE) hgbl, + hwndOwner, (DLGPROC) MultiInputDialogProc); + GlobalFree(hgbl); + + switch ( ret ) { + case 0: /* Timeout */ + return -1; + case IDOK: + return 1; + case IDCANCEL: + return 0; + default: { + char buf[256]; + sprintf(buf,"DialogBoxIndirect() failed: %d",GetLastError()); + MessageBox(hwndOwner, + buf, + "GetLastError()", + MB_OK | MB_ICONINFORMATION | MB_TASKMODAL); + return -1; + } + } +} + +static int +multi_field_dialog(HWND hParent, char * preface, int n, struct textField tb[]) +{ + HINSTANCE hInst = 0; + int maxwidth = 0; + int numlines = 0; + int len; + char * plines[16], *p = preface ? preface : ""; + int i; + + for ( i=0; i<16; i++ ) + plines[i] = NULL; + + while (*p && numlines < 16) { + plines[numlines++] = p; + for ( ;*p && *p != '\r' && *p != '\n'; p++ ); + if ( *p == '\r' && *(p+1) == '\n' ) { + *p++ = '\0'; + p++; + } else if ( *p == '\n' ) { + *p++ = '\0'; + } + if ( strlen(plines[numlines-1]) > maxwidth ) + maxwidth = strlen(plines[numlines-1]); + } + + for ( i=0;i 40 ? 40 : tb[i].len); + if ( maxwidth < len ) + maxwidth = len; + } + + return(MultiInputDialog(hInst, hParent, plines, numlines, maxwidth, n, tb)); +} + +static krb5_error_code KRB5_CALLCONV +KRB5_prompter( krb5_context context, + void *data, + const char *name, + const char *banner, + int num_prompts, + krb5_prompt prompts[]) +{ + krb5_error_code errcode = 0; + int i; + struct textField * tb = NULL; + int len = 0, blen=0, nlen=0; + HWND hParent = (HWND)data; + + if (name) + nlen = strlen(name)+2; + + if (banner) + blen = strlen(banner)+2; + + tb = (struct textField *) malloc(sizeof(struct textField) * num_prompts); + if ( tb != NULL ) { + int ok; + memset(tb,0,sizeof(struct textField) * num_prompts); + for ( i=0; i < num_prompts; i++ ) { + tb[i].buf = prompts[i].reply->data; + tb[i].len = prompts[i].reply->length; + tb[i].label = prompts[i].prompt; + tb[i].def = NULL; + tb[i].echo = (prompts[i].hidden ? 2 : 1); + } + + ok = multi_field_dialog(hParent,(char *)banner,num_prompts,tb); + if ( ok ) { + for ( i=0; i < num_prompts; i++ ) + prompts[i].reply->length = strlen(prompts[i].reply->data); + } else + errcode = -2; + } + + if ( tb ) + free(tb); + if (errcode) { + for (i = 0; i < num_prompts; i++) { + memset(prompts[i].reply->data, 0, prompts[i].reply->length); + } + } + return errcode; +} + +BOOL +KFW_AFS_wait_for_service_start(void) +{ + char HostName[64]; + DWORD CurrentState; + + CurrentState = SERVICE_START_PENDING; + memset(HostName, '\0', sizeof(HostName)); + gethostname(HostName, sizeof(HostName)); + + while (CurrentState != SERVICE_RUNNING || CurrentState != SERVICE_STOPPED) + { + if (GetServiceStatus(HostName, TRANSARCAFSDAEMON, &CurrentState) != NOERROR) + return(0); + if ( IsDebuggerPresent() ) { + switch ( CurrentState ) { + case SERVICE_STOPPED: + OutputDebugString("SERVICE_STOPPED\n"); + break; + case SERVICE_START_PENDING: + OutputDebugString("SERVICE_START_PENDING\n"); + break; + case SERVICE_STOP_PENDING: + OutputDebugString("SERVICE_STOP_PENDING\n"); + break; + case SERVICE_RUNNING: + OutputDebugString("SERVICE_RUNNING\n"); + break; + case SERVICE_CONTINUE_PENDING: + OutputDebugString("SERVICE_CONTINUE_PENDING\n"); + break; + case SERVICE_PAUSE_PENDING: + OutputDebugString("SERVICE_PAUSE_PENDING\n"); + break; + case SERVICE_PAUSED: + OutputDebugString("SERVICE_PAUSED\n"); + break; + default: + OutputDebugString("UNKNOWN Service State\n"); + } + } + if (CurrentState == SERVICE_STOPPED) + return(0); + if (CurrentState == SERVICE_RUNNING) + return(1); + Sleep(500); + } + return(0); +} + + +int +KFW_AFS_unlog(void) +{ + long rc; + char HostName[64]; + DWORD CurrentState; + + CurrentState = 0; + memset(HostName, '\0', sizeof(HostName)); + gethostname(HostName, sizeof(HostName)); + if (GetServiceStatus(HostName, TRANSARCAFSDAEMON, &CurrentState) != NOERROR) + return(0); + if (CurrentState != SERVICE_RUNNING) + return(0); + + rc = pktc_ForgetAllTokens(); + + return(0); +} + +int +KFW_AFS_klog( + krb5_context alt_ctx, + krb5_ccache alt_cc, + char *service, + char *cell, + char *realm, + int LifeTime + ) +{ + long rc = 0; + CREDENTIALS creds; + KTEXT_ST ticket; + struct ktc_principal aserver; + struct ktc_principal aclient; + char username[BUFSIZ]; /* To hold client username structure */ + char realm_of_user[REALM_SZ]; /* Kerberos realm of user */ + char realm_of_cell[REALM_SZ]; /* Kerberos realm of cell */ + char local_cell[MAXCELLCHARS+1]; + char Dmycell[MAXCELLCHARS+1]; + struct ktc_token atoken; + struct ktc_token btoken; + afsconf_cell ak_cellconfig; /* General information about the cell */ + char RealmName[128]; + char CellName[128]; + char ServiceName[128]; + DWORD CurrentState; + char HostName[64]; + BOOL try_krb5 = 0; + krb5_context ctx = 0; + krb5_ccache cc = 0; + krb5_creds increds; + krb5_creds * k5creds = 0; + krb5_error_code code; + krb5_principal client_principal = 0; + int i, retry = 0; + + CurrentState = 0; + memset(HostName, '\0', sizeof(HostName)); + gethostname(HostName, sizeof(HostName)); + if (GetServiceStatus(HostName, TRANSARCAFSDAEMON, &CurrentState) != NOERROR) { + if ( IsDebuggerPresent() ) + OutputDebugString("Unable to retrieve AFSD Service Status\n"); + return(-1); + } + if (CurrentState != SERVICE_RUNNING) { + if ( IsDebuggerPresent() ) + OutputDebugString("AFSD Service NOT RUNNING\n"); + return(-2); + } + + memset(RealmName, '\0', sizeof(RealmName)); + memset(CellName, '\0', sizeof(CellName)); + memset(ServiceName, '\0', sizeof(ServiceName)); + memset(realm_of_user, '\0', sizeof(realm_of_user)); + memset(realm_of_cell, '\0', sizeof(realm_of_cell)); + if (cell && cell[0]) + strcpy(Dmycell, cell); + else + memset(Dmycell, '\0', sizeof(Dmycell)); + + // NULL or empty cell returns information on local cell + if (rc = get_cellconfig(Dmycell, &ak_cellconfig, local_cell)) + { + KFW_AFS_error(rc, "get_cellconfig()"); + return(rc); + } + + if ( alt_ctx ) { + ctx = alt_ctx; + } else { + code = pkrb5_init_context(&ctx); + if (code) goto cleanup; + } + + if ( alt_cc ) { + cc = alt_cc; + } else { + code = pkrb5_cc_default(ctx, &cc); + if (code) goto skip_krb5_init; + } + + memset((char *)&increds, 0, sizeof(increds)); + + code = pkrb5_cc_get_principal(ctx, cc, &client_principal); + if (code) { + if ( code == KRB5_CC_NOTFOUND && IsDebuggerPresent() ) + { + OutputDebugString("Principal Not Found for ccache\n"); + } + goto skip_krb5_init; + } + i = krb5_princ_realm(ctx, client_principal)->length; + if (i > REALM_SZ-1) + i = REALM_SZ-1; + strncpy(realm_of_user,krb5_princ_realm(ctx, client_principal)->data,i); + realm_of_user[i] = 0; + try_krb5 = 1; + + skip_krb5_init: +#ifdef USE_KRB4 + if ( !try_krb5 || !realm_of_user[0] ) { + if ((rc = (*pkrb_get_tf_realm)((*ptkt_string)(), realm_of_user)) != KSUCCESS) + { + goto cleanup; + } + } +#else + goto cleanup; +#endif + strcpy(realm_of_cell, afs_realm_of_cell(&ak_cellconfig)); + + if (strlen(service) == 0) + strcpy(ServiceName, "afs"); + else + strcpy(ServiceName, service); + + if (strlen(cell) == 0) + strcpy(CellName, local_cell); + else + strcpy(CellName, cell); + + if (strlen(realm) == 0) + strcpy(RealmName, realm_of_cell); + else + strcpy(RealmName, realm); + + memset(&creds, '\0', sizeof(creds)); + + if ( try_krb5 ) { + /* First try service/cell@REALM */ + if (code = pkrb5_build_principal(ctx, &increds.server, + strlen(RealmName), + RealmName, + ServiceName, + CellName, + 0)) + { + goto cleanup; + } + + increds.client = client_principal; + increds.times.endtime = 0; + /* Ask for DES since that is what V4 understands */ + increds.keyblock.enctype = ENCTYPE_DES_CBC_CRC; + + if ( IsDebuggerPresent() ) { + char * cname, *sname; + pkrb5_unparse_name(ctx, increds.client, &cname); + pkrb5_unparse_name(ctx, increds.server, &sname); + OutputDebugString("Getting credentials for \""); + OutputDebugString(cname); + OutputDebugString("\" and service \""); + OutputDebugString(sname); + OutputDebugString("\"\n"); + pkrb5_free_unparsed_name(ctx,cname); + pkrb5_free_unparsed_name(ctx,sname); + } + + code = pkrb5_get_credentials(ctx, 0, cc, &increds, &k5creds); + if (code == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN || + code == KRB5KRB_ERR_GENERIC /* heimdal */) { + /* Or service@REALM */ + pkrb5_free_principal(ctx,increds.server); + increds.server = 0; + code = pkrb5_build_principal(ctx, &increds.server, + strlen(RealmName), + RealmName, + ServiceName, + 0); + + if ( IsDebuggerPresent() ) { + char * cname, *sname; + pkrb5_unparse_name(ctx, increds.client, &cname); + pkrb5_unparse_name(ctx, increds.server, &sname); + OutputDebugString("krb5_get_credentials() returned Service Principal Unknown\n"); + OutputDebugString("Trying again: getting credentials for \""); + OutputDebugString(cname); + OutputDebugString("\" and service \""); + OutputDebugString(sname); + OutputDebugString("\"\n"); + pkrb5_free_unparsed_name(ctx,cname); + pkrb5_free_unparsed_name(ctx,sname); + } + + if (!code) + code = pkrb5_get_credentials(ctx, 0, cc, &increds, &k5creds); + } + + if (code) { + if ( IsDebuggerPresent() ) { + char message[256]; + sprintf(message,"krb5_get_credentials returns: %d\n",code); + OutputDebugString(message); + } + try_krb5 = 0; + goto use_krb4; + } + /* This requires krb524d to be running with the KDC */ + code = pkrb524_convert_creds_kdc(ctx, k5creds, &creds); + pkrb5_free_creds(ctx, k5creds); + if (code) { + if ( IsDebuggerPresent() ) { + char message[256]; + sprintf(message,"krb524_convert_creds_kdc returns: %d\n",code); + OutputDebugString(message); + } + try_krb5 = 0; + goto use_krb4; + } + } else { + use_krb4: +#ifdef USE_KRB4 + rc = (*pkrb_get_cred)(ServiceName, CellName, RealmName, &creds); + if (rc == NO_TKT_FIL) { + // if the problem is that we have no krb4 tickets + // do not attempt to continue + goto cleanup; + } + if (rc != KSUCCESS) + rc = (*pkrb_get_cred)(ServiceName, "", RealmName, &creds); + + if (rc != KSUCCESS) + { + if ((rc = (*pkrb_mk_req)(&ticket, ServiceName, CellName, RealmName, 0)) == KSUCCESS) + { + if ((rc = (*pkrb_get_cred)(ServiceName, CellName, RealmName, &creds)) != KSUCCESS) + { + goto cleanup; + } + } + else if ((rc = (*pkrb_mk_req)(&ticket, ServiceName, "", RealmName, 0)) == KSUCCESS) + { + if ((rc = (*pkrb_get_cred)(ServiceName, "", RealmName, &creds)) != KSUCCESS) + { + goto cleanup; + } + } + else + { + goto cleanup; + } + } +#else + goto cleanup; +#endif + } + + memset(&aserver, '\0', sizeof(aserver)); + strncpy(aserver.name, ServiceName, MAXKTCNAMELEN - 1); + strncpy(aserver.cell, CellName, MAXKTCREALMLEN - 1); + + strcpy(username, creds.pname); + if (creds.pinst[0]) + { + strcat(username, "."); + strcat(username, creds.pinst); + } + + memset(&atoken, '\0', sizeof(atoken)); + atoken.kvno = creds.kvno; + atoken.startTime = creds.issue_date; + atoken.endTime = creds.issue_date + (creds.lifetime * 300); + memcpy(&atoken.sessionKey, creds.session, 8); + atoken.ticketLen = creds.ticket_st.length; + memcpy(atoken.ticket, creds.ticket_st.dat, atoken.ticketLen); + + retry_gettoken: + rc = pktc_GetToken(&aserver, &btoken, sizeof(btoken), &aclient); + if (rc != 0 && rc != KTC_NOENT && rc != KTC_NOCELL) { + if ( rc == KTC_NOCM && retry < 20 ) { + Sleep(500); + retry++; + goto retry_gettoken; + } + KFW_AFS_error(rc, "ktc_GetToken()"); + code = rc; + goto cleanup; + } + + if (atoken.kvno == btoken.kvno && + atoken.ticketLen == btoken.ticketLen && + !memcmp(&atoken.sessionKey, &btoken.sessionKey, sizeof(atoken.sessionKey)) && + !memcmp(atoken.ticket, btoken.ticket, atoken.ticketLen)) + { + goto cleanup; + } + + // * Reset the "aclient" structure before we call ktc_SetToken. + // * This structure was first set by the ktc_GetToken call when + // * we were comparing whether identical tokens already existed. + + strncpy(aclient.name, username, MAXKTCNAMELEN - 1); + strcpy(aclient.instance, ""); + strncpy(aclient.cell, creds.realm, MAXKTCREALMLEN - 1); + + if (rc = pktc_SetToken(&aserver, &atoken, &aclient, 0)) + { + KFW_AFS_error(rc, "ktc_SetToken()"); + code = rc; + goto cleanup; + } + + cleanup: + if (client_principal) + pkrb5_free_principal(ctx,client_principal); + /* increds.client == client_principal */ + if (increds.server) + pkrb5_free_principal(ctx,increds.server); + if (cc && (cc != alt_cc)) + pkrb5_cc_close(ctx, cc); + if (ctx && (ctx != alt_ctx)) + pkrb5_free_context(ctx); + + return(code); +} + +/**************************************/ +/* afs_realm_of_cell(): */ +/**************************************/ +static char * +afs_realm_of_cell(afsconf_cell *cellconfig) +{ + static char krbrlm[REALM_SZ+1]=""; + krb5_context ctx = 0; + char ** realmlist=NULL; + krb5_error_code r; + + if (!cellconfig) + return 0; + + r = pkrb5_init_context(&ctx); + if ( !r ) + r = pkrb5_get_host_realm(ctx, cellconfig->hostName[0], &realmlist); + if ( !r && realmlist && realmlist[0] ) { + strcpy(krbrlm, realmlist[0]); + pkrb5_free_host_realm(ctx, realmlist); + } + if (ctx) + pkrb5_free_context(ctx); + + if ( !krbrlm[0] ) + { + char *s = krbrlm; + char *t = cellconfig->name; + int c; + + while (c = *t++) + { + if (islower(c)) c=toupper(c); + *s++ = c; + } + *s++ = 0; + } + return(krbrlm); +} + +/**************************************/ +/* get_cellconfig(): */ +/**************************************/ +static int +get_cellconfig(char *cell, afsconf_cell *cellconfig, char *local_cell) +{ + int rc; + char newcell[MAXCELLCHARS+1]; + + local_cell[0] = (char)0; + memset(cellconfig, 0, sizeof(*cellconfig)); + + /* WIN32: cm_GetRootCellName(local_cell) - NOTE: no way to get max chars */ + if (rc = pcm_GetRootCellName(local_cell)) + { + return(rc); + } + + if (strlen(cell) == 0) + strcpy(cell, local_cell); + + /* WIN32: cm_SearchCellFile(cell, pcallback, pdata) */ + strcpy(cellconfig->name, cell); + + return pcm_SearchCellFile(cell, newcell, get_cellconfig_callback, (void*)cellconfig); +} + +/**************************************/ +/* get_cellconfig_callback(): */ +/**************************************/ +static long +get_cellconfig_callback(void *cellconfig, struct sockaddr_in *addrp, char *namep) +{ + afsconf_cell *cc = (afsconf_cell *)cellconfig; + + cc->hostAddr[cc->numServers] = *addrp; + strcpy(cc->hostName[cc->numServers], namep); + cc->numServers++; + return(0); +} + + +/**************************************/ +/* KFW_AFS_error(): */ +/**************************************/ +void +KFW_AFS_error(LONG rc, LPCSTR FailedFunctionName) +{ + char message[256]; + const char *errText; + + // Using AFS defines as error messages for now, until Transarc + // gets back to me with "string" translations of each of these + // const. defines. + if (rc == KTC_ERROR) + errText = "KTC_ERROR"; + else if (rc == KTC_TOOBIG) + errText = "KTC_TOOBIG"; + else if (rc == KTC_INVAL) + errText = "KTC_INVAL"; + else if (rc == KTC_NOENT) + errText = "KTC_NOENT"; + else if (rc == KTC_PIOCTLFAIL) + errText = "KTC_PIOCTLFAIL"; + else if (rc == KTC_NOPIOCTL) + errText = "KTC_NOPIOCTL"; + else if (rc == KTC_NOCELL) + errText = "KTC_NOCELL"; + else if (rc == KTC_NOCM) + errText = "KTC_NOCM: The service, Transarc AFS Daemon, most likely is not started!"; + else + errText = "Unknown error!"; + + sprintf(message, "%s\n(%s failed)", errText, FailedFunctionName); + + if ( IsDebuggerPresent() ) { + OutputDebugString(message); + OutputDebugString("\n"); + } + MessageBox(NULL, message, "AFS", MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_SETFOREGROUND); + return; +} + +static DWORD +GetServiceStatus( + LPSTR lpszMachineName, + LPSTR lpszServiceName, + DWORD *lpdwCurrentState) +{ + DWORD hr = NOERROR; + SC_HANDLE schSCManager = NULL; + SC_HANDLE schService = NULL; + DWORD fdwDesiredAccess = 0; + SERVICE_STATUS ssServiceStatus = {0}; + BOOL fRet = FALSE; + + *lpdwCurrentState = 0; + + fdwDesiredAccess = GENERIC_READ; + + schSCManager = OpenSCManager(lpszMachineName, + NULL, + fdwDesiredAccess); + + if(schSCManager == NULL) + { + hr = GetLastError(); + goto cleanup; + } + + schService = OpenService(schSCManager, + lpszServiceName, + fdwDesiredAccess); + + if(schService == NULL) + { + hr = GetLastError(); + goto cleanup; + } + + fRet = QueryServiceStatus(schService, + &ssServiceStatus); + + if(fRet == FALSE) + { + hr = GetLastError(); + goto cleanup; + } + + *lpdwCurrentState = ssServiceStatus.dwCurrentState; + +cleanup: + + CloseServiceHandle(schService); + CloseServiceHandle(schSCManager); + + return(hr); +} + +void +UnloadFuncs( + FUNC_INFO fi[], + HINSTANCE h + ) +{ + int n; + if (fi) + for (n = 0; fi[n].func_ptr_var; n++) + *(fi[n].func_ptr_var) = 0; + if (h) FreeLibrary(h); +} + +int +LoadFuncs( + const char* dll_name, + FUNC_INFO fi[], + HINSTANCE* ph, // [out, optional] - DLL handle + int* pindex, // [out, optional] - index of last func loaded (-1 if none) + int cleanup, // cleanup function pointers and unload on error + int go_on, // continue loading even if some functions cannot be loaded + int silent // do not pop-up a system dialog if DLL cannot be loaded + ) +{ + HINSTANCE h; + int i, n, last_i; + int error = 0; + UINT em; + + if (ph) *ph = 0; + if (pindex) *pindex = -1; + + for (n = 0; fi[n].func_ptr_var; n++) + *(fi[n].func_ptr_var) = 0; + + if (silent) + em = SetErrorMode(SEM_FAILCRITICALERRORS); + h = LoadLibrary(dll_name); + if (silent) + SetErrorMode(em); + + if (!h) + return 0; + + last_i = -1; + for (i = 0; (go_on || !error) && (i < n); i++) + { + void* p = (void*)GetProcAddress(h, fi[i].func_name); + if (!p) + error = 1; + else + { + last_i = i; + *(fi[i].func_ptr_var) = p; + } + } + if (pindex) *pindex = last_i; + if (error && cleanup && !go_on) { + for (i = 0; i < n; i++) { + *(fi[i].func_ptr_var) = 0; + } + FreeLibrary(h); + return 0; + } + if (ph) *ph = h; + if (error) return 0; + return 1; +} + +#ifdef USE_FSPROBE +// Cell Accessibility Functions +// based on work originally submitted to the CMU Computer Club +// by Jeffrey Hutzelman +// +// These would work great if the fsProbe interface had been +// ported to Windows + +static +void probeComplete() +{ + fsprobe_Cleanup(1); + rx_Finalize(); +} + +struct ping_params { + unsigned short port; // in + int retry_delay; // in seconds + int verbose; // in + struct { + int wait; // in seconds + int retry; // in attempts + } host; + int max_hosts; // in + int hosts_attempted; // out +} + +// the fsHandler is where we receive the answer to the probe +static +int fsHandler(void) +{ + ping_count = fsprobe_Results.probeNum; + if (!*fsprobe_Results.probeOK) + { + ok_count++; + if (waiting) complete(); + } + if (ping_count == retry) + complete(); + return 0; +} + +// ping_fs is a callback routine meant to be called from within +// cm_SearchCellFile() or cm_SearchCellDNS() +static long +pingFS(void *ping_params, struct sockaddr_in *addrp, char *namep) +{ + int rc; + struct ping_params * pp = (struct ping_params *) ping_params; + + if ( pp->max_hosts && pp->hosts_attempted >= pp->max_hosts ) + return 0; + + pp->hosts_attempted++; + + if (pp->port && addrp->sin_port != htons(pp->port)) + addrp->sin_port = htons(pp->port); + + rc = fsprobe_Init(1, addrp, pp->retry_delay, fsHandler, pp->verbose); + if (rc) + { + fprintf(stderr, "fsprobe_Init failed (%d)\n", rc); + fsprobe_Cleanup(1); + return 0; + } + + for (;;) + { + tv.tv_sec = pp->host.wait; + tv.tv_usec = 0; + if (IOMGR_Select(0, 0, 0, 0, &tv)) + break; + } + probeComplete(); + return(0); +} + + +static BOOL +pingCell(char *cell) +{ + int rc; + char rootcell[MAXCELLCHARS+1]; + char newcell[MAXCELLCHARS+1]; + struct ping_params pp; + + memset(&pp, 0, sizeof(struct ping_params)); + + if (!cell || strlen(cell) == 0) { + /* WIN32 NOTE: no way to get max chars */ + if (rc = pcm_GetRootCellName(rootcell)) + return(FALSE); + cell = rootcell; + } + + pp.port = 7000; // AFS FileServer + pp.retry_delay = 10; + pp.max_hosts = 3; + pp.host.wait = 30; + pp.host.retry = 0; + pp.verbose = 1; + + /* WIN32: cm_SearchCellFile(cell, pcallback, pdata) */ + rc = pcm_SearchCellFile(cell, newcell, pingFS, (void *)&pp); +} +#endif /* USE_FSPROBE */ + +// These two items are imported from afscreds.h +// but it cannot be included without causing conflicts +#define c100ns1SECOND (LONGLONG)10000000 +static void +TimeToSystemTime (SYSTEMTIME *pst, time_t TimeT) +{ + struct tm *pTime; + memset (pst, 0x00, sizeof(SYSTEMTIME)); + + if ((pTime = localtime (&TimeT)) != NULL) + { + pst->wYear = pTime->tm_year + 1900; + pst->wMonth = pTime->tm_mon + 1; + pst->wDayOfWeek = pTime->tm_wday; + pst->wDay = pTime->tm_mday; + pst->wHour = pTime->tm_hour; + pst->wMinute = pTime->tm_min; + pst->wSecond = pTime->tm_sec; + pst->wMilliseconds = 0; + } +} + +void +ObtainTokensFromUserIfNeeded(HWND hWnd) +{ + char * rootcell = NULL; + char cell[MAXCELLCHARS+1] = ""; + char password[PROBE_PASSWORD_LEN+1]; + krb5_data pwdata; + afsconf_cell cellconfig; + struct ktc_principal aserver; + struct ktc_principal aclient; + struct ktc_token atoken; + krb5_context ctx; + krb5_timestamp now = 0; + krb5_error_code code; + int serverReachable = 0; + int rc; +#ifndef USE_FSPROBE + krb5_ccache cc = 0; + const char * realm = 0; + krb5_principal principal = 0; + char * pname = 0; +#endif /* USE_FSPROBE */ + DWORD CurrentState; + char HostName[64]; + + CurrentState = 0; + memset(HostName, '\0', sizeof(HostName)); + gethostname(HostName, sizeof(HostName)); + if (GetServiceStatus(HostName, TRANSARCAFSDAEMON, &CurrentState) != NOERROR) + return; + if (CurrentState != SERVICE_RUNNING) { + SendMessage(hWnd, WM_START_SERVICE, FALSE, 0L); + return; + } + + if ( KFW_is_available() ) { + code = pkrb5_init_context(&ctx); + if ( code ) goto cleanup; + } + + rootcell = (char *)GlobalAlloc(GPTR,MAXCELLCHARS+1); + if ( !rootcell ) goto cleanup; + + code = get_cellconfig(cell, (void*)&cellconfig, rootcell); + if ( code ) goto cleanup; + + memset(&aserver, '\0', sizeof(aserver)); + strcpy(aserver.name, "afs"); + strcpy(aserver.cell, rootcell); + + rc = pktc_GetToken(&aserver, &atoken, sizeof(atoken), &aclient); + + if ( KFW_is_available() ) { + code = pkrb5_timeofday(ctx, &now); + if ( code ) + now = 0; + + if (!rc && (now < atoken.endTime)) + goto cleanup; + } else { + SYSTEMTIME stNow; + FILETIME ftNow; + FILETIME ftExpires; + LONGLONG llNow; + LONGLONG llExpires; + SYSTEMTIME stExpires; + + TimeToSystemTime (&stExpires, atoken.endTime); + GetLocalTime (&stNow); + SystemTimeToFileTime (&stNow, &ftNow); + SystemTimeToFileTime (&stExpires, &ftExpires); + + llNow = (((LONGLONG)ftNow.dwHighDateTime) << 32) + (LONGLONG)(ftNow.dwLowDateTime); + llExpires = (((LONGLONG)ftExpires.dwHighDateTime) << 32) + (LONGLONG)(ftExpires.dwLowDateTime); + + llNow /= c100ns1SECOND; + llExpires /= c100ns1SECOND; + + if (!rc && (llNow < llExpires)) + goto cleanup; + } + + +#ifdef USE_FSPROBE + serverReachable = cellPing(NULL); +#else + if ( KFW_is_available() ) { + // If we can't use the FSProbe interface we can attempt to forge + // a kinit and if we can back an invalid user error we know the + // kdc is at least reachable + realm = afs_realm_of_cell(&cellconfig); // do not free + + code = pkrb5_build_principal(ctx, &principal, strlen(realm), + realm, PROBE_USERNAME, NULL, NULL); + if ( code ) goto cleanup; + + code = KFW_get_ccache(ctx, principal, &cc); + if ( code ) goto cleanup; + + code = pkrb5_unparse_name(ctx, principal, &pname); + if ( code ) goto cleanup; + + pwdata.data = password; + pwdata.length = PROBE_PASSWORD_LEN; + code = pkrb5_c_random_make_octets(ctx, &pwdata); + if (code) { + int i; + for ( i=0 ; i + +DWORD +GetNumOfIpAddrs(void) +{ + PMIB_IPADDRTABLE pIpAddrTable = NULL; + ULONG dwSize; + DWORD code; + DWORD index; + DWORD validAddrs = 0; + + dwSize = 0; + code = GetIpAddrTable(NULL, &dwSize, 0); + if (code == ERROR_INSUFFICIENT_BUFFER) { + pIpAddrTable = malloc(dwSize); + code = GetIpAddrTable(pIpAddrTable, &dwSize, 0); + for ( index=0; index < pIpAddrTable->dwNumEntries; index++ ) { + if (pIpAddrTable->table[index].dwAddr != 0) + validAddrs++; + } + free(pIpAddrTable); + } + return validAddrs; +} + +void +IpAddrChangeMonitor(void * hWnd) +{ +#ifdef USE_OVERLAPPED + HANDLE Handle = INVALID_HANDLE_VALUE; + OVERLAPPED Ovlap; +#endif /* USE_OVERLAPPED */ + DWORD Result; + DWORD prevNumOfAddrs = GetNumOfIpAddrs(); + DWORD NumOfAddrs; + + if ( !hWnd ) + return; + + while ( TRUE ) { +#ifdef USE_OVERLAPPED + ZeroMemory(&Ovlap, sizeof(OVERLAPPED)); + + Result = NotifyAddrChange(&Handle,&Ovlap); + if (Result != ERROR_IO_PENDING) + { + printf("NotifyAddrChange() failed with error %d \n", Result); + break; + } + + if ((Result = WaitForSingleObject(Handle,INFINITE)) == WAIT_FAILED) + { + printf("WaitForSingleObject() failed with error %d\n", + GetLastError()); + continue; + } + + if (GetOverlappedResult(Handle, &Ovlap, + &DataTransfered, TRUE) == 0) + { + printf("GetOverlapped result failed %d \n", + GetLastError()); + break; + } + +#else + Result = NotifyAddrChange(NULL,NULL); +#endif + + NumOfAddrs = GetNumOfIpAddrs(); + if ( NumOfAddrs != prevNumOfAddrs ) { + // Give AFS Client Service a chance to notice and die + // Or for network services to startup + Sleep(2000); + // this call should probably be mutex protected + ObtainTokensFromUserIfNeeded(hWnd); + } + prevNumOfAddrs = NumOfAddrs; + } + +#ifdef USE_OVERLAPPED + if (Handle != INVALID_HANDLE_VALUE) + CloseHandle(Handle); +#endif +} + + +DWORD +IpAddrChangeMonitorInit(HWND hWnd) +{ + DWORD status = ERROR_SUCCESS; + HANDLE thread; + ULONG threadID = 0; + + thread = CreateThread(NULL, 0, (PTHREAD_START_ROUTINE)IpAddrChangeMonitor, + hWnd, 0, &threadID); + + if (thread == NULL) { + status = GetLastError(); + } + CloseHandle(thread); + return status; +} + diff --git a/src/WINNT/client_creds/afskfw.h b/src/WINNT/client_creds/afskfw.h new file mode 100644 index 000000000..8051e6425 --- /dev/null +++ b/src/WINNT/client_creds/afskfw.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2003 SkyRope, LLC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of Skyrope, LLC nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission from Skyrope, LLC. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef AFSKFW_H +#define AFSKFW_H +#ifdef __cplusplus +extern "C" { +#endif +void KFW_initialize(void); +void KFW_cleanup(void); +int KFW_is_available(void); +int KFW_AFS_destroy_tickets_for_cell(char *); +int KFW_AFS_renew_expiring_credentials(void); +int KFW_AFS_get_cred( char * username, + char * instance, + char * cell, + char * password, + int lifetime, + char ** reasonP ); +int KFW_AFS_renew_token_for_cell(char * cell); +int KFW_AFS_renew_tokens_for_all_cells(void); +BOOL KFW_AFS_wait_for_service_start(void); + +#define WM_OBTAIN_TOKENS (WM_USER+77) +#define WM_START_SERVICE (WM_USER+78) +void ObtainTokensFromUserIfNeeded(HWND hWnd); +DWORD IpAddrChangeMonitorInit(HWND hWnd); + +#ifdef __cplusplus +} +#endif +#endif /* AFSKFW_H */ diff --git a/src/WINNT/client_creds/creds.cpp b/src/WINNT/client_creds/creds.cpp index 994b73c8f..ac8a218da 100644 --- a/src/WINNT/client_creds/creds.cpp +++ b/src/WINNT/client_creds/creds.cpp @@ -8,6 +8,7 @@ */ #include "afscreds.h" +#include "afskfw.h" extern "C" { #include @@ -354,6 +355,8 @@ int DestroyCurrentCredentials (LPCTSTR pszCell) CopyStringToAnsi (Principal.cell, pszCell); CopyStringToAnsi (Principal.name, TEXT("afs")); rc = ktc_ForgetToken (&Principal); + if ( KFW_is_available() ) + KFW_AFS_destroy_tickets_for_cell(Principal.cell); } if (rc != 0) @@ -389,7 +392,10 @@ int ObtainNewCredentials (LPCTSTR pszCell, LPCTSTR pszUser, LPCTSTR pszPassword) int Expiration = 0; - rc = ka_UserAuthenticateGeneral(KA_USERAUTH_VERSION, szNameA, "", szCellA, szPasswordA, 0, &Expiration, 0, &Result); + if ( KFW_is_available() ) + rc = KFW_AFS_get_cred(szNameA, NULL, szCellA, szPasswordA, 0, &Result); + else + rc = ka_UserAuthenticateGeneral(KA_USERAUTH_VERSION, szNameA, "", szCellA, szPasswordA, 0, &Expiration, 0, &Result); } if (rc != 0) diff --git a/src/WINNT/client_creds/main.cpp b/src/WINNT/client_creds/main.cpp index f2b96187f..81ad80b0e 100644 --- a/src/WINNT/client_creds/main.cpp +++ b/src/WINNT/client_creds/main.cpp @@ -20,6 +20,7 @@ extern "C" { #include #include #include "rxkad.h" +#include "afskfw.h" /* * DEFINITIONS ________________________________________________________________ @@ -44,6 +45,7 @@ GLOBALS g; BOOL InitApp (LPSTR pszCmdLineA); void ExitApp (void); +void Quit (void); void PumpMessage (MSG *pmsg); BOOL IsServerInstalled (void); @@ -87,6 +89,9 @@ BOOL InitApp (LPSTR pszCmdLineA) BOOL fExit = FALSE; BOOL fInstall = FALSE; BOOL fUninstall = FALSE; + BOOL fAutoInit = FALSE; + BOOL fNetDetect = FALSE; + BOOL fRenewMaps = FALSE; // Parse the command-line // @@ -97,6 +102,18 @@ BOOL InitApp (LPSTR pszCmdLineA) switch (*(++pszCmdLineA)) { + case 'a': + case 'A': + fAutoInit = TRUE; + break; + case 'm': + case 'M': + fRenewMaps = TRUE; + break; + case 'n': + case 'N': + fNetDetect = TRUE; + break; case 's': case 'S': fShow = TRUE; @@ -218,6 +235,8 @@ BOOL InitApp (LPSTR pszCmdLineA) lock_InitializeMutex(&g.expirationCheckLock, "expiration check lock"); lock_InitializeMutex(&g.credsLock, "global creds lock"); + KFW_AFS_wait_for_service_start(); + if ( IsDebuggerPresent() ) { if ( !g.fIsWinNT ) OutputDebugString("No Service Present on non-NT systems\n"); @@ -228,10 +247,43 @@ BOOL InitApp (LPSTR pszCmdLineA) OutputDebugString("AFSD Service stopped\n"); if ( !IsServiceConfigured() ) OutputDebugString("AFSD Service not configured\n"); + else if ( fAutoInit ) + OutputDebugString("AFSD Service will be started\n"); } } } + // If the service isn't started yet, and autoInit start the service + if ( g.fIsWinNT && !IsServiceRunning() && IsServiceConfigured() && fAutoInit ) { + SC_HANDLE hManager; + + if ((hManager = OpenSCManager( NULL, NULL, + SC_MANAGER_CONNECT | + SC_MANAGER_ENUMERATE_SERVICE | + SC_MANAGER_QUERY_LOCK_STATUS)) != NULL ) + { + SC_HANDLE hService; + if ((hService = OpenService( hManager, TEXT("TransarcAFSDaemon"), + SERVICE_CHANGE_CONFIG | SERVICE_QUERY_CONFIG | + SERVICE_QUERY_STATUS) ) != NULL) + { + if (StartService(hService, 0, 0)) { + if ( IsDebuggerPresent() ) + OutputDebugString("AFSD Service start successful\n"); + fRenewMaps = TRUE; + } else if ( IsDebuggerPresent() ) + OutputDebugString("AFSD Service start failed\n"); + + CloseServiceHandle (hService); + } + + CloseServiceHandle (hManager); + } + KFW_AFS_wait_for_service_start(); + } + + KFW_initialize(); + // Create a main window. All further initialization will be done during // processing of WM_INITDIALOG. // @@ -260,20 +312,43 @@ BOOL InitApp (LPSTR pszCmdLineA) Message (MB_ICONHAND, IDS_UNCONFIG_TITLE, IDS_UNCONFIG_DESC); } if (IsServiceRunning()) { + if ( fRenewMaps ) + { + if ( IsDebuggerPresent() ) + OutputDebugString("Renewing Drive Maps\n"); + TestAndDoMapShare(SERVICE_START_PENDING); + TestAndDoMapShare(SERVICE_RUNNING); + } if (fShow) { if ( IsDebuggerPresent() ) OutputDebugString("Displaying Main window\n"); Main_Show (TRUE); } + // If the root cell is reachable and we have no tokens + // display the Obtain Tokens dialog to the user + if ( fAutoInit ) { + if ( IsDebuggerPresent() ) + OutputDebugString("Obtaining Tokens (if needed)\n"); + ObtainTokensFromUserIfNeeded(g.hMain); + } } else if ( IsDebuggerPresent() ) - OutputDebugString("Displaying Main window\n"); + OutputDebugString("AFSD Service Stopped\n"); + + if ( fNetDetect ) { + // Start IP Address Change Monitor + if ( IsDebuggerPresent() ) + OutputDebugString("Activating Network Change Monitor\n"); + IpAddrChangeMonitorInit(g.hMain); + } + Main_EnableRemindTimer(TRUE); return TRUE; } void ExitApp (void) { + KFW_cleanup(); g.hMain = NULL; } diff --git a/src/WINNT/client_creds/mounttab.cpp b/src/WINNT/client_creds/mounttab.cpp index b583ba4b3..fde31de52 100644 --- a/src/WINNT/client_creds/mounttab.cpp +++ b/src/WINNT/client_creds/mounttab.cpp @@ -197,6 +197,7 @@ void Mount_OnCheck (HWND hDlg) } } + WriteActiveMap(List.aDriveMap[ iDriveSel ].chDrive, fChecked && List.aDriveMap[ iDriveSel ].fPersistent ); FreeDriveMapList (&List); } @@ -456,13 +457,14 @@ void Mapping_OnOK (HWND hDlg) return; } - if ( (lstrncmpi (pMap->szMapping, cm_slash_mount_root, lstrlen(cm_slash_mount_root))) && /*TEXT("/afs")*/ - (lstrncmpi (pMap->szMapping, cm_back_slash_mount_root, lstrlen(cm_back_slash_mount_root))) ) /*TEXT("\\afs")*/ - { - Message (MB_ICONHAND, IDS_BADMAP_TITLE, IDS_BADMAP_DESC); - return; - } + if ( (lstrncmpi (pMap->szMapping, cm_slash_mount_root, lstrlen(cm_slash_mount_root))) && /*TEXT("/afs")*/ + (lstrncmpi (pMap->szMapping, cm_back_slash_mount_root, lstrlen(cm_back_slash_mount_root))) ) /*TEXT("\\afs")*/ + { + Message (MB_ICONHAND, IDS_BADMAP_TITLE, IDS_BADMAP_DESC); + return; + } + WriteActiveMap(pMap->chDrive, pMap->fPersistent); EndDialog (hDlg, IDOK); } diff --git a/src/WINNT/client_creds/shortcut.cpp b/src/WINNT/client_creds/shortcut.cpp index bbb1a64fd..811c901df 100644 --- a/src/WINNT/client_creds/shortcut.cpp +++ b/src/WINNT/client_creds/shortcut.cpp @@ -21,6 +21,7 @@ extern "C" { #include #include #include +#include "afscreds.h" #include "shortcut.h" @@ -110,7 +111,7 @@ void Shortcut_FixStartup (LPCTSTR pszLinkName, BOOL fAutoStart) if (fAutoStart) { - Shortcut_Create (szShortcut, szSource, "Autostart Authentication Agent"); + Shortcut_Create (szShortcut, szSource, "Autostart Authentication Agent", AFSCREDS_SHORTCUT_OPTIONS); } else // (!g.fAutoStart) { diff --git a/src/WINNT/client_creds/window.cpp b/src/WINNT/client_creds/window.cpp index e1341ee6c..c42e56e68 100644 --- a/src/WINNT/client_creds/window.cpp +++ b/src/WINNT/client_creds/window.cpp @@ -13,6 +13,7 @@ extern "C" { } #include "afscreds.h" +#include "afskfw.h" /* @@ -184,6 +185,42 @@ BOOL CALLBACK Main_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp) break; } break; + case WM_OBTAIN_TOKENS: + if ( InterlockedIncrement (&g.fShowingMessage) != 1 ) + InterlockedDecrement (&g.fShowingMessage); + else + ShowObtainCreds (wp, (char *)lp); + GlobalFree((void *)lp); + break; + + case WM_START_SERVICE: + { + SC_HANDLE hManager; + if ((hManager = OpenSCManager ( NULL, NULL, + SC_MANAGER_CONNECT | + SC_MANAGER_ENUMERATE_SERVICE | + SC_MANAGER_QUERY_LOCK_STATUS)) != NULL) + { + SC_HANDLE hService; + if ((hService = OpenService ( hManager, TEXT("TransarcAFSDaemon"), + SERVICE_CHANGE_CONFIG | SERVICE_QUERY_CONFIG | + SERVICE_QUERY_STATUS)) != NULL) + { + if (StartService (hService, 0, 0)) + TestAndDoMapShare(SERVICE_START_PENDING); + if ( KFW_is_available() && KFW_AFS_wait_for_service_start() ) { + KFW_AFS_renew_tokens_for_all_cells(); + } + + CloseServiceHandle (hService); + } + + CloseServiceHandle (hManager); + } + KFW_AFS_wait_for_service_start(); + ObtainTokensFromUserIfNeeded(g.hMain); + } + break; } return FALSE; @@ -562,6 +599,8 @@ size_t Main_FindExpiredCreds (void) { size_t retval = (size_t) -1; lock_ObtainMutex(&g.expirationCheckLock); + if ( KFW_is_available() ) + KFW_AFS_renew_expiring_credentials(); lock_ObtainMutex(&g.credsLock); for (size_t iCreds = 0; iCreds < g.cCreds; ++iCreds) { @@ -586,8 +625,13 @@ size_t Main_FindExpiredCreds (void) llExpires /= c100ns1SECOND; if (llExpires <= (llNow + (LONGLONG)cminREMIND_WARN * csec1MINUTE)) + { + if ( KFW_is_available() && + KFW_AFS_renew_token_for_cell(g.aCreds[ iCreds ].szCell) ) + continue; retval = (size_t) iCreds; break; + } } lock_ReleaseMutex(&g.credsLock); diff --git a/src/WINNT/client_exp/gui2fs.cpp b/src/WINNT/client_exp/gui2fs.cpp index 3769ca1e3..7880d5796 100644 --- a/src/WINNT/client_exp/gui2fs.cpp +++ b/src/WINNT/client_exp/gui2fs.cpp @@ -1579,10 +1579,9 @@ BOOL IsPathInAfs(const CHAR *strPath) blob.out_size = MAXSIZE; blob.out = space; - code = pioctl(PCCHAR(strPath), VIOC_FILE_CELL_NAME, &blob, 1); - if (code) { - if ((errno == EINVAL) || (errno == ENOENT)) return FALSE; - } + code = pioctl((LPTSTR)((LPCTSTR)strPath), VIOC_FILE_CELL_NAME, &blob, 1); + if (code) + return FALSE; return TRUE; } diff --git a/src/WINNT/client_exp/partition_info_dlg.cpp b/src/WINNT/client_exp/partition_info_dlg.cpp index 8b365e50e..839b3bd13 100644 --- a/src/WINNT/client_exp/partition_info_dlg.cpp +++ b/src/WINNT/client_exp/partition_info_dlg.cpp @@ -59,9 +59,11 @@ END_MESSAGE_MAP() BOOL CPartitionInfoDlg::OnInitDialog() { + double percentUsed; // because partition sizes are big + CDialog::OnInitDialog(); - ASSERT(m_nFree != 0); + ASSERT(m_nSize != 0); CString strSize; strSize.Format("%ld", m_nSize); @@ -74,7 +76,8 @@ BOOL CPartitionInfoDlg::OnInitDialog() m_Size.SetWindowText(strSize); m_Free.SetWindowText(strFree); - m_PercentUsed.SetWindowText(strPerUsed); + percentUsed = ( double(m_nSize - m_nFree) * 100.0l ) / double(m_nSize); + strPerUsed.Format("%2.2lf", percentUsed ); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE diff --git a/src/WINNT/client_exp/shell_ext.cpp b/src/WINNT/client_exp/shell_ext.cpp index 15ecd8afc..832e26a71 100644 --- a/src/WINNT/client_exp/shell_ext.cpp +++ b/src/WINNT/client_exp/shell_ext.cpp @@ -173,7 +173,7 @@ STDMETHODIMP CShellExt::XMenuExt::QueryContextMenu(HMENU hMenu,UINT indexMenu, // Don't add any menu items if we're being asked to deal with this file as a shortcut. if (uFlags & CMF_VERBSONLY) - return ResultFromScode(MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_NULL, (USHORT)0)); + return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, (USHORT)0); // Check to see if there's already an AFS menu here; if so, remove it int nItemsNow = GetMenuItemCount (hMenu); @@ -263,8 +263,8 @@ STDMETHODIMP CShellExt::XMenuExt::QueryContextMenu(HMENU hMenu,UINT indexMenu, // Add a separator after us ::InsertMenu (hMenu, indexMenu + indexShellMenu++, MF_STRING | MF_BYPOSITION | MF_SEPARATOR, 0, TEXT("")); - return ResultFromScode(MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_NULL, - (USHORT)indexAfsMenu + indexVolPartMenu + indexMountPointMenu + indexShellMenu + indexSymbolicMenu)); + return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, + (USHORT)indexAfsMenu + indexVolPartMenu + indexMountPointMenu + indexShellMenu + indexSymbolicMenu); } STDMETHODIMP CShellExt::XMenuExt::InvokeCommand(LPCMINVOKECOMMANDINFO lpici) @@ -523,8 +523,9 @@ STDMETHODIMP CShellExt::XShellInit::Initialize(LPCITEMIDLIST pidlFolder, IDataOb // Use the given IDataObject to get a list of filenames (CF_HDROP) hres = pdobj->GetData(&fmte, &medium); - if (FAILED(hres)) + if (FAILED(hres)) { return E_FAIL; + } int nNumFiles = DragQueryFile((HDROP)medium.hGlobal, 0xFFFFFFFF, NULL, 0); if (nNumFiles == 0) @@ -561,7 +562,7 @@ STDMETHODIMP CShellExt::XShellInit::Initialize(LPCITEMIDLIST pidlFolder, IDataOb } if (pThis->m_astrFileNames.GetSize() > 0) - hres = S_OK; + hres = NOERROR; else hres = E_FAIL; } diff --git a/src/WINNT/client_exp/shell_ext.h b/src/WINNT/client_exp/shell_ext.h index e357f80fb..9265644a7 100644 --- a/src/WINNT/client_exp/shell_ext.h +++ b/src/WINNT/client_exp/shell_ext.h @@ -87,7 +87,7 @@ protected: // IShellExtInit interface BEGIN_INTERFACE_PART(ShellInit, IShellExtInit) - STDMETHOD(Initialize)(LPCITEMIDLIST pidlFolder,LPDATAOBJECT lpdobj, HKEY hkeyProgID); + STDMETHOD(Initialize)(LPCITEMIDLIST pidlFolder,IDataObject *lpdobj, HKEY hkeyProgID); END_INTERFACE_PART(ShellInit) BEGIN_INTERFACE_PART(IconExt, IShellIconOverlayIdentifier) diff --git a/src/WINNT/client_osi/NTMakefile b/src/WINNT/client_osi/NTMakefile index 2eb25fedb..631b00657 100644 --- a/src/WINNT/client_osi/NTMakefile +++ b/src/WINNT/client_osi/NTMakefile @@ -34,7 +34,8 @@ INCFILES =\ !IFDEF OSIEVENT $(INCFILEDIR)\osievent.h \ !ENDIF - $(INCFILEDIR)\osithrdnt.h + $(INCFILEDIR)\osithrdnt.h \ + $(INCFILEDIR)\largeint.h $(INCFILEDIR)\dbrpc.h: dbrpc.h diff --git a/src/WINNT/client_osi/largeint.h b/src/WINNT/client_osi/largeint.h new file mode 100644 index 000000000..393b69bcd --- /dev/null +++ b/src/WINNT/client_osi/largeint.h @@ -0,0 +1,257 @@ +/*-- + +Module Name: + + largeint.h + +Abstract: + + Include file for sample Large Integer Arithmetic routines. + This file includes all of the prototypes for the routines found in + largeint.lib. For complete descriptions of these functions, see the + largeint.s source file for MIPS, or the divlarge.c and largeint.asm + source files for x86. + +Revision History: + +--*/ + +#ifdef __cplusplus +extern "C" { +#endif + +// +//Large integer arithmetic routines. +// + +// +// Large integer add - 64-bits + 64-bits -> 64-bits +// + +LARGE_INTEGER +WINAPI +LargeIntegerAdd ( + LARGE_INTEGER Addend1, + LARGE_INTEGER Addend2 + ); + +// +// Enlarged integer multiply - 32-bits * 32-bits -> 64-bits +// + +LARGE_INTEGER +WINAPI +EnlargedIntegerMultiply ( + LONG Multiplicand, + LONG Multiplier + ); + +// +// Unsigned enlarged integer multiply - 32-bits * 32-bits -> 64-bits +// + +LARGE_INTEGER +WINAPI +EnlargedUnsignedMultiply ( + ULONG Multiplicand, + ULONG Multiplier + ); + +// +// Enlarged integer divide - 64-bits / 32-bits > 32-bits +// + +ULONG +WINAPI +EnlargedUnsignedDivide ( + IN ULARGE_INTEGER Dividend, + IN ULONG Divisor, + IN PULONG Remainder + ); + +// +// Extended large integer magic divide - 64-bits / 32-bits -> 64-bits +// + +LARGE_INTEGER +WINAPI +ExtendedMagicDivide ( + LARGE_INTEGER Dividend, + LARGE_INTEGER MagicDivisor, + CCHAR ShiftCount + ); + +// +// Large Integer divide - 64-bits / 32-bits -> 64-bits +// + +LARGE_INTEGER +WINAPI +ExtendedLargeIntegerDivide ( + LARGE_INTEGER Dividend, + ULONG Divisor, + PULONG Remainder + ); + +// +// Large Integer divide - 64-bits / 32-bits -> 64-bits +// + +LARGE_INTEGER +WINAPI +LargeIntegerDivide ( + LARGE_INTEGER Dividend, + LARGE_INTEGER Divisor, + PLARGE_INTEGER Remainder + ); + +// +// Extended integer multiply - 32-bits * 64-bits -> 64-bits +// + +LARGE_INTEGER +WINAPI +ExtendedIntegerMultiply ( + LARGE_INTEGER Multiplicand, + LONG Multiplier + ); + +// +// Large integer negation - -(64-bits) +// + +LARGE_INTEGER +WINAPI +LargeIntegerNegate ( + LARGE_INTEGER Subtrahend + ); + +// +// Large integer subtract - 64-bits - 64-bits -> 64-bits. +// + +LARGE_INTEGER +WINAPI +LargeIntegerSubtract ( + LARGE_INTEGER Minuend, + LARGE_INTEGER Subtrahend + ); + +// +// Large integer and - 64-bite & 64-bits -> 64-bits. +// + +#define LargeIntegerAnd(Result, Source, Mask) \ + { \ + Result.HighPart = Source.HighPart & Mask.HighPart; \ + Result.LowPart = Source.LowPart & Mask.LowPart; \ + } + + +// +// Large integer conversion routines. +// + +// +// Convert signed integer to large integer. +// + +LARGE_INTEGER +WINAPI +ConvertLongToLargeInteger ( + LONG SignedInteger + ); + +// +// Convert unsigned integer to large integer. +// + +LARGE_INTEGER +WINAPI +ConvertUlongToLargeInteger ( + ULONG UnsignedInteger + ); + + +// +// Large integer shift routines. +// + +LARGE_INTEGER +WINAPI +LargeIntegerShiftLeft ( + LARGE_INTEGER LargeInteger, + CCHAR ShiftCount + ); + +LARGE_INTEGER +WINAPI +LargeIntegerShiftRight ( + LARGE_INTEGER LargeInteger, + CCHAR ShiftCount + ); + +LARGE_INTEGER +WINAPI +LargeIntegerArithmeticShift ( + LARGE_INTEGER LargeInteger, + CCHAR ShiftCount + ); + +#define LargeIntegerGreaterThan(X,Y) ( \ + (((X).HighPart == (Y).HighPart) && ((X).LowPart > (Y).LowPart)) || \ + ((X).HighPart > (Y).HighPart) \ +) + +#define LargeIntegerGreaterThanOrEqualTo(X,Y) ( \ + (((X).HighPart == (Y).HighPart) && ((X).LowPart >= (Y).LowPart)) || \ + ((X).HighPart > (Y).HighPart) \ +) + +#define LargeIntegerEqualTo(X,Y) ( \ + !(((X).LowPart ^ (Y).LowPart) | ((X).HighPart ^ (Y).HighPart)) \ +) + +#define LargeIntegerNotEqualTo(X,Y) ( \ + (((X).LowPart ^ (Y).LowPart) | ((X).HighPart ^ (Y).HighPart)) \ +) + +#define LargeIntegerLessThan(X,Y) ( \ + (((X).HighPart == (Y).HighPart) && ((X).LowPart < (Y).LowPart)) || \ + ((X).HighPart < (Y).HighPart) \ +) + +#define LargeIntegerLessThanOrEqualTo(X,Y) ( \ + (((X).HighPart == (Y).HighPart) && ((X).LowPart <= (Y).LowPart)) || \ + ((X).HighPart < (Y).HighPart) \ +) + +#define LargeIntegerGreaterThanZero(X) ( \ + (((X).HighPart == 0) && ((X).LowPart > 0)) || \ + ((X).HighPart > 0 ) \ +) + +#define LargeIntegerGreaterOrEqualToZero(X) ( \ + (X).HighPart >= 0 \ +) + +#define LargeIntegerEqualToZero(X) ( \ + !((X).LowPart | (X).HighPart) \ +) + +#define LargeIntegerNotEqualToZero(X) ( \ + ((X).LowPart | (X).HighPart) \ +) + +#define LargeIntegerLessThanZero(X) ( \ + ((X).HighPart < 0) \ +) + +#define LargeIntegerLessOrEqualToZero(X) ( \ + ((X).HighPart < 0) || !((X).LowPart | (X).HighPart) \ +) + +#ifdef __cplusplus +} +#endif + diff --git a/src/WINNT/client_osi/libosi.def b/src/WINNT/client_osi/libosi.def index b60c39c92..d68cace82 100644 --- a/src/WINNT/client_osi/libosi.def +++ b/src/WINNT/client_osi/libosi.def @@ -68,3 +68,4 @@ EXPORTS osi_InitTraceOption @61 osi_LogEvent0 @62 osi_LogEvent @63 + osi_HexifyString @64 diff --git a/src/WINNT/client_osi/osi.h b/src/WINNT/client_osi/osi.h index f4628e5fd..071533e25 100644 --- a/src/WINNT/client_osi/osi.h +++ b/src/WINNT/client_osi/osi.h @@ -20,7 +20,7 @@ #ifndef DJGPP #include #if !defined(_MSC_VER) || (_MSC_VER < 1300) -#include +#include "largeint.h" #endif #include "osithrdnt.h" #else /* DJGPP */ diff --git a/src/WINNT/client_osi/osilog.c b/src/WINNT/client_osi/osilog.c index 09298cf88..72fbecbd1 100644 --- a/src/WINNT/client_osi/osilog.c +++ b/src/WINNT/client_osi/osilog.c @@ -205,6 +205,13 @@ void osi_LogAdd(osi_log_t *logp, char *formatp, long p0, long p1, long p2, long lep->parms[1] = p1; lep->parms[2] = p2; lep->parms[3] = p3; + +#ifdef NOTSERVICE + printf( "%9ld:", lep->micros ); + printf( formatp, p0, p1, p2, p3); + printf( "\n" ); +#endif + thrd_LeaveCrit(&logp->cs); } @@ -380,3 +387,26 @@ void osi_LogEvent(char *a,char *b,char *c,...) DeregisterEventSource(h); va_end(marker); } + +char *osi_HexifyString(char *s) { + int len,c; + char *hex = "0123456789abcdef"; + char *buf, *counter, *bufp; + + len = strlen(s); + + bufp = buf = malloc( len * 3 ); /* [xx.xx.xx.xx\0] */ + + if(!buf) return NULL; + + for(counter = s; *counter; counter ++) { + if(counter != s) *bufp++ = '.'; + c = *counter; + *bufp++ = hex[(c>>4) & 0xf]; + *bufp++ = hex[c & 0xf]; + } + *bufp = 0; + + return buf; +} + diff --git a/src/WINNT/client_osi/osilog.h b/src/WINNT/client_osi/osilog.h index 9eb11ab9f..2a0183e76 100644 --- a/src/WINNT/client_osi/osilog.h +++ b/src/WINNT/client_osi/osilog.h @@ -83,6 +83,7 @@ extern char *osi_LogSaveString(osi_log_t *logp, char *s); extern void osi_InitTraceOption(); extern void osi_LogEvent0(char *a,char *b); extern void osi_LogEvent(char *a,char *b,char *c,...); +extern char *osi_HexifyString(char *s); /* define macros */ #define osi_Log0(l,f) osi_LogAdd((l), (f), 0, 0, 0, 0) diff --git a/src/WINNT/client_osi/osistatl.h b/src/WINNT/client_osi/osistatl.h index ff100273e..0bcfa6da3 100644 --- a/src/WINNT/client_osi/osistatl.h +++ b/src/WINNT/client_osi/osistatl.h @@ -14,7 +14,7 @@ #include "osibasel.h" #if !defined(_MSC_VER) || (_MSC_VER < 1300) -#include +#include "largeint.h" #endif #include "osiqueue.h" diff --git a/src/WINNT/doc/help/en_US/afs-cc.CNT b/src/WINNT/doc/help/en_US/afs-cc.CNT index d6ab42608..7d6b1b69c 100755 --- a/src/WINNT/doc/help/en_US/afs-cc.CNT +++ b/src/WINNT/doc/help/en_US/afs-cc.CNT @@ -1,10 +1,10 @@ -:Base AFS-CC.HLP -:Title IBM AFS Control Center -1 AFS Control Center Configuration -2 Default Cell -3 Setting a Default AFS Cell to Administer=Cell_Membership>main -2 Cell Database -3 Overview=Cell_Database_Overview>main -3 Adding Cells to Your Cell Database=Adding_Cells_to_Your_Cell_Database>main -3 Changing Cell Information=Changing_Cell_Information>main -3 Removing Cells From Your Cell Database=Removing_Cells_From_Your_Cell_Database>main +:Base AFS-CC.HLP +:Title IBM AFS Control Center +1 AFS Control Center Configuration +2 Default Cell +3 Setting a Default AFS Cell to Administer=Cell_Membership>main +2 Cell Database +3 Overview=Cell_Database_Overview>main +3 Adding Cells to Your Cell Database=Adding_Cells_to_Your_Cell_Database>main +3 Changing Cell Information=Changing_Cell_Information>main +3 Removing Cells From Your Cell Database=Removing_Cells_From_Your_Cell_Database>main diff --git a/src/WINNT/doc/help/en_US/afs-light.CNT b/src/WINNT/doc/help/en_US/afs-light.CNT index eae018514..1c2d27eeb 100755 --- a/src/WINNT/doc/help/en_US/afs-light.CNT +++ b/src/WINNT/doc/help/en_US/afs-light.CNT @@ -1,63 +1,63 @@ -:Base AFS-LIGHT.HLP -:Title IBM AFS Light -1 Overview -2 About AFS=Working_in_AFS>main -2 AFS Storage Concepts=AFSFileStorageConcepts>main -2 AFS Security Concepts=AFS_security_concepts>main -2 About AFS Light=AFS_Client>main -2 About Help=Audience_and_Purpose>main -1 Getting Started -2 Overview=Running_AFS>main -2 Identifying an AFS Light Gateway=Adding_your_Client_to_a_Cell>main -2 Mounting the AFS Filespace=Mapping_Drives_Overview>main -2 Authenticating to AFS=Authentication>main -2 Verifying Authentication=VerifyingAuthentication@AFS-LIGHT.HLP>main -2 Unauthenticating from AFS=UnauthenticatingfromAFS@AFS-LIGHT.HLP>main -1 Managing AFS -2 Overview=AccessingAFS@AFS-LIGHT.HLP>main -2 AFS Menu=FileManagerAFSMenu>main -2 AFS Light Configuration Utility=AFS_Client_Configuration_Utility>main -2 AFS Light Program Group=The_AFS_Client_Program_Group>main -2 AFS Light Property Box=AFS_Credentials_utility.>main -2 Command Prompt Commands=CommandPromptCommands@AFS-LIGHT.HLP>main -1 Using AFS -2 Access Control Lists -3 Overview -4 Access Control Lists=ProtectingFilesandDirectories>main -4 Directory-Level Access Control=Directory.LevelAccessControl>main -4 AFS Access Permissions=AFSAccessPermissions>main -4 Additional Access Permissions=OtherVariablePermissions>main -4 Normal and Negative Entries=NormalandNegativeEntries>main -3 Using Access Control Lists -4 Setting ACLs=AccessControlLists>main -4 Adding ACL Entries=AddACLEntry>main -4 Removing ACL Entries=Removing_ACL_Entries>main -4 Copying ACLs=CopyACL>main -2 Volumes and Partitions -3 Overview=Volumes_and_Partitions>main -3 Displaying Volume and Partition Information=Displaying_Volume_and_Partition_information>main -3 Refresh name/ID map=Refreshname.IDmap>main -2 Mount Points -3 Overview=Mount_Point_first_page>main -3 Displaying Mount Points=Displaying_Mount_Points>main -3 Removing Mount Points=Removing_Mount_Points>main -3 Making Mount Points=Making_Mount_Points>main -2 Cached Files -3 Overview=Cached_Files>main -3 Flushing Files and Directories=Flushing_files_or_directories>main -3 Flushing Volumes=Flushing_Volumes>main -2 Server Information -3 Overview=ListingFileServerInformation>main -3 Showing File Servers=Showing_File_Servers>main -3 Showing the Status of File Servers=Showing_the_Status_of_File_Servers>main -2 Cells -3 Listing Information -4 Showing Cells=Showing_Cell>main -3 Cell Database -4 Overview=Cells>main -4 Adding Cells=Adding_Cells_to_your_Cell_Database>main -4 Changing Cell Information=Changing_Cell_Information>main -4 Removing Cells=Deleting_Cell_Information>main -1 Reference -2 Glossary=Glossary>main -2 How To...=How_To...>main +:Base AFS-LIGHT.HLP +:Title IBM AFS Light +1 Overview +2 About AFS=Working_in_AFS>main +2 AFS Storage Concepts=AFSFileStorageConcepts>main +2 AFS Security Concepts=AFS_security_concepts>main +2 About AFS Light=AFS_Client>main +2 About Help=Audience_and_Purpose>main +1 Getting Started +2 Overview=Running_AFS>main +2 Identifying an AFS Light Gateway=Adding_your_Client_to_a_Cell>main +2 Mounting the AFS Filespace=Mapping_Drives_Overview>main +2 Authenticating to AFS=Authentication>main +2 Verifying Authentication=VerifyingAuthentication@AFS-LIGHT.HLP>main +2 Unauthenticating from AFS=UnauthenticatingfromAFS@AFS-LIGHT.HLP>main +1 Managing AFS +2 Overview=AccessingAFS@AFS-LIGHT.HLP>main +2 AFS Menu=FileManagerAFSMenu>main +2 AFS Light Configuration Utility=AFS_Client_Configuration_Utility>main +2 AFS Light Program Group=The_AFS_Client_Program_Group>main +2 AFS Light Property Box=AFS_Credentials_utility.>main +2 Command Prompt Commands=CommandPromptCommands@AFS-LIGHT.HLP>main +1 Using AFS +2 Access Control Lists +3 Overview +4 Access Control Lists=ProtectingFilesandDirectories>main +4 Directory-Level Access Control=Directory.LevelAccessControl>main +4 AFS Access Permissions=AFSAccessPermissions>main +4 Additional Access Permissions=OtherVariablePermissions>main +4 Normal and Negative Entries=NormalandNegativeEntries>main +3 Using Access Control Lists +4 Setting ACLs=AccessControlLists>main +4 Adding ACL Entries=AddACLEntry>main +4 Removing ACL Entries=Removing_ACL_Entries>main +4 Copying ACLs=CopyACL>main +2 Volumes and Partitions +3 Overview=Volumes_and_Partitions>main +3 Displaying Volume and Partition Information=Displaying_Volume_and_Partition_information>main +3 Refresh name/ID map=Refreshname.IDmap>main +2 Mount Points +3 Overview=Mount_Point_first_page>main +3 Displaying Mount Points=Displaying_Mount_Points>main +3 Removing Mount Points=Removing_Mount_Points>main +3 Making Mount Points=Making_Mount_Points>main +2 Cached Files +3 Overview=Cached_Files>main +3 Flushing Files and Directories=Flushing_files_or_directories>main +3 Flushing Volumes=Flushing_Volumes>main +2 Server Information +3 Overview=ListingFileServerInformation>main +3 Showing File Servers=Showing_File_Servers>main +3 Showing the Status of File Servers=Showing_the_Status_of_File_Servers>main +2 Cells +3 Listing Information +4 Showing Cells=Showing_Cell>main +3 Cell Database +4 Overview=Cells>main +4 Adding Cells=Adding_Cells_to_your_Cell_Database>main +4 Changing Cell Information=Changing_Cell_Information>main +4 Removing Cells=Deleting_Cell_Information>main +1 Reference +2 Glossary=Glossary>main +2 How To...=How_To...>main diff --git a/src/WINNT/doc/help/en_US/afs-nt.CNT b/src/WINNT/doc/help/en_US/afs-nt.CNT index d0314639c..27fd9ffc0 100755 --- a/src/WINNT/doc/help/en_US/afs-nt.CNT +++ b/src/WINNT/doc/help/en_US/afs-nt.CNT @@ -1,77 +1,77 @@ -:Base AFS-NT.HLP -:Title IBM AFS Client -1 Overview -2 About AFS=Working_in_AFS>main -2 AFS Storage Concepts=AFSFileStorageConcepts>main -2 AFS Security Concepts=AFS_security_concepts>main -2 About the AFS Client=AFS_Client>main -2 About Help=Audience_and_Purpose>main -1 Getting Started -2 Overview=Running_AFS>main -2 Making your AFS Client a Member of a Cell=Adding_your_Client_to_a_Cell>main -2 AFS Client Wizard=IDH_AFSCREDS_WIZ_START>main -2 Starting and Stopping the AFS Client=StartingandStoppingtheAFSClient@afs-nt.hlp>main -2 Changing the Startup Type of Your AFS Client=ChangingtheStartupTypeofYourAFSClient@afs-nt.hlp>main -2 Mounting the AFS Filespace=Mapping_Drives_Overview>main -2 Authenticating to AFS=Authentication>main -2 Verifying Authentication=VerifyingAuthentication@afs-nt.hlp>main -2 Unauthenticating from AFS=UnauthenticatingfromAFS@afs-nt.hlp>main -1 Managing AFS -2 Overview=AccessingAFS@afs-nt.hlp>main -2 AFS Menu=FileManagerAFSMenu>main -2 AFS Client Configuration Utility=AFS_Client_Configuration_Utility>main -2 AFS Client Program Group=The_AFS_Client_Program_Group>main -2 AFS Client Property Box=AFS_Credentials_utility.>main -2 Command Prompt Commands=CommandPromptCommands@afs-nt.hlp>main -1 Using AFS -2 Access Control Lists -3 Overview -4 Access Control Lists=ProtectingFilesandDirectories>main -4 Directory-Level Access Control=Directory.LevelAccessControl>main -4 AFS Access Permissions=AFSAccessPermissions>main -4 Additional Access Permissions=OtherVariablePermissions>main -4 Normal and Negative Entries=NormalandNegativeEntries>main -3 Using Access Control Lists -4 Setting ACLs=AccessControlLists>main -4 Adding ACL Entries=AddACLEntry>main -4 Removing ACL Entries=Removing_ACL_Entries>main -4 Copying ACLs=CopyACL>main -2 Volumes and Partitions -3 Overview=Volumes_and_Partitions>main -3 Displaying Volume and Partition Information=Displaying_Volume_and_Partition_information>main -3 Refreshing Name/Volume ID Mappings=Refreshname.IDmap>main -2 Mount Points -3 Overview=Mount_Point_first_page>main -3 Displaying Mount Point Information=Displaying_Mount_Points>main -3 Removing Mount Points=Removing_Mount_Points>main -3 Creating Mount Points=Making_Mount_Points>main -2 Cached Files -3 Overview=Cached_Files>main -3 Flushing Files and Directories=Flushing_files_or_directories>main -3 Flushing Volumes=Flushing_Volumes>main -2 Servers -3 Listing Information -4 Overview=ListingFileServerInformation>main -4 Showing File Servers=Showing_File_Servers>main -4 Showing the Status of File Servers=Showing_the_Status_of_File_Servers>main -3 Server Preferences -4 Overview=Server_Prefs_Overview>main -4 Viewing Server Preferences=Viewing_Server_Preferences>main -4 Adding Server Preferences=Adding_Server_Preferences>main -4 Modifying Server Preferences=Modifying_Server_Preferences>main -2 Cells -3 Listing Information -4 Showing Cells=Showing_Cell>main -3 Cell Database -4 Overview=Cells>main -4 Adding Cells=Adding_Cells_to_your_Cell_Database>main -4 Changing Cell Information=Changing_Cell_Information>main -4 Removing Cells=Deleting_Cell_Information>main -2 Submounts -3 Overview=Submounts_Overview>main -3 Creating Submounts=Creating_Submounts>main -3 Modifying Submounts=Change_or_Edit_Submounts>main -3 Removing Submounts=Delete_Submounts>main -1 Reference -2 Glossary=Glossary>main -2 How To...=How_To...>main +:Base AFS-NT.HLP +:Title IBM AFS Client +1 Overview +2 About AFS=Working_in_AFS>main +2 AFS Storage Concepts=AFSFileStorageConcepts>main +2 AFS Security Concepts=AFS_security_concepts>main +2 About the AFS Client=AFS_Client>main +2 About Help=Audience_and_Purpose>main +1 Getting Started +2 Overview=Running_AFS>main +2 Making your AFS Client a Member of a Cell=Adding_your_Client_to_a_Cell>main +2 AFS Client Wizard=IDH_AFSCREDS_WIZ_START>main +2 Starting and Stopping the AFS Client=StartingandStoppingtheAFSClient@afs-nt.hlp>main +2 Changing the Startup Type of Your AFS Client=ChangingtheStartupTypeofYourAFSClient@afs-nt.hlp>main +2 Mounting the AFS Filespace=Mapping_Drives_Overview>main +2 Authenticating to AFS=Authentication>main +2 Verifying Authentication=VerifyingAuthentication@afs-nt.hlp>main +2 Unauthenticating from AFS=UnauthenticatingfromAFS@afs-nt.hlp>main +1 Managing AFS +2 Overview=AccessingAFS@afs-nt.hlp>main +2 AFS Menu=FileManagerAFSMenu>main +2 AFS Client Configuration Utility=AFS_Client_Configuration_Utility>main +2 AFS Client Program Group=The_AFS_Client_Program_Group>main +2 AFS Client Property Box=AFS_Credentials_utility.>main +2 Command Prompt Commands=CommandPromptCommands@afs-nt.hlp>main +1 Using AFS +2 Access Control Lists +3 Overview +4 Access Control Lists=ProtectingFilesandDirectories>main +4 Directory-Level Access Control=Directory.LevelAccessControl>main +4 AFS Access Permissions=AFSAccessPermissions>main +4 Additional Access Permissions=OtherVariablePermissions>main +4 Normal and Negative Entries=NormalandNegativeEntries>main +3 Using Access Control Lists +4 Setting ACLs=AccessControlLists>main +4 Adding ACL Entries=AddACLEntry>main +4 Removing ACL Entries=Removing_ACL_Entries>main +4 Copying ACLs=CopyACL>main +2 Volumes and Partitions +3 Overview=Volumes_and_Partitions>main +3 Displaying Volume and Partition Information=Displaying_Volume_and_Partition_information>main +3 Refreshing Name/Volume ID Mappings=Refreshname.IDmap>main +2 Mount Points +3 Overview=Mount_Point_first_page>main +3 Displaying Mount Point Information=Displaying_Mount_Points>main +3 Removing Mount Points=Removing_Mount_Points>main +3 Creating Mount Points=Making_Mount_Points>main +2 Cached Files +3 Overview=Cached_Files>main +3 Flushing Files and Directories=Flushing_files_or_directories>main +3 Flushing Volumes=Flushing_Volumes>main +2 Servers +3 Listing Information +4 Overview=ListingFileServerInformation>main +4 Showing File Servers=Showing_File_Servers>main +4 Showing the Status of File Servers=Showing_the_Status_of_File_Servers>main +3 Server Preferences +4 Overview=Server_Prefs_Overview>main +4 Viewing Server Preferences=Viewing_Server_Preferences>main +4 Adding Server Preferences=Adding_Server_Preferences>main +4 Modifying Server Preferences=Modifying_Server_Preferences>main +2 Cells +3 Listing Information +4 Showing Cells=Showing_Cell>main +3 Cell Database +4 Overview=Cells>main +4 Adding Cells=Adding_Cells_to_your_Cell_Database>main +4 Changing Cell Information=Changing_Cell_Information>main +4 Removing Cells=Deleting_Cell_Information>main +2 Submounts +3 Overview=Submounts_Overview>main +3 Creating Submounts=Creating_Submounts>main +3 Modifying Submounts=Change_or_Edit_Submounts>main +3 Removing Submounts=Delete_Submounts>main +1 Reference +2 Glossary=Glossary>main +2 How To...=How_To...>main diff --git a/src/WINNT/doc/help/en_US/taafscfg.cnt b/src/WINNT/doc/help/en_US/taafscfg.cnt index 962742f24..587cea00d 100755 --- a/src/WINNT/doc/help/en_US/taafscfg.cnt +++ b/src/WINNT/doc/help/en_US/taafscfg.cnt @@ -1,32 +1,32 @@ -:Base TAAFSCFG.HLP -:Title IBM AFS Server Configuration -1 AFS Server Configuration Help -2 About AFS and the AFS Server and AFS Control Center=About_AFS_and_the_AFS_Server_and_AFS_Control_Center -2 Configuring the AFS Server -3 Overview=Configuring_the_AFS_Server -3 The AFS Server Configuration Wizard=The_AFS_Server_Configuration_Wizard -3 To Configure the AFS Server into an Existing Cell=Configuring_the_AFS_Server_into_an_Existing_Cell -3 To Configure the AFS Server as the First AFS Server in a Cell=Configuring_the_AFS_Server_as_the_First_AFS_Server_in_a_Cell -3 Accessing AFS Data=Accessing_AFS_Data -2 The AFS Server Configuration Dialog Box -3 Overview=The_AFS_Server_Configuration_Dialog_Box -3 To Access the AFS Server Configuration Dialog Box=To_Access_the_AFS_Server_Configuration_Dialog_Box -3 Partitions Tab -4 Overview=IDH_PARTITIONS_PAGE -4 Setting Up AFS Partitions -5 Overview=Setting_Up_AFS_Partitions -5 To Create an AFS Partition=To_Create_an_AFS_Partion -4 Administering AFS Partitions -5 Overview=Administering_AFS_Partitions -5 Salvaging an AFS Partition -6 Overview=Salvaging_an_AFS_Partition -6 To Salvage an AFS Partition=To_Salvage_an_AFS_Partition -5 Removing AFS Partitions -6 Overview=Removing_AFS_Partitions -6 To Remove an AFS Partition=To_Remove_an_AFS_Partition -3 Services Tab -4 Overview=IDH_SERVICES_PAGE -4 AFS Server Roles=AFS_Server_Roles -4 AFS Services=AFS_Services -4 To Configure and Start an AFS Service=To_Configure_and_Start_an_AFS_Service -4 To Stop and Unconfigure an AFS Service=To_Stop_and_Unconfigure_an_AFS_Service +:Base TAAFSCFG.HLP +:Title IBM AFS Server Configuration +1 AFS Server Configuration Help +2 About AFS and the AFS Server and AFS Control Center=About_AFS_and_the_AFS_Server_and_AFS_Control_Center +2 Configuring the AFS Server +3 Overview=Configuring_the_AFS_Server +3 The AFS Server Configuration Wizard=The_AFS_Server_Configuration_Wizard +3 To Configure the AFS Server into an Existing Cell=Configuring_the_AFS_Server_into_an_Existing_Cell +3 To Configure the AFS Server as the First AFS Server in a Cell=Configuring_the_AFS_Server_as_the_First_AFS_Server_in_a_Cell +3 Accessing AFS Data=Accessing_AFS_Data +2 The AFS Server Configuration Dialog Box +3 Overview=The_AFS_Server_Configuration_Dialog_Box +3 To Access the AFS Server Configuration Dialog Box=To_Access_the_AFS_Server_Configuration_Dialog_Box +3 Partitions Tab +4 Overview=IDH_PARTITIONS_PAGE +4 Setting Up AFS Partitions +5 Overview=Setting_Up_AFS_Partitions +5 To Create an AFS Partition=To_Create_an_AFS_Partion +4 Administering AFS Partitions +5 Overview=Administering_AFS_Partitions +5 Salvaging an AFS Partition +6 Overview=Salvaging_an_AFS_Partition +6 To Salvage an AFS Partition=To_Salvage_an_AFS_Partition +5 Removing AFS Partitions +6 Overview=Removing_AFS_Partitions +6 To Remove an AFS Partition=To_Remove_an_AFS_Partition +3 Services Tab +4 Overview=IDH_SERVICES_PAGE +4 AFS Server Roles=AFS_Server_Roles +4 AFS Services=AFS_Services +4 To Configure and Start an AFS Service=To_Configure_and_Start_an_AFS_Service +4 To Stop and Unconfigure an AFS Service=To_Stop_and_Unconfigure_an_AFS_Service diff --git a/src/WINNT/doc/help/en_US/taafssvrmgr.cnt b/src/WINNT/doc/help/en_US/taafssvrmgr.cnt index 11eebad35..289d6434e 100755 --- a/src/WINNT/doc/help/en_US/taafssvrmgr.cnt +++ b/src/WINNT/doc/help/en_US/taafssvrmgr.cnt @@ -1,89 +1,89 @@ -:Base TAAFSSVRMGR.HLP -:Title IBM AFS Server Manager -1 AFS Server Manager -2 Overview of AFS -3 AFS: Overview=AFS__Overview -3 AFS Cells=DCE_Cells -2 AFS Server Manager -3 AFS Server Manager: Overview=DFS_Server_Manager -2 Authenticating to AFS -3 To Authenticate to AFS=To_Obtain_DCE_Credentials -3 To Choose an AFS Cell to Administer=To_Choose_a_DCE_Cell_to_Administer -2 AFS Servers -3 Servers: Overview=Servers__An_Overview -3 Maintaining AFS Servers=Setting_Up_and_Maintaining_DFS_Servers -3 Monitoring Server Subsets=Monitoring_Server_Subsets -3 Server Properties=Server_Properties -3 Server Warnings=Server_Warnings -3 Administrators for a Server -4 Administrators for a Server: Overview=Administrators_for_a_Server -4 To Add or Remove a User from the Administrators List for a Server=To_Edit_an_Administrative_List -3 Server Encryption Keys -4 Server Encryption Keys: Overview=Server_Encryption_Keys -4 To Add a New Server Encryption Key=To_Add_a_New_Server_Key -4 To Remove a Server Encryption Key=To_Remove_a_Server_Encryption_Key -3 Server Files -4 To Install a New File on a Server=To_Install_New_Files_on_a_Server -4 To Install the Former Versions of Binary Files on a Server=To_Install_Former_Versions_of_Binary_Files_on_a_Server -4 To Prune Files from a Server=To_Prune_Files_from_a_Server -4 To Get File Dates=To_Get_File_Dates -3 Synchronizing the VLDB on a Server -4 Synchronizing the VLDB=Synchronizing_the_FLDB -4 To Synchronize the VLDB on a Server=To_Synchronize_the_FLDB -2 AFS Partitions -3 Partitions: Overview=Partitions__An_Overview -3 Partitions Properties=Partition_Properties -3 Partitions Warnings=Partition_Warnings -2 AFS Volumes -3 Volumes: Overview=Filesets__An_Overview -3 The Different Types of Volumes =Read__Write_and_Read_Only_Filesets -3 The Volume Location Database (VLDB)=FLDB__Fileset_Location_Database_ -3 Volume Properties=Fileset_Properties -3 To Create a Volume =To_Create_a_Fileset -3 To Rename a Volume =To_Rename_a_Fileset -3 To Delete a Volume =To_Delete_a_Fileset -3 Moving Volumes -4 Moving Volumes: Overview=Moving_Filesets -4 To Move a Volume =To_Move_a_Fileset -3 Creating Backup Versions of Volumes -4 To Create a Backup Version of a Volume=IDH_SVRMGR_CLONE_OVERVIEW -4 To Create Backup Versions of Multiple Volumes=To_Clone_Multiple_Filesets -3 Locking and Unlocking Volumes -4 Locking and Unlocking VLDB Entries=Locking_and_Unlocking_Filesets -4 To Determine if a Volume is Locked=To_Determine_Whether_a_Fileset_Entry_is_Locked -4 To Lock a Volume =To_Lock_a_Fileset -4 To Unlock a Volume =To_Unlock_a_Fileset -3 Dumping and Restoring Volumes -4 Dumping Volumes=Dumping_and_Restoring_Filesets -4 To Dump a Volume =To_Dump_a_Fileset -4 Restoring Volumes=Restoring_Filesets -4 Restoring Incremental Volume Dumps =Restoring_Multiple_Incremental_Dumps_of_a_Fileset -4 To Restore a Dump File=To_Restore_a_Dump_File_to_a_New_Fileset -3 Volume Warnings=Fileset_Warnings -2 AFS Volume Replication -3 Replicating Volumes=Replicating_Filesets -3 To Create a New Volume Replication Site=To_Create_a_New_Fileset_Replication_Site -3 To Replicate a Volume =To_Replicate_a_Fileset -3 Updating Volume Replicas=Updating_Replicas -2 AFS Services -3 Services: Overview=Services__An_Overview -3 Setting Up and Maintaining AFS Services=Setting_Up_and_Maintaining_DFS_Services -3 Service Properties=Service_Properties -3 To Create a Service=To_Create_a_Service -3 To Delete a Service=To_Delete_a_Service -3 To Start a Service=To_Start_a_Service -3 To Stop a Service=To_Stop_a_Service -3 To Restart a Service=To_Restart_a_Service -3 To Set BOS Service Restart Dates=To_Set_BOS_Service_Restart_Dates_and_Times -3 To View Service Status and Details=To_View_Service_Status_and_Details -3 Service Log Files -4 Log Files=Log_Files -4 To View a Service Log File=To_View_Service_Log -2 Salvaging Volumes -3 Salvaging Volumes: Overview=Salvaging_Volumes -3 To Salvage all Volumes on a File Server=To_Salvage_all_Volumes_on_a_File_Server -3 To Salvage all Volumes on a Partition=To_Salvage_all_Volumes_on_a_Partition -3 To Salvage a Volume=To_Salvage_a_Volume -2 AFS Command Reference -3 Reference for AFS UNIX Users=UNIX_Command_Reference -3 AFS Command Prompt Commands=AFS_Command_Prompt_Commands +:Base TAAFSSVRMGR.HLP +:Title IBM AFS Server Manager +1 AFS Server Manager +2 Overview of AFS +3 AFS: Overview=AFS__Overview +3 AFS Cells=DCE_Cells +2 AFS Server Manager +3 AFS Server Manager: Overview=DFS_Server_Manager +2 Authenticating to AFS +3 To Authenticate to AFS=To_Obtain_DCE_Credentials +3 To Choose an AFS Cell to Administer=To_Choose_a_DCE_Cell_to_Administer +2 AFS Servers +3 Servers: Overview=Servers__An_Overview +3 Maintaining AFS Servers=Setting_Up_and_Maintaining_DFS_Servers +3 Monitoring Server Subsets=Monitoring_Server_Subsets +3 Server Properties=Server_Properties +3 Server Warnings=Server_Warnings +3 Administrators for a Server +4 Administrators for a Server: Overview=Administrators_for_a_Server +4 To Add or Remove a User from the Administrators List for a Server=To_Edit_an_Administrative_List +3 Server Encryption Keys +4 Server Encryption Keys: Overview=Server_Encryption_Keys +4 To Add a New Server Encryption Key=To_Add_a_New_Server_Key +4 To Remove a Server Encryption Key=To_Remove_a_Server_Encryption_Key +3 Server Files +4 To Install a New File on a Server=To_Install_New_Files_on_a_Server +4 To Install the Former Versions of Binary Files on a Server=To_Install_Former_Versions_of_Binary_Files_on_a_Server +4 To Prune Files from a Server=To_Prune_Files_from_a_Server +4 To Get File Dates=To_Get_File_Dates +3 Synchronizing the VLDB on a Server +4 Synchronizing the VLDB=Synchronizing_the_FLDB +4 To Synchronize the VLDB on a Server=To_Synchronize_the_FLDB +2 AFS Partitions +3 Partitions: Overview=Partitions__An_Overview +3 Partitions Properties=Partition_Properties +3 Partitions Warnings=Partition_Warnings +2 AFS Volumes +3 Volumes: Overview=Filesets__An_Overview +3 The Different Types of Volumes =Read__Write_and_Read_Only_Filesets +3 The Volume Location Database (VLDB)=FLDB__Fileset_Location_Database_ +3 Volume Properties=Fileset_Properties +3 To Create a Volume =To_Create_a_Fileset +3 To Rename a Volume =To_Rename_a_Fileset +3 To Delete a Volume =To_Delete_a_Fileset +3 Moving Volumes +4 Moving Volumes: Overview=Moving_Filesets +4 To Move a Volume =To_Move_a_Fileset +3 Creating Backup Versions of Volumes +4 To Create a Backup Version of a Volume=IDH_SVRMGR_CLONE_OVERVIEW +4 To Create Backup Versions of Multiple Volumes=To_Clone_Multiple_Filesets +3 Locking and Unlocking Volumes +4 Locking and Unlocking VLDB Entries=Locking_and_Unlocking_Filesets +4 To Determine if a Volume is Locked=To_Determine_Whether_a_Fileset_Entry_is_Locked +4 To Lock a Volume =To_Lock_a_Fileset +4 To Unlock a Volume =To_Unlock_a_Fileset +3 Dumping and Restoring Volumes +4 Dumping Volumes=Dumping_and_Restoring_Filesets +4 To Dump a Volume =To_Dump_a_Fileset +4 Restoring Volumes=Restoring_Filesets +4 Restoring Incremental Volume Dumps =Restoring_Multiple_Incremental_Dumps_of_a_Fileset +4 To Restore a Dump File=To_Restore_a_Dump_File_to_a_New_Fileset +3 Volume Warnings=Fileset_Warnings +2 AFS Volume Replication +3 Replicating Volumes=Replicating_Filesets +3 To Create a New Volume Replication Site=To_Create_a_New_Fileset_Replication_Site +3 To Replicate a Volume =To_Replicate_a_Fileset +3 Updating Volume Replicas=Updating_Replicas +2 AFS Services +3 Services: Overview=Services__An_Overview +3 Setting Up and Maintaining AFS Services=Setting_Up_and_Maintaining_DFS_Services +3 Service Properties=Service_Properties +3 To Create a Service=To_Create_a_Service +3 To Delete a Service=To_Delete_a_Service +3 To Start a Service=To_Start_a_Service +3 To Stop a Service=To_Stop_a_Service +3 To Restart a Service=To_Restart_a_Service +3 To Set BOS Service Restart Dates=To_Set_BOS_Service_Restart_Dates_and_Times +3 To View Service Status and Details=To_View_Service_Status_and_Details +3 Service Log Files +4 Log Files=Log_Files +4 To View a Service Log File=To_View_Service_Log +2 Salvaging Volumes +3 Salvaging Volumes: Overview=Salvaging_Volumes +3 To Salvage all Volumes on a File Server=To_Salvage_all_Volumes_on_a_File_Server +3 To Salvage all Volumes on a Partition=To_Salvage_all_Volumes_on_a_Partition +3 To Salvage a Volume=To_Salvage_a_Volume +2 AFS Command Reference +3 Reference for AFS UNIX Users=UNIX_Command_Reference +3 AFS Command Prompt Commands=AFS_Command_Prompt_Commands diff --git a/src/WINNT/doc/help/en_US/taafsusrmgr.cnt b/src/WINNT/doc/help/en_US/taafsusrmgr.cnt index 6e79e17f1..a3631e830 100755 --- a/src/WINNT/doc/help/en_US/taafsusrmgr.cnt +++ b/src/WINNT/doc/help/en_US/taafsusrmgr.cnt @@ -1,66 +1,66 @@ -:Base TAAFSUSRMGR.HLP -:Title IBM AFS Account Manager -1 AFS Account Manager -2 AFS User Accounts -3 Creating AFS Accounts -4 Creating AFS User Accounts=Creating_User_Entries -4 To create a new AFS user account=To_create_a_single_user_account -3 Password Authentication and Security -4 Improving Password/Authentication Security=Improving_Password_Authentication_Security -4 To limit the number of consecutive failed login attempts by a user=To_limit_the_number_of_consecutive_failed_login_attempts -4 To unlock a locked user account=To_unlock_a_locked_user_account -4 To set the password lifetime for an AFS user account=To_set_password_lifetime -4 To restrict reuse of passwords by a user=To_restrict_reuse_of_passwords -3 Changing Passwords -4 Changing Passwords=Changing_Passwords -4 To change a user's AFS password=To_change_a_password_in_the_Authentication_Database -3 Removing User Accounts -4 Removing User Accounts=Removing_User_Accounts -4 To delete an AFS user account=To_remove_a_user_account -2 AFS Groups -3 About the Protection Database=AFS_Protection_Database -3 Protection Database Entries=Protection_Database_Entries -3 Using Groups -4 Using Groups Effectively=Using_Groups_Effectively -4 Using Prefix-Less AFS Groups=Using_Prefix_Less_Groups -4 Placing IP Addresses in Groups=Placing_Machines_in_Groups -4 The Standard System Groups=The_Standard_System_Groups -4 Listing Information about Groups -5 Listing Information about Groups=Listing_Information_about_Groups -5 To view a list of the members of an AFS group=To_list_the_members_of_a_group -5 To view information about an AFS group=To_examine_a_Protection_Database_group_entry -5 To view a list of the groups that an AFS group owns=To_list_the_groups_that_a_group_owns -4 Listing Group-Related Information about Users and Machine Entries -5 Listing Group-Related Information about Users and Machine Entries=Listing_Group_Related_Information_about_Users_and_Machine_Entries -5 To view a list of the groups to which an AFS user belongs=To_examine_a_Protection_Database_entry_for_a_user_or_machine -5 To view a list of the groups that an AFS user owns=To_view_a_list_of_the_groups_that_an_AFS_user_owns -5 To view a list of the groups that an IP address account owns=To_view_a_list_of_the_groups_that_an_IP_address_account_owns -5 To view a list of the groups to which an IP address account belongs=To_view_a_list_of_the_groups_to_which_an_IP_address_account_belongs -4 Creating User Entries -5 Creating AFS User Accounts=Creating_User_Entries -5 To create a new AFS user account=To_create_a_single_user_account -4 Creating Machine Entries -5 Creating IP Address Entries=Creating_Machine_Entries -5 To create an IP address account in the AFS Protection Database=To_create_a_single_machine_entry_in_the_Protection_Database -4 Creating Regular and Prefix-Less Groups -5 Creating Regular and Prefix-Less AFS Groups=Creating_Regular_and_Prefix_Less_Groups -5 To create a new regular AFS group=To_create_a_single_regular_group_entry -5 To create a new prefix-less AFS group=To_create_a_single_prefix_less_group_entry -4 Adding Members to Groups and Removing Them from Groups -5 Adding Members to Groups and Removing Them from Groups=Adding_Members_to_Groups_and_Removing_Them_from_Groups -5 To add a user or IP address account to a group=To_add_users_and_machines_to_groups -5 To remove a user, IP address account, or group from an AFS group=To_remove_users_and_machines_from_groups -3 Deleting Entries from the Protection Database -4 Deleting Entries from the Protection Database=Deleting_Entries_from_the_Protection_Database -4 To delete an AFS group=To_delete_user_and_group_entries -3 Changing the Owner of an Entry -4 Changing the Owner of an AFS Group=Changing_the_Owner_of_an_Entry -4 The Name-Changing Implications of Changing Ownership=The_Name_Changing_Implications_of_Changing_Ownership -4 To change the owner of an AFS group=To_change_the_owner_of_a_group_entry -3 Changing the Name of an Entry -4 Changing the Name of an AFS Group=Changing_the_Name_of_an_Entry -4 To change the name of an AFS group=To_change_the_name_of_a_group_entry -3 Changing Group Creation Quota -4 Changing Group Creation Quota=Changing_Group_Creation_Quota -4 To view the group creation quota of an AFS user=To_examine_group_creation_quota -4 To change the group creation quota of an AFS user=To_change_group_creation_quota +:Base TAAFSUSRMGR.HLP +:Title IBM AFS Account Manager +1 AFS Account Manager +2 AFS User Accounts +3 Creating AFS Accounts +4 Creating AFS User Accounts=Creating_User_Entries +4 To create a new AFS user account=To_create_a_single_user_account +3 Password Authentication and Security +4 Improving Password/Authentication Security=Improving_Password_Authentication_Security +4 To limit the number of consecutive failed login attempts by a user=To_limit_the_number_of_consecutive_failed_login_attempts +4 To unlock a locked user account=To_unlock_a_locked_user_account +4 To set the password lifetime for an AFS user account=To_set_password_lifetime +4 To restrict reuse of passwords by a user=To_restrict_reuse_of_passwords +3 Changing Passwords +4 Changing Passwords=Changing_Passwords +4 To change a user's AFS password=To_change_a_password_in_the_Authentication_Database +3 Removing User Accounts +4 Removing User Accounts=Removing_User_Accounts +4 To delete an AFS user account=To_remove_a_user_account +2 AFS Groups +3 About the Protection Database=AFS_Protection_Database +3 Protection Database Entries=Protection_Database_Entries +3 Using Groups +4 Using Groups Effectively=Using_Groups_Effectively +4 Using Prefix-Less AFS Groups=Using_Prefix_Less_Groups +4 Placing IP Addresses in Groups=Placing_Machines_in_Groups +4 The Standard System Groups=The_Standard_System_Groups +4 Listing Information about Groups +5 Listing Information about Groups=Listing_Information_about_Groups +5 To view a list of the members of an AFS group=To_list_the_members_of_a_group +5 To view information about an AFS group=To_examine_a_Protection_Database_group_entry +5 To view a list of the groups that an AFS group owns=To_list_the_groups_that_a_group_owns +4 Listing Group-Related Information about Users and Machine Entries +5 Listing Group-Related Information about Users and Machine Entries=Listing_Group_Related_Information_about_Users_and_Machine_Entries +5 To view a list of the groups to which an AFS user belongs=To_examine_a_Protection_Database_entry_for_a_user_or_machine +5 To view a list of the groups that an AFS user owns=To_view_a_list_of_the_groups_that_an_AFS_user_owns +5 To view a list of the groups that an IP address account owns=To_view_a_list_of_the_groups_that_an_IP_address_account_owns +5 To view a list of the groups to which an IP address account belongs=To_view_a_list_of_the_groups_to_which_an_IP_address_account_belongs +4 Creating User Entries +5 Creating AFS User Accounts=Creating_User_Entries +5 To create a new AFS user account=To_create_a_single_user_account +4 Creating Machine Entries +5 Creating IP Address Entries=Creating_Machine_Entries +5 To create an IP address account in the AFS Protection Database=To_create_a_single_machine_entry_in_the_Protection_Database +4 Creating Regular and Prefix-Less Groups +5 Creating Regular and Prefix-Less AFS Groups=Creating_Regular_and_Prefix_Less_Groups +5 To create a new regular AFS group=To_create_a_single_regular_group_entry +5 To create a new prefix-less AFS group=To_create_a_single_prefix_less_group_entry +4 Adding Members to Groups and Removing Them from Groups +5 Adding Members to Groups and Removing Them from Groups=Adding_Members_to_Groups_and_Removing_Them_from_Groups +5 To add a user or IP address account to a group=To_add_users_and_machines_to_groups +5 To remove a user, IP address account, or group from an AFS group=To_remove_users_and_machines_from_groups +3 Deleting Entries from the Protection Database +4 Deleting Entries from the Protection Database=Deleting_Entries_from_the_Protection_Database +4 To delete an AFS group=To_delete_user_and_group_entries +3 Changing the Owner of an Entry +4 Changing the Owner of an AFS Group=Changing_the_Owner_of_an_Entry +4 The Name-Changing Implications of Changing Ownership=The_Name_Changing_Implications_of_Changing_Ownership +4 To change the owner of an AFS group=To_change_the_owner_of_a_group_entry +3 Changing the Name of an Entry +4 Changing the Name of an AFS Group=Changing_the_Name_of_an_Entry +4 To change the name of an AFS group=To_change_the_name_of_a_group_entry +3 Changing Group Creation Quota +4 Changing Group Creation Quota=Changing_Group_Creation_Quota +4 To view the group creation quota of an AFS user=To_examine_group_creation_quota +4 To change the group creation quota of an AFS user=To_change_group_creation_quota diff --git a/src/WINNT/kfw/inc/kclient/kclient.h b/src/WINNT/kfw/inc/kclient/kclient.h new file mode 100644 index 000000000..13a960265 --- /dev/null +++ b/src/WINNT/kfw/inc/kclient/kclient.h @@ -0,0 +1,48 @@ +/* + +Copyright © 1996 by Project Mandarin, Inc. + +Error codes copyright 1996 by Massachusetts Institute of Technology + +*/ + +#include "kcmacerr.h" + +#if defined(_WIN32) +/* unfortunately the 32-bit compiler doesn't allow a function */ +/* to be declared as __stdcall AND __declspec(dllexport), so */ +/* I have to use a .def file for the export part */ +#define KC_CALLTYPE __stdcall +#define KC_EXPORT +#else +#define KC_CALLTYPE WINAPI +#define KC_EXPORT _export +#endif + +BOOL KC_CALLTYPE GetTicketForService (LPSTR, LPSTR, LPDWORD) ; +BOOL KC_CALLTYPE GetTicketGrantingTicket (void) ; +BOOL KC_CALLTYPE DeleteAllSessions (void) ; +BOOL KC_CALLTYPE SetUserName (LPSTR) ; +#if defined(_WIN32) +BOOL KC_CALLTYPE KCGetUserName (LPSTR) ; +#else +BOOL KC_CALLTYPE GetUserName (LPSTR) ; +#endif +BOOL KC_CALLTYPE ListTickets (HWND) ; +void KC_CALLTYPE SetTicketLifeTime (int) ; +void KC_CALLTYPE SetKrbdllMode (BOOL) ; +BOOL KC_CALLTYPE TgtExist (void) ; +#if !defined(KLITE) +BOOL KC_CALLTYPE ChangePassword (void) ; +#endif +// the following two functions will exist ONLY until the other functions +// are revised to return OSErr themselves. this minimizes the API +// change for this release. +OSErr KC_CALLTYPE KClientErrno(void) ; +signed long KC_CALLTYPE KClientKerberosErrno(void) ; + +BOOL KC_CALLTYPE SendTicketForService(LPSTR service, LPSTR version, int fd); + +#ifdef _WIN32 +DWORD KC_CALLTYPE _KCGetNumInUse(); +#endif diff --git a/src/WINNT/kfw/inc/kclient/kcmacerr.h b/src/WINNT/kfw/inc/kclient/kcmacerr.h new file mode 100644 index 000000000..c0cdf5912 --- /dev/null +++ b/src/WINNT/kfw/inc/kclient/kcmacerr.h @@ -0,0 +1,68 @@ + +/* Error codes from Mac version of Project Mandarin Kerberos Client */ +/* Copyright © 1995 Project Mandarin, Inc. */ + +typedef signed short OSErr; + +enum { + cKrbCorruptedFile = -1024, /* couldn't find a needed resource */ + cKrbNoKillIO, /* can't killIO because all calls sync */ + cKrbBadSelector, /* csCode passed doesn't select a recognized function */ + cKrbCantClose, /* we must always remain open */ + cKrbMapDoesntExist, /* tried to access a map that doesn't exist (index too large, + or criteria doesn't match anything) */ + cKrbSessDoesntExist, /* tried to access a session that doesn't exist */ + cKrbCredsDontExist, /* tried to access credentials that don't exist */ + cKrbTCPunavailable, /* couldn't open MacTCP driver */ + cKrbUserCancelled, /* user cancelled a log in operation */ + cKrbConfigurationErr, /* Kerberos Preference file is not configured properly */ + cKrbServerRejected, /* A server rejected our ticket */ + cKrbServerImposter, /* Server appears to be a phoney */ + cKrbServerRespIncomplete, /* Server response is not complete */ + cKrbNotLoggedIn, /* Returned by cKrbGetUserName if user is not logged in */ + cKrbOldDriver, /* old version of the driver */ + cKrbDriverInUse, /* driver is not reentrant */ + cKrbAppInBkgnd, /* driver won't put up password dialog when in background */ + cKrbInvalidSession, /* invalid structure passed to KClient/KServer routine */ + + cKrbKerberosErrBlock = -20000 /* start of block of 256 kerberos error numbers */ +}; + + +/* the following are borrowed from MacTCPCommonTypes.h */ +/* MacTCP return Codes in the range -23000 through -23049 */ +#define ipBadLapErr -23000 /* bad network configuration */ +#define ipBadCnfgErr -23001 /* bad IP configuration error */ +#define ipNoCnfgErr -23002 /* missing IP or LAP configuration error */ +#define ipLoadErr -23003 /* error in MacTCP load */ +#define ipBadAddr -23004 /* error in getting address */ +#define connectionClosing -23005 /* connection is closing */ +#define invalidLength -23006 +#define connectionExists -23007 /* request conflicts with existing connection */ +#define connectionDoesntExist -23008 /* connection does not exist */ +#define insufficientResources -23009 /* insufficient resources to perform request */ +#define invalidStreamPtr -23010 +#define streamAlreadyOpen -23011 +#define connectionTerminated -23012 +#define invalidBufPtr -23013 +#define invalidRDS -23014 +#define invalidWDS -23014 +#define openFailed -23015 +#define commandTimeout -23016 +#define duplicateSocket -23017 + +/* Error codes from internal IP functions */ +#define ipDontFragErr -23032 /* Packet too large to send w/o fragmenting */ +#define ipDestDeadErr -23033 /* destination not responding */ +#define ipNoFragMemErr -23036 /* no memory to send fragmented pkt */ +#define ipRouteErr -23037 /* can't route packet off-net */ + +#define nameSyntaxErr -23041 +#define cacheFault -23042 +#define noResultProc -23043 +#define noNameServer -23044 +#define authNameErr -23045 +#define noAnsErr -23046 +#define dnrErr -23047 +#define outOfMemory -23048 + diff --git a/src/WINNT/kfw/inc/krb4/com_err.h b/src/WINNT/kfw/inc/krb4/com_err.h new file mode 100644 index 000000000..1111d6348 --- /dev/null +++ b/src/WINNT/kfw/inc/krb4/com_err.h @@ -0,0 +1,56 @@ +/* + * HA HA HA HA!!!! THIS IS A COM_ERR SUBSTITUTE!!!! HA HA HA HA!!!! + */ + +#ifndef _DCNS_MIT_COM_ERR_H +#define _DCNS_MIT_COM_ERR_H + +#if defined(__cplusplus) +extern "C" +{ +#endif + +#include + +#if !defined(WINDOWS) && !defined(_WIN32) +#define FAR +#define LPSTR char * +#endif + +typedef LPSTR (*err_func)(int, long); + +#ifdef WIN16 +#define COMEXP __far __export +int COMEXP com_err_export (LPSTR, long, LPSTR, ...); +LPSTR COMEXP error_message_export (long); +LPSTR COMEXP error_table_name_export(long num); +extern int (*com_err) (LPSTR, long, LPSTR, ...); +int mbprintf (LPSTR, LPSTR, ...); +LPSTR (*error_message) (long); +int (*set_com_err_hook (int (*) (LPSTR, long, LPSTR, va_list))) + (LPSTR, long, LPSTR, va_list); +extern int (*reset_com_err_hook ()) (LPSTR, long, LPSTR, va_list); + +// extern LPSTR (*error_table_name)(long num); +LPSTR (*error_table_name)(long num); + +#else +#define COMEXP +int com_err (LPSTR, long, LPSTR, ...); +int mbprintf (LPSTR, LPSTR, ...); +LPSTR error_message (long); +int (*set_com_err_hook (int (*) (LPSTR, long, LPSTR, va_list))) + (LPSTR, long, LPSTR, va_list); +int (*reset_com_err_hook ()) (LPSTR, long, LPSTR, va_list); +LPSTR error_table_name(long num); + +#endif + + + +#if defined(__cplusplus) +} +#endif + +#endif // _DCNS_MIT_COM_ERR_H + diff --git a/src/WINNT/kfw/inc/krb4/conf-pc.h b/src/WINNT/kfw/inc/krb4/conf-pc.h new file mode 100644 index 000000000..043b6f859 --- /dev/null +++ b/src/WINNT/kfw/inc/krb4/conf-pc.h @@ -0,0 +1,108 @@ +/* + * Copyright 1988 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + * Machine-type definitions: IBM PC 8086 + */ + +#if defined(_WIN32) && !defined(WIN32) +#define WIN32 +#endif + +#if ( defined(WIN16) || defined(WIN32) || defined(_WINDOWS)) && !defined(WINDOWS) +#define WINDOWS +#endif + +#if defined(__OS2__) && !defined(OS2) +#define OS2 +#endif + +#ifdef WIN16 +#define BITS16 +#else +#ifdef MSDOS +#define BITS16 +#else +#define BITS32 +#endif +#endif +#define LSBFIRST + +#define index(s,c) strchr(s,c) /* PC version of index */ +#define rindex(s,c) strrchr(s,c) +#if !defined(OS2) && !defined(LWP) /* utils.h under OS/2 */ +#define bcmp(s1,s2,n) memcmp((s1),(s2),(n)) +#define bcopy(a,b,c) memcpy( (b), (a), (c) ) +#define bzero(a,b) memset( (a), 0, (b) ) +#endif + +typedef unsigned char u_char; +typedef unsigned long u_long; +typedef unsigned short u_short; +typedef unsigned int u_int; +#define NO_UIDGID_T + +#if !defined(WINDOWS) && !defined(DWORD) +typedef long DWORD; +#endif + +#if defined(PC)&&!defined(WINDOWS) +#ifndef LPSTR +typedef char *LPSTR; +typedef char *LPBYTE; +typedef char *CHARPTR; +typedef char *LPINT; +typedef unsigned int WORD; +#endif +#define LONG long +#define FAR +#define PASCAL +#define EXPORT +#endif + +#ifdef OS2 +#include +#define lstrcpy strcpy +#define lstrlen strlen +#define lstrcmp strcmp +#define lstrcpyn strncpy +#endif + +#ifdef WIN32 +#define _export +#endif + +#if defined(BITS32) +#define far +#define near +#endif + +#ifdef WINDOWS +#include +#endif + +#ifdef WIN32 +#include +#endif + +#ifdef WIN16 +#pragma message ( "WIN16 in " __FILE__ ) +#include +#include +#ifndef KRB_INT32 +#define KRB_INT32 long +#endif +#ifndef KRB_UINT32 +#define KRB_UINT32 unsigned KRB_INT32 +#endif +#endif + + +#define RANDOM_KRB_INT32_1 ((KRB_INT32) time(NULL)) +#define RANDOM_KRB_INT32_2 ((KRB_INT32) getpid()) +#define TIME_GMT_UNIXSEC unix_time_gmt_unixsec((unsigned KRB_INT32 *)0); +#ifndef MAXPATHLEN +#define MAXPATHLEN _MAX_PATH +#endif diff --git a/src/WINNT/kfw/inc/krb4/conf.h b/src/WINNT/kfw/inc/krb4/conf.h new file mode 100644 index 000000000..2e2a84cd6 --- /dev/null +++ b/src/WINNT/kfw/inc/krb4/conf.h @@ -0,0 +1,74 @@ +/* + * Copyright 1988 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + * Configuration info for operating system, hardware description, + * language implementation, C library, etc. + * + * This file should be included in (almost) every file in the Kerberos + * sources, and probably should *not* be needed outside of those + * sources. (How do we deal with /usr/include/des.h and + * /usr/include/krb.h?) + */ + +#ifndef _CONF_H_ +#define _CONF_H_ + +#include "osconf.h" + +#ifdef SHORTNAMES +#include "names.h" +#endif + +/* + * Language implementation-specific definitions + */ + +/* special cases */ +#ifdef __HIGHC__ +/* broken implementation of ANSI C */ +#undef __STDC__ +#endif + +#if !defined(__STDC__) && !defined(PC) +#define const +#define volatile +#define signed +typedef char *pointer; /* pointer to generic data */ +#ifndef PROTOTYPE +#define PROTOTYPE(p) () +#endif +#else +typedef void *pointer; +#ifndef PROTOTYPE +#define PROTOTYPE(p) p +#endif +#endif + +/* Does your compiler understand "void"? */ +#ifdef notdef +#define void int +#endif + +/* + * A few checks to see that necessary definitions are included. + */ + +#ifndef MSBFIRST +#ifndef LSBFIRST +#error byte order not defined +#endif +#endif + +/* machine size */ +#ifndef BITS16 +#ifndef BITS32 +#error number of bits? +#endif +#endif + +/* end of checks */ + +#endif /* _CONF_H_ */ diff --git a/src/WINNT/kfw/inc/krb4/des.h b/src/WINNT/kfw/inc/krb4/des.h new file mode 100644 index 000000000..2f30afa00 --- /dev/null +++ b/src/WINNT/kfw/inc/krb4/des.h @@ -0,0 +1,115 @@ +/* + * des.h + * + * Copyright 1987, 1988 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + * Include file for the Data Encryption Standard library. + */ + +/* only do the whole thing once */ +#ifndef DES_DEFS +#define DES_DEFS + +#include "mit_copy.h" +#include "conf.h" + +#ifndef KRB_INT32 +#define KRB_INT32 long +#endif +#ifndef KRB_UINT32 +#define KRB_UINT32 unsigned KRB_INT32 +#endif + +/* There are some declarations in the system-specific header files which + can't be done until KRB_INT32 is defined. So they are in a macro, + which we expand here if defined. */ + +#ifdef DECL_THAT_NEEDS_KRB_INT32 +DECL_THAT_NEEDS_KRB_INT32 +#endif + +typedef unsigned char des_cblock[8]; /* crypto-block size */ +/* Key schedule */ +typedef struct des_ks_struct { union { KRB_INT32 pad; des_cblock _;} __; } des_key_schedule[16]; + +#define DES_KEY_SZ (sizeof(des_cblock)) +#define DES_ENCRYPT 1 +#define DES_DECRYPT 0 + +#ifndef NCOMPAT +#define C_Block des_cblock +#define Key_schedule des_key_schedule +#define ENCRYPT DES_ENCRYPT +#define DECRYPT DES_DECRYPT +#define KEY_SZ DES_KEY_SZ +#define string_to_key des_string_to_key +#define read_pw_string des_read_pw_string +#define random_key des_random_key +#define pcbc_encrypt des_pcbc_encrypt +#define key_sched des_key_sched +#define cbc_encrypt des_cbc_encrypt +#define cbc_cksum des_cbc_cksum +#define C_Block_print des_cblock_print +#define quad_cksum des_quad_cksum +typedef struct des_ks_struct bit_64; +#endif + +#define des_cblock_print(x) des_cblock_print_file(x, stdout) + +/* Function declarations */ + +#define DES_CALLCONV_C + +extern unsigned long DES_CALLCONV_C +quad_cksum PROTOTYPE (( + unsigned char *in, /* input block */ + unsigned KRB_INT32 *out,/* optional longer output */ + long length, /* original length in bytes */ + int out_count, /* number of iterations */ + des_cblock *c_seed)); /* secret seed, 8 bytes */ + +int DES_CALLCONV_C +des_key_sched PROTOTYPE ((des_cblock FAR, des_key_schedule FAR)); + +int DES_CALLCONV_C +des_ecb_encrypt PROTOTYPE ((des_cblock FAR *, des_cblock FAR *, + des_key_schedule FAR, int)); + +int DES_CALLCONV_C +des_pcbc_encrypt PROTOTYPE ((des_cblock FAR *, des_cblock FAR *, long, + des_key_schedule FAR, des_cblock FAR *, int)); + +int DES_CALLCONV_C +des_is_weak_key PROTOTYPE ((des_cblock FAR)); + +void DES_CALLCONV_C +des_fixup_key_parity PROTOTYPE ((des_cblock FAR)); + +int DES_CALLCONV_C +des_check_key_parity PROTOTYPE ((des_cblock FAR)); + +/* + These random_key routines are made external here + for the Macintosh Driver which exports pointers to them + to applications via a driver level interface. + Preserved for KClient compatability. +*/ + +int DES_CALLCONV_C +des_new_random_key PROTOTYPE (( des_cblock )); + +void DES_CALLCONV_C +des_init_random_number_generator PROTOTYPE (( des_cblock )); + +void DES_CALLCONV_C +des_set_random_generator_seed PROTOTYPE (( des_cblock )); + +unsigned long DES_CALLCONV_C +des_cbc_cksum PROTOTYPE ((des_cblock *,des_cblock *,long,des_key_schedule,des_cblock)); + +/* FIXME, put the rest of the function declarations here */ + +#endif /* DES_DEFS */ diff --git a/src/WINNT/kfw/inc/krb4/kadm_err.h b/src/WINNT/kfw/inc/krb4/kadm_err.h new file mode 100644 index 000000000..8e65f9387 --- /dev/null +++ b/src/WINNT/kfw/inc/krb4/kadm_err.h @@ -0,0 +1,56 @@ +/* + * kadm_err.h + * This file is the #include file for kadm_err.et. + * Please do not edit it as it is automatically generated. + */ + +#define KADM_RCSID (-1783126272L) +#define KADM_NO_REALM (-1783126271L) +#define KADM_NO_CRED (-1783126270L) +#define KADM_BAD_KEY (-1783126269L) +#define KADM_NO_ENCRYPT (-1783126268L) +#define KADM_NO_AUTH (-1783126267L) +#define KADM_WRONG_REALM (-1783126266L) +#define KADM_NO_ROOM (-1783126265L) +#define KADM_BAD_VER (-1783126264L) +#define KADM_BAD_CHK (-1783126263L) +#define KADM_NO_READ (-1783126262L) +#define KADM_NO_OPCODE (-1783126261L) +#define KADM_NO_HOST (-1783126260L) +#define KADM_UNK_HOST (-1783126259L) +#define KADM_NO_SERV (-1783126258L) +#define KADM_NO_SOCK (-1783126257L) +#define KADM_NO_CONN (-1783126256L) +#define KADM_NO_HERE (-1783126255L) +#define KADM_NO_MAST (-1783126254L) +#define KADM_NO_VERI (-1783126253L) +#define KADM_INUSE (-1783126252L) +#define KADM_UK_SERROR (-1783126251L) +#define KADM_UK_RERROR (-1783126250L) +#define KADM_UNAUTH (-1783126249L) +#define KADM_DATA (-1783126248L) +#define KADM_NOENTRY (-1783126247L) +#define KADM_NOMEM (-1783126246L) +#define KADM_NO_HOSTNAME (-1783126245L) +#define KADM_NO_BIND (-1783126244L) +#define KADM_LENGTH_ERROR (-1783126243L) +#define KADM_ILL_WILDCARD (-1783126242L) +#define KADM_DB_INUSE (-1783126241L) +#define KADM_INSECURE_PW (-1783126240L) +#define KADM_PW_MISMATCH (-1783126239L) +#ifdef WINDOWS +extern void initialize_kadm_error_table(HANDLE *); +#else +extern void initialize_kadm_error_table(struct et_list **); +#endif +#define ERROR_TABLE_BASE_kadm (-1783126272L) + +/* for compatibility with older versions... */ +#define init_kadm_err_tbl() initialize_kadm_error_table(&_et_list) +#define kadm_err_base ERROR_TABLE_BASE_kadm + +#ifdef WINDOWS +extern HANDLE _et_list; +#else +extern struct et_list *_et_list; +#endif diff --git a/src/WINNT/kfw/inc/krb4/krb.h b/src/WINNT/kfw/inc/krb4/krb.h new file mode 100644 index 000000000..e1deac108 --- /dev/null +++ b/src/WINNT/kfw/inc/krb4/krb.h @@ -0,0 +1,455 @@ +/* + * Copyright 1987, 1988 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + * Include file for the Kerberos library. + */ + +/* Only one time, please */ +#ifndef KRB_DEFS +#define KRB_DEFS + +#include + +/* Need some defs from des.h */ +#include + +/* Text describing error codes */ +#define MAX_KRB_ERRORS 256 +extern char *krb_err_txt[MAX_KRB_ERRORS]; + +/* General definitions */ +#define KSUCCESS 0 +#define KFAILURE 255 + +#ifdef NO_UIDGID_T +typedef unsigned short uid_t; +typedef unsigned short gid_t; +#endif /* NO_UIDGID_T */ + +/* + * Kerberos specific definitions + * + * KRBLOG is the log file for the kerberos master server. KRB_CONF is + * the configuration file where different host machines running master + * and slave servers can be found. KRB_MASTER is the name of the + * machine with the master database. The admin_server runs on this + * machine, and all changes to the db (as opposed to read-only + * requests, which can go to slaves) must go to it. KRB_HOST is the + * default machine * when looking for a kerberos slave server. Other + * possibilities are * in the KRB_CONF file. KRB_REALM is the name of + * the realm. + */ + +#ifdef notdef +/* this is server - only, does not belong here; */ +#define KRBLOG "/kerberos/kerberos.log" +/* are these used anyplace? */ +#define VX_KRB_HSTFILE "/etc/krbhst" +#define PC_KRB_HSTFILE "\\kerberos\\krbhst" +#endif + +#ifdef PC + +#define KRB_CONF "krb.con" +#define KRB_RLM_TRANS "krbrealm.con" + +#else + +#define KRB_CONF "/etc/krb.conf" +#define KRB_RLM_TRANS "/etc/krb.realms" + +#endif /* PC */ + +/* Resources? XXX */ +#define KRB_MASTER "kerberos.mit.edu" +#define KRB_REALM "ATHENA.MIT.EDU" +#define KRB_HOST KRB_MASTER + +/* The maximum sizes for aname, realm, sname, and instance +1 */ +#define ANAME_SZ 40 +#define REALM_SZ 40 +#define SNAME_SZ 40 +#define INST_SZ 40 +#define ADDR_SZ 40 +/* include space for '.' and '@' */ +#define MAX_K_NAME_SZ (ANAME_SZ + INST_SZ + REALM_SZ + 2) +#define KKEY_SZ 100 +#define VERSION_SZ 1 +#define MSG_TYPE_SZ 1 +#define DATE_SZ 26 /* RTI date output */ + +#define MAX_HSTNM 100 + +#ifndef DEFAULT_TKT_LIFE /* allow compile-time override */ +#define DEFAULT_TKT_LIFE 120 /* default lifetime for krb_mk_req + & co., 10 hrs */ +#endif + +/* Definition of text structure used to pass text around */ +#define MAX_KTXT_LEN 1250 + +struct ktext { + int length; /* Length of the text */ + unsigned char dat[MAX_KTXT_LEN]; /* The data itself */ + unsigned long mbz; /* zero to catch runaway strings */ +}; + +typedef struct ktext far *KTEXT; +typedef struct ktext far *KTEXT_FP; +typedef struct ktext KTEXT_ST; + + +/* Definitions for send_to_kdc */ +#define CLIENT_KRB_TIMEOUT 10 /* time between retries */ /* changed from 4, 8-14-94 pbh */ +#define CLIENT_KRB_RETRY 5 /* retry this many times */ +#define CLIENT_KRB_BUFLEN 512 /* max unfragmented packet */ + +/* Definitions for ticket file utilities */ +#define R_TKT_FIL 0 +#define W_TKT_FIL 1 + +/* Definitions for cl_get_tgt */ +#ifdef PC +#define CL_GTGT_INIT_FILE "\\kerberos\\k_in_tkts" /* WTF??!? */ +#else +#define CL_GTGT_INIT_FILE "/etc/k_in_tkts" +#endif /* PC */ + +/* Parameters for rd_ap_req */ +/* Maximum alloable clock skew in seconds */ +#define CLOCK_SKEW 5*60 +/* Filename for readservkey */ +#define KEYFILE "/etc/srvtab" + +/* Structure definition for rd_ap_req */ + +struct auth_dat { + unsigned char k_flags; /* Flags from ticket */ + char pname[ANAME_SZ]; /* Principal's name */ + char pinst[INST_SZ]; /* His Instance */ + char prealm[REALM_SZ]; /* His Realm */ + unsigned long checksum; /* Data checksum (opt) */ + C_Block session; /* Session Key */ + int life; /* Life of ticket */ + unsigned long time_sec; /* Time ticket issued */ + unsigned long address; /* Address in ticket */ + KTEXT_ST reply; /* Auth reply (opt) */ +}; + +typedef struct auth_dat AUTH_DAT; + +/* Structure definition for credentials returned by get_cred */ + +struct credentials { + char service[ANAME_SZ]; /* Service name */ + char instance[INST_SZ]; /* Instance */ + char realm[REALM_SZ]; /* Auth domain */ + C_Block session; /* Session key */ + int lifetime; /* Lifetime */ + int kvno; /* Key version number */ + KTEXT_ST ticket_st; /* The ticket itself */ + long issue_date; /* The issue time */ + char pname[ANAME_SZ]; /* Principal's name */ + char pinst[INST_SZ]; /* Principal's instance */ + char address[ADDR_SZ]; /* IP Address in ticket */ +}; + +typedef struct credentials CREDENTIALS; + +/* Structure definition for rd_private_msg and rd_safe_msg */ + +struct msg_dat { + unsigned char far *app_data; /* pointer to appl data */ + unsigned long app_length; /* length of appl data */ + unsigned long hash; /* hash to lookup replay */ + int swap; /* swap bytes? */ + long time_sec; /* msg timestamp seconds */ + unsigned char time_5ms; /* msg timestamp 5ms units */ +}; + +typedef struct msg_dat MSG_DAT; + + +/* Location of ticket file for save_cred and get_cred */ +#define TKT_FILE tkt_string() + +#define TKT_ENV "KERBEROS_TICKETS" +typedef struct { + unsigned buf_size; + unsigned dummy; + unsigned eof_ptr; + int sema; /* semaphore 0 - OK, -1 - lock write, +ve lock read */ +} tkt_header; + +tkt_header far *tkt_ptr(void); + +#define KM_TKFILE 0 +#define KM_KRBMEM 1 + +#define TKT_ROOT "/tmp/tkt" + +/* Error codes returned from the KDC */ +#define KDC_OK 0 /* Request OK */ +#define KDC_NAME_EXP 1 /* Principal expired */ +#define KDC_SERVICE_EXP 2 /* Service expired */ +#define KDC_AUTH_EXP 3 /* Auth expired */ +#define KDC_PKT_VER 4 /* Protocol version unknown */ +#define KDC_P_MKEY_VER 5 /* Wrong master key version */ +#define KDC_S_MKEY_VER 6 /* Wrong master key version */ +#define KDC_BYTE_ORDER 7 /* Byte order unknown */ +#define KDC_PR_UNKNOWN 8 /* Principal unknown */ +#define KDC_PR_N_UNIQUE 9 /* Principal not unique */ +#define KDC_NULL_KEY 10 /* Principal has null key */ +#define KDC_GEN_ERR 20 /* Generic error from KDC */ + +/* Values returned by get_credentials */ +#define GC_OK 0 /* Retrieve OK */ +#define RET_OK 0 /* Retrieve OK */ +#define GC_TKFIL 21 /* Can't read ticket file */ +#define RET_TKFIL 21 /* Can't read ticket file */ +#define GC_NOTKT 22 /* Can't find ticket or TGT */ +#define RET_NOTKT 22 /* Can't find ticket or TGT */ + +/* Values returned by mk_ap_req */ +#define MK_AP_OK 0 /* Success */ +#define MK_AP_TGTEXP 26 /* TGT Expired */ + +/* Values returned by rd_ap_req */ +#define RD_AP_OK 0 /* Request authentic */ +#define RD_AP_UNDEC 31 /* Can't decode authenticator */ +#define RD_AP_EXP 32 /* Ticket expired */ +#define RD_AP_NYV 33 /* Ticket not yet valid */ +#define RD_AP_REPEAT 34 /* Repeated request */ +#define RD_AP_NOT_US 35 /* The ticket isn't for us */ +#define RD_AP_INCON 36 /* Request is inconsistent */ +#define RD_AP_TIME 37 /* delta_t too big */ +#define RD_AP_BADD 38 /* Incorrect net address */ +#define RD_AP_VERSION 39 /* protocol version mismatch */ +#define RD_AP_MSG_TYPE 40 /* invalid msg type */ +#define RD_AP_MODIFIED 41 /* message stream modified */ +#define RD_AP_ORDER 42 /* message out of order */ +#define RD_AP_UNAUTHOR 43 /* unauthorized request */ + +/* Values returned by get_pw_tkt */ +#define GT_PW_OK 0 /* Got password changing tkt */ +#define GT_PW_NULL 51 /* Current PW is null */ +#define GT_PW_BADPW 52 /* Incorrect current password */ +#define GT_PW_PROT 53 /* Protocol Error */ +#define GT_PW_KDCERR 54 /* Error returned by KDC */ +#define GT_PW_NULLTKT 55 /* Null tkt returned by KDC */ + +/* Values returned by send_to_kdc */ +#define SKDC_OK 0 /* Response received */ +#define SKDC_RETRY 56 /* Retry count exceeded */ +#define SKDC_CANT 57 /* Can't send request */ + +/* + * Values returned by get_intkt + * (can also return SKDC_* and KDC errors) + */ + +#define INTK_OK 0 /* Ticket obtained */ +#define INTK_PW_NULL 51 /* Current PW is null */ +#define INTK_W_NOTALL 61 /* Not ALL tickets returned */ +#define INTK_BADPW 62 /* Incorrect password */ +#define INTK_PROT 63 /* Protocol Error */ +#define INTK_ERR 70 /* Other error */ + +/* Values returned by get_adtkt */ +#define AD_OK 0 /* Ticket Obtained */ +#define AD_NOTGT 71 /* Don't have tgt */ + +/* Error codes returned by ticket file utilities */ +#define NO_TKT_FIL 76 /* No ticket file found */ +#define TKT_FIL_ACC 77 /* Couldn't access tkt file */ +#define TKT_FIL_LCK 78 /* Couldn't lock ticket file */ +#define TKT_FIL_FMT 79 /* Bad ticket file format */ +#define TKT_FIL_INI 80 /* tf_init not called first */ + +/* Error code returned by kparse_name */ +#define KNAME_FMT 81 /* Bad Kerberos name format */ + +/* Error code returned by krb_mk_safe */ +#define SAFE_PRIV_ERROR -1 /* syscall error */ + +/* + * macros for byte swapping; also scratch space + * u_quad 0-->7, 1-->6, 2-->5, 3-->4, 4-->3, 5-->2, 6-->1, 7-->0 + * u_long 0-->3, 1-->2, 2-->1, 3-->0 + * u_short 0-->1, 1-->0 + */ + +#define swap_u_16(x) {\ + unsigned long _krb_swap_tmp[4];\ + _swab(((char *) x) +0, ((char *) _krb_swap_tmp) +14 ,2); \ + _swab(((char *) x) +2, ((char *) _krb_swap_tmp) +12 ,2); \ + _swab(((char *) x) +4, ((char *) _krb_swap_tmp) +10 ,2); \ + _swab(((char *) x) +6, ((char *) _krb_swap_tmp) +8 ,2); \ + _swab(((char *) x) +8, ((char *) _krb_swap_tmp) +6 ,2); \ + _swab(((char *) x) +10,((char *) _krb_swap_tmp) +4 ,2); \ + _swab(((char *) x) +12,((char *) _krb_swap_tmp) +2 ,2); \ + _swab(((char *) x) +14,((char *) _krb_swap_tmp) +0 ,2); \ + bcopy((char *)_krb_swap_tmp,(char *)x,16);\ + } + +#define swap_u_12(x) {\ + unsigned long _krb_swap_tmp[4];\ + _swab(( char *) x, ((char *) _krb_swap_tmp) +10 ,2); \ + _swab(((char *) x) +2, ((char *) _krb_swap_tmp) +8 ,2); \ + _swab(((char *) x) +4, ((char *) _krb_swap_tmp) +6 ,2); \ + _swab(((char *) x) +6, ((char *) _krb_swap_tmp) +4 ,2); \ + _swab(((char *) x) +8, ((char *) _krb_swap_tmp) +2 ,2); \ + _swab(((char *) x) +10,((char *) _krb_swap_tmp) +0 ,2); \ + bcopy((char *)_krb_swap_tmp,(char *)x,12);\ + } + +#define swap_C_Block(x) {\ + unsigned long _krb_swap_tmp[4];\ + _swab(( char *) x, ((char *) _krb_swap_tmp) +6 ,2); \ + _swab(((char *) x) +2,((char *) _krb_swap_tmp) +4 ,2); \ + _swab(((char *) x) +4,((char *) _krb_swap_tmp) +2 ,2); \ + _swab(((char *) x) +6,((char *) _krb_swap_tmp) ,2); \ + bcopy((char *)_krb_swap_tmp,(char *)x,8);\ + } +#define swap_u_quad(x) {\ + unsigned long _krb_swap_tmp[4];\ + _swab(( char *) &x, ((char *) _krb_swap_tmp) +6 ,2); \ + _swab(((char *) &x) +2,((char *) _krb_swap_tmp) +4 ,2); \ + _swab(((char *) &x) +4,((char *) _krb_swap_tmp) +2 ,2); \ + _swab(((char *) &x) +6,((char *) _krb_swap_tmp) ,2); \ + bcopy((char *)_krb_swap_tmp,(char *)&x,8);\ + } + +#define swap_u_long(x) {\ + unsigned long _krb_swap_tmp[4];\ + _swab((char *) &x, ((char *) _krb_swap_tmp) +2 ,2); \ + _swab(((char *) &x) +2,((char *) _krb_swap_tmp),2); \ + x = _krb_swap_tmp[0]; \ + } + +#define swap_u_short(x) {\ + unsigned short _krb_swap_sh_tmp; \ + _swab((char *) &x, ( &_krb_swap_sh_tmp) ,2); \ + x = (unsigned short) _krb_swap_sh_tmp; \ + } + +/* Kerberos ticket flag field bit definitions */ +#define K_FLAG_ORDER 0 /* bit 0 --> lsb */ +#define K_FLAG_1 /* reserved */ +#define K_FLAG_2 /* reserved */ +#define K_FLAG_3 /* reserved */ +#define K_FLAG_4 /* reserved */ +#define K_FLAG_5 /* reserved */ +#define K_FLAG_6 /* reserved */ +#define K_FLAG_7 /* reserved, bit 7 --> msb */ + +#ifdef OLDNAMES +#define krb_mk_req mk_ap_req +#define krb_rd_req rd_ap_req +#define krb_kntoln an_to_ln +#define krb_set_key set_serv_key +#define krb_get_cred get_credentials +#define krb_mk_priv mk_private_msg +#define krb_rd_priv rd_private_msg +#define krb_mk_safe mk_safe_msg +#define krb_rd_safe rd_safe_msg +#define krb_mk_err mk_appl_err_msg +#define krb_rd_err rd_appl_err_msg +#define krb_ck_repl check_replay +#define krb_get_pw_in_tkt get_in_tkt +#define krb_get_svc_in_tkt get_svc_in_tkt +#define krb_get_pw_tkt get_pw_tkt +#define krb_realmofhost krb_getrealm +#define krb_get_phost get_phost +#define krb_get_krbhst get_krbhst +#define krb_get_lrealm get_krbrlm +#endif /* OLDNAMES */ + +#define decomp_ticket k_decomp_ticket +/* Defines for krb_sendauth and krb_recvauth */ + +#define KOPT_DONT_MK_REQ 0x00000001 /* don't call krb_mk_req */ +#define KOPT_DO_MUTUAL 0x00000002 /* do mutual auth */ + +#define KOPT_DONT_CANON 0x00000004 /* + * don't canonicalize inst as + * a hostname + */ + +#define KRB_SENDAUTH_VLEN 8 /* length for version strings */ + +#ifdef ATHENA_COMPAT +#define KOPT_DO_OLDSTYLE 0x00000008 /* use the old-style protocol */ +#endif /* ATHENA_COMPAT */ + +char *tkt_string(); + +int gettimeofday(struct timeval *tv, struct timezone *tz); + +int PASCAL krb_sendauth(long, int, KTEXT, char *, char *, char *, + unsigned long, MSG_DAT *, CREDENTIALS *, + Key_schedule *, struct sockaddr_in *, + struct sockaddr_in FAR *, char *); +int PASCAL krb_mk_req(KTEXT, char *, char *, char *, long); +char * PASCAL krb_getrealm(char *host); + +void tkt_free(tkt_header FAR* hdr); +int krb_get_tf_fullname(char FAR *, char FAR *, char FAR *, char FAR *); +int krb_get_tf_realm(char FAR *,char FAR *); +int tf_init(char FAR*,int); + +long LocalHostAddr(); +int tf_get_pname(char FAR*); +int tf_get_pinst(char FAR*); +int tf_get_cred(CREDENTIALS FAR*); +void tf_close(void); +int tf_save_cred(char FAR*,char FAR*,char FAR*,C_Block,int,int,KTEXT,long); +BOOL k_isinst(char FAR *s); +BOOL k_isrealm(char FAR *s); +BOOL k_isname(char FAR *s); + +char ** get_krb_err_txt(void); /* 2-22-93, pbh */ + +/* Warning, unique to Windows! */ +int set_krb_debug(int); +int set_krb_ap_req_debug(int); +char * PASCAL get_krb_err_txt_entry(int i); +char * krb_err_func(int offset, long code); +int PASCAL k_decomp_ticket(KTEXT, unsigned char *, char *, char *, char *, + unsigned long *, C_Block, int *, unsigned long *, + char *, char *, C_Block, Key_schedule); +int PASCAL krb_mk_req(KTEXT,char *,char *,char *,long); +char * PASCAL krb_getrealm(char *host); +char * PASCAL krb_realmofhost(char *host); +char * krb_get_phost(char *host); + +int kname_parse(char *, char *, char *, char *); +int krb_get_pw_in_tkt(char *, char *, char *, char *, char *, int, char *); +int dest_tkt(void); +int krb_get_lrealm(char *, int); + +int krb_use_kerbmem(); +int krb_check_tgt(); +int krb_check_serv(char *); + +int krb_get_cred(char *, char *, char *, CREDENTIALS *); +int send_to_kdc(KTEXT, KTEXT, char *); + +int create_ciph(KTEXT, C_Block, char *, char *, char *, unsigned long, int, + KTEXT, unsigned long, C_Block *); + +char *krb_get_krbconf2(char *, size_t *); +char *krb_get_krbrealm2(char *, size_t *); + +int krb_save_credentials(char *service, char *instance, char *realm, + C_Block session, int lifetime, int kvno, + KTEXT ticket, long issue_date); + +#define krb_get_err_text get_krb_err_txt_entry + +int krb_in_tkt(char *pname, char *pinst, char *prealm); + +#endif /* KRB_DEFS */ diff --git a/src/WINNT/kfw/inc/krb4/krberr.h b/src/WINNT/kfw/inc/krb4/krberr.h new file mode 100644 index 000000000..f946bb9b3 --- /dev/null +++ b/src/WINNT/kfw/inc/krb4/krberr.h @@ -0,0 +1,22 @@ +/* + * krberr.h + * This file is the #include file for krberr.et. + * Please do not edit it as it is automatically generated. + */ + +#ifdef WINDOWS +extern void initialize_krb_error_func(err_func func,HANDLE *); +#else +extern void initialize_krb_error_func(err_func func,struct et_list **); +#endif +#define ERROR_TABLE_BASE_krb (39525376L) + +/* for compatibility with older versions... */ +#define init_krb_err_func(erf) initialize_krb_error_func(erf,&_et_list) +#define krb_err_base ERROR_TABLE_BASE_krb + +#ifdef WINDOWS +extern HANDLE _et_list; +#else +extern struct et_list *_et_list; +#endif diff --git a/src/WINNT/kfw/inc/krb4/mit_copy.h b/src/WINNT/kfw/inc/krb4/mit_copy.h new file mode 100644 index 000000000..4fcb06b13 --- /dev/null +++ b/src/WINNT/kfw/inc/krb4/mit_copy.h @@ -0,0 +1,20 @@ +/* + Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 by the Massachusetts Institute of Technology + + Export of this software from the United States of America is assumed + to require a specific license from the United States Government. + It is the responsibility of any person or organization contemplating + export to obtain such a license before exporting. + +WITHIN THAT CONSTRAINT, permission to use, copy, modify, and +distribute this software and its documentation for any purpose and +without fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright notice and +this permission notice appear in supporting documentation, and that +the name of M.I.T. not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. M.I.T. makes no representations about the suitability of +this software for any purpose. It is provided "as is" without express +or implied warranty. + + */ diff --git a/src/WINNT/kfw/inc/krb4/osconf.h b/src/WINNT/kfw/inc/krb4/osconf.h new file mode 100644 index 000000000..340421e86 --- /dev/null +++ b/src/WINNT/kfw/inc/krb4/osconf.h @@ -0,0 +1,59 @@ +/* + * Copyright 1988 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + * Athena configuration. + */ + +#ifndef _OSCONF_H_ +#define _OSCONF_H_ + +#ifndef PC +#if defined(IBMPC) || defined(__MSDOS__) || defined(OS2) || defined(_MSDOS) || defined(_WIN32) +#define PC +#endif +#endif + +#ifdef tahoe +#include "conf-bsdtahoe.h" +#else /* !tahoe */ +#ifdef vax +#include "conf-bsdvax.h" +#else /* !vax */ +#if defined(mips) && defined(ultrix) +#include "conf-ultmips2.h" +#else /* !Ultrix MIPS-2 */ +#ifdef ibm032 +#include "conf-bsdibm032.h" +#else /* !ibm032 */ +#ifdef apollo +#include "conf-bsdapollo.h" +#else /* !apollo */ +#ifdef sun +#ifdef sparc +#include "conf-bsdsparc.h" +#else /* sun but not sparc */ +#ifdef i386 +#include "conf-bsd386i.h" +#else /* sun but not (sparc or 386i) */ +#include "conf-bsdm68k.h" +#endif /* i386 */ +#endif /* sparc */ +#else /* !sun */ +#ifdef pyr +#include "conf-pyr.h" +#else +#if defined(PC) || defined(__MSDOS__) || defined(OS2) || defined(_MSDOS) || defined(_WIN32) +#include "conf-pc.h" +#endif /* PC */ +#endif /* pyr */ +#endif /* sun */ +#endif /* apollo */ +#endif /* ibm032 */ +#endif /* mips */ +#endif /* vax */ +#endif /* tahoe */ + +#endif /* _OSCONF_H_ */ diff --git a/src/WINNT/kfw/inc/krb5/KerberosIV/des.h b/src/WINNT/kfw/inc/krb5/KerberosIV/des.h new file mode 100644 index 000000000..8655e1d8f --- /dev/null +++ b/src/WINNT/kfw/inc/krb5/KerberosIV/des.h @@ -0,0 +1,209 @@ +/* + * include/kerberosIV/des.h + * + * Copyright 1987, 1988, 1994, 2002 by the Massachusetts Institute of + * Technology. All Rights Reserved. + * + * Export of this software from the United States of America may + * require a specific license from the United States Government. + * It is the responsibility of any person or organization contemplating + * export to obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. Furthermore if you modify this software you must label + * your software as modified software and not distribute it in such a + * fashion that it might be confused with the original M.I.T. software. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + * + * Include file for the Data Encryption Standard library. + */ + +#if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__)) +# include +# if TARGET_RT_MAC_CFM +# error "Use KfM 4.0 SDK headers for CFM compilation." +# endif +#endif + +#ifdef __cplusplus +#ifndef KRBINT_BEGIN_DECLS +#define KRBINT_BEGIN_DECLS extern "C" { +#define KRBINT_END_DECLS } +#endif +#else +#define KRBINT_BEGIN_DECLS +#define KRBINT_END_DECLS +#endif + +#ifndef KRB5INT_DES_TYPES_DEFINED +#define KRB5INT_DES_TYPES_DEFINED + +#include + +KRBINT_BEGIN_DECLS + +#if TARGET_OS_MAC +# if defined(__MWERKS__) +# pragma import on +# endif +# pragma options align=mac68k +#endif + +#if UINT_MAX >= 0xFFFFFFFFUL +#define DES_INT32 int +#define DES_UINT32 unsigned int +#else +#define DES_INT32 long +#define DES_UINT32 unsigned long +#endif + +typedef unsigned char des_cblock[8]; /* crypto-block size */ +/* + * Key schedule. + * + * This used to be + * + * typedef struct des_ks_struct { + * union { DES_INT32 pad; des_cblock _;} __; + * } des_key_schedule[16]; + * + * but it would cause trouble if DES_INT32 were ever more than 4 + * bytes. The reason is that all the encryption functions cast it to + * (DES_INT32 *), and treat it as if it were DES_INT32[32]. If + * 2*sizeof(DES_INT32) is ever more than sizeof(des_cblock), the + * caller-allocated des_key_schedule will be overflowed by the key + * scheduling functions. We can't assume that every platform will + * have an exact 32-bit int, and nothing should be looking inside a + * des_key_schedule anyway. + */ +typedef struct des_ks_struct { DES_INT32 _[2]; } des_key_schedule[16]; + +#if TARGET_OS_MAC +# if defined(__MWERKS__) +# pragma enumsalwaysint reset +# pragma import reset +# endif +# pragma options align=reset +#endif + +KRBINT_END_DECLS + +#endif /* KRB5INT_DES_TYPES_DEFINED */ + +/* only do the whole thing once */ +#ifndef DES_DEFS +/* + * lib/crypto/des/des_int.h defines KRB5INT_CRYPTO_DES_INT temporarily + * to avoid including the defintions and declarations below. The + * reason that the crypto library needs to include this file is that + * it needs to have its types aligned with krb4's types. + */ +#ifndef KRB5INT_CRYPTO_DES_INT +#define DES_DEFS + +#if defined(_WIN32) +#ifndef KRB4 +#define KRB4 1 +#endif +#include +#endif +#include /* need FILE for des_cblock_print_file */ + +KRBINT_BEGIN_DECLS + +#if TARGET_OS_MAC +# if defined(__MWERKS__) +# pragma import on +# pragma enumsalwaysint on +# endif +# pragma options align=mac68k +#endif + +/* Windows declarations */ +#ifndef KRB5_CALLCONV +#define KRB5_CALLCONV +#define KRB5_CALLCONV_C +#endif + +#define DES_KEY_SZ (sizeof(des_cblock)) +#define DES_ENCRYPT 1 +#define DES_DECRYPT 0 + +#ifndef NCOMPAT +#define C_Block des_cblock +#define Key_schedule des_key_schedule +#define ENCRYPT DES_ENCRYPT +#define DECRYPT DES_DECRYPT +#define KEY_SZ DES_KEY_SZ +#define string_to_key des_string_to_key +#define read_pw_string des_read_pw_string +#define random_key des_random_key +#define pcbc_encrypt des_pcbc_encrypt +#define key_sched des_key_sched +#define cbc_encrypt des_cbc_encrypt +#define cbc_cksum des_cbc_cksum +#define C_Block_print des_cblock_print +#define quad_cksum des_quad_cksum +typedef struct des_ks_struct bit_64; +#endif + +#define des_cblock_print(x) des_cblock_print_file(x, stdout) + +/* + * Function Prototypes + */ + +int KRB5_CALLCONV des_key_sched (C_Block, Key_schedule); + +int KRB5_CALLCONV +des_pcbc_encrypt (C_Block *in, C_Block *out, long length, + const des_key_schedule schedule, C_Block *ivec, + int enc); + +unsigned long KRB5_CALLCONV +des_quad_cksum (const unsigned char *in, unsigned DES_INT32 *out, + long length, int out_count, C_Block *seed); +/* + * XXX ABI change: used to return void; also, cns/kfm have signed long + * instead of unsigned long length. + */ +unsigned long KRB5_CALLCONV +des_cbc_cksum(const des_cblock *, des_cblock *, unsigned long, + const des_key_schedule, const des_cblock *); +int KRB5_CALLCONV des_string_to_key (const char *, C_Block); +void afs_string_to_key(char *, char *, des_cblock); + +/* XXX ABI change: used to return krb5_error_code */ +int KRB5_CALLCONV des_read_password(des_cblock *, char *, int); +int KRB5_CALLCONV des_ecb_encrypt(des_cblock *, des_cblock *, + const des_key_schedule, int); +/* XXX kfm/cns have signed long length */ +int des_cbc_encrypt(des_cblock *, des_cblock *, unsigned long, + const des_key_schedule, const des_cblock *, int); +void des_fixup_key_parity(des_cblock); +int des_check_key_parity(des_cblock); +int KRB5_CALLCONV des_new_random_key(des_cblock); +void des_init_random_number_generator(des_cblock); +int des_random_key(des_cblock *); +int des_is_weak_key(des_cblock); +void des_cblock_print_file(des_cblock *, FILE *fp); + +#if TARGET_OS_MAC +# if defined(__MWERKS__) +# pragma import reset +# endif +# pragma options align=reset +#endif + +KRBINT_END_DECLS + +#endif /* KRB5INT_CRYPTO_DES_INT */ +#endif /* DES_DEFS */ diff --git a/src/WINNT/kfw/inc/krb5/KerberosIV/kadm_err.h b/src/WINNT/kfw/inc/krb5/KerberosIV/kadm_err.h new file mode 100644 index 000000000..8d10bf5e1 --- /dev/null +++ b/src/WINNT/kfw/inc/krb5/KerberosIV/kadm_err.h @@ -0,0 +1,58 @@ +/* + * include//kerberosIV/kadm_err.h: + * This file is automatically generated; please do not edit it. + */ + +#include + +#define KADM_RCSID (-1783126272L) +#define KADM_NO_REALM (-1783126271L) +#define KADM_NO_CRED (-1783126270L) +#define KADM_BAD_KEY (-1783126269L) +#define KADM_NO_ENCRYPT (-1783126268L) +#define KADM_NO_AUTH (-1783126267L) +#define KADM_WRONG_REALM (-1783126266L) +#define KADM_NO_ROOM (-1783126265L) +#define KADM_BAD_VER (-1783126264L) +#define KADM_BAD_CHK (-1783126263L) +#define KADM_NO_READ (-1783126262L) +#define KADM_NO_OPCODE (-1783126261L) +#define KADM_NO_HOST (-1783126260L) +#define KADM_UNK_HOST (-1783126259L) +#define KADM_NO_SERV (-1783126258L) +#define KADM_NO_SOCK (-1783126257L) +#define KADM_NO_CONN (-1783126256L) +#define KADM_NO_HERE (-1783126255L) +#define KADM_NO_MAST (-1783126254L) +#define KADM_NO_VERI (-1783126253L) +#define KADM_INUSE (-1783126252L) +#define KADM_UK_SERROR (-1783126251L) +#define KADM_UK_RERROR (-1783126250L) +#define KADM_UNAUTH (-1783126249L) +#define KADM_DATA (-1783126248L) +#define KADM_NOENTRY (-1783126247L) +#define KADM_NOMEM (-1783126246L) +#define KADM_NO_HOSTNAME (-1783126245L) +#define KADM_NO_BIND (-1783126244L) +#define KADM_LENGTH_ERROR (-1783126243L) +#define KADM_ILL_WILDCARD (-1783126242L) +#define KADM_DB_INUSE (-1783126241L) +#define KADM_INSECURE_PW (-1783126240L) +#define KADM_PW_MISMATCH (-1783126239L) +#define KADM_NOT_SERV_PRINC (-1783126238L) +#define KADM_REALM_TOO_LONG (-1783126237L) +#define ERROR_TABLE_BASE_kadm (-1783126272L) + +extern const struct error_table et_kadm_error_table; + +#if !defined(_WIN32) +/* for compatibility with older versions... */ +extern void initialize_kadm_error_table () /*@modifies internalState@*/; +#else +#define initialize_kadm_error_table() +#endif + +#if !defined(_WIN32) +#define init_kadm_err_tbl initialize_kadm_error_table +#define kadm_err_base ERROR_TABLE_BASE_kadm +#endif diff --git a/src/WINNT/kfw/inc/krb5/KerberosIV/krb.h b/src/WINNT/kfw/inc/krb5/KerberosIV/krb.h new file mode 100644 index 000000000..a79df13b6 --- /dev/null +++ b/src/WINNT/kfw/inc/krb5/KerberosIV/krb.h @@ -0,0 +1,794 @@ +/* + * include/kerberosIV/krb.h + * + * Copyright 1987, 1988, 1994, 2001, 2002 by the Massachusetts + * Institute of Technology. All Rights Reserved. + * + * Export of this software from the United States of America may + * require a specific license from the United States Government. + * It is the responsibility of any person or organization contemplating + * export to obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. Furthermore if you modify this software you must label + * your software as modified software and not distribute it in such a + * fashion that it might be confused with the original M.I.T. software. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + * + * Include file for the Kerberos V4 library. + */ + +/* Only one time, please */ +#ifndef KRB_DEFS +#define KRB_DEFS + +/* + * For MacOS, don't expose prototypes of various private functions. + * Unfortuantely, they've leaked out everywhere else. + */ +#if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__)) +# include +# if TARGET_RT_MAC_CFM +# error "Use KfM 4.0 SDK headers for CFM compilation." +# endif +# ifndef KRB_PRIVATE +# define KRB_PRIVATE 0 +# endif +#else +# ifndef KRB_PRIVATE +# define KRB_PRIVATE 1 +# endif +#endif + +/* Define u_char, u_short, u_int, and u_long. */ +/* XXX these typdef names are not standardized! */ +#include + +/* Need some defs from des.h */ +#include +#include +#include + +#ifdef _WIN32 +#include +#endif /* _WIN32 */ + +#ifdef __cplusplus +#ifndef KRBINT_BEGIN_DECLS +#define KRBINT_BEGIN_DECLS extern "C" { +#define KRBINT_END_DECLS } +#endif +#else +#define KRBINT_BEGIN_DECLS +#define KRBINT_END_DECLS +#endif +KRBINT_BEGIN_DECLS + +#if TARGET_OS_MAC +# if defined(__MWERKS__) +# pragma import on +# pragma enumsalwaysint on +# endif +# pragma options align=mac68k +#endif + +#define KRB4_32 DES_INT32 +#define KRB_INT32 DES_INT32 +#define KRB_UINT32 DES_UINT32 + +#define MAX_KRB_ERRORS 256 + +#if TARGET_OS_MAC +/* ABI divergence on Mac for backwards compatibility. */ +extern const char * const * const krb_err_txt; +#else +extern const char * const krb_err_txt[MAX_KRB_ERRORS]; +#endif + +/* General definitions */ +#define KSUCCESS 0 +#define KFAILURE 255 + +/* + * Kerberos specific definitions + * + * KRBLOG is the log file for the kerberos master server. KRB_CONF is + * the configuration file where different host machines running master + * and slave servers can be found. KRB_MASTER is the name of the + * machine with the master database. The admin_server runs on this + * machine, and all changes to the db (as opposed to read-only + * requests, which can go to slaves) must go to it. KRB_HOST is the + * default machine * when looking for a kerberos slave server. Other + * possibilities are * in the KRB_CONF file. KRB_REALM is the name of + * the realm. + */ + +#define KRB_CONF "/etc/krb.conf" +#define KRB_RLM_TRANS "/etc/krb.realms" +#define KRB_MASTER "kerberos" +#define KRB_HOST KRB_MASTER +#define KRB_REALM "ATHENA.MIT.EDU" + +/* The maximum sizes for aname, realm, sname, and instance +1 */ +#define ANAME_SZ 40 +#define REALM_SZ 40 +#define SNAME_SZ 40 +#define INST_SZ 40 +#define ADDR_SZ 40 +/* + * NB: This overcounts due to NULs. + */ +/* include space for '.' and '@' */ +#define MAX_K_NAME_SZ (ANAME_SZ + INST_SZ + REALM_SZ + 2) +#define KKEY_SZ 100 +#define VERSION_SZ 1 +#define MSG_TYPE_SZ 1 +#define DATE_SZ 26 /* RTI date output */ + +#define MAX_HSTNM 100 + +#ifndef DEFAULT_TKT_LIFE /* allow compile-time override */ +#define DEFAULT_TKT_LIFE 120 /* default lifetime for krb_mk_req */ +#endif + +#define KRB_TICKET_GRANTING_TICKET "krbtgt" + +/* Definition of text structure used to pass text around */ +#define MAX_KTXT_LEN 1250 + +struct ktext { + int length; /* Length of the text */ + unsigned char dat[MAX_KTXT_LEN]; /* The data itself */ + unsigned long mbz; /* zero to catch runaway strings */ +}; + +typedef struct ktext *KTEXT; +typedef struct ktext KTEXT_ST; + + +/* Definitions for send_to_kdc */ +#define CLIENT_KRB_TIMEOUT 4 /* time between retries */ +#define CLIENT_KRB_RETRY 5 /* retry this many times */ +#define CLIENT_KRB_BUFLEN 512 /* max unfragmented packet */ + +/* Definitions for ticket file utilities */ +#define R_TKT_FIL 0 +#define W_TKT_FIL 1 + +/* Definitions for cl_get_tgt */ +#ifdef PC +#define CL_GTGT_INIT_FILE "\\kerberos\\k_in_tkts" +#else +#define CL_GTGT_INIT_FILE "/etc/k_in_tkts" +#endif /* PC */ + +/* Parameters for rd_ap_req */ +/* Maximum allowable clock skew in seconds */ +#define CLOCK_SKEW 5*60 +/* Filename for readservkey */ +#define KEYFILE ((char*)krb__get_srvtabname("/etc/srvtab")) + +/* Structure definition for rd_ap_req */ + +struct auth_dat { + unsigned char k_flags; /* Flags from ticket */ + char pname[ANAME_SZ]; /* Principal's name */ + char pinst[INST_SZ]; /* His Instance */ + char prealm[REALM_SZ]; /* His Realm */ + unsigned KRB4_32 checksum; /* Data checksum (opt) */ + C_Block session; /* Session Key */ + int life; /* Life of ticket */ + unsigned KRB4_32 time_sec; /* Time ticket issued */ + unsigned KRB4_32 address; /* Address in ticket */ + KTEXT_ST reply; /* Auth reply (opt) */ +}; + +typedef struct auth_dat AUTH_DAT; + +/* Structure definition for credentials returned by get_cred */ + +struct credentials { + char service[ANAME_SZ]; /* Service name */ + char instance[INST_SZ]; /* Instance */ + char realm[REALM_SZ]; /* Auth domain */ + C_Block session; /* Session key */ + int lifetime; /* Lifetime */ + int kvno; /* Key version number */ + KTEXT_ST ticket_st; /* The ticket itself */ + KRB4_32 issue_date; /* The issue time */ + char pname[ANAME_SZ]; /* Principal's name */ + char pinst[INST_SZ]; /* Principal's instance */ +#if TARGET_OS_MAC + KRB_UINT32 address; /* Address in ticket */ + KRB_UINT32 stk_type; /* string_to_key function needed */ +#endif +#ifdef _WIN32 + char address[ADDR_SZ]; /* Address in ticket */ +#endif +}; + +typedef struct credentials CREDENTIALS; + +/* Structure definition for rd_private_msg and rd_safe_msg */ + +struct msg_dat { + unsigned char *app_data; /* pointer to appl data */ + unsigned KRB4_32 app_length; /* length of appl data */ + unsigned KRB4_32 hash; /* hash to lookup replay */ + int swap; /* swap bytes? */ + KRB4_32 time_sec; /* msg timestamp seconds */ + unsigned char time_5ms; /* msg timestamp 5ms units */ +}; + +typedef struct msg_dat MSG_DAT; + + +/* Location of ticket file for save_cred and get_cred */ +#ifdef _WIN32 +#define TKT_FILE "\\kerberos\\ticket.ses" +#else +#define TKT_FILE tkt_string() +#define TKT_ROOT "/tmp/tkt" +#endif /* _WIN32 */ + +/* + * Error codes are now defined as offsets from com_err (krb_err.et) + * values. + */ +#define KRB_ET(x) ((KRBET_ ## x) - ERROR_TABLE_BASE_krb) + +/* Error codes returned from the KDC */ +#define KDC_OK KRB_ET(KSUCCESS) /* 0 - Request OK */ +#define KDC_NAME_EXP KRB_ET(KDC_NAME_EXP) /* 1 - Principal expired */ +#define KDC_SERVICE_EXP KRB_ET(KDC_SERVICE_EXP) /* 2 - Service expired */ +#define KDC_AUTH_EXP KRB_ET(KDC_AUTH_EXP) /* 3 - Auth expired */ +#define KDC_PKT_VER KRB_ET(KDC_PKT_VER) /* 4 - Prot version unknown */ +#define KDC_P_MKEY_VER KRB_ET(KDC_P_MKEY_VER) /* 5 - Wrong mkey version */ +#define KDC_S_MKEY_VER KRB_ET(KDC_S_MKEY_VER) /* 6 - Wrong mkey version */ +#define KDC_BYTE_ORDER KRB_ET(KDC_BYTE_ORDER) /* 7 - Byte order unknown */ +#define KDC_PR_UNKNOWN KRB_ET(KDC_PR_UNKNOWN) /* 8 - Princ unknown */ +#define KDC_PR_N_UNIQUE KRB_ET(KDC_PR_N_UNIQUE) /* 9 - Princ not unique */ +#define KDC_NULL_KEY KRB_ET(KDC_NULL_KEY) /* 10 - Princ has null key */ +#define KDC_GEN_ERR KRB_ET(KDC_GEN_ERR) /* 20 - Generic err frm KDC */ + +/* Values returned by get_credentials */ +#define GC_OK KRB_ET(KSUCCESS) /* 0 - Retrieve OK */ +#define RET_OK KRB_ET(KSUCCESS) /* 0 - Retrieve OK */ +#define GC_TKFIL KRB_ET(GC_TKFIL) /* 21 - Can't rd tkt file */ +#define RET_TKFIL KRB_ET(GC_TKFIL) /* 21 - Can't rd tkt file */ +#define GC_NOTKT KRB_ET(GC_NOTKT) /* 22 - Can't find tkt|TGT */ +#define RET_NOTKT KRB_ET(GC_NOTKT) /* 22 - Can't find tkt|TGT */ + +/* Values returned by mk_ap_req */ +#define MK_AP_OK KRB_ET(KSUCCESS) /* 0 - Success */ +#define MK_AP_TGTEXP KRB_ET(MK_AP_TGTEXP) /* 26 - TGT Expired */ + +/* Values returned by rd_ap_req */ +#define RD_AP_OK KRB_ET(KSUCCESS) /* 0 - Request authentic */ +#define RD_AP_UNDEC KRB_ET(RD_AP_UNDEC) /* 31 - Can't decode authent */ +#define RD_AP_EXP KRB_ET(RD_AP_EXP) /* 32 - Ticket expired */ +#define RD_AP_NYV KRB_ET(RD_AP_NYV) /* 33 - Ticket not yet valid */ +#define RD_AP_REPEAT KRB_ET(RD_AP_REPEAT) /* 34 - Repeated request */ +#define RD_AP_NOT_US KRB_ET(RD_AP_NOT_US) /* 35 - Ticket isn't for us */ +#define RD_AP_INCON KRB_ET(RD_AP_INCON) /* 36 - Request inconsistent */ +#define RD_AP_TIME KRB_ET(RD_AP_TIME) /* 37 - delta_t too big */ +#define RD_AP_BADD KRB_ET(RD_AP_BADD) /* 38 - Incorrect net addr */ +#define RD_AP_VERSION KRB_ET(RD_AP_VERSION) /* 39 - prot vers mismatch */ +#define RD_AP_MSG_TYPE KRB_ET(RD_AP_MSG_TYPE) /* 40 - invalid msg type */ +#define RD_AP_MODIFIED KRB_ET(RD_AP_MODIFIED) /* 41 - msg stream modified */ +#define RD_AP_ORDER KRB_ET(RD_AP_ORDER) /* 42 - message out of order */ +#define RD_AP_UNAUTHOR KRB_ET(RD_AP_UNAUTHOR) /* 43 - unauthorized request */ + +/* Values returned by get_pw_tkt */ +#define GT_PW_OK KRB_ET(KSUCCESS) /* 0 - Got passwd chg tkt */ +#define GT_PW_NULL KRB_ET(GT_PW_NULL) /* 51 - Current PW is null */ +#define GT_PW_BADPW KRB_ET(GT_PW_BADPW) /* 52 - Wrong passwd */ +#define GT_PW_PROT KRB_ET(GT_PW_PROT) /* 53 - Protocol Error */ +#define GT_PW_KDCERR KRB_ET(GT_PW_KDCERR) /* 54 - Error ret by KDC */ +#define GT_PW_NULLTKT KRB_ET(GT_PW_NULLTKT) /* 55 - Null tkt ret by KDC */ + +/* Values returned by send_to_kdc */ +#define SKDC_OK KRB_ET(KSUCCESS) /* 0 - Response received */ +#define SKDC_RETRY KRB_ET(SKDC_RETRY) /* 56 - Retry count exceeded */ +#define SKDC_CANT KRB_ET(SKDC_CANT) /* 57 - Can't send request */ + +/* + * Values returned by get_intkt + * (can also return SKDC_* and KDC errors) + */ + +#define INTK_OK KRB_ET(KSUCCESS) /* 0 - Ticket obtained */ +#define INTK_PW_NULL KRB_ET(GT_PW_NULL) /* 51 - Current PW is null */ +#define INTK_W_NOTALL KRB_ET(INTK_W_NOTALL) /* 61 - Not ALL tkts retd */ +#define INTK_BADPW KRB_ET(INTK_BADPW) /* 62 - Incorrect password */ +#define INTK_PROT KRB_ET(INTK_PROT) /* 63 - Protocol Error */ +#define INTK_ERR KRB_ET(INTK_ERR) /* 70 - Other error */ + +/* Values returned by get_adtkt */ +#define AD_OK KRB_ET(KSUCCESS) /* 0 - Ticket Obtained */ +#define AD_NOTGT KRB_ET(AD_NOTGT) /* 71 - Don't have tgt */ + +/* Error codes returned by ticket file utilities */ +#define NO_TKT_FIL KRB_ET(NO_TKT_FIL) /* 76 - No ticket file found */ +#define TKT_FIL_ACC KRB_ET(TKT_FIL_ACC) /* 77 - Can't acc tktfile */ +#define TKT_FIL_LCK KRB_ET(TKT_FIL_LCK) /* 78 - Can't lck tkt file */ +#define TKT_FIL_FMT KRB_ET(TKT_FIL_FMT) /* 79 - Bad tkt file format */ +#define TKT_FIL_INI KRB_ET(TKT_FIL_INI) /* 80 - tf_init not called */ + +/* Error code returned by kparse_name */ +#define KNAME_FMT KRB_ET(KNAME_FMT) /* 81 - Bad krb name fmt */ + +/* Error code returned by krb_mk_safe */ +#define SAFE_PRIV_ERROR (-1) /* syscall error */ + +/* Kerberos ticket flag field bit definitions */ +#define K_FLAG_ORDER 0 /* bit 0 --> lsb */ +#define K_FLAG_1 /* reserved */ +#define K_FLAG_2 /* reserved */ +#define K_FLAG_3 /* reserved */ +#define K_FLAG_4 /* reserved */ +#define K_FLAG_5 /* reserved */ +#define K_FLAG_6 /* reserved */ +#define K_FLAG_7 /* reserved, bit 7 --> msb */ + +/* Are these needed anymore? */ +#ifdef OLDNAMES +#define krb_mk_req mk_ap_req +#define krb_rd_req rd_ap_req +#define krb_kntoln an_to_ln +#define krb_set_key set_serv_key +#define krb_get_cred get_credentials +#define krb_mk_priv mk_private_msg +#define krb_rd_priv rd_private_msg +#define krb_mk_safe mk_safe_msg +#define krb_rd_safe rd_safe_msg +#define krb_mk_err mk_appl_err_msg +#define krb_rd_err rd_appl_err_msg +#define krb_ck_repl check_replay +#define krb_get_pw_in_tkt get_in_tkt +#define krb_get_svc_in_tkt get_svc_in_tkt +#define krb_get_pw_tkt get_pw_tkt +#define krb_realmofhost krb_getrealm +#define krb_get_phost get_phost +#define krb_get_krbhst get_krbhst +#define krb_get_lrealm get_krbrlm +#endif /* OLDNAMES */ + +/* Defines for krb_sendauth and krb_recvauth */ + +#define KOPT_DONT_MK_REQ 0x00000001 /* don't call krb_mk_req */ +#define KOPT_DO_MUTUAL 0x00000002 /* do mutual auth */ +#define KOPT_DONT_CANON 0x00000004 /* don't canonicalize inst as a host */ + +#define KRB_SENDAUTH_VLEN 8 /* length for version strings */ + +#ifdef ATHENA_COMPAT +#define KOPT_DO_OLDSTYLE 0x00000008 /* use the old-style protocol */ +#endif /* ATHENA_COMPAT */ + + +#ifdef _WIN32 +#define TIME_GMT_UNIXSEC win_time_gmt_unixsec((unsigned KRB4_32 *)0) +#define TIME_GMT_UNIXSEC_US(us) win_time_gmt_unixsec((us)) +#define CONVERT_TIME_EPOCH win_time_get_epoch() +#else +/* until we do V4 compat under DOS, just turn this off */ +#define _fmemcpy memcpy +#define _fstrncpy strncpy +#define far_fputs fputs +/* and likewise, just drag in the unix time interface */ +#define TIME_GMT_UNIXSEC unix_time_gmt_unixsec((unsigned KRB4_32 *)0) +#define TIME_GMT_UNIXSEC_US(us) unix_time_gmt_unixsec((us)) +#define CONVERT_TIME_EPOCH ((long)0) /* Unix epoch is Krb epoch */ +#endif /* _WIN32 */ + +/* Constants for KerberosProfileLib */ +#define REALMS_V4_PROF_REALMS_SECTION "v4 realms" +#define REALMS_V4_PROF_KDC "kdc" +#define REALMS_V4_PROF_ADMIN_KDC "admin_server" +#define REALMS_V4_PROF_KPASSWD_KDC "kpasswd_server" +#define REALMS_V4_PROF_DOMAIN_SECTION "v4 domain_realm" +#define REALMS_V4_PROF_LIBDEFAULTS_SECTION "libdefaults" +#define REALMS_V4_PROF_LOCAL_REALM "default_realm" +#define REALMS_V4_PROF_STK "string_to_key_type" +#define REALMS_V4_MIT_STK "mit_string_to_key" +#define REALMS_V4_AFS_STK "afs_string_to_key" +#define REALMS_V4_COLUMBIA_STK "columbia_string_to_key" +#define REALMS_V4_DEFAULT_REALM "default_realm" +#define REALMS_V4_NO_ADDRESSES "noaddresses" + +/* ask to disable IP address checking in the library */ +extern int krb_ignore_ip_address; + +/* Debugging printfs shouldn't even be compiled on many systems that don't + support printf! Use it like DEB (("Oops - %s\n", string)); */ + +#ifdef DEBUG +#define DEB(x) if (krb_debug) printf x +extern int krb_debug; +#else +#define DEB(x) /* nothing */ +#endif + +/* Define a couple of function types including parameters. These + are needed on MS-Windows to convert arguments of the function pointers + to the proper types during calls. */ + +typedef int (KRB5_CALLCONV *key_proc_type) + (char *, char *, char *, + char *, C_Block); +#define KEY_PROC_TYPE_DEFINED + +typedef int (KRB5_CALLCONV *decrypt_tkt_type) + (char *, char *, char *, + char *, key_proc_type, KTEXT *); +#define DECRYPT_TKT_TYPE_DEFINED + +extern struct _krb5_context * krb5__krb4_context; + +/* + * Function Prototypes for Kerberos V4. + */ + +struct sockaddr_in; + +/* dest_tkt.c */ +int KRB5_CALLCONV dest_tkt + (void); +/* err_txt.c */ +const char * KRB5_CALLCONV krb_get_err_text + (int errnum); +/* g_ad_tkt.c */ +/* Previously not KRB5_CALLCONV */ +int KRB5_CALLCONV get_ad_tkt + (char *service, char *sinst, char *realm, int lifetime); +/* g_admhst.c */ +int KRB5_CALLCONV krb_get_admhst + (char *host, char *realm, int idx); +/* g_cred.c */ +int KRB5_CALLCONV krb_get_cred + (char *service, char *instance, char *realm, + CREDENTIALS *c); +/* g_in_tkt.c */ +/* Previously not KRB5_CALLCONV */ +int KRB5_CALLCONV krb_get_in_tkt + (char *k_user, char *instance, char *realm, + char *service, char *sinst, int life, + key_proc_type, decrypt_tkt_type, char *arg); +#if KRB_PRIVATE +/* Previously not KRB5_CALLCONV */ +int KRB5_CALLCONV krb_get_in_tkt_preauth + (char *k_user, char *instance, char *realm, + char *service, char *sinst, int life, + key_proc_type, decrypt_tkt_type, char *arg, + char *preauth_p, int preauth_len); +#endif +/* From KfM */ +int KRB5_CALLCONV krb_get_in_tkt_creds(char *, char *, char *, char *, char *, + int, key_proc_type, decrypt_tkt_type, char *, CREDENTIALS *); + +/* g_krbhst.c */ +int KRB5_CALLCONV krb_get_krbhst + (char *host, const char *realm, int idx); +/* g_krbrlm.c */ +int KRB5_CALLCONV krb_get_lrealm + (char *realm, int idx); +/* g_phost.c */ +char * KRB5_CALLCONV krb_get_phost + (char * alias); +/* get_pw_tkt */ +int KRB5_CALLCONV get_pw_tkt + (char *, char *, char *, char *); +/* g_pw_in_tkt.c */ +int KRB5_CALLCONV krb_get_pw_in_tkt + (char *k_user, char *instance, char *realm, + char *service, char *sinstance, + int life, char *password); +#if KRB_PRIVATE +int KRB5_CALLCONV krb_get_pw_in_tkt_preauth + (char *k_user, char *instance, char *realm, + char *service, char *sinstance, + int life, char *password); +#endif +int KRB5_CALLCONV +krb_get_pw_in_tkt_creds(char *, char *, char *, + char *, char *, int, char *, CREDENTIALS *); + +/* g_svc_in_tkt.c */ +int KRB5_CALLCONV krb_get_svc_in_tkt + (char *k_user, char *instance, char *realm, + char *service, char *sinstance, + int life, char *srvtab); + +/* g_tf_fname.c */ +int KRB5_CALLCONV krb_get_tf_fullname + (const char *ticket_file, char *name, char *inst, char *realm); +/* g_tf_realm.c */ +int KRB5_CALLCONV krb_get_tf_realm + (const char *ticket_file, char *realm); +/* g_tkt_svc.c */ +int KRB5_CALLCONV krb_get_ticket_for_service + (char *serviceName, + char *buf, unsigned KRB4_32 *buflen, + int checksum, des_cblock, Key_schedule, + char *version, int includeVersion); +#if KRB_PRIVATE +/* in_tkt.c */ +int KRB5_CALLCONV in_tkt + (char *name, char *inst); +int KRB5_CALLCONV krb_in_tkt + (char *pname, char *pinst, char *realm); +#endif + +/* kname_parse.c */ +int KRB5_CALLCONV kname_parse + (char *name, char *inst, char *realm, + char *fullname); +/* Merged from KfM */ +int KRB5_CALLCONV kname_unparse + (char *, const char *, const char *, const char *); + +int KRB5_CALLCONV k_isname + (char *); +int KRB5_CALLCONV k_isinst + (char *); +int KRB5_CALLCONV k_isrealm + (char *); + + +/* kuserok.c */ +int KRB5_CALLCONV kuserok + (AUTH_DAT *kdata, char *luser); + +/* lifetime.c */ +KRB4_32 KRB5_CALLCONV krb_life_to_time + (KRB4_32 start, int life); +int KRB5_CALLCONV krb_time_to_life + (KRB4_32 start, KRB4_32 end); + +/* mk_auth.c */ +int KRB5_CALLCONV krb_check_auth + (KTEXT, unsigned KRB4_32 cksum, MSG_DAT *, + C_Block, Key_schedule, + struct sockaddr_in * local_addr, + struct sockaddr_in * foreign_addr); +int KRB5_CALLCONV krb_mk_auth + (long k4_options, KTEXT ticket, + char *service, char *inst, char *realm, + unsigned KRB4_32 checksum, char *version, KTEXT buf); +/* mk_err.c */ +long KRB5_CALLCONV krb_mk_err + (u_char *out, KRB4_32 k4_code, char *text); +#if KRB_PRIVATE +/* mk_preauth.c */ +int krb_mk_preauth + (char **preauth_p, int *preauth_len, key_proc_type, + char *name, char *inst, char *realm, char *password, + C_Block); +void krb_free_preauth + (char * preauth_p, int len); +#endif +/* mk_priv.c */ +long KRB5_CALLCONV krb_mk_priv + (u_char *in, u_char *out, + unsigned KRB4_32 length, + Key_schedule, C_Block *, + struct sockaddr_in * sender, + struct sockaddr_in * receiver); +/* mk_req.c */ +int KRB5_CALLCONV krb_mk_req + (KTEXT authent, + char *service, char *instance, char *realm, + KRB4_32 checksum); +/* Merged from KfM */ +int KRB5_CALLCONV krb_mk_req_creds(KTEXT, CREDENTIALS *, KRB_INT32); + +/* Added CALLCONV (KfM exports w/o INTERFACE, but KfW doesn't export?) */ +int KRB5_CALLCONV krb_set_lifetime(int newval); + +/* mk_safe.c */ +long KRB5_CALLCONV krb_mk_safe + (u_char *in, u_char *out, unsigned KRB4_32 length, + C_Block *, + struct sockaddr_in *sender, + struct sockaddr_in *receiver); +#if KRB_PRIVATE +/* netread.c */ +int krb_net_read + (int fd, char *buf, int len); +/* netwrite.c */ +int krb_net_write + (int fd, char *buf, int len); +/* pkt_clen.c */ +int pkt_clen + (KTEXT); +#endif + +/* put_svc_key.c */ +int KRB5_CALLCONV put_svc_key + (char *sfile, + char *name, char *inst, char *realm, + int newvno, char *key); + +/* rd_err.c */ +int KRB5_CALLCONV krb_rd_err + (u_char *in, u_long in_length, + long *k4_code, MSG_DAT *m_data); +/* rd_priv.c */ +long KRB5_CALLCONV krb_rd_priv + (u_char *in,unsigned KRB4_32 in_length, + Key_schedule, C_Block *, + struct sockaddr_in *sender, + struct sockaddr_in *receiver, + MSG_DAT *m_data); +/* rd_req.c */ +int KRB5_CALLCONV krb_rd_req + (KTEXT, char *service, char *inst, + unsigned KRB4_32 from_addr, AUTH_DAT *, + char *srvtab); +/* Merged from KfM */ +int KRB5_CALLCONV +krb_rd_req_int(KTEXT, char *, char *, KRB_UINT32, AUTH_DAT *, C_Block); + +/* rd_safe.c */ +long KRB5_CALLCONV krb_rd_safe + (u_char *in, unsigned KRB4_32 in_length, + C_Block *, + struct sockaddr_in *sender, + struct sockaddr_in *receiver, + MSG_DAT *m_data); +/* rd_svc_key.c */ +int KRB5_CALLCONV read_service_key + (char *service, char *instance, char *realm, + int kvno, char *file, char *key); +int KRB5_CALLCONV get_service_key + (char *service, char *instance, char *realm, + int *kvno, char *file, char *key); + +/* realmofhost.c */ +char * KRB5_CALLCONV krb_realmofhost + (char *host); +/* recvauth.c */ +int KRB5_CALLCONV krb_recvauth + (long k4_options, int fd, KTEXT ticket, + char *service, char *instance, + struct sockaddr_in *foreign_addr, + struct sockaddr_in *local_addr, + AUTH_DAT *kdata, char *srvtab, + Key_schedule schedule, char *version); +/* sendauth.c */ +int KRB5_CALLCONV krb_sendauth + (long k4_options, int fd, KTEXT ticket, + char *service, char *inst, char *realm, + unsigned KRB4_32 checksum, MSG_DAT *msg_data, + CREDENTIALS *cred, Key_schedule schedule, + struct sockaddr_in *laddr, struct sockaddr_in *faddr, + char *version); + +#if KRB_PRIVATE +/* save_creds.c */ +int KRB5_CALLCONV krb_save_credentials + (char *service, char *instance, char *realm, + C_Block session, int lifetime, int kvno, + KTEXT ticket, long issue_date); +/* send_to_kdc.c */ +/* XXX PRIVATE? KfM doesn't export. */ +int send_to_kdc + (KTEXT pkt, KTEXT rpkt, char *realm); +#endif + +/* tkt_string.c */ +/* Used to return pointer to non-const char */ +const char * KRB5_CALLCONV tkt_string + (void); +/* Previously not KRB5_CALLCONV, and previously took pointer to non-const. */ +void KRB5_CALLCONV krb_set_tkt_string + (const char *); + +#if KRB_PRIVATE +/* tf_util.c */ +int KRB5_CALLCONV tf_init (const char *tf_name, int rw); + +int KRB5_CALLCONV tf_get_pname (char *p); + +int KRB5_CALLCONV tf_get_pinst (char *p); + +int KRB5_CALLCONV tf_get_cred (CREDENTIALS *c); + +void KRB5_CALLCONV tf_close (void); +#endif + +#if KRB_PRIVATE +/* unix_time.c */ +unsigned KRB4_32 KRB5_CALLCONV unix_time_gmt_unixsec + (unsigned KRB4_32 *); + +/* + * Internal prototypes + */ +extern int krb_set_key + (char *key, int cvt); + +/* This is exported by KfM. It was previously not KRB5_CALLCONV. */ +extern int KRB5_CALLCONV decomp_ticket + (KTEXT tkt, unsigned char *flags, char *pname, + char *pinstance, char *prealm, unsigned KRB4_32 *paddress, + C_Block session, int *life, unsigned KRB4_32 *time_sec, + char *sname, char *sinstance, C_Block, + Key_schedule key_s); + + +extern void cr_err_reply(KTEXT pkt, char *pname, char *pinst, char *prealm, + u_long time_ws, u_long e, char *e_string); + +extern int create_ciph(KTEXT c, C_Block session, char *service, + char *instance, char *realm, unsigned long life, + int kvno, KTEXT tkt, unsigned long kdc_time, + C_Block key); + + +extern int krb_create_ticket(KTEXT tkt, unsigned int flags, char *pname, + char *pinstance, char *prealm, long paddress, + char *session, int life, long time_sec, + char *sname, char *sinstance, C_Block key); + +#endif /* KRB_PRIVATE */ + +/* This function is used by KEYFILE above. Do not call it directly */ +extern char * krb__get_srvtabname(const char *); + +#if KRB_PRIVATE + +extern int krb_kntoln(AUTH_DAT *, char *); + +#ifdef KRB5_GENERAL__ +extern int krb_cr_tkt_krb5(KTEXT tkt, unsigned int flags, char *pname, + char *pinstance, char *prealm, long paddress, + char *session, int life, long time_sec, + char *sname, char *sinstance, + krb5_keyblock *k5key); + +extern int krb_set_key_krb5(krb5_context ctx, krb5_keyblock *key); + +#endif + +#endif /* KRB_PRIVATE */ + +/* + * krb_change_password -- merged from KfM + */ +/* change_password.c */ +int KRB5_CALLCONV krb_change_password(char *, char *, char *, char *, char *); + +/* + * RealmsConfig-glue.c -- merged from KfM + */ +int KRB5_CALLCONV krb_get_profile(profile_t *); + +#ifdef _WIN32 +HINSTANCE get_lib_instance(void); +unsigned int krb_get_notification_message(void); +char * KRB5_CALLCONV krb_get_default_user(void); +int KRB5_CALLCONV krb_set_default_user(char *); +unsigned KRB4_32 win_time_gmt_unixsec(unsigned KRB4_32 *); +long win_time_get_epoch(void); +#endif + +#if TARGET_OS_MAC +# if defined(__MWERKS__) +# pragma import reset +# endif +# pragma options align=reset +#endif + +KRBINT_END_DECLS + +#endif /* KRB_DEFS */ diff --git a/src/WINNT/kfw/inc/krb5/KerberosIV/krb_err.h b/src/WINNT/kfw/inc/krb5/KerberosIV/krb_err.h new file mode 100644 index 000000000..4118c1b03 --- /dev/null +++ b/src/WINNT/kfw/inc/krb5/KerberosIV/krb_err.h @@ -0,0 +1,278 @@ +/* + * include//kerberosIV/krb_err.h: + * This file is automatically generated; please do not edit it. + */ + +#include + +#define KRBET_KSUCCESS (39525376L) +#define KRBET_KDC_NAME_EXP (39525377L) +#define KRBET_KDC_SERVICE_EXP (39525378L) +#define KRBET_KDC_AUTH_EXP (39525379L) +#define KRBET_KDC_PKT_VER (39525380L) +#define KRBET_KDC_P_MKEY_VER (39525381L) +#define KRBET_KDC_S_MKEY_VER (39525382L) +#define KRBET_KDC_BYTE_ORDER (39525383L) +#define KRBET_KDC_PR_UNKNOWN (39525384L) +#define KRBET_KDC_PR_N_UNIQUE (39525385L) +#define KRBET_KDC_NULL_KEY (39525386L) +#define KRBET_KRB_RES11 (39525387L) +#define KRBET_KRB_RES12 (39525388L) +#define KRBET_KRB_RES13 (39525389L) +#define KRBET_KRB_RES14 (39525390L) +#define KRBET_KRB_RES15 (39525391L) +#define KRBET_KRB_RES16 (39525392L) +#define KRBET_KRB_RES17 (39525393L) +#define KRBET_KRB_RES18 (39525394L) +#define KRBET_KRB_RES19 (39525395L) +#define KRBET_KDC_GEN_ERR (39525396L) +#define KRBET_GC_TKFIL (39525397L) +#define KRBET_GC_NOTKT (39525398L) +#define KRBET_KRB_RES23 (39525399L) +#define KRBET_KRB_RES24 (39525400L) +#define KRBET_KRB_RES25 (39525401L) +#define KRBET_MK_AP_TGTEXP (39525402L) +#define KRBET_KRB_RES27 (39525403L) +#define KRBET_KRB_RES28 (39525404L) +#define KRBET_KRB_RES29 (39525405L) +#define KRBET_KRB_RES30 (39525406L) +#define KRBET_RD_AP_UNDEC (39525407L) +#define KRBET_RD_AP_EXP (39525408L) +#define KRBET_RD_AP_NYV (39525409L) +#define KRBET_RD_AP_REPEAT (39525410L) +#define KRBET_RD_AP_NOT_US (39525411L) +#define KRBET_RD_AP_INCON (39525412L) +#define KRBET_RD_AP_TIME (39525413L) +#define KRBET_RD_AP_BADD (39525414L) +#define KRBET_RD_AP_VERSION (39525415L) +#define KRBET_RD_AP_MSG_TYPE (39525416L) +#define KRBET_RD_AP_MODIFIED (39525417L) +#define KRBET_RD_AP_ORDER (39525418L) +#define KRBET_RD_AP_UNAUTHOR (39525419L) +#define KRBET_KRB_RES44 (39525420L) +#define KRBET_KRB_RES45 (39525421L) +#define KRBET_KRB_RES46 (39525422L) +#define KRBET_KRB_RES47 (39525423L) +#define KRBET_KRB_RES48 (39525424L) +#define KRBET_KRB_RES49 (39525425L) +#define KRBET_KRB_RES50 (39525426L) +#define KRBET_GT_PW_NULL (39525427L) +#define KRBET_GT_PW_BADPW (39525428L) +#define KRBET_GT_PW_PROT (39525429L) +#define KRBET_GT_PW_KDCERR (39525430L) +#define KRBET_GT_PW_NULLTKT (39525431L) +#define KRBET_SKDC_RETRY (39525432L) +#define KRBET_SKDC_CANT (39525433L) +#define KRBET_KRB_RES58 (39525434L) +#define KRBET_KRB_RES59 (39525435L) +#define KRBET_KRB_RES60 (39525436L) +#define KRBET_INTK_W_NOTALL (39525437L) +#define KRBET_INTK_BADPW (39525438L) +#define KRBET_INTK_PROT (39525439L) +#define KRBET_KRB_RES64 (39525440L) +#define KRBET_KRB_RES65 (39525441L) +#define KRBET_KRB_RES66 (39525442L) +#define KRBET_KRB_RES67 (39525443L) +#define KRBET_KRB_RES68 (39525444L) +#define KRBET_KRB_RES69 (39525445L) +#define KRBET_INTK_ERR (39525446L) +#define KRBET_AD_NOTGT (39525447L) +#define KRBET_KRB_RES72 (39525448L) +#define KRBET_KRB_RES73 (39525449L) +#define KRBET_KRB_RES74 (39525450L) +#define KRBET_KRB_RES75 (39525451L) +#define KRBET_NO_TKT_FIL (39525452L) +#define KRBET_TKT_FIL_ACC (39525453L) +#define KRBET_TKT_FIL_LCK (39525454L) +#define KRBET_TKT_FIL_FMT (39525455L) +#define KRBET_TKT_FIL_INI (39525456L) +#define KRBET_KNAME_FMT (39525457L) +#define KRBET_RES82 (39525458L) +#define KRBET_RES83 (39525459L) +#define KRBET_RES84 (39525460L) +#define KRBET_RES85 (39525461L) +#define KRBET_RES86 (39525462L) +#define KRBET_RES87 (39525463L) +#define KRBET_RES88 (39525464L) +#define KRBET_RES89 (39525465L) +#define KRBET_RES90 (39525466L) +#define KRBET_RES91 (39525467L) +#define KRBET_RES92 (39525468L) +#define KRBET_RES93 (39525469L) +#define KRBET_RES94 (39525470L) +#define KRBET_RES95 (39525471L) +#define KRBET_RES96 (39525472L) +#define KRBET_RES97 (39525473L) +#define KRBET_RES98 (39525474L) +#define KRBET_RES99 (39525475L) +#define KRBET_RES100 (39525476L) +#define KRBET_RES101 (39525477L) +#define KRBET_RES102 (39525478L) +#define KRBET_RES103 (39525479L) +#define KRBET_RES104 (39525480L) +#define KRBET_RES105 (39525481L) +#define KRBET_RES106 (39525482L) +#define KRBET_RES107 (39525483L) +#define KRBET_RES108 (39525484L) +#define KRBET_RES109 (39525485L) +#define KRBET_RES110 (39525486L) +#define KRBET_RES111 (39525487L) +#define KRBET_RES112 (39525488L) +#define KRBET_RES113 (39525489L) +#define KRBET_RES114 (39525490L) +#define KRBET_RES115 (39525491L) +#define KRBET_RES116 (39525492L) +#define KRBET_RES117 (39525493L) +#define KRBET_RES118 (39525494L) +#define KRBET_RES119 (39525495L) +#define KRBET_RES120 (39525496L) +#define KRBET_RES121 (39525497L) +#define KRBET_RES122 (39525498L) +#define KRBET_RES123 (39525499L) +#define KRBET_RES124 (39525500L) +#define KRBET_RES125 (39525501L) +#define KRBET_RES126 (39525502L) +#define KRBET_RES127 (39525503L) +#define KRBET_RES128 (39525504L) +#define KRBET_RES129 (39525505L) +#define KRBET_RES130 (39525506L) +#define KRBET_RES131 (39525507L) +#define KRBET_RES132 (39525508L) +#define KRBET_RES133 (39525509L) +#define KRBET_RES134 (39525510L) +#define KRBET_RES135 (39525511L) +#define KRBET_RES136 (39525512L) +#define KRBET_RES137 (39525513L) +#define KRBET_RES138 (39525514L) +#define KRBET_RES139 (39525515L) +#define KRBET_RES140 (39525516L) +#define KRBET_RES141 (39525517L) +#define KRBET_RES142 (39525518L) +#define KRBET_RES143 (39525519L) +#define KRBET_RES144 (39525520L) +#define KRBET_RES145 (39525521L) +#define KRBET_RES146 (39525522L) +#define KRBET_RES147 (39525523L) +#define KRBET_RES148 (39525524L) +#define KRBET_RES149 (39525525L) +#define KRBET_RES150 (39525526L) +#define KRBET_RES151 (39525527L) +#define KRBET_RES152 (39525528L) +#define KRBET_RES153 (39525529L) +#define KRBET_RES154 (39525530L) +#define KRBET_RES155 (39525531L) +#define KRBET_RES156 (39525532L) +#define KRBET_RES157 (39525533L) +#define KRBET_RES158 (39525534L) +#define KRBET_RES159 (39525535L) +#define KRBET_RES160 (39525536L) +#define KRBET_RES161 (39525537L) +#define KRBET_RES162 (39525538L) +#define KRBET_RES163 (39525539L) +#define KRBET_RES164 (39525540L) +#define KRBET_RES165 (39525541L) +#define KRBET_RES166 (39525542L) +#define KRBET_RES167 (39525543L) +#define KRBET_RES168 (39525544L) +#define KRBET_RES169 (39525545L) +#define KRBET_RES170 (39525546L) +#define KRBET_RES171 (39525547L) +#define KRBET_RES172 (39525548L) +#define KRBET_RES173 (39525549L) +#define KRBET_RES174 (39525550L) +#define KRBET_RES175 (39525551L) +#define KRBET_RES176 (39525552L) +#define KRBET_RES177 (39525553L) +#define KRBET_RES178 (39525554L) +#define KRBET_RES179 (39525555L) +#define KRBET_RES180 (39525556L) +#define KRBET_RES181 (39525557L) +#define KRBET_RES182 (39525558L) +#define KRBET_RES183 (39525559L) +#define KRBET_RES184 (39525560L) +#define KRBET_RES185 (39525561L) +#define KRBET_RES186 (39525562L) +#define KRBET_RES187 (39525563L) +#define KRBET_RES188 (39525564L) +#define KRBET_RES189 (39525565L) +#define KRBET_RES190 (39525566L) +#define KRBET_RES191 (39525567L) +#define KRBET_RES192 (39525568L) +#define KRBET_RES193 (39525569L) +#define KRBET_RES194 (39525570L) +#define KRBET_RES195 (39525571L) +#define KRBET_RES196 (39525572L) +#define KRBET_RES197 (39525573L) +#define KRBET_RES198 (39525574L) +#define KRBET_RES199 (39525575L) +#define KRBET_RES200 (39525576L) +#define KRBET_RES201 (39525577L) +#define KRBET_RES202 (39525578L) +#define KRBET_RES203 (39525579L) +#define KRBET_RES204 (39525580L) +#define KRBET_RES205 (39525581L) +#define KRBET_RES206 (39525582L) +#define KRBET_RES207 (39525583L) +#define KRBET_RES208 (39525584L) +#define KRBET_RES209 (39525585L) +#define KRBET_RES210 (39525586L) +#define KRBET_RES211 (39525587L) +#define KRBET_RES212 (39525588L) +#define KRBET_RES213 (39525589L) +#define KRBET_RES214 (39525590L) +#define KRBET_RES215 (39525591L) +#define KRBET_RES216 (39525592L) +#define KRBET_RES217 (39525593L) +#define KRBET_RES218 (39525594L) +#define KRBET_RES219 (39525595L) +#define KRBET_RES220 (39525596L) +#define KRBET_RES221 (39525597L) +#define KRBET_RES222 (39525598L) +#define KRBET_RES223 (39525599L) +#define KRBET_RES224 (39525600L) +#define KRBET_RES225 (39525601L) +#define KRBET_RES226 (39525602L) +#define KRBET_RES227 (39525603L) +#define KRBET_RES228 (39525604L) +#define KRBET_RES229 (39525605L) +#define KRBET_RES230 (39525606L) +#define KRBET_RES231 (39525607L) +#define KRBET_RES232 (39525608L) +#define KRBET_RES233 (39525609L) +#define KRBET_RES234 (39525610L) +#define KRBET_RES235 (39525611L) +#define KRBET_RES236 (39525612L) +#define KRBET_RES237 (39525613L) +#define KRBET_RES238 (39525614L) +#define KRBET_RES239 (39525615L) +#define KRBET_RES240 (39525616L) +#define KRBET_RES241 (39525617L) +#define KRBET_RES242 (39525618L) +#define KRBET_RES243 (39525619L) +#define KRBET_RES244 (39525620L) +#define KRBET_RES245 (39525621L) +#define KRBET_RES246 (39525622L) +#define KRBET_RES247 (39525623L) +#define KRBET_RES248 (39525624L) +#define KRBET_RES249 (39525625L) +#define KRBET_RES250 (39525626L) +#define KRBET_RES251 (39525627L) +#define KRBET_RES252 (39525628L) +#define KRBET_RES253 (39525629L) +#define KRBET_RES254 (39525630L) +#define KRBET_KFAILURE (39525631L) +#define ERROR_TABLE_BASE_krb (39525376L) + +extern const struct error_table et_krb_error_table; + +#if !defined(_WIN32) +/* for compatibility with older versions... */ +extern void initialize_krb_error_table () /*@modifies internalState@*/; +#else +#define initialize_krb_error_table() +#endif + +#if !defined(_WIN32) +#define init_krb_err_tbl initialize_krb_error_table +#define krb_err_base ERROR_TABLE_BASE_krb +#endif diff --git a/src/WINNT/kfw/inc/krb5/KerberosIV/mit-copyright.h b/src/WINNT/kfw/inc/krb5/KerberosIV/mit-copyright.h new file mode 100644 index 000000000..e00865769 --- /dev/null +++ b/src/WINNT/kfw/inc/krb5/KerberosIV/mit-copyright.h @@ -0,0 +1,23 @@ +/* + Copyright (C) 1989 by the Massachusetts Institute of Technology + + Export of this software from the United States of America may + require a specific license from the United States Government. + It is the responsibility of any person or organization contemplating + export to obtain such a license before exporting. + +WITHIN THAT CONSTRAINT, Permission to use, copy, modify, and +distribute this software and its documentation for any purpose and +without fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright notice and +this permission notice appear in supporting documentation, and that +the name of M.I.T. not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. Furthermore if you modify this software you must label +your software as modified software and not distribute it in such a +fashion that it might be confused with the original M.I.T. software. +M.I.T. makes no representations about the suitability of +this software for any purpose. It is provided "as is" without express +or implied warranty. + + */ diff --git a/src/WINNT/kfw/inc/krb5/com_err.h b/src/WINNT/kfw/inc/krb5/com_err.h new file mode 100644 index 000000000..042a9bd45 --- /dev/null +++ b/src/WINNT/kfw/inc/krb5/com_err.h @@ -0,0 +1,72 @@ +/* + * Header file for common error description library. + * + * Copyright 1988, Student Information Processing Board of the + * Massachusetts Institute of Technology. + * + * Copyright 1995 by Cygnus Support. + * + * For copyright and distribution info, see the documentation supplied + * with this package. + */ + +#ifndef __COM_ERR_H + +#if defined(_WIN32) +#include +#endif + +#ifndef KRB5_CALLCONV +#define KRB5_CALLCONV +#define KRB5_CALLCONV_C +#endif + +#include + +typedef long errcode_t; +typedef void (*et_old_error_hook_func) (const char *, errcode_t, + const char *, va_list ap); + +struct error_table { + /*@shared@*/ char const * const * msgs; + long base; + unsigned int n_msgs; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +/* Public interfaces */ +extern void KRB5_CALLCONV_C com_err + (const char *, errcode_t, const char *, ...); +extern void KRB5_CALLCONV com_err_va + (const char *whoami, errcode_t code, const char *fmt, + va_list ap); +extern /*@observer@*//*@dependent@*/ const char * KRB5_CALLCONV error_message + (errcode_t) + /*@modifies internalState@*/; +extern errcode_t KRB5_CALLCONV add_error_table + (/*@dependent@*/ const struct error_table *) + /*@modifies internalState@*/; +extern errcode_t KRB5_CALLCONV remove_error_table + (const struct error_table *) + /*@modifies internalState@*/; + +#if !defined(_WIN32) +/* + * The display routine should be application specific. A global hook, + * may cause inappropriate display procedures to be called between + * applications under non-Unix environments. + */ + +extern et_old_error_hook_func set_com_err_hook (et_old_error_hook_func); +extern et_old_error_hook_func reset_com_err_hook (void); +#endif + +#ifdef __cplusplus +} +#endif + +#define __COM_ERR_H +#endif /* ! defined(__COM_ERR_H) */ diff --git a/src/WINNT/kfw/inc/krb5/gssapi/gssapi.h b/src/WINNT/kfw/inc/krb5/gssapi/gssapi.h new file mode 100644 index 000000000..35519ed48 --- /dev/null +++ b/src/WINNT/kfw/inc/krb5/gssapi/gssapi.h @@ -0,0 +1,805 @@ +/* + * Copyright 1993 by OpenVision Technologies, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appears in all copies and + * that both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of OpenVision not be used + * in advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. OpenVision makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF + * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _GSSAPI_H_ +#define _GSSAPI_H_ + +/* + * Determine platform-dependent configuration. + */ + +#if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__)) +# include +# if TARGET_RT_MAC_CFM +# error "Use KfM 4.0 SDK headers for CFM compilation." +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#if TARGET_OS_MAC +# if defined(__MWERKS__) +# pragma import on +# endif +# pragma options align=mac68k +#endif + +#if defined(_MSDOS) || defined(_WIN32) +#include +#endif + +#ifndef KRB5_CALLCONV +#define KRB5_CALLCONV +#define KRB5_CALLCONV_C +#endif + +#define GSS_SIZEOF_INT SIZEOF_INT +#define GSS_SIZEOF_LONG SIZEOF_LONG +#define GSS_SIZEOF_SHORT SIZEOF_SHORT + +/* + * First, include stddef.h to get size_t defined. + */ +#if HAVE_STDDEF_H +#include +#endif /* HAVE_STDDEF_H */ + +/* + * POSIX says that sys/types.h is where size_t is defined. + */ +#include + +/* + * If the platform supports the xom.h header file, it should be included here. + */ +#if HAVE_XOM_H +#include +#endif /* HAVE_XOM_H */ + +/* + * $Id$ + */ + +/* + * First, define the three platform-dependent pointer types. + */ + +typedef void * gss_name_t; +typedef void * gss_cred_id_t; +typedef void * gss_ctx_id_t; + +/* + * The following type must be defined as the smallest natural unsigned integer + * supported by the platform that has at least 32 bits of precision. + */ +#if (GSS_SIZEOF_SHORT == 4) +typedef unsigned short gss_uint32; +typedef short gss_int32; +#elif (GSS_SIZEOF_INT == 4) +typedef unsigned int gss_uint32; +typedef int gss_int32; +#elif (GSS_SIZEOF_LONG == 4) +typedef unsigned long gss_uint32; +typedef long gss_int32; +#endif + +#ifdef OM_STRING +/* + * We have included the xom.h header file. Use the definition for + * OM_object identifier. + */ +typedef OM_object_identifier gss_OID_desc, *gss_OID; +#else /* OM_STRING */ +/* + * We can't use X/Open definitions, so roll our own. + */ +typedef gss_uint32 OM_uint32; + +typedef struct gss_OID_desc_struct { + OM_uint32 length; + void *elements; +} gss_OID_desc, *gss_OID; +#endif /* OM_STRING */ + +typedef struct gss_OID_set_desc_struct { + size_t count; + gss_OID elements; +} gss_OID_set_desc, *gss_OID_set; + +typedef struct gss_buffer_desc_struct { + size_t length; + void *value; +} gss_buffer_desc, *gss_buffer_t; + +typedef struct gss_channel_bindings_struct { + OM_uint32 initiator_addrtype; + gss_buffer_desc initiator_address; + OM_uint32 acceptor_addrtype; + gss_buffer_desc acceptor_address; + gss_buffer_desc application_data; +} *gss_channel_bindings_t; + +/* + * For now, define a QOP-type as an OM_uint32 (pending resolution of ongoing + * discussions). + */ +typedef OM_uint32 gss_qop_t; +typedef int gss_cred_usage_t; + +/* + * Flag bits for context-level services. + */ +#define GSS_C_DELEG_FLAG 1 +#define GSS_C_MUTUAL_FLAG 2 +#define GSS_C_REPLAY_FLAG 4 +#define GSS_C_SEQUENCE_FLAG 8 +#define GSS_C_CONF_FLAG 16 +#define GSS_C_INTEG_FLAG 32 +#define GSS_C_ANON_FLAG 64 +#define GSS_C_PROT_READY_FLAG 128 +#define GSS_C_TRANS_FLAG 256 + +/* + * Credential usage options + */ +#define GSS_C_BOTH 0 +#define GSS_C_INITIATE 1 +#define GSS_C_ACCEPT 2 + +/* + * Status code types for gss_display_status + */ +#define GSS_C_GSS_CODE 1 +#define GSS_C_MECH_CODE 2 + +/* + * The constant definitions for channel-bindings address families + */ +#define GSS_C_AF_UNSPEC 0 +#define GSS_C_AF_LOCAL 1 +#define GSS_C_AF_INET 2 +#define GSS_C_AF_IMPLINK 3 +#define GSS_C_AF_PUP 4 +#define GSS_C_AF_CHAOS 5 +#define GSS_C_AF_NS 6 +#define GSS_C_AF_NBS 7 +#define GSS_C_AF_ECMA 8 +#define GSS_C_AF_DATAKIT 9 +#define GSS_C_AF_CCITT 10 +#define GSS_C_AF_SNA 11 +#define GSS_C_AF_DECnet 12 +#define GSS_C_AF_DLI 13 +#define GSS_C_AF_LAT 14 +#define GSS_C_AF_HYLINK 15 +#define GSS_C_AF_APPLETALK 16 +#define GSS_C_AF_BSC 17 +#define GSS_C_AF_DSS 18 +#define GSS_C_AF_OSI 19 +#define GSS_C_AF_X25 21 + +#define GSS_C_AF_NULLADDR 255 + +/* + * Various Null values. + */ +#define GSS_C_NO_NAME ((gss_name_t) 0) +#define GSS_C_NO_BUFFER ((gss_buffer_t) 0) +#define GSS_C_NO_OID ((gss_OID) 0) +#define GSS_C_NO_OID_SET ((gss_OID_set) 0) +#define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0) +#define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0) +#define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0) +#define GSS_C_EMPTY_BUFFER {0, NULL} + +/* + * Some alternate names for a couple of the above values. These are defined + * for V1 compatibility. + */ +#define GSS_C_NULL_OID GSS_C_NO_OID +#define GSS_C_NULL_OID_SET GSS_C_NO_OID_SET + +/* + * Define the default Quality of Protection for per-message services. Note + * that an implementation that offers multiple levels of QOP may either reserve + * a value (for example zero, as assumed here) to mean "default protection", or + * alternatively may simply equate GSS_C_QOP_DEFAULT to a specific explicit + * QOP value. However a value of 0 should always be interpreted by a GSSAPI + * implementation as a request for the default protection level. + */ +#define GSS_C_QOP_DEFAULT 0 + +/* + * Expiration time of 2^32-1 seconds means infinite lifetime for a + * credential or security context + */ +#define GSS_C_INDEFINITE ((OM_uint32) 0xfffffffful) + + +/* Major status codes */ + +#define GSS_S_COMPLETE 0 + +/* + * Some "helper" definitions to make the status code macros obvious. + */ +#define GSS_C_CALLING_ERROR_OFFSET 24 +#define GSS_C_ROUTINE_ERROR_OFFSET 16 +#define GSS_C_SUPPLEMENTARY_OFFSET 0 +#define GSS_C_CALLING_ERROR_MASK ((OM_uint32) 0377ul) +#define GSS_C_ROUTINE_ERROR_MASK ((OM_uint32) 0377ul) +#define GSS_C_SUPPLEMENTARY_MASK ((OM_uint32) 0177777ul) + +/* + * The macros that test status codes for error conditions. Note that the + * GSS_ERROR() macro has changed slightly from the V1 GSSAPI so that it now + * evaluates its argument only once. + */ +#define GSS_CALLING_ERROR(x) \ + ((x) & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET)) +#define GSS_ROUTINE_ERROR(x) \ + ((x) & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET)) +#define GSS_SUPPLEMENTARY_INFO(x) \ + ((x) & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET)) +#define GSS_ERROR(x) \ + ((x) & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \ + (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))) + +/* + * Now the actual status code definitions + */ + +/* + * Calling errors: + */ +#define GSS_S_CALL_INACCESSIBLE_READ \ + (((OM_uint32) 1ul) << GSS_C_CALLING_ERROR_OFFSET) +#define GSS_S_CALL_INACCESSIBLE_WRITE \ + (((OM_uint32) 2ul) << GSS_C_CALLING_ERROR_OFFSET) +#define GSS_S_CALL_BAD_STRUCTURE \ + (((OM_uint32) 3ul) << GSS_C_CALLING_ERROR_OFFSET) + +/* + * Routine errors: + */ +#define GSS_S_BAD_MECH (((OM_uint32) 1ul) << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_BAD_NAME (((OM_uint32) 2ul) << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_BAD_NAMETYPE (((OM_uint32) 3ul) << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_BAD_BINDINGS (((OM_uint32) 4ul) << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_BAD_STATUS (((OM_uint32) 5ul) << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_BAD_SIG (((OM_uint32) 6ul) << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_NO_CRED (((OM_uint32) 7ul) << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_NO_CONTEXT (((OM_uint32) 8ul) << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_DEFECTIVE_TOKEN (((OM_uint32) 9ul) << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_DEFECTIVE_CREDENTIAL \ + (((OM_uint32) 10ul) << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_CREDENTIALS_EXPIRED \ + (((OM_uint32) 11ul) << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_CONTEXT_EXPIRED \ + (((OM_uint32) 12ul) << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_FAILURE (((OM_uint32) 13ul) << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_BAD_QOP (((OM_uint32) 14ul) << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_UNAUTHORIZED (((OM_uint32) 15ul) << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_UNAVAILABLE (((OM_uint32) 16ul) << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_DUPLICATE_ELEMENT \ + (((OM_uint32) 17ul) << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_NAME_NOT_MN \ + (((OM_uint32) 18ul) << GSS_C_ROUTINE_ERROR_OFFSET) + +/* + * Supplementary info bits: + */ +#define GSS_S_CONTINUE_NEEDED (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 0)) +#define GSS_S_DUPLICATE_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 1)) +#define GSS_S_OLD_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 2)) +#define GSS_S_UNSEQ_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 3)) +#define GSS_S_GAP_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 4)) + + +/* + * Finally, function prototypes for the GSSAPI routines. + */ + +#if defined (_WIN32) && defined (_MSC_VER) +# ifdef GSS_DLL_FILE +# define GSS_DLLIMP __declspec(dllexport) +# else +# define GSS_DLLIMP __declspec(dllimport) +# endif +#else +# define GSS_DLLIMP +#endif + +/* Reserved static storage for GSS_oids. Comments are quotes from RFC 2744. + * + * The implementation must reserve static storage for a + * gss_OID_desc object containing the value + * {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x01"}, + * corresponding to an object-identifier value of + * {iso(1) member-body(2) United States(840) mit(113554) + * infosys(1) gssapi(2) generic(1) user_name(1)}. The constant + * GSS_C_NT_USER_NAME should be initialized to point + * to that gss_OID_desc. + */ +GSS_DLLIMP extern gss_OID GSS_C_NT_USER_NAME; + +/* + * The implementation must reserve static storage for a + * gss_OID_desc object containing the value + * {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x02"}, + * corresponding to an object-identifier value of + * {iso(1) member-body(2) United States(840) mit(113554) + * infosys(1) gssapi(2) generic(1) machine_uid_name(2)}. + * The constant GSS_C_NT_MACHINE_UID_NAME should be + * initialized to point to that gss_OID_desc. + */ +GSS_DLLIMP extern gss_OID GSS_C_NT_MACHINE_UID_NAME; + +/* + * The implementation must reserve static storage for a + * gss_OID_desc object containing the value + * {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x03"}, + * corresponding to an object-identifier value of + * {iso(1) member-body(2) United States(840) mit(113554) + * infosys(1) gssapi(2) generic(1) string_uid_name(3)}. + * The constant GSS_C_NT_STRING_UID_NAME should be + * initialized to point to that gss_OID_desc. + */ +GSS_DLLIMP extern gss_OID GSS_C_NT_STRING_UID_NAME; + +/* + * The implementation must reserve static storage for a + * gss_OID_desc object containing the value + * {6, (void *)"\x2b\x06\x01\x05\x06\x02"}, + * corresponding to an object-identifier value of + * {iso(1) org(3) dod(6) internet(1) security(5) + * nametypes(6) gss-host-based-services(2)). The constant + * GSS_C_NT_HOSTBASED_SERVICE_X should be initialized to point + * to that gss_OID_desc. This is a deprecated OID value, and + * implementations wishing to support hostbased-service names + * should instead use the GSS_C_NT_HOSTBASED_SERVICE OID, + * defined below, to identify such names; + * GSS_C_NT_HOSTBASED_SERVICE_X should be accepted a synonym + * for GSS_C_NT_HOSTBASED_SERVICE when presented as an input + * parameter, but should not be emitted by GSS-API + * implementations + */ +GSS_DLLIMP extern gss_OID GSS_C_NT_HOSTBASED_SERVICE_X; + +/* + * The implementation must reserve static storage for a + * gss_OID_desc object containing the value + * {10, (void *)"\x2a\x86\x48\x86\xf7\x12" + * "\x01\x02\x01\x04"}, corresponding to an + * object-identifier value of {iso(1) member-body(2) + * Unites States(840) mit(113554) infosys(1) gssapi(2) + * generic(1) service_name(4)}. The constant + * GSS_C_NT_HOSTBASED_SERVICE should be initialized + * to point to that gss_OID_desc. + */ +GSS_DLLIMP extern gss_OID GSS_C_NT_HOSTBASED_SERVICE; + +/* + * The implementation must reserve static storage for a + * gss_OID_desc object containing the value + * {6, (void *)"\x2b\x06\01\x05\x06\x03"}, + * corresponding to an object identifier value of + * {1(iso), 3(org), 6(dod), 1(internet), 5(security), + * 6(nametypes), 3(gss-anonymous-name)}. The constant + * and GSS_C_NT_ANONYMOUS should be initialized to point + * to that gss_OID_desc. + */ +GSS_DLLIMP extern gss_OID GSS_C_NT_ANONYMOUS; + + +/* + * The implementation must reserve static storage for a + * gss_OID_desc object containing the value + * {6, (void *)"\x2b\x06\x01\x05\x06\x04"}, + * corresponding to an object-identifier value of + * {1(iso), 3(org), 6(dod), 1(internet), 5(security), + * 6(nametypes), 4(gss-api-exported-name)}. The constant + * GSS_C_NT_EXPORT_NAME should be initialized to point + * to that gss_OID_desc. + */ +GSS_DLLIMP extern gss_OID GSS_C_NT_EXPORT_NAME; + +/* Function Prototypes */ + +OM_uint32 KRB5_CALLCONV gss_acquire_cred +(OM_uint32 *, /* minor_status */ + gss_name_t, /* desired_name */ + OM_uint32, /* time_req */ + gss_OID_set, /* desired_mechs */ + gss_cred_usage_t, /* cred_usage */ + gss_cred_id_t *, /* output_cred_handle */ + gss_OID_set *, /* actual_mechs */ + OM_uint32 * /* time_rec */ + ); + +OM_uint32 KRB5_CALLCONV gss_release_cred +(OM_uint32 *, /* minor_status */ + gss_cred_id_t * /* cred_handle */ + ); + +OM_uint32 KRB5_CALLCONV gss_init_sec_context +(OM_uint32 *, /* minor_status */ + gss_cred_id_t, /* claimant_cred_handle */ + gss_ctx_id_t *, /* context_handle */ + gss_name_t, /* target_name */ + gss_OID, /* mech_type (used to be const) */ + OM_uint32, /* req_flags */ + OM_uint32, /* time_req */ + gss_channel_bindings_t, /* input_chan_bindings */ + gss_buffer_t, /* input_token */ + gss_OID *, /* actual_mech_type */ + gss_buffer_t, /* output_token */ + OM_uint32 *, /* ret_flags */ + OM_uint32 * /* time_rec */ + ); + +OM_uint32 KRB5_CALLCONV gss_accept_sec_context +(OM_uint32 *, /* minor_status */ + gss_ctx_id_t *, /* context_handle */ + gss_cred_id_t, /* acceptor_cred_handle */ + gss_buffer_t, /* input_token_buffer */ + gss_channel_bindings_t, /* input_chan_bindings */ + gss_name_t *, /* src_name */ + gss_OID *, /* mech_type */ + gss_buffer_t, /* output_token */ + OM_uint32 *, /* ret_flags */ + OM_uint32 *, /* time_rec */ + gss_cred_id_t * /* delegated_cred_handle */ + ); + +OM_uint32 KRB5_CALLCONV gss_process_context_token +(OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + gss_buffer_t /* token_buffer */ + ); + +OM_uint32 KRB5_CALLCONV gss_delete_sec_context +(OM_uint32 *, /* minor_status */ + gss_ctx_id_t *, /* context_handle */ + gss_buffer_t /* output_token */ + ); + +OM_uint32 KRB5_CALLCONV gss_context_time +(OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + OM_uint32 * /* time_rec */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_get_mic +(OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + gss_qop_t, /* qop_req */ + gss_buffer_t, /* message_buffer */ + gss_buffer_t /* message_token */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_verify_mic +(OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + gss_buffer_t, /* message_buffer */ + gss_buffer_t, /* message_token */ + gss_qop_t * /* qop_state */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_wrap +(OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + int, /* conf_req_flag */ + gss_qop_t, /* qop_req */ + gss_buffer_t, /* input_message_buffer */ + int *, /* conf_state */ + gss_buffer_t /* output_message_buffer */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_unwrap +(OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + gss_buffer_t, /* input_message_buffer */ + gss_buffer_t, /* output_message_buffer */ + int *, /* conf_state */ + gss_qop_t * /* qop_state */ + ); + +OM_uint32 KRB5_CALLCONV gss_display_status +(OM_uint32 *, /* minor_status */ + OM_uint32, /* status_value */ + int, /* status_type */ + gss_OID, /* mech_type (used to be const) */ + OM_uint32 *, /* message_context */ + gss_buffer_t /* status_string */ + ); + +OM_uint32 KRB5_CALLCONV gss_indicate_mechs +(OM_uint32 *, /* minor_status */ + gss_OID_set * /* mech_set */ + ); + +OM_uint32 KRB5_CALLCONV gss_compare_name +(OM_uint32 *, /* minor_status */ + gss_name_t, /* name1 */ + gss_name_t, /* name2 */ + int * /* name_equal */ + ); + +OM_uint32 KRB5_CALLCONV gss_display_name +(OM_uint32 *, /* minor_status */ + gss_name_t, /* input_name */ + gss_buffer_t, /* output_name_buffer */ + gss_OID * /* output_name_type */ + ); + +OM_uint32 KRB5_CALLCONV gss_import_name +(OM_uint32 *, /* minor_status */ + gss_buffer_t, /* input_name_buffer */ + gss_OID, /* input_name_type(used to be const) */ + gss_name_t * /* output_name */ + ); + +OM_uint32 KRB5_CALLCONV gss_release_name +(OM_uint32 *, /* minor_status */ + gss_name_t * /* input_name */ + ); + +OM_uint32 KRB5_CALLCONV gss_release_buffer +(OM_uint32 *, /* minor_status */ + gss_buffer_t /* buffer */ + ); + +OM_uint32 KRB5_CALLCONV gss_release_oid_set +(OM_uint32 *, /* minor_status */ + gss_OID_set * /* set */ + ); + +OM_uint32 KRB5_CALLCONV gss_inquire_cred +(OM_uint32 *, /* minor_status */ + gss_cred_id_t, /* cred_handle */ + gss_name_t *, /* name */ + OM_uint32 *, /* lifetime */ + gss_cred_usage_t *, /* cred_usage */ + gss_OID_set * /* mechanisms */ + ); + +/* Last argument new for V2 */ +OM_uint32 KRB5_CALLCONV gss_inquire_context +(OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + gss_name_t *, /* src_name */ + gss_name_t *, /* targ_name */ + OM_uint32 *, /* lifetime_rec */ + gss_OID *, /* mech_type */ + OM_uint32 *, /* ctx_flags */ + int *, /* locally_initiated */ + int * /* open */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_wrap_size_limit +(OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + int, /* conf_req_flag */ + gss_qop_t, /* qop_req */ + OM_uint32, /* req_output_size */ + OM_uint32 * /* max_input_size */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_import_name_object +(OM_uint32 *, /* minor_status */ + void *, /* input_name */ + gss_OID, /* input_name_type */ + gss_name_t * /* output_name */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_export_name_object +(OM_uint32 *, /* minor_status */ + gss_name_t, /* input_name */ + gss_OID, /* desired_name_type */ + void ** /* output_name */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_add_cred +(OM_uint32 *, /* minor_status */ + gss_cred_id_t, /* input_cred_handle */ + gss_name_t, /* desired_name */ + gss_OID, /* desired_mech */ + gss_cred_usage_t, /* cred_usage */ + OM_uint32, /* initiator_time_req */ + OM_uint32, /* acceptor_time_req */ + gss_cred_id_t *, /* output_cred_handle */ + gss_OID_set *, /* actual_mechs */ + OM_uint32 *, /* initiator_time_rec */ + OM_uint32 * /* acceptor_time_rec */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_inquire_cred_by_mech +(OM_uint32 *, /* minor_status */ + gss_cred_id_t, /* cred_handle */ + gss_OID, /* mech_type */ + gss_name_t *, /* name */ + OM_uint32 *, /* initiator_lifetime */ + OM_uint32 *, /* acceptor_lifetime */ + gss_cred_usage_t * /* cred_usage */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_export_sec_context +(OM_uint32 *, /* minor_status */ + gss_ctx_id_t *, /* context_handle */ + gss_buffer_t /* interprocess_token */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_import_sec_context +(OM_uint32 *, /* minor_status */ + gss_buffer_t, /* interprocess_token */ + gss_ctx_id_t * /* context_handle */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_release_oid +(OM_uint32 *, /* minor_status */ + gss_OID * /* oid */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_create_empty_oid_set +(OM_uint32 *, /* minor_status */ + gss_OID_set * /* oid_set */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_add_oid_set_member +(OM_uint32 *, /* minor_status */ + gss_OID, /* member_oid */ + gss_OID_set * /* oid_set */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_test_oid_set_member +(OM_uint32 *, /* minor_status */ + gss_OID, /* member */ + gss_OID_set, /* set */ + int * /* present */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_str_to_oid +(OM_uint32 *, /* minor_status */ + gss_buffer_t, /* oid_str */ + gss_OID * /* oid */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_oid_to_str +(OM_uint32 *, /* minor_status */ + gss_OID, /* oid */ + gss_buffer_t /* oid_str */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_inquire_names_for_mech +(OM_uint32 *, /* minor_status */ + gss_OID, /* mechanism */ + gss_OID_set * /* name_types */ + ); + +/* + * The following routines are obsolete variants of gss_get_mic, gss_wrap, + * gss_verify_mic and gss_unwrap. They should be provided by GSSAPI V2 + * implementations for backwards compatibility with V1 applications. Distinct + * entrypoints (as opposed to #defines) should be provided, to allow GSSAPI + * V1 applications to link against GSSAPI V2 implementations. + */ +OM_uint32 KRB5_CALLCONV gss_sign +(OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + int, /* qop_req */ + gss_buffer_t, /* message_buffer */ + gss_buffer_t /* message_token */ + ); + +OM_uint32 KRB5_CALLCONV gss_verify +(OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + gss_buffer_t, /* message_buffer */ + gss_buffer_t, /* token_buffer */ + int * /* qop_state */ + ); + +OM_uint32 KRB5_CALLCONV gss_seal +(OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + int, /* conf_req_flag */ + int, /* qop_req */ + gss_buffer_t, /* input_message_buffer */ + int *, /* conf_state */ + gss_buffer_t /* output_message_buffer */ + ); + +OM_uint32 KRB5_CALLCONV gss_unseal +(OM_uint32 *, /* minor_status */ + gss_ctx_id_t, /* context_handle */ + gss_buffer_t, /* input_message_buffer */ + gss_buffer_t, /* output_message_buffer */ + int *, /* conf_state */ + int * /* qop_state */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_export_name +(OM_uint32 *, /* minor_status */ + const gss_name_t, /* input_name */ + gss_buffer_t /* exported_name */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_duplicate_name +(OM_uint32 *, /* minor_status */ + const gss_name_t, /* input_name */ + gss_name_t * /* dest_name */ + ); + +/* New for V2 */ +OM_uint32 KRB5_CALLCONV gss_canonicalize_name +(OM_uint32 *, /* minor_status */ + const gss_name_t, /* input_name */ + const gss_OID, /* mech_type */ + gss_name_t * /* output_name */ + ); + +#if TARGET_OS_MAC +# if defined(__MWERKS__) +# pragma import reset +# endif +# pragma options align=reset +#endif + +#ifdef __cplusplus +} +#endif + +/* XXXX these are not part of the GSSAPI C bindings! (but should be) */ + +#define GSS_CALLING_ERROR_FIELD(x) \ + (((x) >> GSS_C_CALLING_ERROR_OFFSET) & GSS_C_CALLING_ERROR_MASK) +#define GSS_ROUTINE_ERROR_FIELD(x) \ + (((x) >> GSS_C_ROUTINE_ERROR_OFFSET) & GSS_C_ROUTINE_ERROR_MASK) +#define GSS_SUPPLEMENTARY_INFO_FIELD(x) \ + (((x) >> GSS_C_SUPPLEMENTARY_OFFSET) & GSS_C_SUPPLEMENTARY_MASK) + +/* XXXX This is a necessary evil until the spec is fixed */ +#define GSS_S_CRED_UNAVAIL GSS_S_FAILURE + +#endif /* _GSSAPI_H_ */ diff --git a/src/WINNT/kfw/inc/krb5/gssapi/gssapi_generic.h b/src/WINNT/kfw/inc/krb5/gssapi/gssapi_generic.h new file mode 100644 index 000000000..bf3c2af59 --- /dev/null +++ b/src/WINNT/kfw/inc/krb5/gssapi/gssapi_generic.h @@ -0,0 +1,55 @@ +/* + * Copyright 1993 by OpenVision Technologies, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appears in all copies and + * that both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of OpenVision not be used + * in advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. OpenVision makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF + * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _GSSAPI_GENERIC_H_ +#define _GSSAPI_GENERIC_H_ + +/* + * $Id$ + */ + +#include + +#if defined(__cplusplus) && !defined(GSSAPIGENERIC_BEGIN_DECLS) +#define GSSAPIGENERIC_BEGIN_DECLS extern "C" { +#define GSSAPIGENERIC_END_DECLS } +#else +#define GSSAPIGENERIC_BEGIN_DECLS +#define GSSAPIGENERIC_END_DECLS +#endif + +GSSAPIGENERIC_BEGIN_DECLS + +/* Deprecated MIT krb5 oid names provided for compatibility. + * The correct oids (GSS_C_NT_USER_NAME, etc) from rfc 2744 + * are defined in gssapi.h. */ + +GSS_DLLIMP extern gss_OID gss_nt_user_name; +GSS_DLLIMP extern gss_OID gss_nt_machine_uid_name; +GSS_DLLIMP extern gss_OID gss_nt_string_uid_name; +extern gss_OID gss_nt_service_name_v2; +GSS_DLLIMP extern gss_OID gss_nt_service_name; +extern gss_OID gss_nt_exported_name; + +GSSAPIGENERIC_END_DECLS + +#endif /* _GSSAPI_GENERIC_H_ */ diff --git a/src/WINNT/kfw/inc/krb5/gssapi/gssapi_krb5.h b/src/WINNT/kfw/inc/krb5/gssapi/gssapi_krb5.h new file mode 100644 index 000000000..3007a0fd8 --- /dev/null +++ b/src/WINNT/kfw/inc/krb5/gssapi/gssapi_krb5.h @@ -0,0 +1,114 @@ +/* + * Copyright 1993 by OpenVision Technologies, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appears in all copies and + * that both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of OpenVision not be used + * in advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. OpenVision makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF + * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _GSSAPI_KRB5_H_ +#define _GSSAPI_KRB5_H_ + +#include +#include + +/* C++ friendlyness */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Reserved static storage for GSS_oids. See rfc 1964 for more details. */ + +/* 2.1.1. Kerberos Principal Name Form: */ +GSS_DLLIMP extern const gss_OID_desc * const GSS_KRB5_NT_PRINCIPAL_NAME; +/* This name form shall be represented by the Object Identifier {iso(1) + * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2) + * krb5(2) krb5_name(1)}. The recommended symbolic name for this type + * is "GSS_KRB5_NT_PRINCIPAL_NAME". */ + +/* 2.1.2. Host-Based Service Name Form */ +#define GSS_KRB5_NT_HOSTBASED_SERVICE_NAME GSS_C_NT_HOSTBASED_SERVICE +/* This name form shall be represented by the Object Identifier {iso(1) + * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2) + * generic(1) service_name(4)}. The previously recommended symbolic + * name for this type is "GSS_KRB5_NT_HOSTBASED_SERVICE_NAME". The + * currently preferred symbolic name for this type is + * "GSS_C_NT_HOSTBASED_SERVICE". */ + +/* 2.2.1. User Name Form */ +#define GSS_KRB5_NT_USER_NAME GSS_C_NT_USER_NAME +/* This name form shall be represented by the Object Identifier {iso(1) + * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2) + * generic(1) user_name(1)}. The recommended symbolic name for this + * type is "GSS_KRB5_NT_USER_NAME". */ + +/* 2.2.2. Machine UID Form */ +#define GSS_KRB5_NT_MACHINE_UID_NAME GSS_C_NT_MACHINE_UID_NAME +/* This name form shall be represented by the Object Identifier {iso(1) + * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2) + * generic(1) machine_uid_name(2)}. The recommended symbolic name for + * this type is "GSS_KRB5_NT_MACHINE_UID_NAME". */ + +/* 2.2.3. String UID Form */ +#define GSS_KRB5_NT_STRING_UID_NAME GSS_C_NT_STRING_UID_NAME +/* This name form shall be represented by the Object Identifier {iso(1) + * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2) + * generic(1) string_uid_name(3)}. The recommended symbolic name for + * this type is "GSS_KRB5_NT_STRING_UID_NAME". */ + +extern const gss_OID_desc * const gss_mech_krb5; +extern const gss_OID_desc * const gss_mech_krb5_old; +extern const gss_OID_set_desc * const gss_mech_set_krb5; +extern const gss_OID_set_desc * const gss_mech_set_krb5_old; +extern const gss_OID_set_desc * const gss_mech_set_krb5_both; + +extern const gss_OID_desc * const gss_nt_krb5_name; +extern const gss_OID_desc * const gss_nt_krb5_principal; + +extern const gss_OID_desc krb5_gss_oid_array[]; + +#define gss_krb5_nt_general_name gss_nt_krb5_name +#define gss_krb5_nt_principal gss_nt_krb5_principal +#define gss_krb5_nt_service_name gss_nt_service_name +#define gss_krb5_nt_user_name gss_nt_user_name +#define gss_krb5_nt_machine_uid_name gss_nt_machine_uid_name +#define gss_krb5_nt_string_uid_name gss_nt_string_uid_name + +/* Alias for Heimdal compat. */ +#define gsskrb5_register_acceptor_identity krb5_gss_register_acceptor_identity + +OM_uint32 KRB5_CALLCONV krb5_gss_register_acceptor_identity(const char *); + +OM_uint32 KRB5_CALLCONV gss_krb5_get_tkt_flags + (OM_uint32 *minor_status, + gss_ctx_id_t context_handle, + krb5_flags *ticket_flags); + +OM_uint32 KRB5_CALLCONV gss_krb5_copy_ccache + (OM_uint32 *minor_status, + gss_cred_id_t cred_handle, + krb5_ccache out_ccache); + +OM_uint32 KRB5_CALLCONV gss_krb5_ccache_name + (OM_uint32 *minor_status, const char *name, + const char **out_name); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _GSSAPI_KRB5_H_ */ diff --git a/src/WINNT/kfw/inc/krb5/krb5.h b/src/WINNT/kfw/inc/krb5/krb5.h new file mode 100644 index 000000000..5c5df50d5 --- /dev/null +++ b/src/WINNT/kfw/inc/krb5/krb5.h @@ -0,0 +1,3063 @@ +/* + * include/krb5.h + * + * Copyright 1989,1990,1995,2001, 2003 by the Massachusetts Institute of Technology. + * All Rights Reserved. + * + * Export of this software from the United States of America may + * require a specific license from the United States Government. + * It is the responsibility of any person or organization contemplating + * export to obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. Furthermore if you modify this software you must label + * your software as modified software and not distribute it in such a + * fashion that it might be confused with the original M.I.T. software. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + * + * + * General definitions for Kerberos version 5. + */ + +/* + * Copyright (C) 1998 by the FundsXpress, INC. + * + * All rights reserved. + * + * Export of this software from the United States of America may require + * a specific license from the United States Government. It is the + * responsibility of any person or organization contemplating export to + * obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of FundsXpress. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. FundsXpress makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#ifndef KRB5_GENERAL__ +#define KRB5_GENERAL__ + +/* By default, do not expose deprecated interfaces. */ +#ifndef KRB5_DEPRECATED +#define KRB5_DEPRECATED 0 +#endif +/* Do not expose private interfaces. Build system will override. */ +#ifndef KRB5_PRIVATE +#define KRB5_PRIVATE 0 +#endif + +#if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__)) +# include +# if TARGET_RT_MAC_CFM +# error "Use KfM 4.0 SDK headers for CFM compilation." +# endif +#endif + +#if defined(_MSDOS) || defined(_WIN32) +#include +#endif + +#ifndef KRB5_CONFIG__ +#ifndef KRB5_CALLCONV +#define KRB5_CALLCONV +#define KRB5_CALLCONV_C +#endif /* !KRB5_CALLCONV */ +#endif /* !KRB5_CONFIG__ */ + +#ifndef KRB5_CALLCONV_WRONG +#define KRB5_CALLCONV_WRONG +#endif + +#ifndef THREEPARAMOPEN +#define THREEPARAMOPEN(x,y,z) open(x,y,z) +#endif + +#define KRB5_OLD_CRYPTO + +#include +#include /* for *_MAX */ + +#ifndef KRB5INT_BEGIN_DECLS +#if defined(__cplusplus) +#define KRB5INT_BEGIN_DECLS extern "C" { +#define KRB5INT_END_DECLS } +#else +#define KRB5INT_BEGIN_DECLS +#define KRB5INT_END_DECLS +#endif +#endif + +KRB5INT_BEGIN_DECLS + +#if TARGET_OS_MAC +# if defined(__MWERKS__) +# pragma import on +# endif +# pragma options align=mac68k +#endif + +/* from profile.h */ +struct _profile_t; +/* typedef struct _profile_t *profile_t; */ + +/* + * begin wordsize.h + */ + +/* + * Word-size related definition. + */ + +typedef unsigned char krb5_octet; + +#if INT_MAX == 0x7fff +typedef int krb5_int16; +typedef unsigned int krb5_ui_2; +#elif SHRT_MAX == 0x7fff +typedef short krb5_int16; +typedef unsigned short krb5_ui_2; +#else +#error undefined 16 bit type +#endif + +#if INT_MAX == 0x7fffffffL +typedef int krb5_int32; +typedef unsigned int krb5_ui_4; +#elif LONG_MAX == 0x7fffffffL +typedef long krb5_int32; +typedef unsigned long krb5_ui_4; +#elif SHRT_MAX == 0x7fffffffL +typedef short krb5_int32; +typedef unsigned short krb5_ui_4; +#else +#error: undefined 32 bit type +#endif + +#define VALID_INT_BITS INT_MAX +#define VALID_UINT_BITS UINT_MAX + +#define KRB5_INT32_MAX 2147483647 +/* this strange form is necessary since - is a unary operator, not a sign + indicator */ +#define KRB5_INT32_MIN (-KRB5_INT32_MAX-1) + +#define KRB5_INT16_MAX 65535 +/* this strange form is necessary since - is a unary operator, not a sign + indicator */ +#define KRB5_INT16_MIN (-KRB5_INT16_MAX-1) + +/* + * end wordsize.h + */ + +/* + * begin "base-defs.h" + */ + +/* + * Basic definitions for Kerberos V5 library + */ + +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef TRUE +#define TRUE 1 +#endif + +typedef unsigned int krb5_boolean; +typedef unsigned int krb5_msgtype; +typedef unsigned int krb5_kvno; + +typedef krb5_int32 krb5_addrtype; +typedef krb5_int32 krb5_enctype; +typedef krb5_int32 krb5_cksumtype; +typedef krb5_int32 krb5_authdatatype; +typedef krb5_int32 krb5_keyusage; + +typedef krb5_int32 krb5_preauthtype; /* This may change, later on */ +typedef krb5_int32 krb5_flags; +typedef krb5_int32 krb5_timestamp; +typedef krb5_int32 krb5_error_code; +typedef krb5_int32 krb5_deltat; + +typedef krb5_error_code krb5_magic; + +typedef struct _krb5_data { + krb5_magic magic; + unsigned int length; + char *data; +} krb5_data; + +/* + * Hack length for crypto library to use the afs_string_to_key It is + * equivalent to -1 without possible sign extension + * We also overload for an unset salt type length - which is also -1, but + * hey, why not.... +*/ +#define SALT_TYPE_AFS_LENGTH UINT_MAX +#define SALT_TYPE_NO_LENGTH UINT_MAX + +typedef void * krb5_pointer; +typedef void const * krb5_const_pointer; + +typedef struct krb5_principal_data { + krb5_magic magic; + krb5_data realm; + krb5_data *data; /* An array of strings */ + krb5_int32 length; + krb5_int32 type; +} krb5_principal_data; + +typedef krb5_principal_data * krb5_principal; + +/* + * Per V5 spec on definition of principal types + */ + +/* Name type not known */ +#define KRB5_NT_UNKNOWN 0 +/* Just the name of the principal as in DCE, or for users */ +#define KRB5_NT_PRINCIPAL 1 +/* Service and other unique instance (krbtgt) */ +#define KRB5_NT_SRV_INST 2 +/* Service with host name as instance (telnet, rcommands) */ +#define KRB5_NT_SRV_HST 3 +/* Service with host as remaining components */ +#define KRB5_NT_SRV_XHST 4 +/* Unique ID */ +#define KRB5_NT_UID 5 + +/* constant version thereof: */ +typedef const krb5_principal_data *krb5_const_principal; + +#define krb5_princ_realm(context, princ) (&(princ)->realm) +#define krb5_princ_set_realm(context, princ,value) ((princ)->realm = *(value)) +#define krb5_princ_set_realm_length(context, princ,value) (princ)->realm.length = (value) +#define krb5_princ_set_realm_data(context, princ,value) (princ)->realm.data = (value) +#define krb5_princ_size(context, princ) (princ)->length +#define krb5_princ_type(context, princ) (princ)->type +#define krb5_princ_name(context, princ) (princ)->data +#define krb5_princ_component(context, princ,i) \ + (((i) < krb5_princ_size(context, princ)) \ + ? (princ)->data + (i) \ + : NULL) + +/* + * end "base-defs.h" + */ + +/* + * begin "hostaddr.h" + */ + +/* structure for address */ +typedef struct _krb5_address { + krb5_magic magic; + krb5_addrtype addrtype; + unsigned int length; + krb5_octet *contents; +} krb5_address; + +/* per Kerberos v5 protocol spec */ +#define ADDRTYPE_INET 0x0002 +#define ADDRTYPE_CHAOS 0x0005 +#define ADDRTYPE_XNS 0x0006 +#define ADDRTYPE_ISO 0x0007 +#define ADDRTYPE_DDP 0x0010 +#define ADDRTYPE_INET6 0x0018 +/* not yet in the spec... */ +#define ADDRTYPE_ADDRPORT 0x0100 +#define ADDRTYPE_IPPORT 0x0101 + +/* macros to determine if a type is a local type */ +#define ADDRTYPE_IS_LOCAL(addrtype) (addrtype & 0x8000) + +/* + * end "hostaddr.h" + */ + + +struct _krb5_context; +typedef struct _krb5_context * krb5_context; + +struct _krb5_auth_context; +typedef struct _krb5_auth_context * krb5_auth_context; + +struct _krb5_cryptosystem_entry; + +/* + * begin "encryption.h" + */ + +typedef struct _krb5_keyblock { + krb5_magic magic; + krb5_enctype enctype; + unsigned int length; + krb5_octet *contents; +} krb5_keyblock; + +#ifdef KRB5_OLD_CRYPTO +typedef struct _krb5_encrypt_block { + krb5_magic magic; + krb5_enctype crypto_entry; /* to call krb5_encrypt_size, you need + this. it was a pointer, but it + doesn't have to be. gross. */ + krb5_keyblock *key; +} krb5_encrypt_block; +#endif + +typedef struct _krb5_checksum { + krb5_magic magic; + krb5_cksumtype checksum_type; /* checksum type */ + unsigned int length; + krb5_octet *contents; +} krb5_checksum; + +typedef struct _krb5_enc_data { + krb5_magic magic; + krb5_enctype enctype; + krb5_kvno kvno; + krb5_data ciphertext; +} krb5_enc_data; + +/* per Kerberos v5 protocol spec */ +#define ENCTYPE_NULL 0x0000 +#define ENCTYPE_DES_CBC_CRC 0x0001 /* DES cbc mode with CRC-32 */ +#define ENCTYPE_DES_CBC_MD4 0x0002 /* DES cbc mode with RSA-MD4 */ +#define ENCTYPE_DES_CBC_MD5 0x0003 /* DES cbc mode with RSA-MD5 */ +#define ENCTYPE_DES_CBC_RAW 0x0004 /* DES cbc mode raw */ +/* XXX deprecated? */ +#define ENCTYPE_DES3_CBC_SHA 0x0005 /* DES-3 cbc mode with NIST-SHA */ +#define ENCTYPE_DES3_CBC_RAW 0x0006 /* DES-3 cbc mode raw */ +#define ENCTYPE_DES_HMAC_SHA1 0x0008 +#define ENCTYPE_DES3_CBC_SHA1 0x0010 +#define ENCTYPE_AES128_CTS_HMAC_SHA1_96 0x0011 +#define ENCTYPE_AES256_CTS_HMAC_SHA1_96 0x0012 +#define ENCTYPE_ARCFOUR_HMAC 0x0017 +#define ENCTYPE_ARCFOUR_HMAC_EXP 0x0018 +#define ENCTYPE_UNKNOWN 0x01ff +/* local crud */ +/* marc's DES-3 with 32-bit length */ +#define ENCTYPE_LOCAL_DES3_HMAC_SHA1 0x7007 + +#define CKSUMTYPE_CRC32 0x0001 +#define CKSUMTYPE_RSA_MD4 0x0002 +#define CKSUMTYPE_RSA_MD4_DES 0x0003 +#define CKSUMTYPE_DESCBC 0x0004 +/* des-mac-k */ +/* rsa-md4-des-k */ +#define CKSUMTYPE_RSA_MD5 0x0007 +#define CKSUMTYPE_RSA_MD5_DES 0x0008 +#define CKSUMTYPE_NIST_SHA 0x0009 +#define CKSUMTYPE_HMAC_SHA1_DES3 0x000c +#define CKSUMTYPE_HMAC_SHA1_96_AES128 0x000f +#define CKSUMTYPE_HMAC_SHA1_96_AES256 0x0010 +#define CKSUMTYPE_HMAC_MD5_ARCFOUR -138 /*Microsoft md5 hmac cksumtype*/ + +/* The following are entropy source designations. Whenever + * krb5_C_random_add_entropy is called, one of these source ids is passed + * in. This allows the library to better estimate bits of + * entropy in the sample and to keep track of what sources of entropy have + * contributed enough entropy. Sources marked internal MUST NOT be + * used by applications outside the Kerberos library +*/ + +enum { + KRB5_C_RANDSOURCE_OLDAPI = 0, /*calls to krb5_C_RANDOM_SEED (INTERNAL)*/ + KRB5_C_RANDSOURCE_OSRAND = 1, /* /dev/random or equivalent (internal)*/ + KRB5_C_RANDSOURCE_TRUSTEDPARTY = 2, /* From KDC or other trusted party*/ + /*This source should be used carefully; data in this category + * should be from a third party trusted to give random bits + * For example keys issued by the KDC in the application server. + */ + KRB5_C_RANDSOURCE_TIMING = 3, /* Timing of operations*/ + KRB5_C_RANDSOURCE_EXTERNAL_PROTOCOL = 4, /*Protocol data possibly from attacker*/ + KRB5_C_RANDSOURCE_MAX = 5 /*Do not use; maximum source ID*/ +}; + +#ifndef krb5_roundup +/* round x up to nearest multiple of y */ +#define krb5_roundup(x, y) ((((x) + (y) - 1)/(y))*(y)) +#endif /* roundup */ + +/* macro function definitions to help clean up code */ + +#if 1 +#define krb5_x(ptr,args) ((ptr)?((*(ptr)) args):(abort(),1)) +#define krb5_xc(ptr,args) ((ptr)?((*(ptr)) args):(abort(),(char*)0)) +#else +#define krb5_x(ptr,args) ((*(ptr)) args) +#define krb5_xc(ptr,args) ((*(ptr)) args) +#endif + +krb5_error_code KRB5_CALLCONV + krb5_c_encrypt + (krb5_context context, const krb5_keyblock *key, + krb5_keyusage usage, const krb5_data *cipher_state, + const krb5_data *input, krb5_enc_data *output); + +krb5_error_code KRB5_CALLCONV + krb5_c_decrypt + (krb5_context context, const krb5_keyblock *key, + krb5_keyusage usage, const krb5_data *cipher_state, + const krb5_enc_data *input, krb5_data *output); + +krb5_error_code KRB5_CALLCONV + krb5_c_encrypt_length + (krb5_context context, krb5_enctype enctype, + size_t inputlen, size_t *length); + +krb5_error_code KRB5_CALLCONV + krb5_c_block_size + (krb5_context context, krb5_enctype enctype, + size_t *blocksize); + +krb5_error_code KRB5_CALLCONV + krb5_c_init_state +(krb5_context context, +const krb5_keyblock *key, krb5_keyusage usage, +krb5_data *new_state); + +krb5_error_code KRB5_CALLCONV + krb5_c_free_state +(krb5_context context, const krb5_keyblock *key, krb5_data *state); + +krb5_error_code KRB5_CALLCONV + krb5_c_make_random_key + (krb5_context context, krb5_enctype enctype, + krb5_keyblock *k5_random_key); + +/* Register a new entropy sample with the PRNG. may cause +* the PRNG to be reseeded, although this is not guaranteed. See previous randsource definitions +* for information on how each source should be used. +*/ +krb5_error_code KRB5_CALLCONV + krb5_c_random_add_entropy +(krb5_context context, unsigned int randsource_id, const krb5_data *data); + + +krb5_error_code KRB5_CALLCONV + krb5_c_random_make_octets + (krb5_context context, krb5_data *data); + +/* +* Collect entropy from the OS if possible. strong requests that as strong +* of a source of entropy as available be used. Setting strong may +* increase the probability of blocking and should not be used for normal +* applications. Good uses include seeding the PRNG for kadmind +* and realm setup. +* If successful is non-null, then successful is set to 1 if the OS provided +* entropy else zero. +*/ +krb5_error_code KRB5_CALLCONV +krb5_c_random_os_entropy +(krb5_context context, int strong, int *success); + +/*deprecated*/ krb5_error_code KRB5_CALLCONV + krb5_c_random_seed + (krb5_context context, krb5_data *data); + +krb5_error_code KRB5_CALLCONV + krb5_c_string_to_key + (krb5_context context, krb5_enctype enctype, + const krb5_data *string, const krb5_data *salt, + krb5_keyblock *key); +krb5_error_code KRB5_CALLCONV +krb5_c_string_to_key_with_params(krb5_context context, + krb5_enctype enctype, + const krb5_data *string, + const krb5_data *salt, + const krb5_data *params, + krb5_keyblock *key); + +krb5_error_code KRB5_CALLCONV + krb5_c_enctype_compare + (krb5_context context, krb5_enctype e1, krb5_enctype e2, + krb5_boolean *similar); + +krb5_error_code KRB5_CALLCONV + krb5_c_make_checksum + (krb5_context context, krb5_cksumtype cksumtype, + const krb5_keyblock *key, krb5_keyusage usage, + const krb5_data *input, krb5_checksum *cksum); + +krb5_error_code KRB5_CALLCONV + krb5_c_verify_checksum + (krb5_context context, + const krb5_keyblock *key, krb5_keyusage usage, + const krb5_data *data, + const krb5_checksum *cksum, + krb5_boolean *valid); + +krb5_error_code KRB5_CALLCONV + krb5_c_checksum_length + (krb5_context context, krb5_cksumtype cksumtype, + size_t *length); + +krb5_error_code KRB5_CALLCONV + krb5_c_keyed_checksum_types + (krb5_context context, krb5_enctype enctype, + unsigned int *count, krb5_cksumtype **cksumtypes); + +#define KRB5_KEYUSAGE_AS_REQ_PA_ENC_TS 1 +#define KRB5_KEYUSAGE_KDC_REP_TICKET 2 +#define KRB5_KEYUSAGE_AS_REP_ENCPART 3 +#define KRB5_KEYUSAGE_TGS_REQ_AD_SESSKEY 4 +#define KRB5_KEYUSAGE_TGS_REQ_AD_SUBKEY 5 +#define KRB5_KEYUSAGE_TGS_REQ_AUTH_CKSUM 6 +#define KRB5_KEYUSAGE_TGS_REQ_AUTH 7 +#define KRB5_KEYUSAGE_TGS_REP_ENCPART_SESSKEY 8 +#define KRB5_KEYUSAGE_TGS_REP_ENCPART_SUBKEY 9 +#define KRB5_KEYUSAGE_AP_REQ_AUTH_CKSUM 10 +#define KRB5_KEYUSAGE_AP_REQ_AUTH 11 +#define KRB5_KEYUSAGE_AP_REP_ENCPART 12 +#define KRB5_KEYUSAGE_KRB_PRIV_ENCPART 13 +#define KRB5_KEYUSAGE_KRB_CRED_ENCPART 14 +#define KRB5_KEYUSAGE_KRB_SAFE_CKSUM 15 +#define KRB5_KEYUSAGE_APP_DATA_ENCRYPT 16 +#define KRB5_KEYUSAGE_APP_DATA_CKSUM 17 +#define KRB5_KEYUSAGE_KRB_ERROR_CKSUM 18 +#define KRB5_KEYUSAGE_AD_KDCISSUED_CKSUM 19 +#define KRB5_KEYUSAGE_AD_MTE 20 +#define KRB5_KEYUSAGE_AD_ITE 21 + +/* XXX need to register these */ + +#define KRB5_KEYUSAGE_GSS_TOK_MIC 22 +#define KRB5_KEYUSAGE_GSS_TOK_WRAP_INTEG 23 +#define KRB5_KEYUSAGE_GSS_TOK_WRAP_PRIV 24 + +/* Defined in hardware preauth draft */ + +#define KRB5_KEYUSAGE_PA_SAM_CHALLENGE_CKSUM 25 +#define KRB5_KEYUSAGE_PA_SAM_CHALLENGE_TRACKID 26 +#define KRB5_KEYUSAGE_PA_SAM_RESPONSE 27 + +krb5_boolean KRB5_CALLCONV krb5_c_valid_enctype + (krb5_enctype ktype); +krb5_boolean KRB5_CALLCONV krb5_c_valid_cksumtype + (krb5_cksumtype ctype); +krb5_boolean KRB5_CALLCONV krb5_c_is_coll_proof_cksum + (krb5_cksumtype ctype); +krb5_boolean KRB5_CALLCONV krb5_c_is_keyed_cksum + (krb5_cksumtype ctype); + +#if KRB5_PRIVATE +/* Use the above four instead. */ +krb5_boolean KRB5_CALLCONV valid_enctype + (krb5_enctype ktype); +krb5_boolean KRB5_CALLCONV valid_cksumtype + (krb5_cksumtype ctype); +krb5_boolean KRB5_CALLCONV is_coll_proof_cksum + (krb5_cksumtype ctype); +krb5_boolean KRB5_CALLCONV is_keyed_cksum + (krb5_cksumtype ctype); +#endif + +#ifdef KRB5_OLD_CRYPTO +/* + * old cryptosystem routine prototypes. These are now layered + * on top of the functions above. + */ +krb5_error_code KRB5_CALLCONV krb5_encrypt + (krb5_context context, + krb5_const_pointer inptr, + krb5_pointer outptr, + size_t size, + krb5_encrypt_block * eblock, + krb5_pointer ivec); +krb5_error_code KRB5_CALLCONV krb5_decrypt + (krb5_context context, + krb5_const_pointer inptr, + krb5_pointer outptr, + size_t size, + krb5_encrypt_block * eblock, + krb5_pointer ivec); +krb5_error_code KRB5_CALLCONV krb5_process_key + (krb5_context context, + krb5_encrypt_block * eblock, + const krb5_keyblock * key); +krb5_error_code KRB5_CALLCONV krb5_finish_key + (krb5_context context, + krb5_encrypt_block * eblock); +krb5_error_code KRB5_CALLCONV krb5_string_to_key + (krb5_context context, + const krb5_encrypt_block * eblock, + krb5_keyblock * keyblock, + const krb5_data * data, + const krb5_data * salt); +krb5_error_code KRB5_CALLCONV krb5_init_random_key + (krb5_context context, + const krb5_encrypt_block * eblock, + const krb5_keyblock * keyblock, + krb5_pointer * ptr); +krb5_error_code KRB5_CALLCONV krb5_finish_random_key + (krb5_context context, + const krb5_encrypt_block * eblock, + krb5_pointer * ptr); +krb5_error_code KRB5_CALLCONV krb5_random_key + (krb5_context context, + const krb5_encrypt_block * eblock, + krb5_pointer ptr, + krb5_keyblock ** keyblock); +krb5_enctype KRB5_CALLCONV krb5_eblock_enctype + (krb5_context context, + const krb5_encrypt_block * eblock); +krb5_error_code KRB5_CALLCONV krb5_use_enctype + (krb5_context context, + krb5_encrypt_block * eblock, + krb5_enctype enctype); +size_t KRB5_CALLCONV krb5_encrypt_size + (size_t length, + krb5_enctype crypto); +size_t KRB5_CALLCONV krb5_checksum_size + (krb5_context context, + krb5_cksumtype ctype); +krb5_error_code KRB5_CALLCONV krb5_calculate_checksum + (krb5_context context, + krb5_cksumtype ctype, + krb5_const_pointer in, size_t in_length, + krb5_const_pointer seed, size_t seed_length, + krb5_checksum * outcksum); +krb5_error_code KRB5_CALLCONV krb5_verify_checksum + (krb5_context context, + krb5_cksumtype ctype, + const krb5_checksum * cksum, + krb5_const_pointer in, size_t in_length, + krb5_const_pointer seed, size_t seed_length); + +#if KRB5_PRIVATE +krb5_error_code KRB5_CALLCONV krb5_random_confounder + (size_t, krb5_pointer); + +krb5_error_code krb5_encrypt_data + (krb5_context context, krb5_keyblock *key, + krb5_pointer ivec, krb5_data *data, + krb5_enc_data *enc_data); + +krb5_error_code krb5_decrypt_data + (krb5_context context, krb5_keyblock *key, + krb5_pointer ivec, krb5_enc_data *data, + krb5_data *enc_data); +#endif + +#endif /* KRB5_OLD_CRYPTO */ + +/* + * end "encryption.h" + */ + +/* + * begin "fieldbits.h" + */ + +/* kdc_options for kdc_request */ +/* options is 32 bits; each host is responsible to put the 4 bytes + representing these bits into net order before transmission */ +/* #define KDC_OPT_RESERVED 0x80000000 */ +#define KDC_OPT_FORWARDABLE 0x40000000 +#define KDC_OPT_FORWARDED 0x20000000 +#define KDC_OPT_PROXIABLE 0x10000000 +#define KDC_OPT_PROXY 0x08000000 +#define KDC_OPT_ALLOW_POSTDATE 0x04000000 +#define KDC_OPT_POSTDATED 0x02000000 +/* #define KDC_OPT_UNUSED 0x01000000 */ +#define KDC_OPT_RENEWABLE 0x00800000 +/* #define KDC_OPT_UNUSED 0x00400000 */ +/* #define KDC_OPT_RESERVED 0x00200000 */ +/* #define KDC_OPT_RESERVED 0x00100000 */ +/* #define KDC_OPT_RESERVED 0x00080000 */ +/* #define KDC_OPT_RESERVED 0x00040000 */ +#define KDC_OPT_REQUEST_ANONYMOUS 0x00020000 +/* #define KDC_OPT_RESERVED 0x00010000 */ +/* #define KDC_OPT_RESERVED 0x00008000 */ +/* #define KDC_OPT_RESERVED 0x00004000 */ +/* #define KDC_OPT_RESERVED 0x00002000 */ +/* #define KDC_OPT_RESERVED 0x00001000 */ +/* #define KDC_OPT_RESERVED 0x00000800 */ +/* #define KDC_OPT_RESERVED 0x00000400 */ +/* #define KDC_OPT_RESERVED 0x00000200 */ +/* #define KDC_OPT_RESERVED 0x00000100 */ +/* #define KDC_OPT_RESERVED 0x00000080 */ +/* #define KDC_OPT_RESERVED 0x00000040 */ +#define KDC_OPT_DISABLE_TRANSITED_CHECK 0x00000020 +#define KDC_OPT_RENEWABLE_OK 0x00000010 +#define KDC_OPT_ENC_TKT_IN_SKEY 0x00000008 +/* #define KDC_OPT_UNUSED 0x00000004 */ +#define KDC_OPT_RENEW 0x00000002 +#define KDC_OPT_VALIDATE 0x00000001 + +/* + * Mask of ticket flags in the TGT which should be converted into KDC + * options when using the TGT to get derivitive tickets. + * + * New mask = KDC_OPT_FORWARDABLE | KDC_OPT_PROXIABLE | + * KDC_OPT_ALLOW_POSTDATE | KDC_OPT_RENEWABLE + */ +#define KDC_TKT_COMMON_MASK 0x54800000 + +/* definitions for ap_options fields */ +/* ap_options are 32 bits; each host is responsible to put the 4 bytes + representing these bits into net order before transmission */ +#define AP_OPTS_RESERVED 0x80000000 +#define AP_OPTS_USE_SESSION_KEY 0x40000000 +#define AP_OPTS_MUTUAL_REQUIRED 0x20000000 +/* #define AP_OPTS_RESERVED 0x10000000 */ +/* #define AP_OPTS_RESERVED 0x08000000 */ +/* #define AP_OPTS_RESERVED 0x04000000 */ +/* #define AP_OPTS_RESERVED 0x02000000 */ +/* #define AP_OPTS_RESERVED 0x01000000 */ +/* #define AP_OPTS_RESERVED 0x00800000 */ +/* #define AP_OPTS_RESERVED 0x00400000 */ +/* #define AP_OPTS_RESERVED 0x00200000 */ +/* #define AP_OPTS_RESERVED 0x00100000 */ +/* #define AP_OPTS_RESERVED 0x00080000 */ +/* #define AP_OPTS_RESERVED 0x00040000 */ +/* #define AP_OPTS_RESERVED 0x00020000 */ +/* #define AP_OPTS_RESERVED 0x00010000 */ +/* #define AP_OPTS_RESERVED 0x00008000 */ +/* #define AP_OPTS_RESERVED 0x00004000 */ +/* #define AP_OPTS_RESERVED 0x00002000 */ +/* #define AP_OPTS_RESERVED 0x00001000 */ +/* #define AP_OPTS_RESERVED 0x00000800 */ +/* #define AP_OPTS_RESERVED 0x00000400 */ +/* #define AP_OPTS_RESERVED 0x00000200 */ +/* #define AP_OPTS_RESERVED 0x00000100 */ +/* #define AP_OPTS_RESERVED 0x00000080 */ +/* #define AP_OPTS_RESERVED 0x00000040 */ +/* #define AP_OPTS_RESERVED 0x00000020 */ +/* #define AP_OPTS_RESERVED 0x00000010 */ +/* #define AP_OPTS_RESERVED 0x00000008 */ +/* #define AP_OPTS_RESERVED 0x00000004 */ +/* #define AP_OPTS_RESERVED 0x00000002 */ +#define AP_OPTS_USE_SUBKEY 0x00000001 + +#define AP_OPTS_WIRE_MASK 0xfffffff0 + +/* definitions for ad_type fields. */ +#define AD_TYPE_RESERVED 0x8000 +#define AD_TYPE_EXTERNAL 0x4000 +#define AD_TYPE_REGISTERED 0x2000 + +#define AD_TYPE_FIELD_TYPE_MASK 0x1fff + +/* Ticket flags */ +/* flags are 32 bits; each host is responsible to put the 4 bytes + representing these bits into net order before transmission */ +/* #define TKT_FLG_RESERVED 0x80000000 */ +#define TKT_FLG_FORWARDABLE 0x40000000 +#define TKT_FLG_FORWARDED 0x20000000 +#define TKT_FLG_PROXIABLE 0x10000000 +#define TKT_FLG_PROXY 0x08000000 +#define TKT_FLG_MAY_POSTDATE 0x04000000 +#define TKT_FLG_POSTDATED 0x02000000 +#define TKT_FLG_INVALID 0x01000000 +#define TKT_FLG_RENEWABLE 0x00800000 +#define TKT_FLG_INITIAL 0x00400000 +#define TKT_FLG_PRE_AUTH 0x00200000 +#define TKT_FLG_HW_AUTH 0x00100000 +#define TKT_FLG_TRANSIT_POLICY_CHECKED 0x00080000 +#define TKT_FLG_OK_AS_DELEGATE 0x00040000 +#define TKT_FLG_ANONYMOUS 0x00020000 +/* #define TKT_FLG_RESERVED 0x00010000 */ +/* #define TKT_FLG_RESERVED 0x00008000 */ +/* #define TKT_FLG_RESERVED 0x00004000 */ +/* #define TKT_FLG_RESERVED 0x00002000 */ +/* #define TKT_FLG_RESERVED 0x00001000 */ +/* #define TKT_FLG_RESERVED 0x00000800 */ +/* #define TKT_FLG_RESERVED 0x00000400 */ +/* #define TKT_FLG_RESERVED 0x00000200 */ +/* #define TKT_FLG_RESERVED 0x00000100 */ +/* #define TKT_FLG_RESERVED 0x00000080 */ +/* #define TKT_FLG_RESERVED 0x00000040 */ +/* #define TKT_FLG_RESERVED 0x00000020 */ +/* #define TKT_FLG_RESERVED 0x00000010 */ +/* #define TKT_FLG_RESERVED 0x00000008 */ +/* #define TKT_FLG_RESERVED 0x00000004 */ +/* #define TKT_FLG_RESERVED 0x00000002 */ +/* #define TKT_FLG_RESERVED 0x00000001 */ + +/* definitions for lr_type fields. */ +#define LR_TYPE_THIS_SERVER_ONLY 0x8000 + +#define LR_TYPE_INTERPRETATION_MASK 0x7fff + +/* definitions for ad_type fields. */ +#define AD_TYPE_EXTERNAL 0x4000 +#define AD_TYPE_REGISTERED 0x2000 + +#define AD_TYPE_FIELD_TYPE_MASK 0x1fff +#define AD_TYPE_INTERNAL_MASK 0x3fff + +/* definitions for msec direction bit for KRB_SAFE, KRB_PRIV */ +#define MSEC_DIRBIT 0x8000 +#define MSEC_VAL_MASK 0x7fff + +/* + * end "fieldbits.h" + */ + +/* + * begin "proto.h" + */ + +/* Protocol version number */ +#define KRB5_PVNO 5 + +/* Message types */ + +#define KRB5_AS_REQ ((krb5_msgtype)10) /* Req for initial authentication */ +#define KRB5_AS_REP ((krb5_msgtype)11) /* Response to KRB_AS_REQ request */ +#define KRB5_TGS_REQ ((krb5_msgtype)12) /* TGS request to server */ +#define KRB5_TGS_REP ((krb5_msgtype)13) /* Response to KRB_TGS_REQ req */ +#define KRB5_AP_REQ ((krb5_msgtype)14) /* application request to server */ +#define KRB5_AP_REP ((krb5_msgtype)15) /* Response to KRB_AP_REQ_MUTUAL */ +#define KRB5_SAFE ((krb5_msgtype)20) /* Safe application message */ +#define KRB5_PRIV ((krb5_msgtype)21) /* Private application message */ +#define KRB5_CRED ((krb5_msgtype)22) /* Credential forwarding message */ +#define KRB5_ERROR ((krb5_msgtype)30) /* Error response */ + +/* LastReq types */ +#define KRB5_LRQ_NONE 0 +#define KRB5_LRQ_ALL_LAST_TGT 1 +#define KRB5_LRQ_ONE_LAST_TGT (-1) +#define KRB5_LRQ_ALL_LAST_INITIAL 2 +#define KRB5_LRQ_ONE_LAST_INITIAL (-2) +#define KRB5_LRQ_ALL_LAST_TGT_ISSUED 3 +#define KRB5_LRQ_ONE_LAST_TGT_ISSUED (-3) +#define KRB5_LRQ_ALL_LAST_RENEWAL 4 +#define KRB5_LRQ_ONE_LAST_RENEWAL (-4) +#define KRB5_LRQ_ALL_LAST_REQ 5 +#define KRB5_LRQ_ONE_LAST_REQ (-5) +#define KRB5_LRQ_ALL_PW_EXPTIME 6 +#define KRB5_LRQ_ONE_PW_EXPTIME (-6) + +/* PADATA types */ +#define KRB5_PADATA_NONE 0 +#define KRB5_PADATA_AP_REQ 1 +#define KRB5_PADATA_TGS_REQ KRB5_PADATA_AP_REQ +#define KRB5_PADATA_ENC_TIMESTAMP 2 +#define KRB5_PADATA_PW_SALT 3 +#if 0 /* Not used */ +#define KRB5_PADATA_ENC_ENCKEY 4 /* Key encrypted within itself */ +#endif +#define KRB5_PADATA_ENC_UNIX_TIME 5 /* timestamp encrypted in key */ +#define KRB5_PADATA_ENC_SANDIA_SECURID 6 /* SecurId passcode */ +#define KRB5_PADATA_SESAME 7 /* Sesame project */ +#define KRB5_PADATA_OSF_DCE 8 /* OSF DCE */ +#define KRB5_CYBERSAFE_SECUREID 9 /* Cybersafe */ +#define KRB5_PADATA_AFS3_SALT 10 /* Cygnus */ +#define KRB5_PADATA_ETYPE_INFO 11 /* Etype info for preauth */ +#define KRB5_PADATA_SAM_CHALLENGE 12 /* draft challenge system */ +#define KRB5_PADATA_SAM_RESPONSE 13 /* draft challenge system response */ +#define KRB5_PADATA_PK_AS_REQ 14 /* PKINIT */ +#define KRB5_PADATA_PK_AS_REP 15 /* PKINIT */ +#define KRB5_PADATA_ETYPE_INFO2 19 +#define KRB5_PADATA_SAM_CHALLENGE_2 30 /* draft challenge system, updated */ +#define KRB5_PADATA_SAM_RESPONSE_2 31 /* draft challenge system, updated */ + +#define KRB5_SAM_USE_SAD_AS_KEY 0x80000000 +#define KRB5_SAM_SEND_ENCRYPTED_SAD 0x40000000 +#define KRB5_SAM_MUST_PK_ENCRYPT_SAD 0x20000000 /* currently must be zero */ + +/* Reserved for SPX pre-authentication. */ +#define KRB5_PADATA_DASS 16 + +/* Transited encoding types */ +#define KRB5_DOMAIN_X500_COMPRESS 1 + +/* alternate authentication types */ +#define KRB5_ALTAUTH_ATT_CHALLENGE_RESPONSE 64 + +/* authorization data types */ +#define KRB5_AUTHDATA_OSF_DCE 64 +#define KRB5_AUTHDATA_SESAME 65 + +/* password change constants */ + +#define KRB5_KPASSWD_SUCCESS 0 +#define KRB5_KPASSWD_MALFORMED 1 +#define KRB5_KPASSWD_HARDERROR 2 +#define KRB5_KPASSWD_AUTHERROR 3 +#define KRB5_KPASSWD_SOFTERROR 4 +/* These are Microsoft's extensions in RFC 3244, and it looks like + they'll become standardized, possibly with other additions. */ +#define KRB5_KPASSWD_ACCESSDENIED 5 /* unused */ +#define KRB5_KPASSWD_BAD_VERSION 6 +#define KRB5_KPASSWD_INITIAL_FLAG_NEEDED 7 /* unused */ + +/* + * end "proto.h" + */ + +/* Time set */ +typedef struct _krb5_ticket_times { + krb5_timestamp authtime; /* XXX ? should ktime in KDC_REP == authtime + in ticket? otherwise client can't get this */ + krb5_timestamp starttime; /* optional in ticket, if not present, + use authtime */ + krb5_timestamp endtime; + krb5_timestamp renew_till; +} krb5_ticket_times; + +/* structure for auth data */ +typedef struct _krb5_authdata { + krb5_magic magic; + krb5_authdatatype ad_type; + unsigned int length; + krb5_octet *contents; +} krb5_authdata; + +/* structure for transited encoding */ +typedef struct _krb5_transited { + krb5_magic magic; + krb5_octet tr_type; + krb5_data tr_contents; +} krb5_transited; + +typedef struct _krb5_enc_tkt_part { + krb5_magic magic; + /* to-be-encrypted portion */ + krb5_flags flags; /* flags */ + krb5_keyblock *session; /* session key: includes enctype */ + krb5_principal client; /* client name/realm */ + krb5_transited transited; /* list of transited realms */ + krb5_ticket_times times; /* auth, start, end, renew_till */ + krb5_address **caddrs; /* array of ptrs to addresses */ + krb5_authdata **authorization_data; /* auth data */ +} krb5_enc_tkt_part; + +typedef struct _krb5_ticket { + krb5_magic magic; + /* cleartext portion */ + krb5_principal server; /* server name/realm */ + krb5_enc_data enc_part; /* encryption type, kvno, encrypted + encoding */ + krb5_enc_tkt_part *enc_part2; /* ptr to decrypted version, if + available */ +} krb5_ticket; + +/* the unencrypted version */ +typedef struct _krb5_authenticator { + krb5_magic magic; + krb5_principal client; /* client name/realm */ + krb5_checksum *checksum; /* checksum, includes type, optional */ + krb5_int32 cusec; /* client usec portion */ + krb5_timestamp ctime; /* client sec portion */ + krb5_keyblock *subkey; /* true session key, optional */ + krb5_ui_4 seq_number; /* sequence #, optional */ + krb5_authdata **authorization_data; /* New add by Ari, auth data */ +} krb5_authenticator; + +typedef struct _krb5_tkt_authent { + krb5_magic magic; + krb5_ticket *ticket; + krb5_authenticator *authenticator; + krb5_flags ap_options; +} krb5_tkt_authent; + +/* credentials: Ticket, session key, etc. */ +typedef struct _krb5_creds { + krb5_magic magic; + krb5_principal client; /* client's principal identifier */ + krb5_principal server; /* server's principal identifier */ + krb5_keyblock keyblock; /* session encryption key info */ + krb5_ticket_times times; /* lifetime info */ + krb5_boolean is_skey; /* true if ticket is encrypted in + another ticket's skey */ + krb5_flags ticket_flags; /* flags in ticket */ + krb5_address **addresses; /* addrs in ticket */ + krb5_data ticket; /* ticket string itself */ + krb5_data second_ticket; /* second ticket, if related to + ticket (via DUPLICATE-SKEY or + ENC-TKT-IN-SKEY) */ + krb5_authdata **authdata; /* authorization data */ +} krb5_creds; + +/* Last request fields */ +typedef struct _krb5_last_req_entry { + krb5_magic magic; + krb5_int32 lr_type; + krb5_timestamp value; +} krb5_last_req_entry; + +/* pre-authentication data */ +typedef struct _krb5_pa_data { + krb5_magic magic; + krb5_preauthtype pa_type; + unsigned int length; + krb5_octet *contents; +} krb5_pa_data; + +typedef struct _krb5_kdc_req { + krb5_magic magic; + krb5_msgtype msg_type; /* AS_REQ or TGS_REQ? */ + krb5_pa_data **padata; /* e.g. encoded AP_REQ */ + /* real body */ + krb5_flags kdc_options; /* requested options */ + krb5_principal client; /* includes realm; optional */ + krb5_principal server; /* includes realm (only used if no + client) */ + krb5_timestamp from; /* requested starttime */ + krb5_timestamp till; /* requested endtime */ + krb5_timestamp rtime; /* (optional) requested renew_till */ + krb5_int32 nonce; /* nonce to match request/response */ + int nktypes; /* # of ktypes, must be positive */ + krb5_enctype *ktype; /* requested enctype(s) */ + krb5_address **addresses; /* requested addresses, optional */ + krb5_enc_data authorization_data; /* encrypted auth data; OPTIONAL */ + krb5_authdata **unenc_authdata; /* unencrypted auth data, + if available */ + krb5_ticket **second_ticket;/* second ticket array; OPTIONAL */ +} krb5_kdc_req; + +typedef struct _krb5_enc_kdc_rep_part { + krb5_magic magic; + /* encrypted part: */ + krb5_msgtype msg_type; /* krb5 message type */ + krb5_keyblock *session; /* session key */ + krb5_last_req_entry **last_req; /* array of ptrs to entries */ + krb5_int32 nonce; /* nonce from request */ + krb5_timestamp key_exp; /* expiration date */ + krb5_flags flags; /* ticket flags */ + krb5_ticket_times times; /* lifetime info */ + krb5_principal server; /* server's principal identifier */ + krb5_address **caddrs; /* array of ptrs to addresses, + optional */ +} krb5_enc_kdc_rep_part; + +typedef struct _krb5_kdc_rep { + krb5_magic magic; + /* cleartext part: */ + krb5_msgtype msg_type; /* AS_REP or KDC_REP? */ + krb5_pa_data **padata; /* preauthentication data from KDC */ + krb5_principal client; /* client's principal identifier */ + krb5_ticket *ticket; /* ticket */ + krb5_enc_data enc_part; /* encryption type, kvno, encrypted + encoding */ + krb5_enc_kdc_rep_part *enc_part2;/* unencrypted version, if available */ +} krb5_kdc_rep; + +/* error message structure */ +typedef struct _krb5_error { + krb5_magic magic; + /* some of these may be meaningless in certain contexts */ + krb5_timestamp ctime; /* client sec portion; optional */ + krb5_int32 cusec; /* client usec portion; optional */ + krb5_int32 susec; /* server usec portion */ + krb5_timestamp stime; /* server sec portion */ + krb5_ui_4 error; /* error code (protocol error #'s) */ + krb5_principal client; /* client's principal identifier; + optional */ + krb5_principal server; /* server's principal identifier */ + krb5_data text; /* descriptive text */ + krb5_data e_data; /* additional error-describing data */ +} krb5_error; + +typedef struct _krb5_ap_req { + krb5_magic magic; + krb5_flags ap_options; /* requested options */ + krb5_ticket *ticket; /* ticket */ + krb5_enc_data authenticator; /* authenticator (already encrypted) */ +} krb5_ap_req; + +typedef struct _krb5_ap_rep { + krb5_magic magic; + krb5_enc_data enc_part; +} krb5_ap_rep; + +typedef struct _krb5_ap_rep_enc_part { + krb5_magic magic; + krb5_timestamp ctime; /* client time, seconds portion */ + krb5_int32 cusec; /* client time, microseconds portion */ + krb5_keyblock *subkey; /* true session key, optional */ + krb5_ui_4 seq_number; /* sequence #, optional */ +} krb5_ap_rep_enc_part; + +typedef struct _krb5_response { + krb5_magic magic; + krb5_octet message_type; + krb5_data response; + krb5_int32 expected_nonce; /* The expected nonce for KDC_REP messages */ + krb5_timestamp request_time; /* When we made the request */ +} krb5_response; + +typedef struct _krb5_cred_info { + krb5_magic magic; + krb5_keyblock *session; /* session key used to encrypt */ + /* ticket */ + krb5_principal client; /* client name/realm, optional */ + krb5_principal server; /* server name/realm, optional */ + krb5_flags flags; /* ticket flags, optional */ + krb5_ticket_times times; /* auth, start, end, renew_till, */ + /* optional */ + krb5_address **caddrs; /* array of ptrs to addresses */ +} krb5_cred_info; + +typedef struct _krb5_cred_enc_part { + krb5_magic magic; + krb5_int32 nonce; /* nonce, optional */ + krb5_timestamp timestamp; /* client time */ + krb5_int32 usec; /* microsecond portion of time */ + krb5_address *s_address; /* sender address, optional */ + krb5_address *r_address; /* recipient address, optional */ + krb5_cred_info **ticket_info; +} krb5_cred_enc_part; + +typedef struct _krb5_cred { + krb5_magic magic; + krb5_ticket **tickets; /* tickets */ + krb5_enc_data enc_part; /* encrypted part */ + krb5_cred_enc_part *enc_part2; /* unencrypted version, if available*/ +} krb5_cred; + +/* Sandia password generation structures */ +typedef struct _passwd_phrase_element { + krb5_magic magic; + krb5_data *passwd; + krb5_data *phrase; +} passwd_phrase_element; + +typedef struct _krb5_pwd_data { + krb5_magic magic; + int sequence_count; + passwd_phrase_element **element; +} krb5_pwd_data; + +/* these need to be here so the typedefs are available for the prototypes */ + +/* + * begin "safepriv.h" + */ + +#define KRB5_AUTH_CONTEXT_DO_TIME 0x00000001 +#define KRB5_AUTH_CONTEXT_RET_TIME 0x00000002 +#define KRB5_AUTH_CONTEXT_DO_SEQUENCE 0x00000004 +#define KRB5_AUTH_CONTEXT_RET_SEQUENCE 0x00000008 +#define KRB5_AUTH_CONTEXT_PERMIT_ALL 0x00000010 +#define KRB5_AUTH_CONTEXT_USE_SUBKEY 0x00000020 + +typedef struct krb5_replay_data { + krb5_timestamp timestamp; + krb5_int32 usec; + krb5_ui_4 seq; +} krb5_replay_data; + +/* flags for krb5_auth_con_genaddrs() */ +#define KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR 0x00000001 +#define KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR 0x00000002 +#define KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR 0x00000004 +#define KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR 0x00000008 + +/* type of function used as a callback to generate checksum data for + * mk_req */ + +typedef krb5_error_code +(KRB5_CALLCONV * krb5_mk_req_checksum_func) (krb5_context, krb5_auth_context , void *, + krb5_data **); + +/* + * end "safepriv.h" + */ + + +/* + * begin "ccache.h" + */ + +typedef krb5_pointer krb5_cc_cursor; /* cursor for sequential lookup */ + +struct _krb5_ccache; +typedef struct _krb5_ccache *krb5_ccache; +struct _krb5_cc_ops; +typedef struct _krb5_cc_ops krb5_cc_ops; + +/* for retrieve_cred */ +#define KRB5_TC_MATCH_TIMES 0x00000001 +#define KRB5_TC_MATCH_IS_SKEY 0x00000002 +#define KRB5_TC_MATCH_FLAGS 0x00000004 +#define KRB5_TC_MATCH_TIMES_EXACT 0x00000008 +#define KRB5_TC_MATCH_FLAGS_EXACT 0x00000010 +#define KRB5_TC_MATCH_AUTHDATA 0x00000020 +#define KRB5_TC_MATCH_SRV_NAMEONLY 0x00000040 +#define KRB5_TC_MATCH_2ND_TKT 0x00000080 +#define KRB5_TC_MATCH_KTYPE 0x00000100 +#define KRB5_TC_SUPPORTED_KTYPES 0x00000200 + +/* for set_flags and other functions */ +#define KRB5_TC_OPENCLOSE 0x00000001 + +const char * KRB5_CALLCONV +krb5_cc_get_name (krb5_context context, krb5_ccache cache); + +krb5_error_code KRB5_CALLCONV +krb5_cc_gen_new (krb5_context context, krb5_ccache *cache); + +krb5_error_code KRB5_CALLCONV +krb5_cc_initialize(krb5_context context, krb5_ccache cache, + krb5_principal principal); + +krb5_error_code KRB5_CALLCONV +krb5_cc_destroy (krb5_context context, krb5_ccache cache); + +krb5_error_code KRB5_CALLCONV +krb5_cc_close (krb5_context context, krb5_ccache cache); + +krb5_error_code KRB5_CALLCONV +krb5_cc_store_cred (krb5_context context, krb5_ccache cache, + krb5_creds *creds); + +krb5_error_code KRB5_CALLCONV +krb5_cc_retrieve_cred (krb5_context context, krb5_ccache cache, + krb5_flags flags, krb5_creds *mcreds, + krb5_creds *creds); + +krb5_error_code KRB5_CALLCONV +krb5_cc_get_principal (krb5_context context, krb5_ccache cache, + krb5_principal *principal); + +krb5_error_code KRB5_CALLCONV +krb5_cc_start_seq_get (krb5_context context, krb5_ccache cache, + krb5_cc_cursor *cursor); + +krb5_error_code KRB5_CALLCONV +krb5_cc_next_cred (krb5_context context, krb5_ccache cache, + krb5_cc_cursor *cursor, krb5_creds *creds); + +krb5_error_code KRB5_CALLCONV +krb5_cc_end_seq_get (krb5_context context, krb5_ccache cache, + krb5_cc_cursor *cursor); + +krb5_error_code KRB5_CALLCONV +krb5_cc_remove_cred (krb5_context context, krb5_ccache cache, krb5_flags flags, + krb5_creds *creds); + +krb5_error_code KRB5_CALLCONV +krb5_cc_set_flags (krb5_context context, krb5_ccache cache, krb5_flags flags); + +const char * KRB5_CALLCONV +krb5_cc_get_type (krb5_context context, krb5_ccache cache); + +/* + * end "ccache.h" + */ + +/* + * begin "rcache.h" + */ + +struct krb5_rc_st; +typedef struct krb5_rc_st *krb5_rcache; + +#if KRB5_PRIVATE +typedef struct _krb5_donot_replay { + krb5_magic magic; + char *server; /* null-terminated */ + char *client; /* null-terminated */ + krb5_int32 cusec; + krb5_timestamp ctime; +} krb5_donot_replay; + +krb5_error_code krb5_rc_default + (krb5_context, + krb5_rcache *); +krb5_error_code krb5_rc_resolve_type + (krb5_context, + krb5_rcache *,char *); +krb5_error_code krb5_rc_resolve_full + (krb5_context, + krb5_rcache *,char *); +char * krb5_rc_get_type + (krb5_context, + krb5_rcache); +char * krb5_rc_default_type + (krb5_context); +char * krb5_rc_default_name + (krb5_context); +krb5_error_code krb5_auth_to_rep + (krb5_context, + krb5_tkt_authent *, + krb5_donot_replay *); + + +krb5_error_code KRB5_CALLCONV krb5_rc_initialize + (krb5_context, krb5_rcache,krb5_deltat); +krb5_error_code KRB5_CALLCONV krb5_rc_recover + (krb5_context, krb5_rcache); +krb5_error_code KRB5_CALLCONV krb5_rc_destroy + (krb5_context, krb5_rcache); +krb5_error_code KRB5_CALLCONV krb5_rc_close + (krb5_context, krb5_rcache); +krb5_error_code KRB5_CALLCONV krb5_rc_store + (krb5_context, krb5_rcache,krb5_donot_replay *); +krb5_error_code KRB5_CALLCONV krb5_rc_expunge + (krb5_context, krb5_rcache); +krb5_error_code KRB5_CALLCONV krb5_rc_get_lifespan + (krb5_context, krb5_rcache,krb5_deltat *); +char *KRB5_CALLCONV krb5_rc_get_name + (krb5_context, krb5_rcache); +krb5_error_code KRB5_CALLCONV krb5_rc_resolve + (krb5_context, krb5_rcache, char *); +#endif /* KRB5_PRIVATE */ +/* + * end "rcache.h" + */ + +/* + * begin "keytab.h" + */ + + +/* XXX */ +#define MAX_KEYTAB_NAME_LEN 1100 /* Long enough for MAXPATHLEN + some extra */ + +typedef krb5_pointer krb5_kt_cursor; /* XXX */ + +typedef struct krb5_keytab_entry_st { + krb5_magic magic; + krb5_principal principal; /* principal of this key */ + krb5_timestamp timestamp; /* time entry written to keytable */ + krb5_kvno vno; /* key version number */ + krb5_keyblock key; /* the secret key */ +} krb5_keytab_entry; + +#if KRB5_PRIVATE +struct _krb5_kt_ops; +typedef struct _krb5_kt { /* should move into k5-int.h */ + krb5_magic magic; + const struct _krb5_kt_ops *ops; + krb5_pointer data; +} *krb5_keytab; +#else +struct _krb5_kt; +typedef struct _krb5_kt *krb5_keytab; +#endif + +char * KRB5_CALLCONV +krb5_kt_get_type (krb5_context, krb5_keytab keytab); +krb5_error_code KRB5_CALLCONV +krb5_kt_get_name(krb5_context context, krb5_keytab keytab, char *name, + unsigned int namelen); +krb5_error_code KRB5_CALLCONV +krb5_kt_close(krb5_context context, krb5_keytab keytab); +krb5_error_code KRB5_CALLCONV +krb5_kt_get_entry(krb5_context context, krb5_keytab keytab, + krb5_const_principal principal, krb5_kvno vno, + krb5_enctype enctype, krb5_keytab_entry *entry); +krb5_error_code KRB5_CALLCONV +krb5_kt_start_seq_get(krb5_context context, krb5_keytab keytab, + krb5_kt_cursor *cursor); +krb5_error_code KRB5_CALLCONV +krb5_kt_next_entry(krb5_context context, krb5_keytab keytab, + krb5_keytab_entry *entry, krb5_kt_cursor *cursor); +krb5_error_code KRB5_CALLCONV +krb5_kt_end_seq_get(krb5_context context, krb5_keytab keytab, + krb5_kt_cursor *cursor); + +/* + * end "keytab.h" + */ + +/* + * begin "func-proto.h" + */ + +krb5_error_code KRB5_CALLCONV krb5_init_context + (krb5_context *); +krb5_error_code KRB5_CALLCONV krb5_init_secure_context + (krb5_context *); +void KRB5_CALLCONV krb5_free_context + (krb5_context); + +#if KRB5_PRIVATE +krb5_error_code krb5_set_default_in_tkt_ktypes + (krb5_context, + const krb5_enctype *); +krb5_error_code krb5_get_default_in_tkt_ktypes + (krb5_context, + krb5_enctype **); + +krb5_error_code krb5_set_default_tgs_ktypes + (krb5_context, + const krb5_enctype *); +#endif + +krb5_error_code KRB5_CALLCONV +krb5_set_default_tgs_enctypes + (krb5_context, + const krb5_enctype *); +#if KRB5_PRIVATE +krb5_error_code KRB5_CALLCONV krb5_get_tgs_ktypes + (krb5_context, + krb5_const_principal, + krb5_enctype **); +#endif + +krb5_error_code KRB5_CALLCONV krb5_get_permitted_enctypes + (krb5_context, krb5_enctype **); + +#if KRB5_PRIVATE +void KRB5_CALLCONV krb5_free_ktypes + (krb5_context, krb5_enctype *); + +krb5_boolean krb5_is_permitted_enctype + (krb5_context, krb5_enctype); +#endif + +/* libkrb.spec */ +#if KRB5_PRIVATE +krb5_error_code krb5_kdc_rep_decrypt_proc + (krb5_context, + const krb5_keyblock *, + krb5_const_pointer, + krb5_kdc_rep * ); +krb5_error_code KRB5_CALLCONV krb5_decrypt_tkt_part + (krb5_context, + const krb5_keyblock *, + krb5_ticket * ); +krb5_error_code krb5_get_cred_from_kdc + (krb5_context, + krb5_ccache, /* not const, as reading may save + state */ + krb5_creds *, + krb5_creds **, + krb5_creds *** ); +krb5_error_code krb5_get_cred_from_kdc_validate + (krb5_context, + krb5_ccache, /* not const, as reading may save + state */ + krb5_creds *, + krb5_creds **, + krb5_creds *** ); +krb5_error_code krb5_get_cred_from_kdc_renew + (krb5_context, + krb5_ccache, /* not const, as reading may save + state */ + krb5_creds *, + krb5_creds **, + krb5_creds *** ); +#endif + +void KRB5_CALLCONV krb5_free_tgt_creds + (krb5_context, + krb5_creds **); /* XXX too hard to do with const */ + +#define KRB5_GC_USER_USER 1 /* want user-user ticket */ +#define KRB5_GC_CACHED 2 /* want cached ticket only */ + +krb5_error_code KRB5_CALLCONV krb5_get_credentials + (krb5_context, + krb5_flags, + krb5_ccache, + krb5_creds *, + krb5_creds **); +krb5_error_code KRB5_CALLCONV krb5_get_credentials_validate + (krb5_context, + krb5_flags, + krb5_ccache, + krb5_creds *, + krb5_creds **); +krb5_error_code KRB5_CALLCONV krb5_get_credentials_renew + (krb5_context, + krb5_flags, + krb5_ccache, + krb5_creds *, + krb5_creds **); +#if KRB5_PRIVATE +krb5_error_code krb5_get_cred_via_tkt + (krb5_context, + krb5_creds *, + krb5_flags, + krb5_address * const *, + krb5_creds *, + krb5_creds **); +#endif +krb5_error_code KRB5_CALLCONV krb5_mk_req + (krb5_context, + krb5_auth_context *, + krb5_flags, + char *, + char *, + krb5_data *, + krb5_ccache, + krb5_data * ); +krb5_error_code KRB5_CALLCONV krb5_mk_req_extended + (krb5_context, + krb5_auth_context *, + krb5_flags, + krb5_data *, + krb5_creds *, + krb5_data * ); +krb5_error_code KRB5_CALLCONV krb5_mk_rep + (krb5_context, + krb5_auth_context, + krb5_data *); +krb5_error_code KRB5_CALLCONV krb5_rd_rep + (krb5_context, + krb5_auth_context, + const krb5_data *, + krb5_ap_rep_enc_part **); +krb5_error_code KRB5_CALLCONV krb5_mk_error + (krb5_context, + const krb5_error *, + krb5_data * ); +krb5_error_code KRB5_CALLCONV krb5_rd_error + (krb5_context, + const krb5_data *, + krb5_error ** ); +krb5_error_code KRB5_CALLCONV krb5_rd_safe + (krb5_context, + krb5_auth_context, + const krb5_data *, + krb5_data *, + krb5_replay_data *); +krb5_error_code KRB5_CALLCONV krb5_rd_priv + (krb5_context, + krb5_auth_context, + const krb5_data *, + krb5_data *, + krb5_replay_data *); +krb5_error_code KRB5_CALLCONV krb5_parse_name + (krb5_context, + const char *, + krb5_principal * ); +krb5_error_code KRB5_CALLCONV krb5_unparse_name + (krb5_context, + krb5_const_principal, + char ** ); +krb5_error_code KRB5_CALLCONV krb5_unparse_name_ext + (krb5_context, + krb5_const_principal, + char **, + unsigned int *); + +krb5_error_code KRB5_CALLCONV krb5_set_principal_realm + (krb5_context, krb5_principal, const char *); + +krb5_boolean KRB5_CALLCONV_WRONG krb5_address_search + (krb5_context, + const krb5_address *, + krb5_address * const *); +krb5_boolean KRB5_CALLCONV krb5_address_compare + (krb5_context, + const krb5_address *, + const krb5_address *); +int KRB5_CALLCONV krb5_address_order + (krb5_context, + const krb5_address *, + const krb5_address *); +krb5_boolean KRB5_CALLCONV krb5_realm_compare + (krb5_context, + krb5_const_principal, + krb5_const_principal); +krb5_boolean KRB5_CALLCONV krb5_principal_compare + (krb5_context, + krb5_const_principal, + krb5_const_principal); +krb5_error_code KRB5_CALLCONV krb5_init_keyblock + (krb5_context, krb5_enctype enctype, + size_t length, krb5_keyblock **out); + /* Initialize a new keyblock and allocate storage + * for the contents of the key, which will be freed along + * with the keyblock when krb5_free_keyblock is called. + * It is legal to pass in a length of 0, in which + * case contents are left unallocated. + */ +krb5_error_code KRB5_CALLCONV krb5_copy_keyblock + (krb5_context, + const krb5_keyblock *, + krb5_keyblock **); +krb5_error_code KRB5_CALLCONV krb5_copy_keyblock_contents + (krb5_context, + const krb5_keyblock *, + krb5_keyblock *); +krb5_error_code KRB5_CALLCONV krb5_copy_creds + (krb5_context, + const krb5_creds *, + krb5_creds **); +krb5_error_code KRB5_CALLCONV krb5_copy_data + (krb5_context, + const krb5_data *, + krb5_data **); +krb5_error_code KRB5_CALLCONV krb5_copy_principal + (krb5_context, + krb5_const_principal, + krb5_principal *); +#if KRB5_PRIVATE +krb5_error_code KRB5_CALLCONV krb5_copy_addr + (krb5_context, + const krb5_address *, + krb5_address **); +#endif +krb5_error_code KRB5_CALLCONV krb5_copy_addresses + (krb5_context, + krb5_address * const *, + krb5_address ***); +krb5_error_code KRB5_CALLCONV krb5_copy_ticket + (krb5_context, + const krb5_ticket *, + krb5_ticket **); +krb5_error_code KRB5_CALLCONV krb5_copy_authdata + (krb5_context, + krb5_authdata * const *, + krb5_authdata ***); +krb5_error_code KRB5_CALLCONV krb5_copy_authenticator + (krb5_context, + const krb5_authenticator *, + krb5_authenticator **); +krb5_error_code KRB5_CALLCONV krb5_copy_checksum + (krb5_context, + const krb5_checksum *, + krb5_checksum **); +#if KRB5_PRIVATE +void krb5_init_ets + (krb5_context); +void krb5_free_ets + (krb5_context); +krb5_error_code krb5_generate_subkey + (krb5_context, + const krb5_keyblock *, krb5_keyblock **); +krb5_error_code krb5_generate_seq_number + (krb5_context, + const krb5_keyblock *, krb5_ui_4 *); +#endif +krb5_error_code KRB5_CALLCONV krb5_get_server_rcache + (krb5_context, + const krb5_data *, krb5_rcache *); +krb5_error_code KRB5_CALLCONV_C krb5_build_principal_ext + (krb5_context, krb5_principal *, unsigned int, const char *, ...); +krb5_error_code KRB5_CALLCONV_C krb5_build_principal + (krb5_context, krb5_principal *, unsigned int, const char *, ...); +#ifdef va_start +/* XXX depending on varargs include file defining va_start... */ +krb5_error_code KRB5_CALLCONV krb5_build_principal_va + (krb5_context, + krb5_principal, unsigned int, const char *, va_list); +#endif + +krb5_error_code KRB5_CALLCONV krb5_425_conv_principal + (krb5_context, + const char *name, + const char *instance, const char *realm, + krb5_principal *princ); + +krb5_error_code KRB5_CALLCONV krb5_524_conv_principal + (krb5_context context, krb5_const_principal princ, + char *name, char *inst, char *realm); + +struct credentials; +int KRB5_CALLCONV krb5_524_convert_creds + (krb5_context context, krb5_creds *v5creds, + struct credentials *v4creds); +#if KRB5_DEPRECATED +#define krb524_convert_creds_kdc krb5_524_convert_creds +#define krb524_init_ets(x) (0) +#endif + +/* libkt.spec */ +#if KRB5_PRIVATE +krb5_error_code KRB5_CALLCONV krb5_kt_register + (krb5_context, + struct _krb5_kt_ops * ); +#endif + +krb5_error_code KRB5_CALLCONV krb5_kt_resolve + (krb5_context, + const char *, + krb5_keytab * ); +krb5_error_code KRB5_CALLCONV krb5_kt_default_name + (krb5_context, + char *, + int ); +krb5_error_code KRB5_CALLCONV krb5_kt_default + (krb5_context, + krb5_keytab * ); +krb5_error_code KRB5_CALLCONV krb5_free_keytab_entry_contents + (krb5_context, + krb5_keytab_entry * ); +#if KRB5_PRIVATE +/* use krb5_free_keytab_entry_contents instead */ +krb5_error_code KRB5_CALLCONV krb5_kt_free_entry + (krb5_context, + krb5_keytab_entry * ); +#endif +/* remove and add are functions, so that they can return NOWRITE + if not a writable keytab */ +krb5_error_code KRB5_CALLCONV krb5_kt_remove_entry + (krb5_context, + krb5_keytab, + krb5_keytab_entry * ); +krb5_error_code KRB5_CALLCONV krb5_kt_add_entry + (krb5_context, + krb5_keytab, + krb5_keytab_entry * ); +krb5_error_code krb5_principal2salt + (krb5_context, + krb5_const_principal, krb5_data *); +#if KRB5_PRIVATE +krb5_error_code krb5_principal2salt_norealm + (krb5_context, + krb5_const_principal, krb5_data *); +#endif +/* librc.spec--see rcache.h */ + +/* libcc.spec */ +krb5_error_code KRB5_CALLCONV krb5_cc_resolve + (krb5_context, + const char *, + krb5_ccache * ); +const char * KRB5_CALLCONV krb5_cc_default_name + (krb5_context); +krb5_error_code KRB5_CALLCONV krb5_cc_set_default_name + (krb5_context, const char *); +krb5_error_code KRB5_CALLCONV krb5_cc_default + (krb5_context, + krb5_ccache *); +#if KRB5_PRIVATE +unsigned int KRB5_CALLCONV krb5_get_notification_message + (void); +#endif + +krb5_error_code KRB5_CALLCONV krb5_cc_copy_creds + (krb5_context context, + krb5_ccache incc, + krb5_ccache outcc); + + +/* chk_trans.c */ +#if KRB5_PRIVATE +krb5_error_code krb5_check_transited_list + (krb5_context, const krb5_data *trans, + const krb5_data *realm1, const krb5_data *realm2); +#endif + +/* free_rtree.c */ +#if KRB5_PRIVATE +void krb5_free_realm_tree + (krb5_context, + krb5_principal *); +#endif + +/* krb5_free.c */ +void KRB5_CALLCONV krb5_free_principal + (krb5_context, krb5_principal ); +void KRB5_CALLCONV krb5_free_authenticator + (krb5_context, krb5_authenticator * ); +#if KRB5_PRIVATE +void KRB5_CALLCONV krb5_free_authenticator_contents + (krb5_context, krb5_authenticator * ); +#endif +void KRB5_CALLCONV krb5_free_addresses + (krb5_context, krb5_address ** ); +#if KRB5_PRIVATE +void KRB5_CALLCONV krb5_free_address + (krb5_context, krb5_address * ); +#endif +void KRB5_CALLCONV krb5_free_authdata + (krb5_context, krb5_authdata ** ); +#if KRB5_PRIVATE +void KRB5_CALLCONV krb5_free_enc_tkt_part + (krb5_context, krb5_enc_tkt_part * ); +#endif +void KRB5_CALLCONV krb5_free_ticket + (krb5_context, krb5_ticket * ); +#if KRB5_PRIVATE +void KRB5_CALLCONV krb5_free_tickets + (krb5_context, krb5_ticket ** ); +void KRB5_CALLCONV krb5_free_kdc_req + (krb5_context, krb5_kdc_req * ); +void KRB5_CALLCONV krb5_free_kdc_rep + (krb5_context, krb5_kdc_rep * ); +void KRB5_CALLCONV krb5_free_last_req + (krb5_context, krb5_last_req_entry ** ); +void KRB5_CALLCONV krb5_free_enc_kdc_rep_part + (krb5_context, krb5_enc_kdc_rep_part * ); +#endif +void KRB5_CALLCONV krb5_free_error + (krb5_context, krb5_error * ); +#if KRB5_PRIVATE +void KRB5_CALLCONV krb5_free_ap_req + (krb5_context, krb5_ap_req * ); +void KRB5_CALLCONV krb5_free_ap_rep + (krb5_context, krb5_ap_rep * ); +void KRB5_CALLCONV krb5_free_cred + (krb5_context, krb5_cred *); +#endif +void KRB5_CALLCONV krb5_free_creds + (krb5_context, krb5_creds *); +void KRB5_CALLCONV krb5_free_cred_contents + (krb5_context, krb5_creds *); +#if KRB5_PRIVATE +void KRB5_CALLCONV krb5_free_cred_enc_part + (krb5_context, krb5_cred_enc_part *); +#endif +void KRB5_CALLCONV krb5_free_checksum + (krb5_context, krb5_checksum *); +void KRB5_CALLCONV krb5_free_checksum_contents + (krb5_context, krb5_checksum *); +void KRB5_CALLCONV krb5_free_keyblock + (krb5_context, krb5_keyblock *); +void KRB5_CALLCONV krb5_free_keyblock_contents + (krb5_context, krb5_keyblock *); +#if KRB5_PRIVATE +void KRB5_CALLCONV krb5_free_pa_data + (krb5_context, krb5_pa_data **); +#endif +void KRB5_CALLCONV krb5_free_ap_rep_enc_part + (krb5_context, krb5_ap_rep_enc_part *); +#if KRB5_PRIVATE +void KRB5_CALLCONV krb5_free_tkt_authent + (krb5_context, krb5_tkt_authent *); +void KRB5_CALLCONV krb5_free_pwd_data + (krb5_context, krb5_pwd_data *); +void KRB5_CALLCONV krb5_free_pwd_sequences + (krb5_context, passwd_phrase_element **); +#endif +void KRB5_CALLCONV krb5_free_data + (krb5_context, krb5_data *); +void KRB5_CALLCONV krb5_free_data_contents + (krb5_context, krb5_data *); +void KRB5_CALLCONV krb5_free_unparsed_name + (krb5_context, char *); +void KRB5_CALLCONV krb5_free_cksumtypes + (krb5_context, krb5_cksumtype *); + +/* From krb5/os but needed but by the outside world */ +krb5_error_code KRB5_CALLCONV krb5_us_timeofday + (krb5_context, + krb5_int32 *, + krb5_int32 * ); +krb5_error_code KRB5_CALLCONV krb5_timeofday + (krb5_context, + krb5_int32 * ); + /* get all the addresses of this host */ +krb5_error_code KRB5_CALLCONV krb5_os_localaddr + (krb5_context, + krb5_address ***); +krb5_error_code KRB5_CALLCONV krb5_get_default_realm + (krb5_context, + char ** ); +krb5_error_code KRB5_CALLCONV krb5_set_default_realm + (krb5_context, + const char * ); +void KRB5_CALLCONV krb5_free_default_realm + (krb5_context, + char * ); +krb5_error_code KRB5_CALLCONV krb5_sname_to_principal + (krb5_context, + const char *, + const char *, + krb5_int32, + krb5_principal *); +krb5_error_code KRB5_CALLCONV +krb5_change_password + (krb5_context context, krb5_creds *creds, char *newpw, + int *result_code, krb5_data *result_code_string, + krb5_data *result_string); +krb5_error_code KRB5_CALLCONV +krb5_set_password + (krb5_context context, krb5_creds *creds, char *newpw, krb5_principal change_password_for, + int *result_code, krb5_data *result_code_string, krb5_data *result_string); +krb5_error_code KRB5_CALLCONV +krb5_set_password_using_ccache + (krb5_context context, krb5_ccache ccache, char *newpw, krb5_principal change_password_for, + int *result_code, krb5_data *result_code_string, krb5_data *result_string); + +#if KRB5_PRIVATE +#ifndef macintosh +krb5_error_code krb5_set_config_files + (krb5_context, const char **); + +krb5_error_code KRB5_CALLCONV krb5_get_default_config_files + (char ***filenames); + +void KRB5_CALLCONV krb5_free_config_files + (char **filenames); + +#endif +#endif + +krb5_error_code KRB5_CALLCONV +krb5_get_profile + (krb5_context, struct _profile_t * /* profile_t */ *); + +#if KRB5_PRIVATE +krb5_error_code krb5_send_tgs + (krb5_context, + krb5_flags, + const krb5_ticket_times *, + const krb5_enctype *, + krb5_const_principal, + krb5_address * const *, + krb5_authdata * const *, + krb5_pa_data * const *, + const krb5_data *, + krb5_creds *, + krb5_response * ); +#endif + +#if KRB5_DEPRECATED +krb5_error_code KRB5_CALLCONV krb5_get_in_tkt + (krb5_context, + krb5_flags, + krb5_address * const *, + krb5_enctype *, + krb5_preauthtype *, + krb5_error_code ( * )(krb5_context, + krb5_enctype, + krb5_data *, + krb5_const_pointer, + krb5_keyblock **), + krb5_const_pointer, + krb5_error_code ( * )(krb5_context, + const krb5_keyblock *, + krb5_const_pointer, + krb5_kdc_rep * ), + krb5_const_pointer, + krb5_creds *, + krb5_ccache, + krb5_kdc_rep ** ); + +krb5_error_code KRB5_CALLCONV krb5_get_in_tkt_with_password + (krb5_context, + krb5_flags, + krb5_address * const *, + krb5_enctype *, + krb5_preauthtype *, + const char *, + krb5_ccache, + krb5_creds *, + krb5_kdc_rep ** ); + +krb5_error_code KRB5_CALLCONV krb5_get_in_tkt_with_skey + (krb5_context, + krb5_flags, + krb5_address * const *, + krb5_enctype *, + krb5_preauthtype *, + const krb5_keyblock *, + krb5_ccache, + krb5_creds *, + krb5_kdc_rep ** ); + +krb5_error_code KRB5_CALLCONV krb5_get_in_tkt_with_keytab + (krb5_context, + krb5_flags, + krb5_address * const *, + krb5_enctype *, + krb5_preauthtype *, + krb5_keytab, + krb5_ccache, + krb5_creds *, + krb5_kdc_rep ** ); +#endif /* KRB5_DEPRECATED */ + +#if KRB5_PRIVATE +krb5_error_code krb5_decode_kdc_rep + (krb5_context, + krb5_data *, + const krb5_keyblock *, + krb5_kdc_rep ** ); +#endif + +krb5_error_code KRB5_CALLCONV krb5_rd_req + (krb5_context, + krb5_auth_context *, + const krb5_data *, + krb5_const_principal, + krb5_keytab, + krb5_flags *, + krb5_ticket **); + +#if KRB5_PRIVATE +krb5_error_code krb5_rd_req_decoded + (krb5_context, + krb5_auth_context *, + const krb5_ap_req *, + krb5_const_principal, + krb5_keytab, + krb5_flags *, + krb5_ticket **); + +krb5_error_code krb5_rd_req_decoded_anyflag + (krb5_context, + krb5_auth_context *, + const krb5_ap_req *, + krb5_const_principal, + krb5_keytab, + krb5_flags *, + krb5_ticket **); +#endif + +krb5_error_code KRB5_CALLCONV krb5_kt_read_service_key + (krb5_context, + krb5_pointer, + krb5_principal, + krb5_kvno, + krb5_enctype, + krb5_keyblock **); +krb5_error_code KRB5_CALLCONV krb5_mk_safe + (krb5_context, + krb5_auth_context, + const krb5_data *, + krb5_data *, + krb5_replay_data *); +krb5_error_code KRB5_CALLCONV krb5_mk_priv + (krb5_context, + krb5_auth_context, + const krb5_data *, + krb5_data *, + krb5_replay_data *); +#if KRB5_PRIVATE +krb5_error_code KRB5_CALLCONV krb5_cc_register + (krb5_context, + krb5_cc_ops *, + krb5_boolean ); +#endif + +krb5_error_code KRB5_CALLCONV krb5_sendauth + (krb5_context, + krb5_auth_context *, + krb5_pointer, + char *, + krb5_principal, + krb5_principal, + krb5_flags, + krb5_data *, + krb5_creds *, + krb5_ccache, + krb5_error **, + krb5_ap_rep_enc_part **, + krb5_creds **); + +krb5_error_code KRB5_CALLCONV krb5_recvauth + (krb5_context, + krb5_auth_context *, + krb5_pointer, + char *, + krb5_principal, + krb5_int32, + krb5_keytab, + krb5_ticket **); +krb5_error_code KRB5_CALLCONV krb5_recvauth_version + (krb5_context, + krb5_auth_context *, + krb5_pointer, + krb5_principal, + krb5_int32, + krb5_keytab, + krb5_ticket **, + krb5_data *); + +#if KRB5_PRIVATE +krb5_error_code krb5_walk_realm_tree + (krb5_context, + const krb5_data *, + const krb5_data *, + krb5_principal **, + int); +#endif + +krb5_error_code KRB5_CALLCONV krb5_mk_ncred + (krb5_context, + krb5_auth_context, + krb5_creds **, + krb5_data **, + krb5_replay_data *); + +krb5_error_code KRB5_CALLCONV krb5_mk_1cred + (krb5_context, + krb5_auth_context, + krb5_creds *, + krb5_data **, + krb5_replay_data *); + +krb5_error_code KRB5_CALLCONV krb5_rd_cred + (krb5_context, + krb5_auth_context, + krb5_data *, + krb5_creds ***, + krb5_replay_data *); + +krb5_error_code KRB5_CALLCONV krb5_fwd_tgt_creds + (krb5_context, + krb5_auth_context, + char *, + krb5_principal, + krb5_principal, + krb5_ccache, + int forwardable, + krb5_data *); + +krb5_error_code KRB5_CALLCONV krb5_auth_con_init + (krb5_context, + krb5_auth_context *); + +krb5_error_code KRB5_CALLCONV krb5_auth_con_free + (krb5_context, + krb5_auth_context); + +krb5_error_code KRB5_CALLCONV krb5_auth_con_setflags + (krb5_context, + krb5_auth_context, + krb5_int32); + +krb5_error_code KRB5_CALLCONV krb5_auth_con_getflags + (krb5_context, + krb5_auth_context, + krb5_int32 *); + +krb5_error_code KRB5_CALLCONV +krb5_auth_con_set_checksum_func (krb5_context, krb5_auth_context, + krb5_mk_req_checksum_func, void *); + +krb5_error_code KRB5_CALLCONV +krb5_auth_con_get_checksum_func( krb5_context, krb5_auth_context, + krb5_mk_req_checksum_func *, void **); + +krb5_error_code KRB5_CALLCONV_WRONG krb5_auth_con_setaddrs + (krb5_context, + krb5_auth_context, + krb5_address *, + krb5_address *); + +krb5_error_code KRB5_CALLCONV krb5_auth_con_getaddrs + (krb5_context, + krb5_auth_context, + krb5_address **, + krb5_address **); + +krb5_error_code KRB5_CALLCONV krb5_auth_con_setports + (krb5_context, + krb5_auth_context, + krb5_address *, + krb5_address *); + +krb5_error_code KRB5_CALLCONV krb5_auth_con_setuseruserkey + (krb5_context, + krb5_auth_context, + krb5_keyblock *); + +krb5_error_code KRB5_CALLCONV krb5_auth_con_getkey + (krb5_context, + krb5_auth_context, + krb5_keyblock **); + +krb5_error_code KRB5_CALLCONV krb5_auth_con_getsendsubkey( + krb5_context, krb5_auth_context, krb5_keyblock **); + +krb5_error_code KRB5_CALLCONV krb5_auth_con_getrecvsubkey( + krb5_context, krb5_auth_context, krb5_keyblock **); + +krb5_error_code KRB5_CALLCONV krb5_auth_con_setsendsubkey( + krb5_context, krb5_auth_context, krb5_keyblock *); + +krb5_error_code KRB5_CALLCONV krb5_auth_con_setrecvsubkey( + krb5_context, krb5_auth_context, krb5_keyblock *); + +#if KRB5_DEPRECATED +krb5_error_code KRB5_CALLCONV krb5_auth_con_getlocalsubkey + (krb5_context, + krb5_auth_context, + krb5_keyblock **); + +krb5_error_code KRB5_CALLCONV krb5_auth_con_getremotesubkey + (krb5_context, + krb5_auth_context, + krb5_keyblock **); +#endif + +#if KRB5_PRIVATE +krb5_error_code KRB5_CALLCONV krb5_auth_con_set_req_cksumtype + (krb5_context, + krb5_auth_context, + krb5_cksumtype); + +krb5_error_code krb5_auth_con_set_safe_cksumtype + (krb5_context, + krb5_auth_context, + krb5_cksumtype); +#endif + +krb5_error_code KRB5_CALLCONV krb5_auth_con_getlocalseqnumber + (krb5_context, + krb5_auth_context, + krb5_int32 *); + +krb5_error_code KRB5_CALLCONV krb5_auth_con_getremoteseqnumber + (krb5_context, + krb5_auth_context, + krb5_int32 *); + +#if KRB5_DEPRECATED +krb5_error_code KRB5_CALLCONV krb5_auth_con_initivector + (krb5_context, + krb5_auth_context); +#endif + +#if KRB5_PRIVATE +krb5_error_code krb5_auth_con_setivector + (krb5_context, + krb5_auth_context, + krb5_pointer); + +krb5_error_code krb5_auth_con_getivector + (krb5_context, + krb5_auth_context, + krb5_pointer *); +#endif + +krb5_error_code KRB5_CALLCONV krb5_auth_con_setrcache + (krb5_context, + krb5_auth_context, + krb5_rcache); + +krb5_error_code KRB5_CALLCONV_WRONG krb5_auth_con_getrcache + (krb5_context, + krb5_auth_context, + krb5_rcache *); + +#if KRB5_PRIVATE +krb5_error_code krb5_auth_con_setpermetypes + (krb5_context, + krb5_auth_context, + const krb5_enctype *); + +krb5_error_code krb5_auth_con_getpermetypes + (krb5_context, + krb5_auth_context, + krb5_enctype **); +#endif + +krb5_error_code KRB5_CALLCONV krb5_auth_con_getauthenticator + (krb5_context, + krb5_auth_context, + krb5_authenticator **); + +#define KRB5_REALM_BRANCH_CHAR '.' + +/* + * end "func-proto.h" + */ + +/* + * begin stuff from libos.h + */ + +#if KRB5_PRIVATE +krb5_error_code krb5_read_message (krb5_context, krb5_pointer, krb5_data *); +krb5_error_code krb5_write_message (krb5_context, krb5_pointer, krb5_data *); +int krb5_net_read (krb5_context, int , char *, int); +int krb5_net_write (krb5_context, int , const char *, int); +#endif + +krb5_error_code KRB5_CALLCONV krb5_read_password + (krb5_context, + const char *, + const char *, + char *, + unsigned int * ); +krb5_error_code KRB5_CALLCONV krb5_aname_to_localname + (krb5_context, + krb5_const_principal, + int, + char * ); +krb5_error_code KRB5_CALLCONV krb5_get_host_realm + (krb5_context, + const char *, + char *** ); +krb5_error_code KRB5_CALLCONV krb5_free_host_realm + (krb5_context, + char * const * ); +#if KRB5_PRIVATE +krb5_error_code KRB5_CALLCONV krb5_get_realm_domain + (krb5_context, + const char *, + char ** ); +#endif +krb5_boolean KRB5_CALLCONV krb5_kuserok + (krb5_context, + krb5_principal, const char *); +krb5_error_code KRB5_CALLCONV krb5_auth_con_genaddrs + (krb5_context, + krb5_auth_context, + int, int); +#if KRB5_PRIVATE +krb5_error_code krb5_gen_portaddr + (krb5_context, + const krb5_address *, + krb5_const_pointer, + krb5_address **); +krb5_error_code krb5_gen_replay_name + (krb5_context, + const krb5_address *, + const char *, + char **); +krb5_error_code krb5_make_fulladdr + (krb5_context, + krb5_address *, + krb5_address *, + krb5_address *); +#endif + +krb5_error_code KRB5_CALLCONV krb5_set_real_time + (krb5_context, krb5_int32, krb5_int32); + +#if KRB5_PRIVATE +krb5_error_code krb5_set_debugging_time + (krb5_context, krb5_int32, krb5_int32); +krb5_error_code krb5_use_natural_time + (krb5_context); +#endif +krb5_error_code KRB5_CALLCONV krb5_get_time_offsets + (krb5_context, krb5_int32 *, krb5_int32 *); +#if KRB5_PRIVATE +krb5_error_code krb5_set_time_offsets + (krb5_context, krb5_int32, krb5_int32); +#endif + +/* str_conv.c */ +krb5_error_code KRB5_CALLCONV krb5_string_to_enctype + (char *, krb5_enctype *); +krb5_error_code KRB5_CALLCONV krb5_string_to_salttype + (char *, krb5_int32 *); +krb5_error_code KRB5_CALLCONV krb5_string_to_cksumtype + (char *, krb5_cksumtype *); +krb5_error_code KRB5_CALLCONV krb5_string_to_timestamp + (char *, krb5_timestamp *); +krb5_error_code KRB5_CALLCONV krb5_string_to_deltat + (char *, krb5_deltat *); +krb5_error_code KRB5_CALLCONV krb5_enctype_to_string + (krb5_enctype, char *, size_t); +krb5_error_code KRB5_CALLCONV krb5_salttype_to_string + (krb5_int32, char *, size_t); +krb5_error_code KRB5_CALLCONV krb5_cksumtype_to_string + (krb5_cksumtype, char *, size_t); +krb5_error_code KRB5_CALLCONV krb5_timestamp_to_string + (krb5_timestamp, char *, size_t); +krb5_error_code KRB5_CALLCONV krb5_timestamp_to_sfstring + (krb5_timestamp, char *, size_t, char *); +krb5_error_code KRB5_CALLCONV krb5_deltat_to_string + (krb5_deltat, char *, size_t); + + + +/* The name of the Kerberos ticket granting service... and its size */ +#define KRB5_TGS_NAME "krbtgt" +#define KRB5_TGS_NAME_SIZE 6 + +/* flags for recvauth */ +#define KRB5_RECVAUTH_SKIP_VERSION 0x0001 +#define KRB5_RECVAUTH_BADAUTHVERS 0x0002 +/* initial ticket api functions */ + +typedef struct _krb5_prompt { + char *prompt; + int hidden; + krb5_data *reply; +} krb5_prompt; + +typedef krb5_error_code (KRB5_CALLCONV *krb5_prompter_fct)(krb5_context context, + void *data, + const char *name, + const char *banner, + int num_prompts, + krb5_prompt prompts[]); + + +krb5_error_code KRB5_CALLCONV +krb5_prompter_posix (krb5_context context, + void *data, + const char *name, + const char *banner, + int num_prompts, + krb5_prompt prompts[]); + +typedef struct _krb5_get_init_creds_opt { + krb5_flags flags; + krb5_deltat tkt_life; + krb5_deltat renew_life; + int forwardable; + int proxiable; + krb5_enctype *etype_list; + int etype_list_length; + krb5_address **address_list; + krb5_preauthtype *preauth_list; + int preauth_list_length; + krb5_data *salt; +} krb5_get_init_creds_opt; + +#define KRB5_GET_INIT_CREDS_OPT_TKT_LIFE 0x0001 +#define KRB5_GET_INIT_CREDS_OPT_RENEW_LIFE 0x0002 +#define KRB5_GET_INIT_CREDS_OPT_FORWARDABLE 0x0004 +#define KRB5_GET_INIT_CREDS_OPT_PROXIABLE 0x0008 +#define KRB5_GET_INIT_CREDS_OPT_ETYPE_LIST 0x0010 +#define KRB5_GET_INIT_CREDS_OPT_ADDRESS_LIST 0x0020 +#define KRB5_GET_INIT_CREDS_OPT_PREAUTH_LIST 0x0040 +#define KRB5_GET_INIT_CREDS_OPT_SALT 0x0080 + + +void KRB5_CALLCONV +krb5_get_init_creds_opt_init +(krb5_get_init_creds_opt *opt); + +void KRB5_CALLCONV +krb5_get_init_creds_opt_set_tkt_life +(krb5_get_init_creds_opt *opt, + krb5_deltat tkt_life); + +void KRB5_CALLCONV +krb5_get_init_creds_opt_set_renew_life +(krb5_get_init_creds_opt *opt, + krb5_deltat renew_life); + +void KRB5_CALLCONV +krb5_get_init_creds_opt_set_forwardable +(krb5_get_init_creds_opt *opt, + int forwardable); + +void KRB5_CALLCONV +krb5_get_init_creds_opt_set_proxiable +(krb5_get_init_creds_opt *opt, + int proxiable); + +void KRB5_CALLCONV +krb5_get_init_creds_opt_set_etype_list +(krb5_get_init_creds_opt *opt, + krb5_enctype *etype_list, + int etype_list_length); + +void KRB5_CALLCONV +krb5_get_init_creds_opt_set_address_list +(krb5_get_init_creds_opt *opt, + krb5_address **addresses); + +void KRB5_CALLCONV +krb5_get_init_creds_opt_set_preauth_list +(krb5_get_init_creds_opt *opt, + krb5_preauthtype *preauth_list, + int preauth_list_length); + +void KRB5_CALLCONV +krb5_get_init_creds_opt_set_salt +(krb5_get_init_creds_opt *opt, + krb5_data *salt); + +krb5_error_code KRB5_CALLCONV +krb5_get_init_creds_password +(krb5_context context, + krb5_creds *creds, + krb5_principal client, + char *password, + krb5_prompter_fct prompter, + void *data, + krb5_deltat start_time, + char *in_tkt_service, + krb5_get_init_creds_opt *k5_gic_options); + +krb5_error_code KRB5_CALLCONV +krb5_get_init_creds_keytab +(krb5_context context, + krb5_creds *creds, + krb5_principal client, + krb5_keytab arg_keytab, + krb5_deltat start_time, + char *in_tkt_service, + krb5_get_init_creds_opt *k5_gic_options); + +typedef struct _krb5_verify_init_creds_opt { + krb5_flags flags; + int ap_req_nofail; +} krb5_verify_init_creds_opt; + +#define KRB5_VERIFY_INIT_CREDS_OPT_AP_REQ_NOFAIL 0x0001 + +void KRB5_CALLCONV +krb5_verify_init_creds_opt_init +(krb5_verify_init_creds_opt *k5_vic_options); +void KRB5_CALLCONV +krb5_verify_init_creds_opt_set_ap_req_nofail +(krb5_verify_init_creds_opt *k5_vic_options, + int ap_req_nofail); + +krb5_error_code KRB5_CALLCONV +krb5_verify_init_creds +(krb5_context context, + krb5_creds *creds, + krb5_principal ap_req_server, + krb5_keytab ap_req_keytab, + krb5_ccache *ccache, + krb5_verify_init_creds_opt *k5_vic_options); + +krb5_error_code KRB5_CALLCONV +krb5_get_validated_creds +(krb5_context context, + krb5_creds *creds, + krb5_principal client, + krb5_ccache ccache, + char *in_tkt_service); + +krb5_error_code KRB5_CALLCONV +krb5_get_renewed_creds +(krb5_context context, + krb5_creds *creds, + krb5_principal client, + krb5_ccache ccache, + char *in_tkt_service); + +krb5_error_code KRB5_CALLCONV +krb5_decode_ticket +(const krb5_data *code, + krb5_ticket **rep); + +void KRB5_CALLCONV +krb5_appdefault_string +(krb5_context context, + const char *appname, + const krb5_data *realm, + const char *option, + const char *default_value, + char ** ret_value); + +void KRB5_CALLCONV +krb5_appdefault_boolean +(krb5_context context, + const char *appname, + const krb5_data *realm, + const char *option, + int default_value, + int *ret_value); + +#if KRB5_PRIVATE +/* + * The realm iterator functions + */ + +krb5_error_code KRB5_CALLCONV krb5_realm_iterator_create + (krb5_context context, void **iter_p); + +krb5_error_code KRB5_CALLCONV krb5_realm_iterator + (krb5_context context, void **iter_p, char **ret_realm); + +void KRB5_CALLCONV krb5_realm_iterator_free + (krb5_context context, void **iter_p); + +void KRB5_CALLCONV krb5_free_realm_string + (krb5_context context, char *str); +#endif + +/* + * Prompter enhancements + */ + +#define KRB5_PROMPT_TYPE_PASSWORD 0x1 +#define KRB5_PROMPT_TYPE_NEW_PASSWORD 0x2 +#define KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN 0x3 +#define KRB5_PROMPT_TYPE_PREAUTH 0x4 + +typedef krb5_int32 krb5_prompt_type; + +krb5_prompt_type* KRB5_CALLCONV krb5_get_prompt_types + (krb5_context context); + +#if TARGET_OS_MAC +# if defined(__MWERKS__) +# pragma import reset +# endif +# pragma options align=reset +#endif + +KRB5INT_END_DECLS + +/* Don't use this! We're going to phase it out. It's just here to keep + applications from breaking right away. */ +#define krb5_const const + +#endif /* KRB5_GENERAL__ */ + +/* + * include/krb5_err.h: + * This file is automatically generated; please do not edit it. + */ + +#include + +#define KRB5KDC_ERR_NONE (-1765328384L) +#define KRB5KDC_ERR_NAME_EXP (-1765328383L) +#define KRB5KDC_ERR_SERVICE_EXP (-1765328382L) +#define KRB5KDC_ERR_BAD_PVNO (-1765328381L) +#define KRB5KDC_ERR_C_OLD_MAST_KVNO (-1765328380L) +#define KRB5KDC_ERR_S_OLD_MAST_KVNO (-1765328379L) +#define KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN (-1765328378L) +#define KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN (-1765328377L) +#define KRB5KDC_ERR_PRINCIPAL_NOT_UNIQUE (-1765328376L) +#define KRB5KDC_ERR_NULL_KEY (-1765328375L) +#define KRB5KDC_ERR_CANNOT_POSTDATE (-1765328374L) +#define KRB5KDC_ERR_NEVER_VALID (-1765328373L) +#define KRB5KDC_ERR_POLICY (-1765328372L) +#define KRB5KDC_ERR_BADOPTION (-1765328371L) +#define KRB5KDC_ERR_ETYPE_NOSUPP (-1765328370L) +#define KRB5KDC_ERR_SUMTYPE_NOSUPP (-1765328369L) +#define KRB5KDC_ERR_PADATA_TYPE_NOSUPP (-1765328368L) +#define KRB5KDC_ERR_TRTYPE_NOSUPP (-1765328367L) +#define KRB5KDC_ERR_CLIENT_REVOKED (-1765328366L) +#define KRB5KDC_ERR_SERVICE_REVOKED (-1765328365L) +#define KRB5KDC_ERR_TGT_REVOKED (-1765328364L) +#define KRB5KDC_ERR_CLIENT_NOTYET (-1765328363L) +#define KRB5KDC_ERR_SERVICE_NOTYET (-1765328362L) +#define KRB5KDC_ERR_KEY_EXP (-1765328361L) +#define KRB5KDC_ERR_PREAUTH_FAILED (-1765328360L) +#define KRB5KDC_ERR_PREAUTH_REQUIRED (-1765328359L) +#define KRB5KDC_ERR_SERVER_NOMATCH (-1765328358L) +#define KRB5PLACEHOLD_27 (-1765328357L) +#define KRB5PLACEHOLD_28 (-1765328356L) +#define KRB5PLACEHOLD_29 (-1765328355L) +#define KRB5PLACEHOLD_30 (-1765328354L) +#define KRB5KRB_AP_ERR_BAD_INTEGRITY (-1765328353L) +#define KRB5KRB_AP_ERR_TKT_EXPIRED (-1765328352L) +#define KRB5KRB_AP_ERR_TKT_NYV (-1765328351L) +#define KRB5KRB_AP_ERR_REPEAT (-1765328350L) +#define KRB5KRB_AP_ERR_NOT_US (-1765328349L) +#define KRB5KRB_AP_ERR_BADMATCH (-1765328348L) +#define KRB5KRB_AP_ERR_SKEW (-1765328347L) +#define KRB5KRB_AP_ERR_BADADDR (-1765328346L) +#define KRB5KRB_AP_ERR_BADVERSION (-1765328345L) +#define KRB5KRB_AP_ERR_MSG_TYPE (-1765328344L) +#define KRB5KRB_AP_ERR_MODIFIED (-1765328343L) +#define KRB5KRB_AP_ERR_BADORDER (-1765328342L) +#define KRB5KRB_AP_ERR_ILL_CR_TKT (-1765328341L) +#define KRB5KRB_AP_ERR_BADKEYVER (-1765328340L) +#define KRB5KRB_AP_ERR_NOKEY (-1765328339L) +#define KRB5KRB_AP_ERR_MUT_FAIL (-1765328338L) +#define KRB5KRB_AP_ERR_BADDIRECTION (-1765328337L) +#define KRB5KRB_AP_ERR_METHOD (-1765328336L) +#define KRB5KRB_AP_ERR_BADSEQ (-1765328335L) +#define KRB5KRB_AP_ERR_INAPP_CKSUM (-1765328334L) +#define KRB5KRB_AP_PATH_NOT_ACCEPTED (-1765328333L) +#define KRB5KRB_ERR_RESPONSE_TOO_BIG (-1765328332L) +#define KRB5PLACEHOLD_53 (-1765328331L) +#define KRB5PLACEHOLD_54 (-1765328330L) +#define KRB5PLACEHOLD_55 (-1765328329L) +#define KRB5PLACEHOLD_56 (-1765328328L) +#define KRB5PLACEHOLD_57 (-1765328327L) +#define KRB5PLACEHOLD_58 (-1765328326L) +#define KRB5PLACEHOLD_59 (-1765328325L) +#define KRB5KRB_ERR_GENERIC (-1765328324L) +#define KRB5KRB_ERR_FIELD_TOOLONG (-1765328323L) +#define KRB5PLACEHOLD_62 (-1765328322L) +#define KRB5PLACEHOLD_63 (-1765328321L) +#define KRB5PLACEHOLD_64 (-1765328320L) +#define KRB5PLACEHOLD_65 (-1765328319L) +#define KRB5PLACEHOLD_66 (-1765328318L) +#define KRB5PLACEHOLD_67 (-1765328317L) +#define KRB5PLACEHOLD_68 (-1765328316L) +#define KRB5PLACEHOLD_69 (-1765328315L) +#define KRB5PLACEHOLD_70 (-1765328314L) +#define KRB5PLACEHOLD_71 (-1765328313L) +#define KRB5PLACEHOLD_72 (-1765328312L) +#define KRB5PLACEHOLD_73 (-1765328311L) +#define KRB5PLACEHOLD_74 (-1765328310L) +#define KRB5PLACEHOLD_75 (-1765328309L) +#define KRB5PLACEHOLD_76 (-1765328308L) +#define KRB5PLACEHOLD_77 (-1765328307L) +#define KRB5PLACEHOLD_78 (-1765328306L) +#define KRB5PLACEHOLD_79 (-1765328305L) +#define KRB5PLACEHOLD_80 (-1765328304L) +#define KRB5PLACEHOLD_81 (-1765328303L) +#define KRB5PLACEHOLD_82 (-1765328302L) +#define KRB5PLACEHOLD_83 (-1765328301L) +#define KRB5PLACEHOLD_84 (-1765328300L) +#define KRB5PLACEHOLD_85 (-1765328299L) +#define KRB5PLACEHOLD_86 (-1765328298L) +#define KRB5PLACEHOLD_87 (-1765328297L) +#define KRB5PLACEHOLD_88 (-1765328296L) +#define KRB5PLACEHOLD_89 (-1765328295L) +#define KRB5PLACEHOLD_90 (-1765328294L) +#define KRB5PLACEHOLD_91 (-1765328293L) +#define KRB5PLACEHOLD_92 (-1765328292L) +#define KRB5PLACEHOLD_93 (-1765328291L) +#define KRB5PLACEHOLD_94 (-1765328290L) +#define KRB5PLACEHOLD_95 (-1765328289L) +#define KRB5PLACEHOLD_96 (-1765328288L) +#define KRB5PLACEHOLD_97 (-1765328287L) +#define KRB5PLACEHOLD_98 (-1765328286L) +#define KRB5PLACEHOLD_99 (-1765328285L) +#define KRB5PLACEHOLD_100 (-1765328284L) +#define KRB5PLACEHOLD_101 (-1765328283L) +#define KRB5PLACEHOLD_102 (-1765328282L) +#define KRB5PLACEHOLD_103 (-1765328281L) +#define KRB5PLACEHOLD_104 (-1765328280L) +#define KRB5PLACEHOLD_105 (-1765328279L) +#define KRB5PLACEHOLD_106 (-1765328278L) +#define KRB5PLACEHOLD_107 (-1765328277L) +#define KRB5PLACEHOLD_108 (-1765328276L) +#define KRB5PLACEHOLD_109 (-1765328275L) +#define KRB5PLACEHOLD_110 (-1765328274L) +#define KRB5PLACEHOLD_111 (-1765328273L) +#define KRB5PLACEHOLD_112 (-1765328272L) +#define KRB5PLACEHOLD_113 (-1765328271L) +#define KRB5PLACEHOLD_114 (-1765328270L) +#define KRB5PLACEHOLD_115 (-1765328269L) +#define KRB5PLACEHOLD_116 (-1765328268L) +#define KRB5PLACEHOLD_117 (-1765328267L) +#define KRB5PLACEHOLD_118 (-1765328266L) +#define KRB5PLACEHOLD_119 (-1765328265L) +#define KRB5PLACEHOLD_120 (-1765328264L) +#define KRB5PLACEHOLD_121 (-1765328263L) +#define KRB5PLACEHOLD_122 (-1765328262L) +#define KRB5PLACEHOLD_123 (-1765328261L) +#define KRB5PLACEHOLD_124 (-1765328260L) +#define KRB5PLACEHOLD_125 (-1765328259L) +#define KRB5PLACEHOLD_126 (-1765328258L) +#define KRB5PLACEHOLD_127 (-1765328257L) +#define KRB5_ERR_RCSID (-1765328256L) +#define KRB5_LIBOS_BADLOCKFLAG (-1765328255L) +#define KRB5_LIBOS_CANTREADPWD (-1765328254L) +#define KRB5_LIBOS_BADPWDMATCH (-1765328253L) +#define KRB5_LIBOS_PWDINTR (-1765328252L) +#define KRB5_PARSE_ILLCHAR (-1765328251L) +#define KRB5_PARSE_MALFORMED (-1765328250L) +#define KRB5_CONFIG_CANTOPEN (-1765328249L) +#define KRB5_CONFIG_BADFORMAT (-1765328248L) +#define KRB5_CONFIG_NOTENUFSPACE (-1765328247L) +#define KRB5_BADMSGTYPE (-1765328246L) +#define KRB5_CC_BADNAME (-1765328245L) +#define KRB5_CC_UNKNOWN_TYPE (-1765328244L) +#define KRB5_CC_NOTFOUND (-1765328243L) +#define KRB5_CC_END (-1765328242L) +#define KRB5_NO_TKT_SUPPLIED (-1765328241L) +#define KRB5KRB_AP_WRONG_PRINC (-1765328240L) +#define KRB5KRB_AP_ERR_TKT_INVALID (-1765328239L) +#define KRB5_PRINC_NOMATCH (-1765328238L) +#define KRB5_KDCREP_MODIFIED (-1765328237L) +#define KRB5_KDCREP_SKEW (-1765328236L) +#define KRB5_IN_TKT_REALM_MISMATCH (-1765328235L) +#define KRB5_PROG_ETYPE_NOSUPP (-1765328234L) +#define KRB5_PROG_KEYTYPE_NOSUPP (-1765328233L) +#define KRB5_WRONG_ETYPE (-1765328232L) +#define KRB5_PROG_SUMTYPE_NOSUPP (-1765328231L) +#define KRB5_REALM_UNKNOWN (-1765328230L) +#define KRB5_SERVICE_UNKNOWN (-1765328229L) +#define KRB5_KDC_UNREACH (-1765328228L) +#define KRB5_NO_LOCALNAME (-1765328227L) +#define KRB5_MUTUAL_FAILED (-1765328226L) +#define KRB5_RC_TYPE_EXISTS (-1765328225L) +#define KRB5_RC_MALLOC (-1765328224L) +#define KRB5_RC_TYPE_NOTFOUND (-1765328223L) +#define KRB5_RC_UNKNOWN (-1765328222L) +#define KRB5_RC_REPLAY (-1765328221L) +#define KRB5_RC_IO (-1765328220L) +#define KRB5_RC_NOIO (-1765328219L) +#define KRB5_RC_PARSE (-1765328218L) +#define KRB5_RC_IO_EOF (-1765328217L) +#define KRB5_RC_IO_MALLOC (-1765328216L) +#define KRB5_RC_IO_PERM (-1765328215L) +#define KRB5_RC_IO_IO (-1765328214L) +#define KRB5_RC_IO_UNKNOWN (-1765328213L) +#define KRB5_RC_IO_SPACE (-1765328212L) +#define KRB5_TRANS_CANTOPEN (-1765328211L) +#define KRB5_TRANS_BADFORMAT (-1765328210L) +#define KRB5_LNAME_CANTOPEN (-1765328209L) +#define KRB5_LNAME_NOTRANS (-1765328208L) +#define KRB5_LNAME_BADFORMAT (-1765328207L) +#define KRB5_CRYPTO_INTERNAL (-1765328206L) +#define KRB5_KT_BADNAME (-1765328205L) +#define KRB5_KT_UNKNOWN_TYPE (-1765328204L) +#define KRB5_KT_NOTFOUND (-1765328203L) +#define KRB5_KT_END (-1765328202L) +#define KRB5_KT_NOWRITE (-1765328201L) +#define KRB5_KT_IOERR (-1765328200L) +#define KRB5_NO_TKT_IN_RLM (-1765328199L) +#define KRB5DES_BAD_KEYPAR (-1765328198L) +#define KRB5DES_WEAK_KEY (-1765328197L) +#define KRB5_BAD_ENCTYPE (-1765328196L) +#define KRB5_BAD_KEYSIZE (-1765328195L) +#define KRB5_BAD_MSIZE (-1765328194L) +#define KRB5_CC_TYPE_EXISTS (-1765328193L) +#define KRB5_KT_TYPE_EXISTS (-1765328192L) +#define KRB5_CC_IO (-1765328191L) +#define KRB5_FCC_PERM (-1765328190L) +#define KRB5_FCC_NOFILE (-1765328189L) +#define KRB5_FCC_INTERNAL (-1765328188L) +#define KRB5_CC_WRITE (-1765328187L) +#define KRB5_CC_NOMEM (-1765328186L) +#define KRB5_CC_FORMAT (-1765328185L) +#define KRB5_CC_NOT_KTYPE (-1765328184L) +#define KRB5_INVALID_FLAGS (-1765328183L) +#define KRB5_NO_2ND_TKT (-1765328182L) +#define KRB5_NOCREDS_SUPPLIED (-1765328181L) +#define KRB5_SENDAUTH_BADAUTHVERS (-1765328180L) +#define KRB5_SENDAUTH_BADAPPLVERS (-1765328179L) +#define KRB5_SENDAUTH_BADRESPONSE (-1765328178L) +#define KRB5_SENDAUTH_REJECTED (-1765328177L) +#define KRB5_PREAUTH_BAD_TYPE (-1765328176L) +#define KRB5_PREAUTH_NO_KEY (-1765328175L) +#define KRB5_PREAUTH_FAILED (-1765328174L) +#define KRB5_RCACHE_BADVNO (-1765328173L) +#define KRB5_CCACHE_BADVNO (-1765328172L) +#define KRB5_KEYTAB_BADVNO (-1765328171L) +#define KRB5_PROG_ATYPE_NOSUPP (-1765328170L) +#define KRB5_RC_REQUIRED (-1765328169L) +#define KRB5_ERR_BAD_HOSTNAME (-1765328168L) +#define KRB5_ERR_HOST_REALM_UNKNOWN (-1765328167L) +#define KRB5_SNAME_UNSUPP_NAMETYPE (-1765328166L) +#define KRB5KRB_AP_ERR_V4_REPLY (-1765328165L) +#define KRB5_REALM_CANT_RESOLVE (-1765328164L) +#define KRB5_TKT_NOT_FORWARDABLE (-1765328163L) +#define KRB5_FWD_BAD_PRINCIPAL (-1765328162L) +#define KRB5_GET_IN_TKT_LOOP (-1765328161L) +#define KRB5_CONFIG_NODEFREALM (-1765328160L) +#define KRB5_SAM_UNSUPPORTED (-1765328159L) +#define KRB5_SAM_INVALID_ETYPE (-1765328158L) +#define KRB5_SAM_NO_CHECKSUM (-1765328157L) +#define KRB5_SAM_BAD_CHECKSUM (-1765328156L) +#define KRB5_KT_NAME_TOOLONG (-1765328155L) +#define KRB5_KT_KVNONOTFOUND (-1765328154L) +#define KRB5_APPL_EXPIRED (-1765328153L) +#define KRB5_LIB_EXPIRED (-1765328152L) +#define KRB5_CHPW_PWDNULL (-1765328151L) +#define KRB5_CHPW_FAIL (-1765328150L) +#define KRB5_KT_FORMAT (-1765328149L) +#define KRB5_NOPERM_ETYPE (-1765328148L) +#define KRB5_CONFIG_ETYPE_NOSUPP (-1765328147L) +#define KRB5_OBSOLETE_FN (-1765328146L) +#define KRB5_EAI_FAIL (-1765328145L) +#define KRB5_EAI_NODATA (-1765328144L) +#define KRB5_EAI_NONAME (-1765328143L) +#define KRB5_EAI_SERVICE (-1765328142L) +#define KRB5_ERR_NUMERIC_REALM (-1765328141L) +#define KRB5_ERR_BAD_S2K_PARAMS (-1765328140L) +#define KRB5_ERR_NO_SERVICE (-1765328139L) +#define KRB5_CC_READONLY (-1765328138L) +#define KRB5_CC_NOSUPP (-1765328137L) +#define ERROR_TABLE_BASE_krb5 (-1765328384L) + +extern const struct error_table et_krb5_error_table; + +#if !defined(_WIN32) +/* for compatibility with older versions... */ +extern void initialize_krb5_error_table () /*@modifies internalState@*/; +#else +#define initialize_krb5_error_table() +#endif + +#if !defined(_WIN32) +#define init_krb5_err_tbl initialize_krb5_error_table +#define krb5_err_base ERROR_TABLE_BASE_krb5 +#endif +/* + * include/kdb5_err.h: + * This file is automatically generated; please do not edit it. + */ + +#include + +#define KRB5_KDB_RCSID (-1780008448L) +#define KRB5_KDB_INUSE (-1780008447L) +#define KRB5_KDB_UK_SERROR (-1780008446L) +#define KRB5_KDB_UK_RERROR (-1780008445L) +#define KRB5_KDB_UNAUTH (-1780008444L) +#define KRB5_KDB_NOENTRY (-1780008443L) +#define KRB5_KDB_ILL_WILDCARD (-1780008442L) +#define KRB5_KDB_DB_INUSE (-1780008441L) +#define KRB5_KDB_DB_CHANGED (-1780008440L) +#define KRB5_KDB_TRUNCATED_RECORD (-1780008439L) +#define KRB5_KDB_RECURSIVELOCK (-1780008438L) +#define KRB5_KDB_NOTLOCKED (-1780008437L) +#define KRB5_KDB_BADLOCKMODE (-1780008436L) +#define KRB5_KDB_DBNOTINITED (-1780008435L) +#define KRB5_KDB_DBINITED (-1780008434L) +#define KRB5_KDB_ILLDIRECTION (-1780008433L) +#define KRB5_KDB_NOMASTERKEY (-1780008432L) +#define KRB5_KDB_BADMASTERKEY (-1780008431L) +#define KRB5_KDB_INVALIDKEYSIZE (-1780008430L) +#define KRB5_KDB_CANTREAD_STORED (-1780008429L) +#define KRB5_KDB_BADSTORED_MKEY (-1780008428L) +#define KRB5_KDB_CANTLOCK_DB (-1780008427L) +#define KRB5_KDB_DB_CORRUPT (-1780008426L) +#define KRB5_KDB_BAD_VERSION (-1780008425L) +#define KRB5_KDB_BAD_SALTTYPE (-1780008424L) +#define KRB5_KDB_BAD_ENCTYPE (-1780008423L) +#define KRB5_KDB_BAD_CREATEFLAGS (-1780008422L) +#define KRB5_KDB_NO_PERMITTED_KEY (-1780008421L) +#define KRB5_KDB_NO_MATCHING_KEY (-1780008420L) +#define ERROR_TABLE_BASE_kdb5 (-1780008448L) + +extern const struct error_table et_kdb5_error_table; + +#if !defined(_WIN32) +/* for compatibility with older versions... */ +extern void initialize_kdb5_error_table () /*@modifies internalState@*/; +#else +#define initialize_kdb5_error_table() +#endif + +#if !defined(_WIN32) +#define init_kdb5_err_tbl initialize_kdb5_error_table +#define kdb5_err_base ERROR_TABLE_BASE_kdb5 +#endif +/* + * include/kv5m_err.h: + * This file is automatically generated; please do not edit it. + */ + +#include + +#define KV5M_NONE (-1760647424L) +#define KV5M_PRINCIPAL (-1760647423L) +#define KV5M_DATA (-1760647422L) +#define KV5M_KEYBLOCK (-1760647421L) +#define KV5M_CHECKSUM (-1760647420L) +#define KV5M_ENCRYPT_BLOCK (-1760647419L) +#define KV5M_ENC_DATA (-1760647418L) +#define KV5M_CRYPTOSYSTEM_ENTRY (-1760647417L) +#define KV5M_CS_TABLE_ENTRY (-1760647416L) +#define KV5M_CHECKSUM_ENTRY (-1760647415L) +#define KV5M_AUTHDATA (-1760647414L) +#define KV5M_TRANSITED (-1760647413L) +#define KV5M_ENC_TKT_PART (-1760647412L) +#define KV5M_TICKET (-1760647411L) +#define KV5M_AUTHENTICATOR (-1760647410L) +#define KV5M_TKT_AUTHENT (-1760647409L) +#define KV5M_CREDS (-1760647408L) +#define KV5M_LAST_REQ_ENTRY (-1760647407L) +#define KV5M_PA_DATA (-1760647406L) +#define KV5M_KDC_REQ (-1760647405L) +#define KV5M_ENC_KDC_REP_PART (-1760647404L) +#define KV5M_KDC_REP (-1760647403L) +#define KV5M_ERROR (-1760647402L) +#define KV5M_AP_REQ (-1760647401L) +#define KV5M_AP_REP (-1760647400L) +#define KV5M_AP_REP_ENC_PART (-1760647399L) +#define KV5M_RESPONSE (-1760647398L) +#define KV5M_SAFE (-1760647397L) +#define KV5M_PRIV (-1760647396L) +#define KV5M_PRIV_ENC_PART (-1760647395L) +#define KV5M_CRED (-1760647394L) +#define KV5M_CRED_INFO (-1760647393L) +#define KV5M_CRED_ENC_PART (-1760647392L) +#define KV5M_PWD_DATA (-1760647391L) +#define KV5M_ADDRESS (-1760647390L) +#define KV5M_KEYTAB_ENTRY (-1760647389L) +#define KV5M_CONTEXT (-1760647388L) +#define KV5M_OS_CONTEXT (-1760647387L) +#define KV5M_ALT_METHOD (-1760647386L) +#define KV5M_ETYPE_INFO_ENTRY (-1760647385L) +#define KV5M_DB_CONTEXT (-1760647384L) +#define KV5M_AUTH_CONTEXT (-1760647383L) +#define KV5M_KEYTAB (-1760647382L) +#define KV5M_RCACHE (-1760647381L) +#define KV5M_CCACHE (-1760647380L) +#define KV5M_PREAUTH_OPS (-1760647379L) +#define KV5M_SAM_CHALLENGE (-1760647378L) +#define KV5M_SAM_CHALLENGE_2 (-1760647377L) +#define KV5M_SAM_KEY (-1760647376L) +#define KV5M_ENC_SAM_RESPONSE_ENC (-1760647375L) +#define KV5M_ENC_SAM_RESPONSE_ENC_2 (-1760647374L) +#define KV5M_SAM_RESPONSE (-1760647373L) +#define KV5M_SAM_RESPONSE_2 (-1760647372L) +#define KV5M_PREDICTED_SAM_RESPONSE (-1760647371L) +#define KV5M_PASSWD_PHRASE_ELEMENT (-1760647370L) +#define KV5M_GSS_OID (-1760647369L) +#define KV5M_GSS_QUEUE (-1760647368L) +#define ERROR_TABLE_BASE_kv5m (-1760647424L) + +extern const struct error_table et_kv5m_error_table; + +#if !defined(_WIN32) +/* for compatibility with older versions... */ +extern void initialize_kv5m_error_table () /*@modifies internalState@*/; +#else +#define initialize_kv5m_error_table() +#endif + +#if !defined(_WIN32) +#define init_kv5m_err_tbl initialize_kv5m_error_table +#define kv5m_err_base ERROR_TABLE_BASE_kv5m +#endif +/* + * include/krb524_err.h: + * This file is automatically generated; please do not edit it. + */ + +#include + +#define KRB524_BADKEY (-1750206208L) +#define KRB524_BADADDR (-1750206207L) +#define KRB524_BADPRINC (-1750206206L) +#define KRB524_BADREALM (-1750206205L) +#define KRB524_V4ERR (-1750206204L) +#define KRB524_ENCFULL (-1750206203L) +#define KRB524_DECEMPTY (-1750206202L) +#define KRB524_NOTRESP (-1750206201L) +#define KRB524_KRB4_DISABLED (-1750206200L) +#define ERROR_TABLE_BASE_k524 (-1750206208L) + +extern const struct error_table et_k524_error_table; + +#if !defined(_WIN32) +/* for compatibility with older versions... */ +extern void initialize_k524_error_table () /*@modifies internalState@*/; +#else +#define initialize_k524_error_table() +#endif + +#if !defined(_WIN32) +#define init_k524_err_tbl initialize_k524_error_table +#define k524_err_base ERROR_TABLE_BASE_k524 +#endif +/* + * include/asn1_err.h: + * This file is automatically generated; please do not edit it. + */ + +#include + +#define ASN1_BAD_TIMEFORMAT (1859794432L) +#define ASN1_MISSING_FIELD (1859794433L) +#define ASN1_MISPLACED_FIELD (1859794434L) +#define ASN1_TYPE_MISMATCH (1859794435L) +#define ASN1_OVERFLOW (1859794436L) +#define ASN1_OVERRUN (1859794437L) +#define ASN1_BAD_ID (1859794438L) +#define ASN1_BAD_LENGTH (1859794439L) +#define ASN1_BAD_FORMAT (1859794440L) +#define ASN1_PARSE_ERROR (1859794441L) +#define ASN1_BAD_GMTIME (1859794442L) +#define ASN1_MISMATCH_INDEF (1859794443L) +#define ASN1_MISSING_EOC (1859794444L) +#define ERROR_TABLE_BASE_asn1 (1859794432L) + +extern const struct error_table et_asn1_error_table; + +#if !defined(_WIN32) +/* for compatibility with older versions... */ +extern void initialize_asn1_error_table () /*@modifies internalState@*/; +#else +#define initialize_asn1_error_table() +#endif + +#if !defined(_WIN32) +#define init_asn1_err_tbl initialize_asn1_error_table +#define asn1_err_base ERROR_TABLE_BASE_asn1 +#endif diff --git a/src/WINNT/kfw/inc/krb5/profile.h b/src/WINNT/kfw/inc/krb5/profile.h new file mode 100644 index 000000000..7a5fe432b --- /dev/null +++ b/src/WINNT/kfw/inc/krb5/profile.h @@ -0,0 +1,179 @@ +/* + * profile.h + */ + +#ifndef _KRB5_PROFILE_H +#define _KRB5_PROFILE_H + +#if defined(_WIN32) +#include +#endif + +#if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__)) +# include +# if TARGET_RT_MAC_CFM +# error "Use KfM 4.0 SDK headers for CFM compilation." +# endif +#endif + +#ifndef KRB5_CALLCONV +#define KRB5_CALLCONV +#define KRB5_CALLCONV_C +#endif + +typedef struct _profile_t *profile_t; + +/* + * Used by the profile iterator in prof_get.c + */ +#define PROFILE_ITER_LIST_SECTION 0x0001 +#define PROFILE_ITER_SECTIONS_ONLY 0x0002 +#define PROFILE_ITER_RELATIONS_ONLY 0x0004 + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#if TARGET_OS_MAC +# if defined(__MWERKS__) +# pragma import on +# endif +#endif + +typedef char* profile_filespec_t; /* path as C string */ +typedef char* profile_filespec_list_t; /* list of : separated paths, C string */ +typedef const char * const_profile_filespec_t; /* path as C string */ +typedef const char * const_profile_filespec_list_t; /* list of : separated paths, C string */ + +long KRB5_CALLCONV profile_init + (const_profile_filespec_t *files, profile_t *ret_profile); + +long KRB5_CALLCONV profile_init_path + (const_profile_filespec_list_t filelist, profile_t *ret_profile); + +long KRB5_CALLCONV profile_flush + (profile_t profile); + +void KRB5_CALLCONV profile_abandon + (profile_t profile); + +void KRB5_CALLCONV profile_release + (profile_t profile); + +long KRB5_CALLCONV profile_get_values + (profile_t profile, const char *const *names, char ***ret_values); + +void KRB5_CALLCONV profile_free_list + (char **list); + +long KRB5_CALLCONV profile_get_string + (profile_t profile, const char *name, const char *subname, + const char *subsubname, const char *def_val, + char **ret_string); +long KRB5_CALLCONV profile_get_integer + (profile_t profile, const char *name, const char *subname, + const char *subsubname, int def_val, + int *ret_default); + +long KRB5_CALLCONV profile_get_boolean + (profile_t profile, const char *name, const char *subname, + const char *subsubname, int def_val, + int *ret_default); + +long KRB5_CALLCONV profile_get_relation_names + (profile_t profile, const char **names, char ***ret_names); + +long KRB5_CALLCONV profile_get_subsection_names + (profile_t profile, const char **names, char ***ret_names); + +long KRB5_CALLCONV profile_iterator_create + (profile_t profile, const char **names, + int flags, void **ret_iter); + +void KRB5_CALLCONV profile_iterator_free + (void **iter_p); + +long KRB5_CALLCONV profile_iterator + (void **iter_p, char **ret_name, char **ret_value); + +void KRB5_CALLCONV profile_release_string (char *str); + +long KRB5_CALLCONV profile_update_relation + (profile_t profile, const char **names, + const char *old_value, const char *new_value); + +long KRB5_CALLCONV profile_clear_relation + (profile_t profile, const char **names); + +long KRB5_CALLCONV profile_rename_section + (profile_t profile, const char **names, + const char *new_name); + +long KRB5_CALLCONV profile_add_relation + (profile_t profile, const char **names, + const char *new_value); + +#if TARGET_OS_MAC +# if defined(__MWERKS__) +# pragma import reset +# endif +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _KRB5_PROFILE_H */ +/* + * util/profile/prof_err.h: + * This file is automatically generated; please do not edit it. + */ + +#include + +#define PROF_VERSION (-1429577728L) +#define PROF_MAGIC_NODE (-1429577727L) +#define PROF_NO_SECTION (-1429577726L) +#define PROF_NO_RELATION (-1429577725L) +#define PROF_ADD_NOT_SECTION (-1429577724L) +#define PROF_SECTION_WITH_VALUE (-1429577723L) +#define PROF_BAD_LINK_LIST (-1429577722L) +#define PROF_BAD_GROUP_LVL (-1429577721L) +#define PROF_BAD_PARENT_PTR (-1429577720L) +#define PROF_MAGIC_ITERATOR (-1429577719L) +#define PROF_SET_SECTION_VALUE (-1429577718L) +#define PROF_EINVAL (-1429577717L) +#define PROF_READ_ONLY (-1429577716L) +#define PROF_SECTION_NOTOP (-1429577715L) +#define PROF_SECTION_SYNTAX (-1429577714L) +#define PROF_RELATION_SYNTAX (-1429577713L) +#define PROF_EXTRA_CBRACE (-1429577712L) +#define PROF_MISSING_OBRACE (-1429577711L) +#define PROF_MAGIC_PROFILE (-1429577710L) +#define PROF_MAGIC_SECTION (-1429577709L) +#define PROF_TOPSECTION_ITER_NOSUPP (-1429577708L) +#define PROF_INVALID_SECTION (-1429577707L) +#define PROF_END_OF_SECTIONS (-1429577706L) +#define PROF_BAD_NAMESET (-1429577705L) +#define PROF_NO_PROFILE (-1429577704L) +#define PROF_MAGIC_FILE (-1429577703L) +#define PROF_FAIL_OPEN (-1429577702L) +#define PROF_EXISTS (-1429577701L) +#define PROF_BAD_BOOLEAN (-1429577700L) +#define PROF_BAD_INTEGER (-1429577699L) +#define PROF_MAGIC_FILE_DATA (-1429577698L) +#define ERROR_TABLE_BASE_prof (-1429577728L) + +extern const struct error_table et_prof_error_table; + +#if !defined(_WIN32) +/* for compatibility with older versions... */ +extern void initialize_prof_error_table () /*@modifies internalState@*/; +#else +#define initialize_prof_error_table() +#endif + +#if !defined(_WIN32) +#define init_prof_err_tbl initialize_prof_error_table +#define prof_err_base ERROR_TABLE_BASE_prof +#endif diff --git a/src/WINNT/kfw/inc/krb5/win-mac.h b/src/WINNT/kfw/inc/krb5/win-mac.h new file mode 100644 index 000000000..4cf155e62 --- /dev/null +++ b/src/WINNT/kfw/inc/krb5/win-mac.h @@ -0,0 +1,176 @@ +/* + * This file is now only used on Windows + */ + +/* + * type functions split out of here to make things look nicer in the + * various include files which need these definitions, as well as in + * the util/ directories. + */ + +#ifndef _KRB5_WIN_MAC_H +#define _KRB5_WIN_MAC_H + +#ifdef _WIN32 + +#define ID_READ_PWD_DIALOG 10000 +#define ID_READ_PWD_PROMPT 10001 +#define ID_READ_PWD_PROMPT2 10002 +#define ID_READ_PWD_PWD 10003 + +#ifdef RES_ONLY + +#define APSTUDIO_HIDDEN_SYMBOLS +#include + +#else /* ! RES_ONLY */ + +#define SIZEOF_INT 4 +#define SIZEOF_SHORT 2 +#define SIZEOF_LONG 4 + +#include +#include + +#define HAVE_LABS + +#ifndef SIZE_MAX /* in case Microsoft defines max size of size_t */ +#define SIZE_MAX UINT_MAX +#endif + +#ifndef KRB5_CALLCONV +# define KRB5_CALLCONV __stdcall +# define KRB5_CALLCONV_C __cdecl + +/* + * Use this to mark an incorrect calling convention that has been + * "immortalized" because it was incorrectly exported in a previous + * release. + */ + +# define KRB5_CALLCONV_WRONG KRB5_CALLCONV_C + +#endif /* !KRB5_CALLCONV */ + +#ifndef KRB5_SYSTYPES__ +#define KRB5_SYSTYPES__ +#include +typedef unsigned long u_long; /* Not part of sys/types.h on the pc */ +typedef unsigned int u_int; +typedef unsigned short u_short; +typedef unsigned char u_char; +#endif /* KRB5_SYSTYPES__ */ + +#define MAXHOSTNAMELEN 512 +#ifndef MAXPATHLEN +#define MAXPATHLEN 256 /* Also for Windows temp files */ +#endif + +#define HAVE_NETINET_IN_H +#define MSDOS_FILESYSTEM +#define HAVE_STRING_H +#define HAVE_SRAND +#define HAVE_ERRNO +#define HAVE_STRDUP +#define NO_USERID +#define NO_PASSWORD + +#define WM_KERBEROS5_CHANGED "Kerberos5 Changed" +#ifdef KRB4 +#define WM_KERBEROS_CHANGED "Kerberos Changed" +#endif + +/* Kerberos Windows initialization file */ +#define KERBEROS_INI "kerberos.ini" +#ifdef CYGNUS +#define KERBEROS_HLP "kerbnet.hlp" +#else +#define KERBEROS_HLP "krb5clnt.hlp" +#endif +#define INI_DEFAULTS "Defaults" +#define INI_USER "User" /* Default user */ +#define INI_INSTANCE "Instance" /* Default instance */ +#define INI_REALM "Realm" /* Default realm */ +#define INI_POSITION "Position" +#define INI_OPTIONS "Options" +#define INI_DURATION "Duration" /* Ticket duration in minutes */ +#define INI_EXPIRATION "Expiration" /* Action on expiration (alert or beep) */ +#define INI_ALERT "Alert" +#define INI_BEEP "Beep" +#define INI_FILES "Files" +#ifdef KRB4 +#define INI_KRB_CONF "krb.conf" /* Location of krb.conf file */ +#define DEF_KRB_CONF "krb.conf" /* Default name for krb.conf file */ +#else +#define INI_KRB5_CONF "krb5.ini" /* From k5-config.h */ +#define INI_KRB_CONF INI_KRB5_CONF /* Location of krb.conf file */ +#define DEF_KRB_CONF INI_KRB5_CONF /* Default name for krb.conf file */ +#define INI_TICKETOPTS "TicketOptions" /* Ticket options */ +#define INI_FORWARDABLE "Forwardable" /* get forwardable tickets */ +#define INI_KRB_CCACHE "krb5cc" /* From k5-config.h */ +#endif +#define INI_KRB_REALMS "krb.realms" /* Location of krb.realms file */ +#define DEF_KRB_REALMS "krb.realms" /* Default name for krb.realms file */ +#define INI_RECENT_LOGINS "Recent Logins" +#define INI_LOGIN "Login" + +#define HAS_VOID_TYPE +#define HAVE_STDARG_H +#define HAVE_SYS_TYPES_H +#define HAVE_STDLIB_H + +/* This controls which encryption routines libcrypto will provide */ +#define PROVIDE_DES_CBC_MD5 +#define PROVIDE_DES_CBC_CRC +#define PROVIDE_DES_CBC_RAW +#define PROVIDE_DES_CBC_CKSUM +#define PROVIDE_CRC32 +#define PROVIDE_RSA_MD4 +#define PROVIDE_RSA_MD5 +/* #define PROVIDE_DES3_CBC_SHA */ +/* #define PROVIDE_DES3_CBC_RAW */ +/* #define PROVIDE_NIST_SHA */ + +/* Ugly. Microsoft, in stdc mode, doesn't support the low-level i/o + * routines directly. Rather, they only export the _ version. + * The following defines works around this problem. + */ +#include +#include +#include +#include +#include + +#ifdef NEED_SYSERROR +/* Only needed by util/et/error_message.c but let's keep the source clean */ +#define sys_nerr _sys_nerr +#define sys_errlist _sys_errlist +#endif + +/* + * Functions with slightly different names on the PC + */ +#ifndef strcasecmp +#define strcasecmp stricmp +#endif +#ifndef strncasecmp +#define strncasecmp strnicmp +#endif + +HINSTANCE get_lib_instance(void); + +#endif /* !RES_ONLY */ + +#endif /* _WIN32 */ + +#define THREEPARAMOPEN(x,y,z) open(x,y,z) + +#ifndef KRB5_CALLCONV +#define KRB5_CALLCONV +#endif + +#ifndef KRB5_CALLCONV_C +#define KRB5_CALLCONV_C +#endif + +#endif /* _KRB5_WIN_MAC_H */ diff --git a/src/WINNT/kfw/inc/krbcc/cacheapi.h b/src/WINNT/kfw/inc/krbcc/cacheapi.h new file mode 100644 index 000000000..76615995a --- /dev/null +++ b/src/WINNT/kfw/inc/krbcc/cacheapi.h @@ -0,0 +1,458 @@ +/* + * $Id$ + * + * Copyright 1997 by the Regents of the University of Michigan + * + * This software is being provided to you, the LICENSEE, by the + * Regents of the University of Michigan (UM) 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: + * + * 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: + * + * Copyright 1997 by the Regents of the University of Michigan. + * All rights reserved. + * + * THIS SOFTWARE IS PROVIDED "AS IS", AND UM MAKES NO REPRESENTATIONS + * OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not + * limitation, UM 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. + * + * The name of the University of Michigan or UM 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 UM, and USER agrees to preserve same. + * + * The University of Michigan + * c/o Steve Rothwell + * 535 W. William Street + * Ann Arbor, Michigan 48013-4943 + * U.S.A. + */ + +/* +** CacheAPI.h +** +** The externally visible functions and data structures +** for the Kerberos Common Cache DLL +** This should be the ONLY externally visible file. +** This is ALL anyone should need to call the API. +** +** +*/ + +#ifndef Krb_CCacheAPI_h_ +#define Krb_CCacheAPI_h_ + +#include + +//typedef int cc_int32; +#define cc_int32 long +#define cc_uint32 unsigned long + +typedef cc_int32 cc_time_t; + +#define CC_API_VER_1 1 +#define CC_API_VER_2 2 + +//enum { +// CC_API_VER_1 = 1, +// CC_API_VER_2 = 2 +//}; + +#define CCACHE_API __declspec(dllexport) 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 + + +/* +** types, structs, & constants +*/ +// Flag bits promised by Ted "RSN" +#define CC_FLAGS_RESERVED 0xFFFFFFFF + +typedef cc_uint32 cc_nc_flags; // set via constants above + +typedef struct opaque_dll_control_block_type* apiCB; +typedef struct opaque_ccache_pointer_type* ccache_p; +typedef struct opaque_credential_iterator_type* ccache_cit; + +#if 0 +enum _cc_data_type { + type_ticket = 0, /* 0 for ticket, second_ticket */ + /* Ted's draft spec says these are to be + "as defined in the Kerberos V5 protocol" + all I can find are typdefs, + can't find an enumerated type or #define + */ + type_address, /* = <"as defined in the Kerberos V5 protocol"> */ + type_authdata, /* = <"as defined in the Kerberos V5 protocol"> */ + type_encryption, /* = <"as defined in the Kerberos V5 protocol"> */ + cc_data_type_max /* for validation */ +}; +#endif + +typedef struct _cc_data +{ + cc_uint32 type; // should be one of _cc_data_type + cc_uint32 length; + unsigned char* data; // the proverbial bag-o-bits +} cc_data; + +// V5 Credentials +typedef struct _cc_creds { + char* client; + char* server; + cc_data keyblock; + cc_time_t authtime; + cc_time_t starttime; + cc_time_t endtime; + cc_time_t renew_till; + cc_uint32 is_skey; + cc_uint32 ticket_flags; + cc_data FAR ** addresses; + cc_data ticket; + cc_data second_ticket; + cc_data FAR ** authdata; +} cc_creds; + + +// begin V4 stuff +// use an enumerated type so all callers infer the same meaning +// these values are what krbv4win uses internally. +#define STK_AFS 0 +#define STK_DES 1 + +// K4 uses a MAX_KTXT_LEN of 1250 to hold a ticket +// K95 uses 256 +// To be safe I'll use the larger number, but a factor of 5!!! +#define MAX_V4_CRED_LEN 1250 + +// V4 Credentials + +enum { + KRB_NAME_SZ = 40, + KRB_INSTANCE_SZ = 40, + KRB_REALM_SZ = 40 +}; + +typedef struct cc_V4credential { + unsigned char kversion; + char principal[KRB_NAME_SZ + 1]; + char principal_instance[KRB_INSTANCE_SZ + 1]; + char service[KRB_NAME_SZ + 1]; + char service_instance[KRB_INSTANCE_SZ + 1]; + char realm[KRB_REALM_SZ + 1]; + unsigned char session_key[8]; + cc_int32 kvno; // k95 used BYTE skvno + cc_int32 str_to_key; // k4 infers dynamically, k95 stores + long issue_date; // k95 called this issue_time + cc_int32 lifetime; // k95 used LONG expiration_time + cc_uint32 address; // IP Address of local host + cc_int32 ticket_sz; // k95 used BYTE, k4 ktext uses int to hold up to 1250 + unsigned char ticket[MAX_V4_CRED_LEN]; + unsigned long oops; // zero to catch runaways +} V4Cred_type; + +enum { + CC_CRED_VUNKNOWN = 0, // For validation + CC_CRED_V4 = 1, + CC_CRED_V5 = 2, + CC_CRED_VMAX = 3 // For validation +}; + +typedef union cred_ptr_union_type { + V4Cred_type* pV4Cred; + cc_creds* pV5Cred; +} cred_ptr_union; + +typedef struct cred_union_type { + cc_int32 cred_type; + cred_ptr_union cred; +} cred_union; + +typedef struct _infoNC { + char* name; + char* principal; + cc_int32 vers; +} infoNC; + + +/* +** The official (externally visible) API +*/ + +#ifdef __cplusplus +extern "C" /* this entire list of functions */ +{ +#endif /* __cplusplus */ + +/* +** Main cache routines : initialize, shutdown, get_cache_names, & get_change_time +*/ +CCACHE_API +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 + ); + +CCACHE_API +cc_shutdown( + apiCB** cc_ctx // <> DLL's primary control structure. NULL after call. + ); + +CCACHE_API +cc_get_change_time( + apiCB* cc_ctx, // > DLL's primary control structure + cc_time_t* time // < time of last change to main cache + ); + + +/* +** Named Cache (NC) routines +** create, open, close, destroy, get_principal, get_cred_version, & +** lock_request +** +** Multiple NCs are allowed within the main cache. Each has a Name +** and kerberos version # (V4 or V5). Caller gets "ccache_ptr"s for +** NCs. +*/ +CCACHE_API +cc_create( + apiCB* cc_ctx, // > DLL's primary control structure + const char* name, // > name of cache to be [destroyed if exists, then] created + const char* principal, + cc_int32 vers, // > ticket version (CC_CRED_V4 or CC_CRED_V5) + cc_uint32 cc_flags, // > options + ccache_p** ccache_ptr // < NC control structure + ); + +CCACHE_API +cc_open( + apiCB* cc_ctx, // > DLL's primary control structure + const char* name, // > name of pre-created cache + cc_int32 vers, // > ticket version (CC_CRED_V4 or CC_CRED_V5) + cc_uint32 cc_flags, // > options + ccache_p** ccache_ptr // < NC control structure + ); + +CCACHE_API +cc_close( + apiCB* cc_ctx, // > DLL's primary control structure + ccache_p** ccache_ptr // <> NC control structure. NULL after call. + ); + +CCACHE_API +cc_destroy( + apiCB* cc_ctx, // > DLL's primary control structure + ccache_p** ccache_ptr // <> NC control structure. NULL after call. + ); + +/* +** Ways to get information about the NCs +*/ + +CCACHE_API +cc_seq_fetch_NCs_begin( + apiCB* cc_ctx, + ccache_cit** itNCs + ); + +CCACHE_API +cc_seq_fetch_NCs_end( + apiCB* cc_ctx, + ccache_cit** itNCs + ); + +CCACHE_API +cc_seq_fetch_NCs_next( + apiCB* cc_ctx, + ccache_p** ccache_ptr, + ccache_cit* itNCs + ); + +CCACHE_API +cc_seq_fetch_NCs( + apiCB* cc_ctx, // > DLL's primary control structure + ccache_p** ccache_ptr, // < NC control structure (free via cc_close()) + ccache_cit** itNCs // <> iterator used by DLL, + // set to NULL before first call + // returned NULL at CC_END + ); + +CCACHE_API +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()) + ); + +CCACHE_API +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 + ); + +/* +** Functions that provide distinguishing characteristics of NCs. +*/ + +CCACHE_API +cc_get_name( + apiCB* cc_ctx, // > DLL's primary control structure + const ccache_p* ccache_ptr, // > NC control structure + char** name // < name of NC associated with ccache_ptr + // (free via cc_free_name()) + ); + +CCACHE_API +cc_set_principal( + apiCB* cc_ctx, // > DLL's primary control structure + const ccache_p* ccache_pointer, // > NC control structure + const cc_int32 vers, + const char* principal // > name of principal associated with NC + // Free via cc_free_principal() + ); + +CCACHE_API +cc_get_principal( + apiCB* cc_ctx, // > DLL's primary control structure + const ccache_p* ccache_pointer, // > NC control structure + char** principal // < name of principal associated with NC + // Free via cc_free_principal() + ); + +CCACHE_API +cc_get_cred_version( + apiCB* cc_ctx, // > DLL's primary control structure + const ccache_p* ccache_ptr, // > NC control structure + cc_int32* vers // < ticket version associated with NC + ); + +#define CC_LOCK_UNLOCK 1 +#define CC_LOCK_READER 2 +#define CC_LOCK_WRITER 3 +#define CC_LOCK_NOBLOCK 16 + +CCACHE_API +cc_lock_request( + apiCB* cc_ctx, // > DLL's primary control structure + const ccache_p* ccache_ptr, // > NC control structure + const cc_int32 lock_type // > one (or combination) of above defined + // lock types + ); + + +/* +** Credentials routines (work within an NC) +** store, remove_cred, seq_fetch_creds +*/ +CCACHE_API +cc_store( + apiCB* cc_ctx, // > DLL's primary control structure + ccache_p* ccache_ptr, // > NC control structure + const cred_union creds // > credentials to be copied into NC + ); + +CCACHE_API +cc_remove_cred( + apiCB* cc_ctx, // > DLL's primary control structure + ccache_p* ccache_ptr, // > NC control structure + const cred_union cred // > credentials to remove from NC + ); + +CCACHE_API +cc_seq_fetch_creds( + apiCB* cc_ctx, // > DLL's primary control structure + const ccache_p* ccache_ptr, // > NC control structure + cred_union** creds, // < filled in by DLL, free via cc_free_creds() + ccache_cit** itCreds // <> iterator used by DLL, set to NULL + // before first call -- Also NULL for final + // call if loop ends before CC_END + ); + +CCACHE_API +cc_seq_fetch_creds_begin( + apiCB* cc_ctx, + const ccache_p* ccache_ptr, + ccache_cit** itCreds + ); + +CCACHE_API +cc_seq_fetch_creds_end( + apiCB* cc_ctx, + ccache_cit** itCreds + ); + +CCACHE_API +cc_seq_fetch_creds_next( + apiCB* cc_ctx, + cred_union** cred, + ccache_cit* itCreds + ); + +/* +** methods of liberation, +** or freeing space via the free that goes with the malloc used to get it +** It's important to use the free carried in the DLL, not the one supplied +** by your compiler vendor. +** +** freeing a NULL pointer is not treated as an error +*/ +CCACHE_API +cc_free_principal( + apiCB* cc_ctx, // > DLL's primary control structure + char** principal // <> ptr to principal to be freed, returned as NULL + // (from cc_get_principal()) + ); + +CCACHE_API +cc_free_name( + apiCB* cc_ctx, // > DLL's primary control structure + char** name // <> ptr to name to be freed, returned as NULL + // (from cc_get_name()) + ); + +CCACHE_API +cc_free_creds( + apiCB* cc_ctx, // > DLL's primary control structure + cred_union** pCred // <> cred (from cc_seq_fetch_creds()) to be freed + // Returned as NULL. + ); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* Krb_CCacheAPI_h_ */ diff --git a/src/WINNT/kfw/inc/leash/leasherr.h b/src/WINNT/kfw/inc/leash/leasherr.h new file mode 100644 index 000000000..834765fbb --- /dev/null +++ b/src/WINNT/kfw/inc/leash/leasherr.h @@ -0,0 +1,32 @@ +/* + * leasherr.h + * This file is the #include file for leasherr.et. + * Please do not edit it as it is automatically generated. + */ + +#define LSH_ONLYONEME (40591872L) +#define LSH_INVPRINCIPAL (40591873L) +#define LSH_FAILEDREALM (40591874L) +#define LSH_INVINSTANCE (40591875L) +#define LSH_INVREALM (40591876L) +#define LSH_EOF (40591877L) +#define LSH_EXPIRESOON (40591878L) +#define LSH_NOMATCH (40591879L) +#define LSH_BADCHARS (40591880L) +#define LSH_FATAL_ERROR (40591881L) +#define LSH_BADWINSOCK (40591882L) +#define LSH_BADTIMESERV (40591883L) +#define LSH_NOSOCKET (40591884L) +#define LSH_NOCONNECT (40591885L) +#define LSH_TIMEFAILED (40591886L) +#define LSH_GETTIMEOFDAY (40591887L) +#define LSH_SETTIMEOFDAY (40591888L) +#define LSH_RECVTIME (40591889L) +#define LSH_RECVBYTES (40591890L) +#define LSH_ALREADY_SETTIME (40591891L) +extern void initialize_lsh_error_table(struct et_list **); +#define ERROR_TABLE_BASE_lsh (40591872L) + +/* for compatibility with older versions... */ +#define init_lsh_err_tbl() initialize_lsh_error_table(&_et_list) +#define lsh_err_base ERROR_TABLE_BASE_lsh diff --git a/src/WINNT/kfw/inc/leash/leashinfo.h b/src/WINNT/kfw/inc/leash/leashinfo.h new file mode 100644 index 000000000..7365aa1b5 --- /dev/null +++ b/src/WINNT/kfw/inc/leash/leashinfo.h @@ -0,0 +1,2 @@ +#define LSH_TIME_HOST 1970 +#define LSH_DEFAULT_TICKET_LIFE 1971 diff --git a/src/WINNT/kfw/inc/leash/leashwin.h b/src/WINNT/kfw/inc/leash/leashwin.h new file mode 100644 index 000000000..f3ac7429d --- /dev/null +++ b/src/WINNT/kfw/inc/leash/leashwin.h @@ -0,0 +1,133 @@ +#ifndef __LEASHWIN__ +#define __LEASHWIN__ + +#include + +typedef struct { + int dlgtype; +#define DLGTYPE_PASSWD 0 +#define DLGTYPE_CHPASSWD 1 + // Tells whether dialog box is in change pwd more or init ticket mode??? + // (verify this): + int dlgstatemax; // What is this??? + // The title on the Dialog box - for Renewing or Initializing: + LPSTR title; + LPSTR principal; +} LSH_DLGINFO, FAR *LPLSH_DLGINFO; + +#define LEASH_USERNAME_SZ 64 +#define LEASH_REALM_SZ 192 + +typedef struct { + DWORD size; + int dlgtype; +#define DLGTYPE_PASSWD 0 +#define DLGTYPE_CHPASSWD 1 + // Tells whether dialog box is in change pwd more or init ticket mode??? + // (verify this): + LPSTR title; + LPSTR username; + LPSTR realm; + int use_defaults; + int forwardable; + int noaddresses; + int lifetime; + int renew_till; + int proxiable; + int publicip; + // Version 1 of this structure ended here + struct { + char username[LEASH_USERNAME_SZ]; + char realm[LEASH_REALM_SZ]; + } out; +} LSH_DLGINFO_EX, FAR *LPLSH_DLGINFO_EX; + +#define LSH_DLGINFO_EX_V1_SZ (sizeof(DWORD) + 3 * sizeof(LPSTR) * 8 * sizeof(int)) + +typedef struct { + char principal[MAX_K_NAME_SZ]; /* Principal name/instance/realm */ + int btickets; /* Do we have tickets? */ + long lifetime; /* Lifetime -- needs to have + room for 255 5-minute + periods * 5 * 60 */ + long issue_date; /* The issue time */ + long renew_till; /* The Renew time (k5 only) */ +} TICKETINFO; + +int FAR Leash_kinit_dlg(HWND hParent, LPLSH_DLGINFO lpdlginfo); +int FAR Leash_kinit_dlg_ex(HWND hParent, LPLSH_DLGINFO_EX lpdlginfoex); +int FAR Leash_changepwd_dlg(HWND hParent, LPLSH_DLGINFO lpdlginfo); +int FAR Leash_changepwd_dlg_ex(HWND hParent, LPLSH_DLGINFO_EX lpdlginfo); + +long FAR Leash_checkpwd(char *principal, char *password); +long FAR Leash_changepwd(char *principal, char *password, char *newpassword, char** result_string); +long FAR Leash_kinit(char *principal, char *password, int lifetime); +long FAR Leash_kinit_ex(char * principal, char * password, int lifetime, + int forwardable, int proxiable, int renew_life, + int addressless, unsigned long publicIP); + +long FAR Leash_klist(HWND hlist, TICKETINFO FAR *ticketinfo); +long FAR Leash_kdestroy(void); +long FAR Leash_get_lsh_errno( LONG FAR *err_val); + +long FAR Leash_renew(void); +long FAR Leash_importable(void); +long FAR Leash_import(void); + +BOOL Leash_set_help_file( char FAR *szHelpFile ); +LPSTR Leash_get_help_file(void); + +void Leash_reset_defaults(void); + +#define NO_TICKETS 0 +#define EXPD_TICKETS 2 +#define GOOD_TICKETS 1 + +/* Leash Configuration functions - alters Current User Registry */ +DWORD Leash_get_default_lifetime(); +DWORD Leash_set_default_lifetime(DWORD minutes); +DWORD Leash_reset_default_lifetime(); +DWORD Leash_get_default_renew_till(); +DWORD Leash_set_default_renew_till(DWORD minutes); +DWORD Leash_reset_default_renew_till(); +DWORD Leash_get_default_renewable(); +DWORD Leash_set_default_renewable(DWORD onoff); +DWORD Leash_reset_default_renewable(); +DWORD Leash_get_default_forwardable(); +DWORD Leash_set_default_forwardable(DWORD onoff); +DWORD Leash_reset_default_forwardable(); +DWORD Leash_get_default_noaddresses(); +DWORD Leash_set_default_noaddresses(DWORD onoff); +DWORD Leash_reset_default_noaddresses(); +DWORD Leash_get_default_proxiable(); +DWORD Leash_set_default_proxiable(DWORD onoff); +DWORD Leash_reset_default_proxiable(); +DWORD Leash_get_default_publicip(); +DWORD Leash_set_default_publicip(DWORD ipv4addr); +DWORD Leash_reset_default_publicip(); +DWORD Leash_get_default_use_krb4(); +DWORD Leash_set_default_use_krb4(DWORD onoff); +DWORD Leash_reset_default_use_krb4(); +DWORD Leash_get_hide_kinit_options(); +DWORD Leash_set_hide_kinit_options(DWORD onoff); +DWORD Leash_reset_hide_kinit_options(); +DWORD Leash_get_default_life_min(); +DWORD Leash_set_default_life_min(DWORD minutes); +DWORD Leash_reset_default_life_min(); +DWORD Leash_get_default_life_max(); +DWORD Leash_set_default_life_max(DWORD minutes); +DWORD Leash_reset_default_life_max(); +DWORD Leash_get_default_renew_min(); +DWORD Leash_set_default_renew_min(DWORD minutes); +DWORD Leash_reset_default_renew_min(); +DWORD Leash_get_default_renew_max(); +DWORD Leash_set_default_renew_max(DWORD minutes); +DWORD Leash_reset_default_renew_max(); +DWORD Leash_get_lock_file_locations(); +DWORD Leash_set_lock_file_locations(DWORD onoff); +DWORD Leash_reset_lock_file_locations(); +DWORD Leash_get_default_uppercaserealm(); +DWORD Leash_set_default_uppercaserealm(DWORD onoff); +DWORD Leash_reset_default_uppercaserealm(); + +#endif /* LEASHWIN */ diff --git a/src/WINNT/kfw/inc/loadfuncs/loadfuncs-afs.h b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-afs.h new file mode 100644 index 000000000..be2023787 --- /dev/null +++ b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-afs.h @@ -0,0 +1,51 @@ +#ifndef __LOADFUNCS_AFS_H__ +#define __LOADFUNCS_AFS_H__ + +#include "loadfuncs.h" + +#define AFSTOKENS_DLL "libafstokens.dll" +#define AFSCONF_DLL "libafsconf.dll" + +#define CALLCONV_C +typedef long cm_configProc_t(void *, struct sockaddr_in *, char *); + +TYPEDEF_FUNC( + int, + CALLCONV_C, + ktc_ListTokens, + (int, int *, struct ktc_principal *) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + ktc_GetToken, + (struct ktc_principal *, struct ktc_token *, int, struct ktc_principal *) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + ktc_SetToken, + (struct ktc_principal *, struct ktc_principal *, struct ktc_token *, int) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + ktc_ForgetAllTokens, + () + ); + + +TYPEDEF_FUNC( + long, + CALLCONV_C, + cm_SearchCellFile, + (char *, cm_configProc_t *, void *) + ); +TYPEDEF_FUNC( + long, + CALLCONV_C, + cm_GetRootCellName, + (char *) + ); + +#endif /* __LOADFUNCS_AFS_H__ */ diff --git a/src/WINNT/kfw/inc/loadfuncs/loadfuncs-afs36.h b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-afs36.h new file mode 100644 index 000000000..974b8dbd3 --- /dev/null +++ b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-afs36.h @@ -0,0 +1,51 @@ +#ifndef __LOADFUNCS_AFS36_H__ +#define __LOADFUNCS_AFS36_H__ + +#include "loadfuncs.h" + +#define AFSTOKENS_DLL "afsauthent.dll" +#define AFSCONF_DLL "libafsconf.dll" + +#define CALLCONV_C +typedef long cm_configProc_t(void *, struct sockaddr_in *, char *); + +TYPEDEF_FUNC( + int, + CALLCONV_C, + ktc_ListTokens, + (int, int *, struct ktc_principal *) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + ktc_GetToken, + (struct ktc_principal *, struct ktc_token *, int, struct ktc_principal *) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + ktc_SetToken, + (struct ktc_principal *, struct ktc_token *, struct ktc_principal *, int) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + ktc_ForgetAllTokens, + () + ); + + +TYPEDEF_FUNC( + long, + CALLCONV_C, + cm_SearchCellFile, + (char *, char *, cm_configProc_t *, void *) + ); +TYPEDEF_FUNC( + long, + CALLCONV_C, + cm_GetRootCellName, + (char *) + ); + +#endif /* __LOADFUNCS_AFS_H__ */ diff --git a/src/WINNT/kfw/inc/loadfuncs/loadfuncs-com_err.h b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-com_err.h new file mode 100644 index 000000000..42e50a086 --- /dev/null +++ b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-com_err.h @@ -0,0 +1,40 @@ +#ifndef __LOADFUNCS_COM_ERR_H__ +#define __LOADFUNCS_COM_ERR_H__ + +#include "loadfuncs.h" +#include + +#define COMERR_DLL "comerr32.dll" + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV_C, + com_err, + (const char FAR *, errcode_t, const char FAR *, ...) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + com_err_va, + (const char FAR *whoami, errcode_t code, const char FAR *fmt, va_list ap) + ); +TYPEDEF_FUNC( + const char FAR *, + KRB5_CALLCONV, + error_message, + (errcode_t) + ); +TYPEDEF_FUNC( + errcode_t, + KRB5_CALLCONV, + add_error_table, + (const struct error_table FAR *) + ); +TYPEDEF_FUNC( + errcode_t, + KRB5_CALLCONV, + remove_error_table, + (const struct error_table FAR *) + ); + +#endif /* __LOADFUNCS_COM_ERR_H__ */ diff --git a/src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb.h b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb.h new file mode 100644 index 000000000..5ba4578ee --- /dev/null +++ b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb.h @@ -0,0 +1,306 @@ +#ifndef __LOADFUNCS_KRB_H__ +#define __LOADFUNCS_KRB_H__ + +#include "loadfuncs.h" +#include + +#define KRB4_DLL "krbv4w32.dll" + +#define krb_err_text(status) pget_krb_err_txt_entry(status) +#define CALLCONV_C + +TYPEDEF_FUNC( + char *, + CALLCONV_C, + tkt_string, + () + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + gettimeofday, + (struct timeval *tv, struct timezone *tz) + ); +TYPEDEF_FUNC( + int, + PASCAL, + krb_sendauth, + (long, int, KTEXT, char *, char *, char *, + unsigned long, MSG_DAT *, CREDENTIALS *, + Key_schedule *, struct sockaddr_in *, + struct sockaddr_in FAR *, char *) + ); +TYPEDEF_FUNC( + int, + PASCAL, + krb_mk_req, + (KTEXT, char *, char *, char *, long) + ); +TYPEDEF_FUNC( + char *, + PASCAL, + krb_getrealm, + (char *host) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + krb_get_tf_fullname, + (char FAR *, char FAR *, char FAR *, char FAR *) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + krb_get_tf_realm, + (char FAR *,char FAR *) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + tf_init, + (char FAR*,int) + ); +TYPEDEF_FUNC( + long, + CALLCONV_C, + LocalHostAddr, + () + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + tf_get_pname, + (char FAR*) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + tf_get_pinst, + (char FAR*) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + tf_get_cred, + (CREDENTIALS FAR*) + ); +TYPEDEF_FUNC( + void, + CALLCONV_C, + tf_close, + (void) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + tf_save_cred, + (char FAR*,char FAR*,char FAR*,C_Block,int,int,KTEXT,long) + ); +TYPEDEF_FUNC( + BOOL, + CALLCONV_C, + k_isinst, + (char FAR *s) + ); +TYPEDEF_FUNC( + BOOL, + CALLCONV_C, + k_isrealm, + (char FAR *s) + ); +TYPEDEF_FUNC( + BOOL, + CALLCONV_C, + k_isname, + (char FAR *s) + ); + +TYPEDEF_FUNC( + char **, + CALLCONV_C, + get_krb_err_txt, + (void) + ); + +/* Warning, unique to Windows! */ +TYPEDEF_FUNC( + int, + CALLCONV_C, + set_krb_debug, + (int) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + set_krb_ap_req_debug, + (int) + ); +TYPEDEF_FUNC( + char *, + PASCAL, + get_krb_err_txt_entry, + (int i) + ); +TYPEDEF_FUNC( + char *, + CALLCONV_C, + krb_err_func, + (int offset, long code) + ); +TYPEDEF_FUNC( + int, + PASCAL, + k_decomp_ticket, + (KTEXT, unsigned char *, char *, char *, char *, + unsigned long *, C_Block, int *, unsigned long *, + char *, char *, C_Block, Key_schedule) + ); +TYPEDEF_FUNC( + int, + PASCAL, + krb_mk_req, + (KTEXT,char *,char *,char *,long) + ); +TYPEDEF_FUNC( + char *, + PASCAL, + krb_getrealm, + (char *host) + ); +TYPEDEF_FUNC( + char *, + PASCAL, + krb_realmofhost, + (char *host) + ); +TYPEDEF_FUNC( + char *, + CALLCONV_C, + krb_get_phost, + (char *host) + ); + +TYPEDEF_FUNC( + int, + CALLCONV_C, + kname_parse, + (char *, char *, char *, char *) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + krb_get_pw_in_tkt, + (char *, char *, char *, char *, char *, int, char *) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + dest_tkt, + (void) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + krb_get_lrealm, + (char *, int) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + krb_check_serv, + (char*) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + krb_get_cred, + (char *, char *, char *, CREDENTIALS *) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + send_to_kdc, + (KTEXT, KTEXT, char *) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + create_ciph, + (KTEXT, C_Block, char *, char *, char *, unsigned long, int, + KTEXT, unsigned long, C_Block *) + ); +TYPEDEF_FUNC( + char *, + CALLCONV_C, + krb_get_krbconf2, + (char *, size_t *) + ); +TYPEDEF_FUNC( + char *, + CALLCONV_C, + krb_get_krbrealm2, + (char *, size_t *) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + krb_in_tkt, + (char *, char *, char *) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + krb_save_credentials, + (char *, char *, char *, C_Block, int, int, KTEXT, long) + ); + +/* NOT IN krb.h HEADER: */ + +TYPEDEF_FUNC( + int, + CALLCONV_C, + k_gethostname, + (char FAR*, int) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + krb_get_krbhst, + (char *, char *, int) + ); +TYPEDEF_FUNC( + void, + CALLCONV_C, + krb_set_tkt_string, + (char *) + ); + +/* Evil incarnate... */ + +TYPEDEF_FUNC( + long, + CALLCONV_C, + kadm_change_your_password, + (LPSTR principal, LPSTR old_password, + LPSTR new_password, HANDLE FAR * hInfo_desc) + ); +TYPEDEF_FUNC( + void, + CALLCONV_C, + initialize_krb_error_func, + (void* func, HANDLE *__et_list) + ); +TYPEDEF_FUNC( + void, + CALLCONV_C, + initialize_kadm_error_table, + (HANDLE *__et_list) + ); +TYPEDEF_FUNC( + LONG, + CALLCONV_C, + lsh_LoadKrb4LeashErrorTables, + (HMODULE hLeashDll, INT useCallBackFunction) + ); + +#endif /* __LOADFUNCS_KRB_H__ */ diff --git a/src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb5.h b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb5.h new file mode 100644 index 000000000..46827f64c --- /dev/null +++ b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb5.h @@ -0,0 +1,1737 @@ +#ifndef __LOADFUNCS_KRB5_H__ +#define __LOADFUNCS_KRB5_H__ + +#include "loadfuncs.h" +#include + +#define KRB5_DLL "krb5_32.dll" + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_principal, + (krb5_context, krb5_principal) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_authenticator, + (krb5_context, krb5_authenticator * ) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_authenticator_contents, + (krb5_context, krb5_authenticator * ) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_addresses, + (krb5_context, krb5_address * * ) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_address, + (krb5_context, krb5_address * ) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_authdata, + (krb5_context, krb5_authdata * * ) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_enc_tkt_part, + (krb5_context, krb5_enc_tkt_part * ) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_ticket, + (krb5_context, krb5_ticket * ) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_tickets, + (krb5_context, krb5_ticket * * ) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_kdc_req, + (krb5_context, krb5_kdc_req * ) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_kdc_rep, + (krb5_context, krb5_kdc_rep * ) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_last_req, + (krb5_context, krb5_last_req_entry * * ) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_enc_kdc_rep_part, + (krb5_context, krb5_enc_kdc_rep_part * ) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_error, + (krb5_context, krb5_error * ) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_ap_req, + (krb5_context, krb5_ap_req * ) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_ap_rep, + (krb5_context, krb5_ap_rep * ) + ); + +/* Removed around the time of krb5_rc_* change... */ +#if 0 +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_safe, + (krb5_context, krb5_safe * ) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_priv, + (krb5_context, krb5_priv * ) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_priv_enc_part, + (krb5_context, krb5_priv_enc_part * ) + ); +#endif + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_cred, + (krb5_context, krb5_cred *) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_creds, + (krb5_context, krb5_creds *) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_cred_contents, + (krb5_context, krb5_creds *) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_cred_enc_part, + (krb5_context, krb5_cred_enc_part *) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_checksum, + (krb5_context, krb5_checksum *) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_checksum_contents, + (krb5_context, krb5_checksum *) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_keyblock, + (krb5_context, krb5_keyblock *) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_keyblock_contents, + (krb5_context, krb5_keyblock *) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_pa_data, + (krb5_context, krb5_pa_data * *) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_ap_rep_enc_part, + (krb5_context, krb5_ap_rep_enc_part *) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_tkt_authent, + (krb5_context, krb5_tkt_authent *) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_pwd_data, + (krb5_context, krb5_pwd_data *) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_pwd_sequences, + (krb5_context, passwd_phrase_element * *) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_data, + (krb5_context, krb5_data *) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_data_contents, + (krb5_context, krb5_data *) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_unparsed_name, + (krb5_context, char *) + ); +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_cksumtypes, + (krb5_context, krb5_cksumtype *) + ); + +/* ------------------------------------------------------------------------- */ + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_c_encrypt, + (krb5_context context, const krb5_keyblock *key, + krb5_keyusage usage, const krb5_data *ivec, + const krb5_data *input, krb5_enc_data *output) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_c_decrypt, + (krb5_context context, const krb5_keyblock *key, + krb5_keyusage usage, const krb5_data *ivec, + const krb5_enc_data *input, krb5_data *output) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_c_encrypt_length, + (krb5_context context, krb5_enctype enctype, + size_t inputlen, size_t *length) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_c_block_size, + (krb5_context context, krb5_enctype enctype, + size_t *blocksize) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_c_make_random_key, + (krb5_context context, krb5_enctype enctype, + krb5_keyblock *random_key) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_c_random_make_octets, + (krb5_context context, krb5_data *data) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_c_random_seed, + (krb5_context context, krb5_data *data) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_c_string_to_key, + (krb5_context context, krb5_enctype enctype, + const krb5_data *string, const krb5_data *salt, + krb5_keyblock *key) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_c_enctype_compare, + (krb5_context context, krb5_enctype e1, krb5_enctype e2, + krb5_boolean *similar) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_c_make_checksum, + (krb5_context context, krb5_cksumtype cksumtype, + const krb5_keyblock *key, krb5_keyusage usage, + const krb5_data *input, krb5_checksum *cksum) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_c_verify_checksum, + (krb5_context context, + const krb5_keyblock *key, krb5_keyusage usage, + const krb5_data *data, + const krb5_checksum *cksum, + krb5_boolean *valid) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_c_checksum_length, + (krb5_context context, krb5_cksumtype cksumtype, + size_t *length) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_c_keyed_checksum_types, + (krb5_context context, krb5_enctype enctype, + unsigned int *count, krb5_cksumtype **cksumtypes) + ); + +/* ------------------------------------------------------------------------- */ + +TYPEDEF_FUNC( + krb5_boolean, + KRB5_CALLCONV, + valid_enctype, + (const krb5_enctype ktype) + ); + +TYPEDEF_FUNC( + krb5_boolean, + KRB5_CALLCONV, + valid_cksumtype, + (const krb5_cksumtype ctype) + ); + +TYPEDEF_FUNC( + krb5_boolean, + KRB5_CALLCONV, + is_coll_proof_cksum, + (const krb5_cksumtype ctype) + ); + +TYPEDEF_FUNC( + krb5_boolean, + KRB5_CALLCONV, + is_keyed_cksum, + (const krb5_cksumtype ctype) + ); + +/* ------------------------------------------------------------------------- */ + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_init_context, + (krb5_context *) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_context, + (krb5_context) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_decrypt_tkt_part, + (krb5_context, + const krb5_keyblock *, + krb5_ticket * ) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_tgt_creds, + (krb5_context, + krb5_creds ** ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_get_credentials, + (krb5_context, + const krb5_flags, + krb5_ccache, + krb5_creds *, + krb5_creds * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_get_credentials_validate, + (krb5_context, + const krb5_flags, + krb5_ccache, + krb5_creds *, + krb5_creds * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_get_credentials_renew, + (krb5_context, + const krb5_flags, + krb5_ccache, + krb5_creds *, + krb5_creds * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_mk_req, + (krb5_context, + krb5_auth_context *, + const krb5_flags, + char *, + char *, + krb5_data *, + krb5_ccache, + krb5_data * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_mk_req_extended, + (krb5_context, + krb5_auth_context *, + const krb5_flags, + krb5_data *, + krb5_creds *, + krb5_data * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_mk_rep, + (krb5_context, + krb5_auth_context, + krb5_data *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_rd_rep, + (krb5_context, + krb5_auth_context, + const krb5_data *, + krb5_ap_rep_enc_part * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_mk_error, + (krb5_context, + const krb5_error *, + krb5_data * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_rd_error, + (krb5_context, + const krb5_data *, + krb5_error * * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_rd_safe, + (krb5_context, + krb5_auth_context, + const krb5_data *, + krb5_data *, + krb5_replay_data *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_rd_priv, + (krb5_context, + krb5_auth_context, + const krb5_data *, + krb5_data *, + krb5_replay_data *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_parse_name, + (krb5_context, + const char *, + krb5_principal * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_unparse_name, + (krb5_context, + krb5_const_principal, + char * * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_unparse_name_ext, + (krb5_context, + krb5_const_principal, + char * *, + int *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_set_principal_realm, + (krb5_context, krb5_principal, const char *) + ); + +TYPEDEF_FUNC( + krb5_boolean, + KRB5_CALLCONV, + krb5_principal_compare, + (krb5_context, + krb5_const_principal, + krb5_const_principal) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_copy_keyblock, + (krb5_context, + const krb5_keyblock *, + krb5_keyblock * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_copy_keyblock_contents, + (krb5_context, + const krb5_keyblock *, + krb5_keyblock *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_copy_creds, + (krb5_context, + const krb5_creds *, + krb5_creds * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_copy_data, + (krb5_context, + const krb5_data *, + krb5_data * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_copy_principal, + (krb5_context, + krb5_const_principal, + krb5_principal *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_copy_addr, + (krb5_context, + const krb5_address *, + krb5_address * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_copy_addresses, + (krb5_context, + krb5_address * const *, + krb5_address * * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_copy_ticket, + (krb5_context, + const krb5_ticket *, + krb5_ticket * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_copy_authdata, + (krb5_context, + krb5_authdata * const *, + krb5_authdata * * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_copy_authenticator, + (krb5_context, + const krb5_authenticator *, + krb5_authenticator * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_copy_checksum, + (krb5_context, + const krb5_checksum *, + krb5_checksum * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_get_server_rcache, + (krb5_context, + const krb5_data *, krb5_rcache *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV_C, + krb5_build_principal_ext, + (krb5_context, krb5_principal *, int, const char *, ...) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV_C, + krb5_build_principal, + (krb5_context, krb5_principal *, int, const char *, ...) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_425_conv_principal, + (krb5_context, + const char *name, + const char *instance, const char *realm, + krb5_principal *princ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_524_conv_principal, + (krb5_context context, const krb5_principal princ, + char *name, char *inst, char *realm) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_mk_chpw_req, + (krb5_context context, krb5_auth_context auth_context, + krb5_data *ap_req, char *passwd, krb5_data *packet) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_rd_chpw_rep, + (krb5_context context, krb5_auth_context auth_context, + krb5_data *packet, int *result_code, + krb5_data *result_data) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_chpw_result_code_string, + (krb5_context context, int result_code, + char **result_codestr) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_kt_register, + (krb5_context, + struct _krb5_kt_ops * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_kt_resolve, + (krb5_context, + const char *, + krb5_keytab * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_kt_default_name, + (krb5_context, + char *, + int ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_kt_default, + (krb5_context, + krb5_keytab * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_kt_free_entry, + (krb5_context, + krb5_keytab_entry * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_kt_remove_entry, + (krb5_context, + krb5_keytab, + krb5_keytab_entry * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_kt_add_entry, + (krb5_context, + krb5_keytab, + krb5_keytab_entry * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_cc_resolve, + (krb5_context, + const char *, + krb5_ccache * ) + ); + +TYPEDEF_FUNC( + const char*, + KRB5_CALLCONV, + krb5_cc_default_name, + (krb5_context) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_cc_set_default_name, + (krb5_context, const char *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_cc_default, + (krb5_context, + krb5_ccache *) + ); + +TYPEDEF_FUNC( + unsigned int, + KRB5_CALLCONV, + krb5_get_notification_message, + (void) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_cc_copy_creds, + (krb5_context context, + krb5_ccache incc, + krb5_ccache outcc) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_us_timeofday, + (krb5_context, + krb5_int32 *, + krb5_int32 * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_timeofday, + (krb5_context, + krb5_int32 * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_os_localaddr, + (krb5_context, + krb5_address * * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_get_default_realm, + (krb5_context, + char * * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_set_default_realm, + (krb5_context, + const char * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_sname_to_principal, + (krb5_context, + const char *, + const char *, + krb5_int32, + krb5_principal *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_change_password, + (krb5_context context, krb5_creds *creds, char *newpw, + int *result_code, krb5_data *result_code_string, + krb5_data *result_string) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_get_default_config_files, + (char ***filenames) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_config_files, + (char **filenames) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_get_in_tkt, + (krb5_context, + const krb5_flags, + krb5_address * const *, + krb5_enctype *, + krb5_preauthtype *, + krb5_error_code ( * )(krb5_context, + const krb5_enctype, + krb5_data *, + krb5_const_pointer, + krb5_keyblock * *), + krb5_const_pointer, + krb5_error_code ( * )(krb5_context, + const krb5_keyblock *, + krb5_const_pointer, + krb5_kdc_rep * ), + krb5_const_pointer, + krb5_creds *, + krb5_ccache, + krb5_kdc_rep * * ) + ); + + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_get_in_tkt_with_password, + (krb5_context, + const krb5_flags, + krb5_address * const *, + krb5_enctype *, + krb5_preauthtype *, + const char *, + krb5_ccache, + krb5_creds *, + krb5_kdc_rep * * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_get_in_tkt_with_skey, + (krb5_context, + const krb5_flags, + krb5_address * const *, + krb5_enctype *, + krb5_preauthtype *, + const krb5_keyblock *, + krb5_ccache, + krb5_creds *, + krb5_kdc_rep * * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_get_in_tkt_with_keytab, + (krb5_context, + const krb5_flags, + krb5_address * const *, + krb5_enctype *, + krb5_preauthtype *, + const krb5_keytab, + krb5_ccache, + krb5_creds *, + krb5_kdc_rep * * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_rd_req, + (krb5_context, + krb5_auth_context *, + const krb5_data *, + krb5_const_principal, + krb5_keytab, + krb5_flags *, + krb5_ticket * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_kt_read_service_key, + (krb5_context, + krb5_pointer, + krb5_principal, + krb5_kvno, + krb5_enctype, + krb5_keyblock * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_mk_safe, + (krb5_context, + krb5_auth_context, + const krb5_data *, + krb5_data *, + krb5_replay_data *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_mk_priv, + (krb5_context, + krb5_auth_context, + const krb5_data *, + krb5_data *, + krb5_replay_data *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_cc_register, + (krb5_context, + krb5_cc_ops *, + krb5_boolean ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_sendauth, + (krb5_context, + krb5_auth_context *, + krb5_pointer, + char *, + krb5_principal, + krb5_principal, + krb5_flags, + krb5_data *, + krb5_creds *, + krb5_ccache, + krb5_error * *, + krb5_ap_rep_enc_part * *, + krb5_creds * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_recvauth, + (krb5_context, + krb5_auth_context *, + krb5_pointer, + char *, + krb5_principal, + krb5_int32, + krb5_keytab, + krb5_ticket * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_mk_ncred, + (krb5_context, + krb5_auth_context, + krb5_creds * *, + krb5_data * *, + krb5_replay_data *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_mk_1cred, + (krb5_context, + krb5_auth_context, + krb5_creds *, + krb5_data * *, + krb5_replay_data *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_rd_cred, + (krb5_context, + krb5_auth_context, + krb5_data *, + krb5_creds * * *, + krb5_replay_data *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_fwd_tgt_creds, + (krb5_context, + krb5_auth_context, + char *, + krb5_principal, + krb5_principal, + krb5_ccache, + int forwardable, + krb5_data *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_auth_con_init, + (krb5_context, + krb5_auth_context *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_auth_con_free, + (krb5_context, + krb5_auth_context) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_auth_con_setflags, + (krb5_context, + krb5_auth_context, + krb5_int32) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_auth_con_getflags, + (krb5_context, + krb5_auth_context, + krb5_int32 *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_auth_con_setuseruserkey, + (krb5_context, + krb5_auth_context, + krb5_keyblock *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_auth_con_getkey, + (krb5_context, + krb5_auth_context, + krb5_keyblock **) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_auth_con_getlocalsubkey, + (krb5_context, + krb5_auth_context, + krb5_keyblock * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_auth_con_set_req_cksumtype, + (krb5_context, + krb5_auth_context, + krb5_cksumtype) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_auth_con_getlocalseqnumber, + (krb5_context, + krb5_auth_context, + krb5_int32 *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_auth_con_getremoteseqnumber, + (krb5_context, + krb5_auth_context, + krb5_int32 *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_auth_con_setrcache, + (krb5_context, + krb5_auth_context, + krb5_rcache) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_auth_con_getauthenticator, + (krb5_context, + krb5_auth_context, + krb5_authenticator * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_auth_con_getremotesubkey, + (krb5_context, + krb5_auth_context, + krb5_keyblock * *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_read_password, + (krb5_context, + const char *, + const char *, + char *, + int * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_get_host_realm, + (krb5_context, + const char *, + char * * * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_free_host_realm, + (krb5_context, + char * const * ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_get_realm_domain, + (krb5_context, + const char *, + char ** ) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_auth_con_genaddrs, + (krb5_context, + krb5_auth_context, + int, int) + ); + +/* ------------------------------------------------------------------------- */ + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_string_to_enctype, + (char *, krb5_enctype *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_string_to_salttype, + (char *, krb5_int32 *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_string_to_cksumtype, + (char *, krb5_cksumtype *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_string_to_timestamp, + (char *, krb5_timestamp *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_string_to_deltat, + (char *, krb5_deltat *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_enctype_to_string, + (krb5_enctype, char *, size_t) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_salttype_to_string, + (krb5_int32, char *, size_t) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_cksumtype_to_string, + (krb5_cksumtype, char *, size_t) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_timestamp_to_string, + (krb5_timestamp, char *, size_t) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_timestamp_to_sfstring, + (krb5_timestamp, char *, size_t, char *) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_deltat_to_string, + (krb5_deltat, char *, size_t) + ); + +/* ------------------------------------------------------------------------- */ + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_prompter_posix, + (krb5_context context, + void *data, + const char *name, + const char *banner, + int num_prompts, + krb5_prompt prompts[]) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_get_init_creds_opt_init, + (krb5_get_init_creds_opt *opt) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_get_init_creds_opt_set_tkt_life, + (krb5_get_init_creds_opt *opt, + krb5_deltat tkt_life) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_get_init_creds_opt_set_renew_life, + (krb5_get_init_creds_opt *opt, + krb5_deltat renew_life) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_get_init_creds_opt_set_forwardable, + (krb5_get_init_creds_opt *opt, + int forwardable) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_get_init_creds_opt_set_proxiable, + (krb5_get_init_creds_opt *opt, + int proxiable) + ); + + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_get_init_creds_opt_set_etype_list, + (krb5_get_init_creds_opt *opt, + krb5_enctype *etype_list, + int etype_list_length) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_get_init_creds_opt_set_address_list, + (krb5_get_init_creds_opt *opt, + krb5_address **addresses) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_get_init_creds_opt_set_preauth_list, + (krb5_get_init_creds_opt *opt, + krb5_preauthtype *preauth_list, + int preauth_list_length) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_get_init_creds_opt_set_salt, + (krb5_get_init_creds_opt *opt, + krb5_data *salt) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_get_init_creds_password, + (krb5_context context, + krb5_creds *creds, + krb5_principal client, + char *password, + krb5_prompter_fct prompter, + void *data, + krb5_deltat start_time, + char *in_tkt_service, + krb5_get_init_creds_opt *options) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_get_init_creds_keytab, + (krb5_context context, + krb5_creds *creds, + krb5_principal client, + krb5_keytab arg_keytab, + krb5_deltat start_time, + char *in_tkt_service, + krb5_get_init_creds_opt *options) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_verify_init_creds_opt_init, + (krb5_verify_init_creds_opt *options) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_verify_init_creds_opt_set_ap_req_nofail, + (krb5_verify_init_creds_opt *options, + int ap_req_nofail) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_verify_init_creds, + (krb5_context context, + krb5_creds *creds, + krb5_principal ap_req_server, + krb5_keytab ap_req_keytab, + krb5_ccache *ccache, + krb5_verify_init_creds_opt *options) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_get_validated_creds, + (krb5_context context, + krb5_creds *creds, + krb5_principal client, + krb5_ccache ccache, + char *in_tkt_service) + ); + + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_get_renewed_creds, + (krb5_context context, + krb5_creds *creds, + krb5_principal client, + krb5_ccache ccache, + char *in_tkt_service) + ); + +/* ------------------------------------------------------------------------- */ + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_realm_iterator_create, + (krb5_context context, void **iter_p) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_realm_iterator, + (krb5_context context, void **iter_p, char **ret_realm) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_realm_iterator_free, + (krb5_context context, void **iter_p) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + krb5_free_realm_string, + (krb5_context context, char *str) + ); + +TYPEDEF_FUNC( + krb5_prompt_type*, + KRB5_CALLCONV, + krb5_get_prompt_types, + (krb5_context context) + ); + +/* NOT IN krb5.h HEADER: */ + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_decode_ticket, + (const krb5_data *code, krb5_ticket **rep) + ); + +/* --- more --- */ + +TYPEDEF_FUNC( + char *, + KRB5_CALLCONV, + krb5_cc_get_name, + (krb5_context context, krb5_ccache cache) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_cc_gen_new, + (krb5_context context, krb5_ccache *cache) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_cc_initialize, + (krb5_context context, krb5_ccache cache, krb5_principal principal) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_cc_destroy, + (krb5_context context, krb5_ccache cache) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_cc_close, + (krb5_context context, krb5_ccache cache) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_cc_store_cred, + (krb5_context context, krb5_ccache cache, krb5_creds *creds) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_cc_retrieve_cred, + (krb5_context context, krb5_ccache cache, + krb5_flags flags, krb5_creds *mcreds, + krb5_creds *creds) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_cc_get_principal, + (krb5_context context, krb5_ccache cache, krb5_principal *principal) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_cc_start_seq_get, + (krb5_context context, krb5_ccache cache, krb5_cc_cursor *cursor) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_cc_next_cred, + (krb5_context context, krb5_ccache cache, krb5_cc_cursor *cursor, + krb5_creds *creds) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_cc_end_seq_get, + (krb5_context context, krb5_ccache cache, krb5_cc_cursor *cursor) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_cc_remove_cred, + (krb5_context context, krb5_ccache cache, krb5_flags flags, + krb5_creds *creds) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_cc_set_flags, + (krb5_context context, krb5_ccache cache, krb5_flags flags) + ); + +TYPEDEF_FUNC( + const char *, + KRB5_CALLCONV, + krb5_cc_get_type, + (krb5_context context, krb5_ccache cache) + ); + +TYPEDEF_FUNC( + char *, + KRB5_CALLCONV, + krb5_kt_get_type, + (krb5_context, krb5_keytab keytab) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_kt_get_name, + (krb5_context context, krb5_keytab keytab, char *name, + unsigned int namelen) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_kt_close, + (krb5_context context, krb5_keytab keytab) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_kt_get_entry, + (krb5_context context, krb5_keytab keytab, + krb5_const_principal principal, krb5_kvno vno, + krb5_enctype enctype, krb5_keytab_entry *entry) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_kt_start_seq_get, + (krb5_context context, krb5_keytab keytab, krb5_kt_cursor *cursor) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_kt_next_entry, + (krb5_context context, krb5_keytab keytab, + krb5_keytab_entry *entry, krb5_kt_cursor *cursor) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_kt_end_seq_get, + (krb5_context context, krb5_keytab keytab, krb5_kt_cursor *cursor) + ); + +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_locate_kdc, + (krb5_context context, const krb5_data *realm, + struct addrlist *addrlist, + int get_masters, int socktype, int family) + ); +#endif /* __LOADFUNCS_KRB5_H__ */ diff --git a/src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb524.h b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb524.h new file mode 100644 index 000000000..18f427414 --- /dev/null +++ b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb524.h @@ -0,0 +1,23 @@ +#ifndef __LOADFUNCS_KRB524_H__ +#define __LOADFUNCS_KRB524_H__ + +#include "loadfuncs.h" +#include +#include + +#define KRB524_DLL "krb524.dll" + +TYPEDEF_FUNC( + int, + KRB5_CALLCONV_C, + krb524_init_ets, + (krb5_context context) + ); +TYPEDEF_FUNC( + int, + KRB5_CALLCONV_C, + krb524_convert_creds_kdc, + (krb5_context context, krb5_creds *v5creds, + CREDENTIALS *v4creds) + ); +#endif /* __LOADFUNCS_KRB524_H__ */ diff --git a/src/WINNT/kfw/inc/loadfuncs/loadfuncs-leash.h b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-leash.h new file mode 100644 index 000000000..4222245d8 --- /dev/null +++ b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-leash.h @@ -0,0 +1,373 @@ +#ifndef __LOADFUNCS_LEASH_H__ +#define __LOADFUNCS_LEASH_H__ + +#include "loadfuncs.h" +#include + +#define LEASH_DLL "leashw32.dll" + +#define CALLCONV_C + +TYPEDEF_FUNC( + int, + CALLCONV_C, + Leash_kinit_dlg, + (HWND, LPLSH_DLGINFO) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + Leash_kinit_dlg_ex, + (HWND, LPLSH_DLGINFO_EX) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + Leash_changepwd_dlg, + (HWND, LPLSH_DLGINFO) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + Leash_changepwd_dlg_ex, + (HWND, LPLSH_DLGINFO_EX) + ); +TYPEDEF_FUNC( + long, + CALLCONV_C, + Leash_checkpwd, + (char *, char *) + ); +TYPEDEF_FUNC( + long, + CALLCONV_C, + Leash_changepwd, + (char *, char *, char*, char*) + ); +TYPEDEF_FUNC( + long, + CALLCONV_C, + Leash_kinit, + (char *, char *, int) + ); +TYPEDEF_FUNC( + long, + CALLCONV_C, + Leash_kinit_ex, + (char *, char *, int,int, int, int, int, unsigned long) + ); +TYPEDEF_FUNC( + long, + CALLCONV_C, + Leash_klist, + (HWND, TICKETINFO*) + ); +TYPEDEF_FUNC( + long, + CALLCONV_C, + Leash_kdestroy, + (void) + ); +TYPEDEF_FUNC( + long, + CALLCONV_C, + Leash_get_lsh_errno, + (LONG *) + ); +TYPEDEF_FUNC( + BOOL, + CALLCONV_C, + Leash_set_help_file, + (char *) + ); +TYPEDEF_FUNC( + char *, + CALLCONV_C, + Leash_get_help_file, + (void) + ); +TYPEDEF_FUNC( + long, + CALLCONV_C, + Leash_timesync, + (int) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_get_default_lifetime, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_set_default_lifetime, + (DWORD) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_reset_default_lifetime, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_get_default_renew_till, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_set_default_renew_till, + (DWORD) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_reset_default_renew_till, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_get_default_forwardable, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_set_default_forwardable, + (DWORD) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_reset_default_forwardable, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_get_default_noaddresses, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_set_default_noaddresses, + (DWORD) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_reset_default_noaddresses, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_get_default_proxiable, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_set_default_proxiable, + (DWORD) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_reset_default_proxiable, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_get_default_publicip, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_set_default_publicip, + (DWORD) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_reset_default_publicip, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_get_default_use_krb4, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_set_default_use_krb4, + (DWORD) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_reset_default_use_krb4, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_get_default_life_min, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_set_default_life_min, + (DWORD) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_reset_default_life_min, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_get_default_life_max, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_set_default_life_max, + (DWORD) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_reset_default_life_max, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_get_default_renew_min, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_set_default_renew_min, + (DWORD) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_reset_default_renew_min, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_get_default_renew_max, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_set_default_renew_max, + (DWORD) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_reset_default_renew_max, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_get_default_renewable, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_set_default_renewable, + (DWORD) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_reset_default_renewable, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_get_lock_file_locations, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_set_lock_file_locations, + (DWORD) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_reset_lock_file_locations, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_get_default_uppercaserealm, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_set_default_uppercaserealm, + (DWORD) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_reset_default_uppercaserealm, + (void) + ); +TYPEDEF_FUNC( + BOOL, + CALLCONV_C, + Leash_import, + (void) + ); +TYPEDEF_FUNC( + long, + CALLCONV_C, + Leash_importable, + (void) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + Leash_renew, + (void) + ); +TYPEDEF_FUNC( + void, + CALLCONV_C, + Leash_reset_defaults, + (void) + ); +/* They are not yet all here... */ + +#endif /* __LOADFUNCS_LEASH_H__ */ diff --git a/src/WINNT/kfw/inc/loadfuncs/loadfuncs-lsa.h b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-lsa.h new file mode 100644 index 000000000..0393edf73 --- /dev/null +++ b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-lsa.h @@ -0,0 +1,45 @@ +#ifndef __LOADFUNCS_LSA_H__ +#define __LOADFUNCS_LSA_H__ + +#include "loadfuncs.h" + +#define SECUR32_DLL "secur32.dll" +#define ADVAPI32_DLL "advapi32.dll" + +TYPEDEF_FUNC( + NTSTATUS, + NTAPI, + LsaConnectUntrusted, + (PHANDLE) + ); +TYPEDEF_FUNC( + NTSTATUS, + NTAPI, + LsaLookupAuthenticationPackage, + (HANDLE, PLSA_STRING, PULONG) + ); +TYPEDEF_FUNC( + NTSTATUS, + NTAPI, + LsaCallAuthenticationPackage, + (HANDLE, ULONG, PVOID, ULONG, PVOID *, PULONG, PNTSTATUS) + ); +TYPEDEF_FUNC( + NTSTATUS, + NTAPI, + LsaFreeReturnBuffer, + (PVOID) + ); +TYPEDEF_FUNC( + ULONG, + NTAPI, + LsaNtStatusToWinError, + (NTSTATUS) + ); +TYPEDEF_FUNC( + ULONG, + NTAPI, + LsaGetLogonSessionData, + (PLUID, PSECURITY_LOGON_SESSION_DATA*) + ); +#endif /* __LOADFUNCS_LSA_H__ */ diff --git a/src/WINNT/kfw/inc/loadfuncs/loadfuncs-profile.h b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-profile.h new file mode 100644 index 000000000..d7c21655b --- /dev/null +++ b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-profile.h @@ -0,0 +1,147 @@ +#ifndef __LOADFUNCS_PROFILE_H__ +#define __LOADFUNCS_PROFILE_H__ + +#include "loadfuncs.h" +#include + +#define PROFILE_DLL "xpprof32.dll" + +TYPEDEF_FUNC( + long, + KRB5_CALLCONV, + profile_init, + (const_profile_filespec_t *files, profile_t *ret_profile) + ); + +TYPEDEF_FUNC( + long, + KRB5_CALLCONV, + profile_init_path, + (const_profile_filespec_list_t filelist, profile_t *ret_profile) + ); + +TYPEDEF_FUNC( + long, + KRB5_CALLCONV, + profile_flush, + (profile_t profile) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + profile_abandon, + (profile_t profile) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + profile_release, + (profile_t profile) + ); + +TYPEDEF_FUNC( + long, + KRB5_CALLCONV, + profile_get_values, + (profile_t profile, const char **names, char ***ret_values) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + profile_free_list, + (char **list) + ); + +TYPEDEF_FUNC( + long, + KRB5_CALLCONV, + profile_get_string, + (profile_t profile, const char *name, const char *subname, + const char *subsubname, const char *def_val, + char **ret_string) + ); + +TYPEDEF_FUNC( + long, + KRB5_CALLCONV, + profile_get_integer, + (profile_t profile, const char *name, const char *subname, + const char *subsubname, int def_val, + int *ret_default) + ); + +TYPEDEF_FUNC( + long, + KRB5_CALLCONV, + profile_get_relation_names, + (profile_t profile, const char **names, char ***ret_names) + ); + +TYPEDEF_FUNC( + long, + KRB5_CALLCONV, + profile_get_subsection_names, + (profile_t profile, const char **names, char ***ret_names) + ); + +TYPEDEF_FUNC( + long, + KRB5_CALLCONV, + profile_iterator_create, + (profile_t profile, const char **names, int flags, void **ret_iter) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + profile_iterator_free, + (void **iter_p) + ); + +TYPEDEF_FUNC( + long, + KRB5_CALLCONV, + profile_iterator, + (void **iter_p, char **ret_name, char **ret_value) + ); + +TYPEDEF_FUNC( + void, + KRB5_CALLCONV, + profile_release_string, + (char *str) + ); + +TYPEDEF_FUNC( + long, + KRB5_CALLCONV, + profile_update_relation, + (profile_t profile, const char **names, const char *old_value, const char *new_value) + ); + +TYPEDEF_FUNC( + long, + KRB5_CALLCONV, + profile_clear_relation, + (profile_t profile, const char **names) + ); + +TYPEDEF_FUNC( + long, + KRB5_CALLCONV, + profile_rename_section, + (profile_t profile, const char **names, const char *new_name) + ); + +TYPEDEF_FUNC( + long, + KRB5_CALLCONV, + profile_add_relation, + (profile_t profile, const char **names, const char *new_value) + ); + + +#endif /* __LOADFUNCS_PROFILE_H__ */ diff --git a/src/WINNT/kfw/inc/loadfuncs/loadfuncs-wshelper.h b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-wshelper.h new file mode 100644 index 000000000..35780c588 --- /dev/null +++ b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-wshelper.h @@ -0,0 +1,232 @@ +#ifndef __LOADFUNCS_WSHELPER_H__ +#define __LOADFUNCS_WSHELPER_H__ + +#include +#include + +#define WSHELPER_DLL "wshelp32.dll" +#define CALLCONV_C + +TYPEDEF_FUNC( + struct hostent *, + WINAPI, + rgethostbyname, + (char *name) + ); + +TYPEDEF_FUNC( + struct hostent *, + WINAPI, + rgethostbyaddr, + (char* addr, int len, int type) + ); + +TYPEDEF_FUNC( + struct servent, + WINAPI, + rgetservbyname, + (LPSTR name, LPSTR proto) + ); + +TYPEDEF_FUNC( + LPSTR, + WINAPI, + gethinfobyname, + (LPSTR name) + ); + +TYPEDEF_FUNC( + LPSTR, + WINAPI, + getmxbyname, + (LPSTR name) + ); + +TYPEDEF_FUNC( + LPSTR, + WINAPI, + getrecordbyname, + (LPSTR name, int rectype) + ); + +TYPEDEF_FUNC( + DWORD, + WINAPI, + rrhost, + (LPSTR lpHost) + ); + +TYPEDEF_FUNC( + unsigned long, + WINAPI, + inet_aton, + (const char* cp, struct in_addr *addr) + ); + +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + WhichOS, + (DWORD * check) + ); + +TYPEDEF_FUNC( + int, + WINAPI, + wsh_gethostname, + (char* name, int size) + ); + +TYPEDEF_FUNC( + int, + WINAPI, + wsh_getdomainname, + (char* name, int size) + ); + +TYPEDEF_FUNC( + LONG, + CALLCONV_C, + WSHGetHostID, + () + ); + +TYPEDEF_FUNC( + int, + WINAPI, + res_init, + () + ); + +TYPEDEF_FUNC( + void, + WINAPI, + res_setopts, + (long opts) + ); + +TYPEDEF_FUNC( + long, + WINAPI, + res_getopts, + (void) + ); + +TYPEDEF_FUNC( + int, + WINAPI, + res_mkquery, + (int op, const char FAR *dname, + int qclass, int type, + const char FAR *data, int datalen, + const struct rrec FAR *newrr, + char FAR *buf, int buflen) + ); + +TYPEDEF_FUNC( + int, + WINAPI, + res_send, + (const char FAR *msg, int msglen, + char FAR *answer, int anslen) + ); + +TYPEDEF_FUNC( + int, + WINAPI, + res_querydomain, + (const char FAR *name, + const char FAR *domain, + int qclass, int type, + u_char FAR *answer, int anslen) + ); + +TYPEDEF_FUNC( + int, + WINAPI, + res_search, + (const char FAR *name, + int qclass, int type, + u_char FAR *answer, int anslen) + ); + +TYPEDEF_FUNC( + int, + WINAPI, + dn_comp, + (const u_char FAR *exp_dn, + u_char FAR *comp_dn, + int length, u_char FAR * FAR *dnptrs, + u_char FAR * FAR *lastdnptr) + ); + +TYPEDEF_FUNC( + int, + WINAPI, + rdn_expand, + (const u_char FAR *msg, + const u_char FAR *eomorig, + const u_char FAR *comp_dn, + u_char FAR *exp_dn, + int length) + ); + +TYPEDEF_FUNC( + LPSTR, + WINAPI, + hes_to_bind, + ( + LPSTR HesiodName, + LPSTR HesiodNameType + ) + ); + +TYPEDEF_FUNC( + LPSTR *, + WINAPI, + hes_resolve, + ( + LPSTR HesiodName, + LPSTR HesiodNameType + ) + ); + +TYPEDEF_FUNC( + int, + WINAPI, + hes_error, + ( + void + ) + ); + +TYPEDEF_FUNC( + struct hes_postoffice *, + WINAPI, + hes_getmailhost, + (LPSTR user) + ); + +TYPEDEF_FUNC( + struct servent *, + WINAPI, + hes_getservbyname, + (LPSTR name, + LPSTR proto) + ); + +TYPEDEF_FUNC( + struct passwd *, + WINAPI, + hes_getpwnam, + (LPSTR nam) + ); + +TYPEDEF_FUNC( + struct passwd *, + WINAPI, + hes_getpwuid, + (int uid) + ); + +#endif /* __LOADFUNCS_WSHELPER_H__ */ diff --git a/src/WINNT/kfw/inc/loadfuncs/loadfuncs.c b/src/WINNT/kfw/inc/loadfuncs/loadfuncs.c new file mode 100644 index 000000000..46cacfd9f --- /dev/null +++ b/src/WINNT/kfw/inc/loadfuncs/loadfuncs.c @@ -0,0 +1,88 @@ +#define WIN32_LEAN_AND_MEAN +#include +#include "loadfuncs.h" + +// +// UnloadFuncs: +// +// This function will reset all the function pointers of a function loaded +// by LaodFuncs and will free the DLL instance provided. +// + +void +UnloadFuncs( + FUNC_INFO fi[], + HINSTANCE h + ) +{ + int n; + if (fi) + for (n = 0; fi[n].func_ptr_var; n++) + *(fi[n].func_ptr_var) = 0; + if (h) FreeLibrary(h); +} + + +// +// LoadFuncs: +// +// This function try to load the functions for a DLL. It returns 0 on failure +// and non-zero on success. The parameters are descibed below. +// + +int +LoadFuncs( + const char* dll_name, + FUNC_INFO fi[], + HINSTANCE* ph, // [out, optional] - DLL handle + int* pindex, // [out, optional] - index of last func loaded (-1 if none) + int cleanup, // cleanup function pointers and unload on error + int go_on, // continue loading even if some functions cannot be loaded + int silent // do not pop-up a system dialog if DLL cannot be loaded + + ) +{ + HINSTANCE h; + int i, n, last_i; + int error = 0; + UINT em; + + if (ph) *ph = 0; + if (pindex) *pindex = -1; + + for (n = 0; fi[n].func_ptr_var; n++) + *(fi[n].func_ptr_var) = 0; + + if (silent) + em = SetErrorMode(SEM_FAILCRITICALERRORS); + h = LoadLibrary(dll_name); + if (silent) + SetErrorMode(em); + + if (!h) + return 0; + + last_i = -1; + for (i = 0; (go_on || !error) && (i < n); i++) + { + void* p = (void*)GetProcAddress(h, fi[i].func_name); + if (!p) + error = 1; + else + { + last_i = i; + *(fi[i].func_ptr_var) = p; + } + } + if (pindex) *pindex = last_i; + if (error && cleanup && !go_on) { + for (i = 0; i < n; i++) { + *(fi[i].func_ptr_var) = 0; + } + FreeLibrary(h); + return 0; + } + if (ph) *ph = h; + if (error) return 0; + return 1; +} diff --git a/src/WINNT/kfw/inc/loadfuncs/loadfuncs.h b/src/WINNT/kfw/inc/loadfuncs/loadfuncs.h new file mode 100644 index 000000000..e56b5337e --- /dev/null +++ b/src/WINNT/kfw/inc/loadfuncs/loadfuncs.h @@ -0,0 +1,41 @@ +#ifndef __LOADFUNCS_H__ +#define __LOADFUNCS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef struct _FUNC_INFO { + void** func_ptr_var; + char* func_name; +} FUNC_INFO; + +#define DECL_FUNC_PTR(x) FP_##x p##x +#define MAKE_FUNC_INFO(x) { (void**) &p##x, #x } +#define END_FUNC_INFO { 0, 0 } +#define TYPEDEF_FUNC(ret, call, name, args) typedef ret (call *FP_##name) args + +void +UnloadFuncs( + FUNC_INFO fi[], + HINSTANCE h + ); + +int +LoadFuncs( + const char* dll_name, + FUNC_INFO fi[], + HINSTANCE* ph, // [out, optional] - DLL handle + int* pindex, // [out, optional] - index of last func loaded (-1 if none) + int cleanup, // cleanup function pointers and unload on error + int go_on, // continue loading even if some functions cannot be loaded + int silent // do not pop-up a system dialog if DLL cannot be loaded + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __LOADFUNCS_H__ */ diff --git a/src/WINNT/kfw/inc/wshelper/arpa/nameser.h b/src/WINNT/kfw/inc/wshelper/arpa/nameser.h new file mode 100644 index 000000000..4dba1baeb --- /dev/null +++ b/src/WINNT/kfw/inc/wshelper/arpa/nameser.h @@ -0,0 +1,263 @@ +/* + * @doc + * @module nameser.h | + * Copyright (c) 1983, 1989 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)nameser.h 5.25 (Berkeley) 4/3/91 + */ + +#ifndef _NAMESER_H_ +#define _NAMESER_H_ + +/* + * Define constants based on rfc883 + */ +#define PACKETSZ 512 /* maximum packet size */ +#define MAXDNAME 256 /* maximum domain name */ +#define MAXCDNAME 255 /* maximum compressed domain name */ +#define MAXLABEL 63 /* maximum length of domain label */ + /* Number of bytes of fixed size data in query structure */ +#define QFIXEDSZ 4 + /* number of bytes of fixed size data in resource record */ +#define RRFIXEDSZ 10 + +#if !defined(MAXHOSTNAME) +#define MAXHOSTNAME MAXCDNAME +#endif + +/* + * Internet nameserver port number + */ +#define NAMESERVER_PORT 53 + +/* + * Currently defined opcodes + */ +#define QUERY 0x0 /* standard query */ +#define IQUERY 0x1 /* inverse query */ +#define STATUS 0x2 /* nameserver status query */ +/*#define xxx 0x3 /* 0x3 reserved */ + /* non standard */ +#define UPDATEA 0x9 /* add resource record */ +#define UPDATED 0xa /* delete a specific resource record */ +#define UPDATEDA 0xb /* delete all nemed resource record */ +#define UPDATEM 0xc /* modify a specific resource record */ +#define UPDATEMA 0xd /* modify all named resource record */ + +#define ZONEINIT 0xe /* initial zone transfer */ +#define ZONEREF 0xf /* incremental zone referesh */ + +/* + * Currently defined response codes + */ +#define NOERROR 0 /* no error */ +#define FORMERR 1 /* format error */ +#define SERVFAIL 2 /* server failure */ +#define NXDOMAIN 3 /* non existent domain */ +#define NOTIMP 4 /* not implemented */ +#define REFUSED 5 /* query refused */ + /* non standard */ +#define NOCHANGE 0xf /* update failed to change db */ + +/* + * Type values for resources and queries + */ +#define T_A 1 /* host address */ +#define T_NS 2 /* authoritative server */ +#define T_MD 3 /* mail destination */ +#define T_MF 4 /* mail forwarder */ +#define T_CNAME 5 /* connonical name */ +#define T_SOA 6 /* start of authority zone */ +#define T_MB 7 /* mailbox domain name */ +#define T_MG 8 /* mail group member */ +#define T_MR 9 /* mail rename name */ +#define T_NULL 10 /* null resource record */ +#define T_WKS 11 /* well known service */ +#define T_PTR 12 /* domain name pointer */ +#define T_HINFO 13 /* host information */ +#define T_MINFO 14 /* mailbox information */ +#define T_MX 15 /* mail routing information */ +#define T_TXT 16 /* text strings */ + /* non standard */ +#define T_UINFO 100 /* user (finger) information */ +#define T_UID 101 /* user ID */ +#define T_GID 102 /* group ID */ +#define T_UNSPEC 103 /* Unspecified format (binary data) */ + /* Query type values which do not appear in resource records */ +#define T_AXFR 252 /* transfer zone of authority */ +#define T_MAILB 253 /* transfer mailbox records */ +#define T_MAILA 254 /* transfer mail agent records */ +#define T_ANY 255 /* wildcard match */ + +/* + * Values for class field + */ + +#define C_IN 1 /* the arpa internet */ +#define C_CHAOS 3 /* for chaos net at MIT */ +#define C_HS 4 /* for Hesiod name server at MIT */ + /* Query class values which do not appear in resource records */ +#define C_ANY 255 /* wildcard match */ + +/* + * Status return codes for T_UNSPEC conversion routines + */ +#define CONV_SUCCESS 0 +#define CONV_OVERFLOW -1 +#define CONV_BADFMT -2 +#define CONV_BADCKSUM -3 +#define CONV_BADBUFLEN -4 + +#ifndef BYTE_ORDER +#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */ +#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */ + +#if defined(vax) || defined(ns32000) || defined(sun386) || defined(MIPSEL) || \ + defined(BIT_ZERO_ON_RIGHT) +#define BYTE_ORDER LITTLE_ENDIAN + +#endif +#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \ + defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \ + defined(MIPSEB) || defined (BIT_ZERO_ON_LEFT) +#define BYTE_ORDER BIG_ENDIAN +#endif +#endif /* BYTE_ORDER */ + +#ifndef BYTE_ORDER + /* you must determine what the correct bit order is for your compiler */ + #define BYTE_ORDER LITTLE_ENDIAN /* for Intel x86 series */ +#endif +/* + * Structure for query header, the order of the fields is machine and + * compiler dependent, in our case, the bits within a byte are assignd + * least significant first, while the order of transmition is most + * significant first. This requires a somewhat confusing rearrangement. + */ + +#if defined (_WINDLL) || (_WIN32) +/* define UNIX types */ +#include +#endif + +typedef struct { + u_short id; /* query identification number */ +#if BYTE_ORDER == BIG_ENDIAN + /* fields in third byte */ + u_char qr:1; /* response flag */ + u_char opcode:4; /* purpose of message */ + u_char aa:1; /* authoritive answer */ + u_char tc:1; /* truncated message */ + u_char rd:1; /* recursion desired */ + /* fields in fourth byte */ + u_char ra:1; /* recursion available */ + u_char pr:1; /* primary server required (non standard) */ + u_char unused:2; /* unused bits */ + u_char rcode:4; /* response code */ +#endif +#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN + /* fields in third byte */ + u_char rd:1; /* recursion desired */ + u_char tc:1; /* truncated message */ + u_char aa:1; /* authoritive answer */ + u_char opcode:4; /* purpose of message */ + u_char qr:1; /* response flag */ + /* fields in fourth byte */ + u_char rcode:4; /* response code */ + u_char unused:2; /* unused bits */ + u_char pr:1; /* primary server required (non standard) */ + u_char ra:1; /* recursion available */ +#endif + /* remaining bytes */ + u_short qdcount; /* number of question entries */ + u_short ancount; /* number of answer entries */ + u_short nscount; /* number of authority entries */ + u_short arcount; /* number of resource entries */ +} HEADER; + +/* + * Defines for handling compressed domain names + */ +#define INDIR_MASK 0xc0 + +/* + * Structure for passing resource records around. + */ +struct rrec { + short r_zone; /* zone number */ + short r_class; /* class number */ + short r_type; /* type number */ + u_long r_ttl; /* time to live */ + int r_size; /* size of data area */ + char *r_data; /* pointer to data */ +}; + +extern u_short _getshort(); +extern u_long _getlong(); + +/* + * Inline versions of get/put short/long. + * Pointer is advanced; we assume that both arguments + * are lvalues and will already be in registers. + * cp MUST be u_char *. + */ +#define GETSHORT(s, cp) { \ + (s) = *(cp)++ << 8; \ + (s) |= *(cp)++; \ +} + +#define GETLONG(l, cp) { \ + (l) = *(cp)++ << 8; \ + (l) |= *(cp)++; (l) <<= 8; \ + (l) |= *(cp)++; (l) <<= 8; \ + (l) |= *(cp)++; \ +} + + +#define PUTSHORT(s, cp) { \ + *(cp)++ = (s) >> 8; \ + *(cp)++ = (s); \ +} + +/* + * Warning: PUTLONG destroys its first argument. + */ +#define PUTLONG(l, cp) { \ + (cp)[3] = l; \ + (cp)[2] = (l >>= 8); \ + (cp)[1] = (l >>= 8); \ + (cp)[0] = l >> 8; \ + (cp) += sizeof(u_long); \ +} + +#endif /* !_NAMESER_H_ */ diff --git a/src/WINNT/kfw/inc/wshelper/hesiod.h b/src/WINNT/kfw/inc/wshelper/hesiod.h new file mode 100644 index 000000000..4de160fd6 --- /dev/null +++ b/src/WINNT/kfw/inc/wshelper/hesiod.h @@ -0,0 +1,125 @@ +/* This file contains definitions for use by the Hesiod name service and + * applications. + * + * @doc + * + * @module hesiod.h | + * For copying and distribution information, see the file + * mit-copyright.h . + * + * Original version by Steve Dyer, IBM/Project Athena. + * + */ + +/* Configuration information. */ + +#ifndef _HESIOD_ +#define _HESIOD_ + +#if defined(_WINDOWS) || defined(_WIN32) +#include +#endif + +#if defined(_WINDOWS) || defined(_WIN32) +#define HESIOD_CONF "c:\\net\\tcp\\hesiod.cfg" +#else +#define HESIOD_CONF "/etc/hesiod.conf" /* Configuration file. */ +#endif + +#define DEF_RHS ".Athena.MIT.EDU" /* Defaults if HESIOD_CONF */ +#define DEF_LHS ".ns" /* file is not present. */ + +/* @doc ERROR +/* Error codes. */ +/* + +@type HES_ER_UNINIT | -1 uninitialized +@type HES_ER_OK | 0 no error +@type HES_ER_NOTFOUND | 1 Hesiod name not found by server +@type HES_ER_CONFIG | 2 local problem (no config file?) +@type HES_ER_NET | 3 network problem + + */ + +#define HES_ER_UNINIT -1 /* uninitialized */ +#define HES_ER_OK 0 /* no error */ +#define HES_ER_NOTFOUND 1 /* Hesiod name not found by server */ +#define HES_ER_CONFIG 2 /* local problem (no config file?) */ +#define HES_ER_NET 3 /* network problem */ + +/* Declaration of routines */ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_WINDOWS) || defined(_WIN32) + +LPSTR WINAPI +hes_to_bind( + LPSTR HesiodName, + LPSTR HesiodNameType + ); + +LPSTR * WINAPI +hes_resolve( + LPSTR HesiodName, + LPSTR HesiodNameType + ); + +int WINAPI +hes_error( + void + ); + +#else +char *hes_to_bind(const char *name, const char *type); +char **hes_resolve(const char *name, const char *type); +int hes_error(void); +#endif /* WINDOWS */ + + +/* + * @doc + * + * @struct hes_postoffice | For use in getting post-office information. + * + * @field LPSTR | po_type | The post office type, e.g. POP, IMAP + * @field LPSTR | po_host | The post office host, e.g. PO10.MIT.EDU + * @field LPSTR | po_name | The account name on the post office, e.g. tom + * + */ +#if defined(_WINDOWS) || defined(_WIN32) +struct hes_postoffice { + LPSTR po_type; + LPSTR po_host; + LPSTR po_name; +}; +#else +struct hes_postoffice { + char *po_type; + char *po_host; + char *po_name; +}; +#endif + +/* Other routines */ + +#if defined(_WINDOWS) || defined(_WIN32) +struct hes_postoffice FAR * WINAPI hes_getmailhost(LPSTR user); +struct servent FAR * WINAPI hes_getservbyname(LPSTR name, + LPSTR proto); +struct passwd FAR * WINAPI hes_getpwnam(LPSTR nam); +struct passwd FAR * WINAPI hes_getpwuid(int uid); +#else +struct hes_postoffice *hes_getmailhost(); +struct servent *hes_getservbyname(); +struct passwd *hes_getpwnam(); +struct passwd *hes_getpwuid(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _HESIOD_ */ diff --git a/src/WINNT/kfw/inc/wshelper/mitwhich.h b/src/WINNT/kfw/inc/wshelper/mitwhich.h new file mode 100644 index 000000000..c6b7f057d --- /dev/null +++ b/src/WINNT/kfw/inc/wshelper/mitwhich.h @@ -0,0 +1,156 @@ +/* + +@doc + +@module mitwhich.h | + +some defines so that we can figure out which MS OS and subsystem an +application is running under. Also support for finding out which +TCP/IP stack is being used. This is useful when you need to find out +about the domain or the nameservers. + + */ + +#if !defined( __MIT_WHICH_H ) +#define __MIT_WHICH_H + +// these should become resources and loaded at run time +#define NT_32 "Winsock 2.0" +#define NT_16 "Windows NT 16-bit Windows Sockets" +#define W95_32 "Microsoft Windows Sockets Version 1.1." +#define W95_16 "Microsoft Windows Sockets Version 1.1." +#define LWP_16 "Novell Winsock version 1.1" +// Note that these are currently in wshelper.h and should be somewhere else +#define MS_NT_32 1 +#define MS_NT_16 2 +#define MS_95_32 3 +#define MS_95_16 4 +#define NOVELL_LWP_16 5 + +#define MS_OS_WIN 1 +#define MS_OS_95 2 +#define MS_OS_NT 4 +#define MS_OS_2000 12 +#define MS_OS_XP 28 +#define MS_OS_2003 60 +#define MS_OS_NT_UNKNOWN 124 +#define MS_OS_UNKNOWN 0 + +#define STACK_UNKNOWN 0 +#define UNKNOWN_16_UNDER_32 -2 +#define UNKNOWN_16_UNDER_16 -3 +#define UNKNOWN_32_UNDER_32 -4 +#define UNKNOWN_32_UNDER_16 -5 + + +/* + @comm these are the current MIT DNS servers, the wshelper and + wshelp32 DLLs will do their best to find the correct DNS servers + for the local machine however, if all else fails these will be used + as a last resort. Site administrators outside of the MIT domain + should change these defaults to their own defaults either by + editing this file and recompiling or by editing the string tables + of the binaries. Don't use App Studio to edit the .RC files. + + #define DNS1 "18.70.0.160" + #define DNS2 "18.71.0.151" + #define DNS3 "18.72.0.3" + + #define DEFAULT_DOMAIN "mit.edu" +*/ + +#define DNS1 "18.70.0.160" +#define DNS2 "18.71.0.151" +#define DNS3 "18.72.0.3" + +#define DEFAULT_DOMAIN "mit.edu" + + +#ifndef _PATH_RESCONF +#if !defined(WINDOWS) && !defined(_WINDOWS) && !defined(_WIN32) +#define _PATH_RESCONF "/etc/resolv.conf" +#else +#define _PATH_RESCONF "c:/net/tcp/resolv.cfg" +#endif +#endif + + +/* Microsoft TCP/IP registry values that we care about */ +#define NT_TCP_PATH "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters" +#define NT_TCP_PATH_TRANS "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Transient" +#define W95_TCP_PATH "SYSTEM\\CurrentControlSet\\Services\\VxD\\MSTCP" + +#define NT_DOMAIN_KEY "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Domain" +#define NT_NS_KEY "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\NameServer" + +#define W95_DOMAIN_KEY "SYSTEM\\CurrentControlSet\\Services\\VxD\\MSTCP\\Domain" +#define W95_NS_KEY "SYSTEM\\CurrentControlSet\\Services\\VxD\\MSTCP\\NameServer" + +/* + + @comm Notes on different Winsock stack configuration files. + + The Microsoft stacks for Windows95 and NT 3.x, 4.x use the registry + to store the default domain and the IP addresses of the DNS + servers. The wshelper and wshelp32 will use the registry information + when possible. + + Novell's LAN WorkPlace stack and the much older Excelan products use + a resolv.cfg file to store this information. The resolv.cfg file + could be located in a number of places over the years. Our DLL will + try to search for it in: + + C:\etc\resolv.cfg + C:\excelan\tcp\resolv.cfg + C:\net\tcp\resolv.cfg + %NDIR%\etc\resolv.cfg + %NDIR%\tcp\resolv.cfg + + where %NDIR% is the expansion of the local environment variable + NDIR. So setting NDIR to be N:\COMMON\NET would mean that we would + also look in N:\common\net\etc\resolv.cfg and + N:\common\net\tcp\resolv.cfg for the domain and nameserver + information. + + Here is a sample resolv.cfg file + + ; LAN WorkPlace resolver configuration file + domain mit.edu + + nameserver 18.70.0.160 + nameserver 18.71.0.151 + nameserver 18.72.0.3 + ; end of file + + The TRUMPET Winsock stack uses a TRUMPETWSK.INI file to store the + domain and nameserver configuration information. The section tag is + [Trumpet Winsock]. The domain information is identified by domain= + and the nameserver information is identified by a single name, dns=, + multiple nameservers may be specified on the same line and they + should be space delimited. + + trupwsk.ini + [Trumpet Winsock] + dns=18.71.0.151 18.70.0.160 18.72.0.3 + domain=mit.edu + + Core Internet-Connect uses a CORE.INI file, nameservers are comma + delimited. + + [winsock] + domainname=mit.edu + nameservers=18.71.0.151, 18.70.0.160, 18.72.0.3 + + FTP software uses a PCTCP.INI file. This file may be located by use + of the environment variable PCTCP. + + [pctcp general] + domain=mit.edu + [pctcp addresses] + domain-name-server=18.70.0.160 + domain-name-server=18.71.0.151 + domain-name-server=18.72.0.3 + +*/ + +#endif // __MIT_WHICH_H diff --git a/src/WINNT/kfw/inc/wshelper/resolv.h b/src/WINNT/kfw/inc/wshelper/resolv.h new file mode 100644 index 000000000..ec904d67b --- /dev/null +++ b/src/WINNT/kfw/inc/wshelper/resolv.h @@ -0,0 +1,201 @@ +/* + +@doc + +@module resolv.h | + * Copyright (c) 1983, 1987, 1989 The Regents of the University of California. + * All rights reserved. + + Structure definitions for resolver functions and #define statements + +*/ + +/* + * Copyright (c) 1983, 1987, 1989 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)resolv.h 5.15 (Berkeley) 4/3/91 + */ + +#ifndef _RESOLV_H_ +#define _RESOLV_H_ + +#if defined(_WINDOWS) || defined(_WIN32) +#include +#endif + +/* + * Resolver configuration file. + * Normally not present, but may contain the address of the + * inital name server(s) to query and the domain search list. + */ + +#ifndef _PATH_RESCONF +#if defined(_WINDOWS) || defined(_WIN32) +#define _PATH_RESCONF "c:\\net\\tcp\\resolv.cfg" +#else +#define _PATH_RESCONF "/etc/resolv.conf" +#endif +#endif + +#ifndef MAXDNAME +#include +#endif + +/* + * Global defines and variables for resolver stub. + */ +#define MAXNS 3 /* max # name servers we'll track */ +#define MAXDFLSRCH 3 /* # default domain levels to try */ +#define MAXDNSRCH 6 /* max # domains in search path */ +#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ + +#define RES_TIMEOUT 5 /* min. seconds between retries */ + +// new +#define MAXMXRECS 8 + +struct mxent { + int numrecs; + u_short pref[MAXMXRECS]; + char FAR * FAR * hostname; +}; + + +/* + + @struct state | This structure holds the state for the resolver query + + */ +struct state { + int retrans; /* @field retransmition time interval */ + int retry; /* @field number of times to retransmit */ + long options; /* @field option flags - see below. */ + int nscount; /* @field number of name servers */ + struct sockaddr_in nsaddr_list[MAXNS]; /* @field address of name server */ +#define nsaddr nsaddr_list[0] /* @field for backward compatibility */ + u_short id; /* @field current packet id */ + char defdname[MAXDNAME]; /* @field default domain */ + char *dnsrch[MAXDNSRCH+1]; /* @field components of domain to search */ +}; + +/* + * Resolver options + */ +#define RES_INIT 0x0001 /* address initialized */ +#define RES_DEBUG 0x0002 /* print debug messages */ +#define RES_AAONLY 0x0004 /* authoritative answers only */ +#define RES_USEVC 0x0008 /* use virtual circuit */ +#define RES_PRIMARY 0x0010 /* query primary server only */ +#define RES_IGNTC 0x0020 /* ignore trucation errors */ +#define RES_RECURSE 0x0040 /* recursion desired */ +#define RES_DEFNAMES 0x0080 /* use default domain name */ +#define RES_STAYOPEN 0x0100 /* Keep TCP socket open */ +#define RES_DNSRCH 0x0200 /* search up local domain tree */ + +#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) + +extern struct state _res; + +#include + +/* Private routines shared between libc/net, named, nslookup and others. */ +#define dn_skipname __dn_skipname +#define fp_query __fp_query +#define hostalias __hostalias +#define putlong __putlong +#define putshort __putshort +#define p_class __p_class +#define p_time __p_time +#define p_type __p_type + +#if defined(_WINDOWS) || defined(_WIN32) + +#ifdef __cplusplus +extern "C" { +#endif + +int WINAPI res_init(); +void WINAPI res_setopts(long opts); +long WINAPI res_getopts(void); +int WINAPI res_mkquery(int op, const char FAR *dname, + int qclass, int type, + const char FAR *data, int datalen, + const struct rrec FAR *newrr, + char FAR *buf, int buflen); +int WINAPI res_send(const char FAR *msg, int msglen, + char FAR *answer, int anslen); +int WINAPI res_querydomain(const char FAR *name, + const char FAR *domain, + int qclass, int type, + u_char FAR *answer, int anslen); +int WINAPI res_search(const char FAR *name, + int qclass, int type, + u_char FAR *answer, int anslen); + +int WINAPI dn_comp(const u_char FAR *exp_dn, + u_char FAR *comp_dn, + int length, u_char FAR * FAR *dnptrs, + u_char FAR * FAR *lastdnptr); +int WINAPI rdn_expand(const u_char FAR *msg, + const u_char FAR *eomorig, + const u_char FAR *comp_dn, + u_char FAR *exp_dn, + int length); +/* Microsoft includes an implementation of dn_expand() in winsock */ +/* Make sure we do not use it. jaltman@columbia.edu */ +#define dn_expand(a,b,c,d,e) rdn_expand(a,b,c,d,e) + +#ifdef __cplusplus +} +#endif +#else +__BEGIN_DECLS +int __dn_skipname __P((const u_char *, const u_char *)); +void __fp_query __P((char *, FILE *)); +char *__hostalias __P((const char *)); +void __putlong __P((u_long, u_char *)); +void __putshort __P((u_short, u_char *)); +char *__p_class __P((int)); +char *__p_time __P((u_long)); +char *__p_type __P((int)); + +int dn_comp __P((const u_char *, u_char *, int, u_char **, u_char **)); +int rdn_expand __P((const u_char *, const u_char *, const u_char *, + u_char *, int)); +int res_init __P((void)); +int res_mkquery __P((int, const char *, int, int, const char *, int, + const struct rrec *, char *, int)); +int res_send __P((const char *, int, char *, int)); +__END_DECLS +#endif /* _WINDOWS || _WIN32 */ + +#endif /* !_RESOLV_H_ */ diff --git a/src/WINNT/kfw/inc/wshelper/wshelper.h b/src/WINNT/kfw/inc/wshelper/wshelper.h new file mode 100644 index 000000000..0bdf3630e --- /dev/null +++ b/src/WINNT/kfw/inc/wshelper/wshelper.h @@ -0,0 +1,58 @@ +/* + WSHelper DNS/Hesiod Library for WINSOCK + wshelper.h +*/ + +#ifndef _WSHELPER_ +#define _WSHELPER_ + +#include +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct hostent FAR* WINAPI rgethostbyname(char FAR *name); +struct hostent FAR* WINAPI rgethostbyaddr(char FAR *addr, + int len, int type); +struct servent FAR* WINAPI rgetservbyname(LPSTR name, + LPSTR proto); + +LPSTR WINAPI gethinfobyname(LPSTR name); +LPSTR WINAPI getmxbyname(LPSTR name); +LPSTR WINAPI getrecordbyname(LPSTR name, int rectype); +DWORD WINAPI rrhost( LPSTR lpHost ); + +unsigned long WINAPI inet_aton(register const char *cp, + struct in_addr *addr); + +DWORD WhichOS( DWORD *check); + +#ifdef _WIN32 +int WINAPI wsh_gethostname(char* name, int size); +int WINAPI wsh_getdomainname(char* name, int size); +LONG FAR WSHGetHostID(); +#endif + +/* some definitions to determine which OS were using and which subsystem */ + +#if !defined( STACK_UNKNOWN ) +#define STACK_UNKNOWN -1 +#define MS_NT_32 1 +#define MS_NT_16 2 +#define MS_95_32 3 +#define MS_95_16 4 +#define NOVELL_LWP_16 5 +#endif /* STACK_UNKNOWN */ + + +#ifdef __cplusplus +} +#endif + +#endif /* _WSHELPER_ */ + diff --git a/src/WINNT/kfw/lib/i386/comerr32.lib b/src/WINNT/kfw/lib/i386/comerr32.lib new file mode 100644 index 0000000000000000000000000000000000000000..be521f5b6e72ba10979b4a16ccebf48c3d477d84 GIT binary patch literal 2560 zcmcIm&ub& z>ZSjI2M=C)^X5NM-`ky8c40v%I?2qudGmI@nfJaovny|nZteVC>~+drvYBErt0R*ep5Jka&h-obvQs_%R_+^&=k zs{0ka)@e7o-FyzZUOv*aaSMErCYC|<<5786-`T2e(I?IJh0aUpv<8NPORrxVYIfb8 zl|##hzUy@LcB9ub&Kjx$UdXMm?2LL{O!bY^mTBpsvTVDJcIUD&YVN6>I||A$3K0rJ zG60l=z*Pv)NO4Uy83k^`z<_!R6MXO^j3opSLc}2j$ba{Vhw%Eu^qi8u=BA-jwTP=>w-?Bp4+!Xn764QJEJouegANwc=$nWg>biHx< z`E2#j8UouSP%5~Jip2YLvu^Z_)tsDoO2T)lzl4Iq3>BFhVYe>SctnDa@T48g>6Uy+omwouzrOb zQFwLWjTmv~N0r+95q>gVV$LJa!k1hj=irOqyU*$mb z%$NVfgIQwxg0?a7PM_Ov8(D|ntUUWk09K&A{Wc}f3er_fN6s^6apajI^=$V;4n+Tt z{X2_K=|!FL9L~)~n~W)b(>X~sAKzdp^MrBe<2SD}aIS=(h5d>o{|MeQ!t>FcX+PkL zp==1MjG#Ox6hG)xv^qb|;>}nHt014_5iAZ=fU!m&q{Yzee=~QyUJ}|8qj|n|F38v) Dij^EI literal 0 HcmV?d00001 diff --git a/src/WINNT/kfw/lib/i386/delaydlls.lib b/src/WINNT/kfw/lib/i386/delaydlls.lib new file mode 100644 index 0000000000000000000000000000000000000000..a39ff4ac7368ca5c8d679e148d0c252d103e707c GIT binary patch literal 13306 zcmeHOe{@sVeZR7VB#em#h~N;D2rvUe>&O-{HfFJ8EL#pX5&j_&uqBKw2Z4V@ekPEG zmDae+>pM=f^d#-po}A>gNlErAXXh-)qw^dw1_)H8o{9^wEZ_jG%9K zqZeg-Jw0`Oecr76-ND+rbiO~47))en?PHg6$ zkM2~vK85kk*_+Yr^z>#m1*F zGu`CB&t~Okvr?V2pUp~IclFB$yE|iA&b6nOS803gzWmaT!Tkq2;-1Qijzp}lqlXrE ztm(t0P_z8IwQX1}kc+v@?XIY(aJkCL%D0qr?7sXa(_L)!Rgd>s?Ad>Uxlf_AClTwG z4#z}_u{{vJW7SgXGv5JRZ2!oEC9PV{w;}u{1LtLq+R{W%m(-=97;A(09M+gm@S$MA z$IHClQYm&s;u;aT!L`cHSo19+{dqiGEVxg#TdzTbShNZqj766S&2l`r-Qgn!!(^vy zsa8sT=DAs>-BrlCCj;klWZQ*F)&ksq6-#TU*Ma(G)T0XezIpOJ58U6(!M6x}Kb$Au zkAQo39(-wOD1VV-;+0C!^! zzB|EZx>c*Gc;>3F3plrm&DDMiD7FG~TE#6uIv3v!U~E(&gj{?Vk+%ext16D>OD?`8 zSm#&cLm?L*`LhWaw+@$!Z!0kO>2NcRzdOL!224W5%{KnN49wFRe0SIR>wWD_ZB31} zTi1+?#CuBn;``UQ=A&+I4Q+2}%fQ~>RJYUD>~CG;B2T*6Ld1-9Y~R{3oapX26ie)n zB?gB(`s32)yAKa{48@20V~JQtmvkUD(A6;_#rrzoKzbME#YmHTldfdT941(^vc)W) zEhrH2>gISiEDiQbt_>|4UH1=3@&5QD@qq_j+XwrH;(f6M7OErNG3W;eT=4-{PkeX? zTYog(KQx$-hBvs6taDfH-spPx0KhK1{?>q9glPm-C0-k-=|0y}7G+*nH7gOnIWUunCos+N9n4DB%S2TeCau!B) z1`nmK#6Eh3Nw)^1l>y1@NlrpznfBUM8lJF-1eMb8p9@G^QurdJsl=(Yl{kXPcI-l` zpe1;Pd{SAUAgx`eQ(b`8GIowwM;4DICF@xhMlrY{62zhS97ueq_=?ep^TIm?-lfME zW^5bqe} z0xXQZB{{>&`H8D}o}}_$AOD$he)Q+&k6(%^ry^wbrt#yOk5Bv}Z{7ylmA(@DS@a0? z{CFc%{0t3HHFjNEKbAbY*puvq<{%3mG)*n0aW>v&&ucjdP55A5>-0}Y-zefE^t8n* zgJdd6sZL#c%`yLq#r#u#>6w;~U6PNzFCV)sAG;_Ydq+O@snTgz-sCMM`!7|WEj;le zjn3nj5X=7eNs))SH(pRAH(##)ap8#{P`1xP8CM~WZz}>7YOVq)eJ?*N+5jgc8kT2d`x{A8M; z@v{YWx>Y&PYbb^VjcfiMgAvx+9y(a!dC&6^&sVM?uli%DJ>2@(9dg7XN9=N>K#n-% zh*ORf$&q3?;t~t2@~cqzZ>i3rV7&!3ubz|^R7LC~cV?RNT=#r5waIh+H9HDStyQy6 zBu6$V=ef@4o#%R#7B8Jx(bPQC?^YGKg9+K=|D<)EG3j(rs~m@JY=Rdy_(H#HcclP zeV8jvUn7Wsp@fi`*8CR-WX3`QjMt_G)Fq5w2SgC%`NW07#LPV3tLEnM12(>zK-$K8 zllsxdT!^VJY|M=~&LuD6gIo$CrWZ;Z+lRQ1OGAkJxpW-y0GFOXJjkVI5fj43UPk;7 zmy(EwxpV=s#HCA!N4Rti@xxpq7msks0g1*p{Dbr~m)wxP&LuCTZ*Ym`3RZh%SMj*> zlvjpSS7M>#k(?*rXE{Y{65i-}EZ#Ipq&EN?Q+7GWEl<|UyXd%O4=E41sNA^a%d))} zl0yz!km2l=19l{fO&>NO!R^il zqW-tBX`h8tV5%BIxteRAF?S2kZB;r-?ClC4NFn8yN_~N{vq&zUAR$x~9)I+d#e2{s z*B4Cxq!l}Rky!L)8=B4;oc_sZ4I5E)%1(z8Ld*WhC+~E~E9F{C6btq#3!`?e!NinpKY-89f!^*Ff28-wVSn}{)aK|YcaQr(ZgjO1gl!9x!TG2c>NhGBu zfYw)EOMHL^DNj<9C}AAk{{sz#&OO(OAwWucU)h0=SggXtgkWM;2R&&Eu`zy33%4u3 zzCt=|oC~6z#Mj^&tz@ksX_Laoujjhvip3gipMG2Tu>vrq$?65BMPP^1e{$S5%3Iro@d4p=bj<NdJFRN)zKvnSQIPL>MM&} zigMelFDBl`+h0QwG73^J3-Vx*(omeCDn{dHs9e#`NjJ=$z{kp`$S5Qy+l^T4X*B+X zMDMpkg1{7tc(Cvep}mk#nB(`d!m-zog7ag^!V`Z@;!gY6xxy3Qh1eP%-*y^L7Utt8 z_2QxYSoz2Fo5!2{%>xWx4K0U?=2O6q0>>vl$P3G%;`!i<#*$Gv5K3Z zWIJOuy=+RI+RBrWNm`r^;^*$a5C9Mq=?#e1R4NHzuHI-GgMCvtL_=}Fv=zldJKC_8_ z|DbML>Q?BKpa#mLU|}w`rTD%hlsKg5e;uLzF`MZ35n30Gp#e!6_kyRSsiLgB!ov>( z+&UAQ&HSLC*Oc=<6B=Tq1F#mT)xY#>SS3_yO?AJ^&^m24X>}U-R-;-)sXs|f{jso=$RKHZ8m8~3;&G}7H?4p z#wMr;!onkBUtPtN*4nvM zWnPlSyflk>NftA`oS9AC6ywAG>Ss8)YRnI*%*!}4W&g3NAz7flo27ZppwZ7JI*1x; zx-82dnrCLyA(j8}wLiczrup->%DkMpRNal7wr7LeN|=U|!;zlD-z$I+z=E zOV?{JG*1{b-=J+u4cPUtpL(jcus+lT|FJp=O(i>&p{ZcKX$|(u&1G&D;3cS(ez#gn zT9bm98l(Eq2o`KO&ch3;^|h&bok{tl)%2fJ8Y-usrzPMpj`_9RhTi%*j-jI=)#sT{ z{^?}e`VEzN9k;G${=F>bby>{oIfm+l!NmUZ`8QxntJgBx#u3(MF>ip@==1t4=8YUf zGn)8zZv69arI|OW%p0?q@5*A{$eE#L4JhS+tLc$&92&Q(5ng`{nrkV|3rNv@&Fv$J zL~K9`CI-7>!^6#kJtKWFTs=)7;q^Y?3*x@x9u}pa_M%b11t7q0xca=CSxwL%h~dU! zqCPR$Zz$IuZEW^6;KpTJG~oBu`CD4OUa;Z9X*3$+zaB>WaFsNj64z!E9_{MuEca3M zS6gR+Y1dYNH!g+FaiKTe#!X$rlBktiYk9h|)fC^K=t>-=R#&mDF@Zy;#HcS|A;+cE z)Meka73y)V!zx)#>QdND7gNQ(Q?=}{l!$lt59x}`dJXk=;8O4$S8j9N+TK1mG9ZP! z`tZ{`O@#n%W`{RF%+t|cx_R8yO}~IgV;IMq~i88dg z32N(jiQ2kZAevikf%cs{qIJGDpQl{4R6BECnryhMHx|WR#h4U}b|n&BN4@R1w1_L{ z6sPa*lM}mr)C4o;qN{5>1i`4Fey=H+f!A;Y+j!kQO+OoGe#Cq*#jn@QX_=3(nRLdnC39w z>vp7vyK!6vE9Rd39`Bwq4+a^H1x`&DVW}&?>YpzG-yHc?JCwjQ?PWD{{KZ8y8m(_1 z=);zl4DiLQxO6R8vmeaLr_#r41_3}hSH^7Nj0Q_1gnOa;4g|Y2?>xO`=jA^&Ux?o zIZaqM!HM3zzkBYv=broV@_xsakH^!4XZDuu)(RyOZfJmu+MCugRP;s5s z$87)*7v6MWUsZ0v}sl7P)l}mPuXt!sO%G4=0qdmaD6=vvnJfwD5m{o?H<3{^w*l` zPjRkWv0Efnr_%bMaZZ<(Qab^B*u?@V3&Ktx$P9(LZ2flu!i(&pD%e_eDsIGWBh*uP zZo%$29S?+tL{)gYYG7=P6;@H~ZdiC+1*fYF{k-Ao`?Xi8KKR<<7iAMFO?CEL@jYpq zh5>Y}^Aa8s48y#^*4=Ffp4`{ne!Ttjt<4)dx_b5>JHAmXP#$S-JG`&sK-Wf%LO!7$ zpy8@(e{=6xda(CdJw2eON5*=G6UMH=b7Q@uiLqflt@p-_GkPlCn=ul}-eh9HI@AAp z&W&nq5Z6=r)k;;Sip!;}>_`k^f|1jPw(Zzs+L2KsF`W2vA~mG#9~mA^B=s~0q&AN= zYl&o1ABrb6T-wA)O53$d+dN1wF7;WuwEo3R0&kZVPic4wGsAkya18IqZVV2WnTxt0 z590Bwv%7m12&wG#(%iIB6rC~Oo_QxPFH>J`+GLwI#7j_(pZ7F#0LJRPukl8eIX9Q0>I8R2_uOGOFCOA% zZaQyk>>S_QY-}}oF0}i_TLvf zIm1A_X0g+59@NXMycGOxzAXqYlK2( z?br5A*3taZmp$+EWKK$dZZ^}!+k-=S0xq_VH#Hlzm@s5kFM2z?(YYe??e0!C&rZu( zb=tcYjP;%5d-4o+e#SghnwvGF<%Vz4Q!@>}VT9HLlgZW6kCU>eZMLV4m<>x#X}x|+ zT+OR=JK&Xl(p`K6k6%@yr2Y1*$53u!L|3?i(IJ%5`z1&BJkT2M{T9lNjObO95kCMT zpMLd*qniQJSa%zx%<(4&{RQZAc>L;bD8YNMqCpB>o-;0&jr7Rv?MsAdp1g>Dcu+x?#sI4J7epfh2-SAc^1`K&#pFOF$CA z6(E`S$3Sbj_dTFTfhyD;Ac^3g4hrBiQOR~s1A&Vn(%%DVj6ML85g$6bzdO3Sj;_RO zN4g0}&bJ;&BHatLg8dx;l1RS_By0ONkc{{tkc{{V5Pbst>K8yV0!{uPP;CpXoWx5X zJjhB!gaN8p1-MOnR>J2=J5a)_+RUixG(LDhBzG5-8uC;Xu%$uhql5S^RwYgqm&eos zY`iLZT8|r5Vdf{Ianl?M#_J)XQz&kVg8*SeB&Sf^^oCa8^-Q58k5^87^t9N9x(-I_ z8XMIp_46Z|8bxo5Xx#M2M_LcPafQO8YU>pBvyBo>HSdqhb4?R_b=lN}tr0XIkE#w6 z({THVG;-WBie@H6;_@5`vqo&(RE(nadWeiQ0eyetyRPjF@fbQ?jeUVAS{kZ~Y%0lA z4eu}fP(RIDC@pAec*qaMu2d(NQivv2ps^DSTUo@Z1*IOg$f#%SCTg((S#orup#;Si z8TFjqL@k;u(6q-L;nxdnzK2%JXfi&iM_VE-EsK(+XtXKXq++qyXnJHQ6(81t6T_pi z*qD(<_J%xZ(Ez*u^k^Ch*J-;MONp;x9;9Hj9V&~(4e2hIxk!AD7pPKxkR^>OC0{+e)=>5 z>*viuwH(F&B^tOTMUcesTJ7Ud3CpvvbC59S?#pa*g} z^v-<+&?woHXJHD0_ZL=7CtBl@?fwH8xv}lcPL(>P^p!xuVj3JBec?pc0Yu+* zzoO3~t;4VSQ3^9m0ZH$xK+^jor}s6WARfQEj`9&kvnXZkdqA65H|OYx4?fJgavZv# zwLs!|y@R#@iI?p_!uXnj9^$cWKr-7GfMgvDUn~65VCT?lmBZk zRz*<5Q=*nA>)HQ*N*ct%#Nb$Hl*F~(B*eSK1 z3?ULTF%)7JG=d)C8uX(mNnS&og<2%?6>9*>Yse3Amb~U(c1E8!TK9853;u@ui0rfK zV%!CaNvU>AL)B93Ok+Lu+G78dszE`1B*JIxZq%YVdynQ^fo1}&d-##iqLw@@a&ae% SGUeIL^4v+N&c{=wvi|@e>OlYi literal 0 HcmV?d00001 diff --git a/src/WINNT/kfw/lib/i386/gssapi32.lib b/src/WINNT/kfw/lib/i386/gssapi32.lib new file mode 100644 index 0000000000000000000000000000000000000000..3a7de55952a6370b55123fdb1f2c2fbc9886e4f3 GIT binary patch literal 13558 zcmcIqOK%%T5-!>6I93!{u^l^(U(~~T*?Li=WCe=_6-S`%O(AY1O`YQm0`W{o7>INV*{T`*suK)<8wPAT+*9X>tkgvOCx6okncc{3|6VhJA^PPrUbc)rA?>_Q#S%zS&5PF4T(XFYPnGAn7 zW0laY)vHApd&VFgzxvRvK_g5d-|%)Sx%4FM zTUZeFpSpE#`yiB%ibAI07RtFan~bm^>h~*@$wp8r3Yn7EsFe!`PQx$w`;AK5?#CD`j8ny zPHw{4ItZpLv>9uqL7y$;X*PMGs>Bysf2$X2PQ&}V>y*7c&kxPY#1~rbqhJw-`%VE2aYt8#C_W8gf^Kqri3%Gw}tk^duXW= zy1v`+Bg$+xY;{7Lp!!u@<^oY;30V{(vREI!oyHQfWJW`K3Jaosze1Uz4+@JyX2K z^#T<(9IR_pPpc4m72nx!xb;9sUP;K`Lwv8|I{Rpxr1M%e8l6|!vDUivPrV|Y8m{=k z`nt2=pdV#u6 zP$q|Z&k=9t7V3@ye2CPAI^SUV%i9=BBi+aM-M$X+15)i8z)Peru43PiO4!d1I01KH z4rX8$GLVI7I1PV*cOV5L@D_B!4LAem;4IvNQMd|&a2~Ef54;BN!X>y2!!QnGa2qBe z4O1`yeegQG4X5A&T!)MBCcFXt&GTMEq=j3a!62R zyy#HumSW$an#Nw{{n{RXHx0<*Qi&!RB;VTE4CF|>Dn=lzC0Q?tvdvXWpd1w;Ta^}7 z2%#psVJn+#bYmCIx3Fs(_C>OUP&0l*HSW^ZAhDH%ng`Z#Nm6hCp@i66D+q^-H6${% zRq%{U44EM_HYD8E2)B7`ZA`4Cz*oGAF^#uIv4(J(uuO?n?7@kYS%xP)a<&*aSbJt- z_JcvfV@~UXBOk|CPC{bRCX2r#0NkC?$e1NNoGJOZK-L^b>wb-hT09!5l6@H|>t0Oa z8FNj`(TMdpjLnUdMF$AYP6HGVC2JUb6R9?OB~f9^2BMyb=x9EHutwJ-D7s@GV2y%To0(u0C>!WKpAQrBy77N@5zWTvBgXv-Ts} zPSgm_cgIWRGC9w0c7~sso1+1L>XXjpj+4;!ayoam12BROo{sU7yS2YFuuh8r3;54J zd4c`rpy&N@uT=000~nvv=K}tGhx9*IK8e3Mn0&_M@NAnt-T2dicwCNfbC7y=0)NkA z)J>i)xl_Y%zUMSDNrU7$jp6yJu5&A1v0iOdxBb-c+DK}7DgP0z*8bwzd7w#J01WYo zeh>aV75pdT;A@Zw4d3@v*I(fG-#H@DArE=M6TrKj!`y>#b~z{LAbH1=oRc9k$PhAF z!6AIiWx|KFg(+27CRiI-I$VH%g!YoorX_nh5!lPW@x|y1gVA0{h9y6eyN+W5+tsUkOC{ASM~+3^yGO6AwVpeq_u@h7AdkE#r$vE9lr_kukSVh|RB=wO-?K z5n8>B9XT^lfaO9fD>chEL=6{@rf{2(arL7<8R-y~Wf^N?%daW8;)o*|;!Mm4pT@H) zcByMRI#Gb-LQ5l@F|XP_?CI+QSIs+Q5XG`uLbUXhxT7;6qLkDmLW>*MP8p3v!g#|c z-Q^_0jkDZ0IIb}rQ()Woi81rp72;~io&qTsTAI%o#5V<^nn}taZCg;B5AF^T&1tFv z-1g|kS<_jLY)*m|V7ZWVjC(>{cK^>aY#F5OG0ukH8L7MZ0It%vbVQN99~5Oj(wT|e{?YEB7de`CB9ja; zZf#!D5RY4&#( zA!_6tOvX8cCB^J7S0bqFHb8-t3$65XhNsn9)QOjwc;l$|6A|SjJQ=KQuRCMuD_)!8 zEvJSYJs(Vj9cNS5IkxHW@z_vrsHp16W+K!$Uy)K!BgdwRaO1|fm*f@LI=S76d`*!I z)nZj7#_y9*@zW0R8AdY17*EkJBWj<8D4=cctXWHLjvpN0O}`jjaXXd}&*CRih)2FJ z2xe0~VOIdf~h!|r-qdFqJHc*%UCj(28}& zVND4veuXDD-@aAG^efG=#Qk6*tT=0#Rc F{{!W=fdK#j literal 0 HcmV?d00001 diff --git a/src/WINNT/kfw/lib/i386/kclnt32.lib b/src/WINNT/kfw/lib/i386/kclnt32.lib new file mode 100644 index 0000000000000000000000000000000000000000..085dbd36eb4841af699a62d550656a715eb44389 GIT binary patch literal 4570 zcmcIoOK;mo5FW{|T9#}n>7hVh3gD(`fV#3p#W7G6v}HFnBrAp_9}7m0jYX7}0+MNa z>oo=X19Hf@zac1c$S>%j2mgTHdM|QKXSiH($t4*Hb{AOf?(E~+*_m&4sas$7?7`@p z+*jpr+OF*GZfn&&trnJ7{O0|ts6EO7z^4E!%K)ntfZPZm|AOa25rA_3F3-j10F(>Q zcwWB*pj^Do^Tta6%B4k~*Iofo-Z={?QyTeVbM? zFP<2Qz0+9_?B3Wl$LD+vy`oH12OKhsxoqFEI?Qp*$=C^I#ddX=d*(2^)w^K2Cf1J# z8+F`~I!X~YO~+T)3D$}TacQni(|pXjW&~C3!to8eKeViq$uPXbu(*5f9{r5?fx5D! zKI)Cn*=f&lewx_BV2mp7u<bD!r?lXJh#E({cy_0S| zy*M7D6@t~#Gtn@Td~W7x0rN^oz2y~v$|}GJdH5oaJSqU(#qv4w?itoE*8y&0{pAM0 zB2IX<25^A&H`v$5J_}_?UnsybEW#4J2OCg?Ral2L$iWKaAp<4Iru3I!0SwhDv93F% zNrYTexyla3WoI>z;>8JGqPT0UzoSs5lkBN#c#+~y)ZU2^$qz80C`5PzZ z00Y|Ov0J{={-WGGZZ-V=a6xD^lUBeO;?*#qV5}gS1OxhDa`6N=yOjSP-o6!hG=mcD zE(=0u9l+b~NJu>G2xmb^G#Y~fn2xCh5|Wqc$4|66z@FctA`5N&z24V>r0qnxNDx~Bozl(-nlBfJX9x#htKgL}o#K!gwP3HMbo?ol_28^KHLL`bDM%;xa1J1ACy?De;M5DNp^mdm)rTT1I3O9{t z`8nc|4+WUY?JGgS+`4KBxWqz=)BNs}Zpo{m-H$)nj}YlgyoV4i^j46;r21?pnqtK* z2`l;nk#OerRc$w3zYkGAy3>vDyGDkZ+j6x8tj`eVCSfH#m#&1G<}dUCkEr2S*p<-I zxKFPWLQ@`hS3*p)ApSAoAzm9B#N#i*`412WKd!)#o}#i+Qhhciq{Qogi3yzK(zm39 G0RI8dA1pEe literal 0 HcmV?d00001 diff --git a/src/WINNT/kfw/lib/i386/krb524.lib b/src/WINNT/kfw/lib/i386/krb524.lib new file mode 100644 index 0000000000000000000000000000000000000000..b43d494f74683cb257c3cd9aad7ff9df8f9e05ef GIT binary patch literal 1976 zcmcIl&2G~`5dQ2WO$j-K!jXy~m8x7qe(a`|5OSbMM0L|BO^;}s+JQ#>NtGC`Tzcd+ zcnEHN0S+AKohvUu*&WZ!H?y-(Uv>u0!K=)R{Aeo`tJRWW6xS=G z{Guew#Z|f5%K%6N`ZADg0I4%z?jq=Eo3?Br>RZk2R$FYm-FefhH{07SaX8pF%LasK z?ArGDKE4D8g6;OZ-NvTasI_Y(&^taAQd~Iwlh56OC!9go9g0KO!IYg5$=*rN6J2i@ z3WSVXBTGS5R8I* zbQGX-Q+62Zr7$~eErG>973;nR%o7d_MZxXvfBLwz6OcfS7GD)1XA8O4g`V5-I!k4> z^@tWfsQ;FX1kDzT=knaDWFt$9OX}(z^DX4hDKvP1drTq|Ikkd^ISvv3j$0ZTq_PWJ zJ!jA#_CI*}mDcmTU2kj#+gCVMTE?a2i7FTla3~h|B{H4(j*4yYs0Ht_m9as91mh~-H|aXC-EDMHSiC;uh>vqW`~jF?#Kq7<1CwQ6gL`1}yVY+8X$fO;SfR0FTB!nQ3H?LpMG}F_s=e;-0 z5`riLDB=c)h^T;oiU`OivPlqR5s*zpL_|PDz)@gA3?HA#@6@g3RNcDO_x5f6O6L2{ z)a$A`^{eI7dg|1D!|u&)YvtlC-ag0wH*fC3h4U6Hn7eS$_n)i(oHsakQ5JN_7DO98 zM|AWc(J_Y*efV^u`uH}QPJ#^)`pp*B?=#(3Ym`>Jo zD$1tlBDkQ>?x5*Qa6zXbzlu(S3;Nt_O~=D!LY|pU?`wJzF6i?IYq|?A=#0ghE{6;H z!p@q`hYLD$TTQ6rGeKY6Qq%EpLC8u*UARn7W%Om#i=s#2g3el|32ku}=hLbkTmAkk^Yq z7cbF-yj~2t1m$M>7RsyW7`RNxC)1_NHQf&vblFWAUA}-w(S>k9SIo)iN~ELcD7Z`; zGWzxik)p@og09+M6WZb`(03MVx)LtvYUD}Lsc=Ep%+mA{T+p?LYC;*W1zoqVCZu&8 z==y6j`tDpJMd!i=-7s6zNpL~`L7FDvGCiNsjT1zQ*24vTZ&=fVa6vcir3v+M6X<5t zt0Lgu4Ep{eO_#$3-LktT#JvS{>rzb*zy;lQkS5g4ZJ^tiYkCqc=m*1^9)%0KV}DI( z(>p+SUY*fhD6gUm;DUa*t)@@I1>OBBO)tU)-Lp~?@^BC6-aR#;4EKWWJ13+2QE!Tl zhsy+BrXQgl6g>eK^uU3dZifr{@sOsA;DR1ReiWSum+AKz{bYnl(YIa`q?2witdLCdgRiKem;jt(I??Dy`0gbD8C}aeH8SIC7P~; z3wmrPO{c>JJ-($T)WPGRr)FzHS)Ky@dUH)j!ex3Xqo?~sOwXWx6rqgIfS!G~rW@db zelw`)0=S^{D7T_B;DUaO^cAgx%k+ngeg}C~^dwx+a|dX;9WLnkAx&4o1--B+qZ1y% zdYH4)Qsz-BsrmZqcNg4XSx(MO&oVmkJqj4oS>aRPMr(HT9y z0rdrXVqDW>a6!LBJ{8>o7xX0ZspxXJpkE;$ioOIF^z>61ZCF6WbOrLnbUm<`?%Xq@ zQ_zk~_sz}dkv$*>pljA;bjhh0_fBmz_I~fa@7r%#V~=;e|DF5oz3;O3?blecJF-O`e!rQEQjk`owX)q>)myu|F|u~N6)j9Z5~m=wk+J3q)QFW#ks}vWz`Lq_ zM4ZzE6!0mL>$TU6uU);|6L0|@iIYri?Q#Q}^{`x0E^537gWHT ziEN~Ef?0$War+XR%X$fk22LOsxm1Gig1oHlwYyC5-VK;Af=Fli+R?FLH}Pv($oUp? zG}?#v<6K!tf^)Lz))@g}Lx&0OR%1B^yj6|f=#gTXkn{C8>@+ae9$(R4=^DG`E*?3kLTh_uUOoM!8I$2RztJMkdU)~#6;Vzl|0s5kjFd9ORTXm zv~;I4(ol2bkXeni8U>+Y3J|dNaEv(!@c49?nUFb~qRX}#h2dT*tDCD(aGi*3lYBs) zuiG3S?yP1cDFKQz2=aJ!n2OhF_0e7JINNH(17rNXc6&I_XnZ}6Y(2+IPR^@cgtr>` zfMUMJVWU|8VKv=c-IF!trICx|r8n6e8`TZX?Ik275)$ErBuDv#zt7d~j*c7=ZQsdA zkmPNSwbqU``%*Z}WQaw3EKG7^92o2L+#j_rH ztl#X%gf$u>5Zc*N+f3IcQ+aR66Rv^va#nT7e7tNOZ&S{gt*0NqsL$#A1tk=`BN*g+ zE7fAkAo*VTxWR%@HMr&pf+Q~v+CH&vA9eM@CmPMn=aF zZq`#7Ul0=E>|^@RF&WQXd`$UX0Wz847UTiZ3ySfE#ZqfbR8tsN4US&*8J}2857y;~ zS-hYeuRgQxwwq(C?W#{zoH@?6K_PFu+ZAU~ipP3|aaVSFeaL#F&|`y zw0jGFh$IL}Yk672b&%z313y&n*WcDaPVXoqAg>rBvFUz;OOm zuk1BAyPS9sb?UT7I^DyX-Qni)F?XI)knteu)M-zk2VhatD3$YEL zh*PJl1}WrvWXdY>V@{oNuQ@iQe3&>>r-t#MR4!$_;#9rvt7e2i4!j6KIuq^g>d}55 zbCF)&yIGG@i3f*iba9;kJ0G<;l-&}|=LH0Osu6g}rq*EI+>#Fpc%gv7S!F}0j%>;E zK>=@n6c-ITBO~Z{VwcLr&4mPwLf0z$rCyS0{2ePUV6hY4;-Gse+u!RC$(a=t!?e-ezy*29k{j&M~ABc||*#?6*h zcEoiYF2Lst&twfy=zR+wy~?h?b#&wB$5!X1S%&Pz z888IiJ`V4^_rMn?O2WY)BqG~S9tjGoNQ)kVw6^=23!e?x@+k;j+aJs7m zURabn(=|j`T|ksiul^&9A|%SmBctt=E~~~n%41|b0w;r_yu3!ow7+^H!t8|!Zuakt z3^$$X-t!4!s??R5W5nnk&46bCa>0dZWcP`!^!X{cK*6ui0E783=Uc$Rleg1}OD-EC zIeSXRv&ylVTpRj&9BnfyxSoN9mFFqq=dP5P!5|ip=W}NzZZg%JK~RcUowIO!du)_T z!;3OyT09gejnSIMcxR+JI%cIYo^Uk2Krwgs+fd|Z`(fJ{@gT=LI*zQgctPUS0ijVi}O#q~px0h#@k)K8=o{Z!eqnS!nZ09Fpt5ZF!V|Ab% zR3rX^%gDMqn(yKkpIdm@6sCwHQo{*Grk!PtrY&L4S8#O2#Yoji(nG}4$+lR-6uHuX zao!6Noca=r3%2Eog-pXDem7$g{}K@m!q)GQV_@g~Vc06dHgerNti8MGn{1j~VKnKEZ^=E&}cFS=fDpwmB`cN1y#U*e8Ns2K7&eEg|UO&%-7bv>5h+mxFfx0&KKF z+n$L$gSPx4ctC7W-UU4cI`qr13k5AZ3*`XqaW={U+Tk4FfVTJw(UG9_po7mv`k+0| zL;9c{&xcJrXv?qStpLyl(Ad{dCeX64!|oTf_yX7=f_C}_U_o17i1z?Me*let6LCTN zU4(Q&OD;ybpdBs&?ziyv0B8ef`K7SM1>JNR(Spli2M(HZ1>(Sd^(fE=(8#x8zY5y_ zDwG4X_&c!62JLV)?E68pt|58}bm+Cf1nqkr;(@Nco@nlOVe1Z>eFNGI#75JTpyxpo zH=^vI;qSqY7qr(+nLYH9o52fO^nK(RwEHda2Q9r7Z3sH(HslAi{C2brX!r-HXVCt4 zpsb*)?*#5$uzd$@`$N240D9HkL@$C?-h(tid)^BS&^h-ZZ}+3^Krez0{SjFC_S`RwpXQ)@urH`OKe~$MR zKre$)(l3$<>K|4JL`2lVDIPw6R{ST80necfprPksCl6Zm0@~*U)Fs?Ij)jaJhq_t^ez>!a zM|*>I$KTI>1a*w?rI$hWP-h#Eukj~P=b!_A30~09lPEiA$6rDAKu;l$3pOAv$j(x< z`<`fnC8wYr?t@ID4%R_FPQ3*7#2exL3)+~TpkLC@=yCcvJwlJtFX%Dals2QE(yQpz zv^o6|Z9#ubv*=G~E83F&l>Usirq|GH`g8gV`b+vN`fJ*T{)S#lFVeR3I(j|Lp*PTW z^hVmA-b6dln`uXS3++U2rJd<*v(38}p<vT1y*fk`AN8 z=?FTK{*8{Jf2X7ALv##%m_9i*(I@DW^eOr@eTGh^Q|LeG zRQfEPMxUe8>GSj}I)lDIXVMoj{QMVvna-lK=^XkBolED@`Sex#8hxEEpl{HH^i8^m zE~ZQ9TXY#+N|)0WbS3?szD-xrcj#)mhOVXS=z97t-GGjIBRxgGrl;u{dX|1e>*=@j zJNh2oL^sp-=@z<`o}=67cKQL`L3h$!^h3Iv?xB0>KDwWNL=Vu9=|TDlJwy-F^Z(!4 z|EF4e6RgIjVH>ZPaFupM*?NUHZ{e=hg_PNuaS8?7(9~A8{BG1`r(l<<7I6iZ|6)~U zw)(*tVkCxtP9P$f8!b{b5(zG4vM>3}38rtIFJny8%3da+x0u$HJ{DHSGTz!YIg9jo zQqwV%FGwkBoMAT!*l$1r)$Xu>fBN?21qo)`NN?{Xvs1!m7MZSN;9Zcf5@xn))9!Ek zY}Pq!YFq1)5|Ewfhx@x&#u1adRxe(k2u-&?B2=-FF33TNHUm(J3P!9dX38Qvq3JM= zp1djv!%LVJi`232H6}sEV%OJHmNX0YlGMkYl`MU|1g2-O>m`BC&o`Y+;j-fkK2Gss zO~bs_<#-FDbWl|WilN10z+1_HQSzD|TEQYwva@*UB^Vze2Q8#RvB)X3yyIDpuj;#J zdBVia5E4z>X^uj+LPQKq&ekvFGJ)B-zcK0yV--te1v@;EXrY0f(pvdPmL6Ng08fOM zwx^RkRW0QtZ(Ly`VpOz_lbqABb<6Ry#oL@PIhag1w6YyhkjaeSEakLGKidf<;#ITr$tC1j zzNmekzn;p9<;CKKfH~GMhC1nVnWL^n&D02WEnlWan68=1)G1HHv?NG$TBadE8q+ZI z2vXoHh(fm;hK80NLAdF_+5OqfI#NVo@yrIv%w!`BG6Si)Di8)1-``cqCM_zUE|1;T z5D?J!qDx>0#VX}sWI))|#uR>9W*AZ%oP2VLjZ8|7jWF)cStj|8xev-=8K6JnXtu~k z1|ikW8GKN^pDC)iDnm1G!QF{6m*!>q>fOG~OvCq1-+=eymb>6Cc}ibd_n5Ma z>lLq|ixi44mKR(E^LV@Z=C-}s6ov*@x`JT6^o%SH?42riLo47_ccbF>m~hXj;?1fc z?c^;fjAdpJjjiQ)MPkCMT$}f@;4aTk>-Kw)R`E^t!pmKaX`8(-RcF0M% z@^(j*)$Wmt^sCh$%BhCgGq{h;UQQlaSh3ShDS}m4 zfeP3Q^Oe6U$n1~gwCV*og|Fvr9%9ct<4WEvEUw-S!?FUqtNK=L$0q`|0<5p6%+1m= zI$&NMnxiDA#?8gyf{VMlBIU>f<~eS6zMKo<2IG}*E+C?)Er{b@vd%>?%GrEC>ZxPY zNlYOdNhEklI~OC+5&Ge3<~71m9sBZG|AGTFvDu ztLR8ef-O*|=6I8p1pZKksuBnkpt>M|FAweoA@ZH(+NYvpSV zFQiJ;Mdpo{Tc2ZZrh^L9pe__$h7VZz_}1FlB%U1BjCrM}43O)3(;JK41J-<+#i%&7 zuRj!9i?!gjUvm}~KIfY$EZsG5Y-V-3IaQ|dk0>#-p!h?%S(s2q(r|}6dgCvYlFrM$DJ%W#HqUh~uu~Gn|2o!-BzteREHx+O&LSV&)xr?oRbqO%<{n2g zzR^cEePy4H8d3A9ki3E~^VZgGcK9>*L5zym#8Ts4#4@|Ux=OM6Dm>{G8@QBOL@(8# z9yT(WdFS7s%#yQ@Qz})R@H3L(Cj(zrVq_X*FUZP8)YmnvA8aHy$Zn|DaQV`9S#}0c zrDNSn5rR>=xg?Cb&G#wbH`{8v?RH$D0gMRAKb|O5EnW@S4iWV&$P}33>NA%Gr#N$d zt`~V=p0dov4my#l=$wKqi=I=BDQ~sLc3LlI#~lO+by$oK-;clx_PLk+Ov6M)g%L~y zzvVbYw1pjJ*k35TY(}IKE35Y6N9ye31BH*_S@o7k-)f_D@w-RM;wtv-x>?lPnLxbk>XE`nXV#LPKr&PO@w2o^0WhxHNRBea)L37bQO?S zEop$LQb~nDu>zqK>LlZ96-mY;Ty}!fbYrVLGI67eOfaZ{D$~H2VGh1522NFE(qLb! zB$A%qA`|R^V#q|r*phnTDtM*JaRrM_02C|`R|(aRVuunZ|D2Rl_n0_N(PMlt`1{X5 z8Rd?Nz_)dRmz{itj)`d149X)^;waDHd8N$HyowTi90@a>Q`zYFzOu%6MqfaRiK|r2 zC}ydYF&;tHA&Os7>UkkNjAiWyxgFL3K7fd8p(_k%w~M^N)X3rBpE9ge*VZVBAB1O!k2vll}DD4 zISzHJGAk_ZG{Kz-*gQrQ99e=k01H!Z{Bp^m1>G{tc^k>Hlco!@FUr_3Plch7ZJgY@ zHId+8dn%O@t|FzcRaL0Oa*xMoU;l*|<*79fc4J}}R&kYt7!4! zgbD~wgZ*$Q;AXoIsg!q}pZm6}_TOcAY)qNSPxZC<1-mWK-;FAQw)k<9`9r%ywAGSbc*Wh^e!dBsjUO(rdPQHT*a|{`YEF?`}40>-Ubf zx}9EUq(5iJ{oXQX>E8RiCkqb#XEf&I6ktECer<*SH&ed^3=Q%0g3N9<>x1+^|6}l& zga2{vHYQW%A(%uZsV!mlcC zA*7^K51YSmH&Jg{4}-CPvfdIsY`|0%%OdwM`A_t)1;(G_-E02P?#$M2**Yy0#maSR zMRCp{TafCXOE=-DO9o5!9y63s@{@#gC$4DjXvZzGJA7@2dgB}qW>yOhifB=FGl zvR9x2D`bH|;&&;$!R&by6w-u(HEEw5}(+IB$O%%J7;>=IJ^E>*h&yT+yG4M2RAK@4^H0%RKUYKH2djNCt7Z4mtn0`>3` zCEVQLxiuoMDi=vHsb0dtx$!#P5heU1MpWgA+qlc3ir=N$GKIT^#f@K^5LmMCrEmud z`pBD6UVgnKE3d)zu4G8q>b+%Qyq@0#+*uaa93hH5c|FvDIO-dL`X@P5dzqvjW~7Qai$QVMq~ha0_OBd}&vhW{*vn~fNJeMiDp zm*K>SzqP|PSAFt}(ucEj-_0}!z zU_#3NI*OXVq$Z0kewUK6!GhW0Z7B6N34D72P5@SywSh#P|Bag`%xD6QfxcZ=3w5wy z4BHuH-Zolh|2mlj7r)EZcfs0Y9bfcmq+Fk zRC88qujI-Mh~MQ(o*38O7{||DAQhO^+qyu?w@1xypC4IJel>ea9QnIcnNu^@o1$f& zp_!{-OyT{^4pCftt5#NV<+WgH?fd2^uDh};fyM7q^_&{NcZ}nDSFZ(L)Dc0=?Ecv?>ZmNEFvAE&A@mh$9apUa*(M}BR;VubVU6KlBMLtoRD{#ey z_g4&Wp1>2g>FePoaV}RYRIrr?}2@n{$zo+9h5nuyckN0;qZm zr`9!#LR5JfsOCvPYW2LEz}1lc+j#X#oY*P+Z5~%@0Eywv1KjHL`&}DW7@m*weS-1`aT~I z7h2nsFlmORQ{DY{YM$IzqVid(XBbiMj5sAj{}kdz4-7?J*B%e{^AJPBS%Ea8{qy}k zYKK2o&rKQ(L6z6HDgDwihnctdl?APin%F&jK%n~O#1c~cF4dx`oznge(HMOCMhpUM z8gp4m3kaLUm{?p#@C!a;8Ryf5~GyJKaEpMJ8&O z^*|rj9MjeBHHq>5Ujs~K;aj(iiFNcrKHiM9WlDZN=;PrK$C}KGrkjTR6pRV1b3QnZ z>Fkf|)^DPZHhk=vTm2<&fF0svx_1O>)o^MaZCb?ekpc-RewXT-sU7ZeiD(``5CGLB zD5VW)g=pUE3KCZQE>*@9>aak~zuX{@W^}F4wy3#RAtYqwSv%F5BM#F&IZ+EOb&q*P zh}O{WS=2*JoIkCUh)O%)J(f`mH#KvPI^5`!`Vv_DE+@H(S>;fR>%H~9{*DF=Ncc^t~7nfs&zY9uts<*>b4t4bZa6Xx_W67YocC&ZMIGP zPL3#}{9R6#66YHI0JAebGPK`pbz%-S5P{=kMTX7##FNbqEUi2cLN zwP|9+KP-b0Bb zE&t}@29H5W;T6Bj_0fb39TlMJho%I?G*%6Xap>QDJn?dpU$r6w<;s|t(~kBr?f$nO zVrr!SP#kf_?Z>0&=D{BcD}I+M^FU(eJIO;86JOnv(8O5$2@lgfM<~iwdBvZ) zEBMI>UUsz#lP;zqe(JCmc0v8}I|QF9#5ON5)kZIze`DJ%0BM%Q{_UxaVjvY_mYC~k)Ikm zV=8>{erlaOq*fhYD9S_81W~zvrdE4rdg#%IUuD57W2f$ge9_15;_b5R-TUw$t~zRB z2k|8jHTPs~z0xLdzwF`W-ovejTQDQB4dz)MuK(Ds1Qowa_3MQZaj4G&oMKj#x0S@=fb=eMEbDgcn@vm9k(C z<^AY+KBm;H)kIBcF3s;WH^QURe>9O^jToZDldhb(g1zU;^Mtz+~jf( zO4mV5>D<3A5zS-O60Ex9CeC&*kZ3b?Uq2zW--zJp*RX3^O{MnL7fRHbyg^^EreiJX zHzlU`KDca5@w>LHUL+B{x5oua_1=*fX)g{D&Aa9ju)4e!tP$s+Rxb$=U*Q|{-;#L# zgY31+n3_2+m6$kk%Dwhp3puq0yv#@TpOUYKnrPF@ebiU{F8vh}FZTw%ET;Hfs&}Tw z^(!5!dtYAwOym4Ap@;ppMU#*BOE~enRM`d+Xje%z`?|eAs6Of>(7q$l>_-RcprzXF zYKaETk@}#41gkv0Ehsp5-WKEAH4;sKEkS~b-=$hDg>|iurM|=<(y!iTiFyCJ0L%Nz zg9NQ!n+3Z(e);u!iE2KXPzx<}fAPB(E%-h~J;cPwd4omtKYk$r#qUxQlPckV*w;s_ z3N`z%h5(tyI9AYtY$1H3E1~@Wf_=fE?us$7viY9C^*#wwucV2Sftw^^@VyZUDt?!1 z&xHKkY%z%0-6qjq@mcA1 ziKb>H|A?Woj3j2jANW}6vo|9B%Cl0c7VnT)Gc!LVPKoYxXuPPmC(3nSvq;^1xl3Y> zt;X#l`^6(!sWaLWekd?oll(m({>GDp6Ti!iVFmKSFJj%DLz7=I5=b%!rBGAnQTJF> z^BtRF<3f>#Qn;y6=3a-3a|~6t1NG{5uwZ^*jrDy3E&gREQMStUn>w+%-$QP-nz(yy zz9v-*GqFbfk&o$rkxGJA?=6XW{{as*Q^?OqNfVeq_Au2av+M`3WI@I6a*~_Cd@zq` zKdmKjW>kuP;$ixq0IP+W7>^$EFvHJ_y;7(@jiJs={U*x#ut0T>1I)xNsg#cPXHnGP zlWVe~tM}K$x$Yw#x|_uPD>MSWRL@D>*8O=DG54)F0a<+ymO77o)W^5`u&kYft7+Bi zI|_A7U_N}Jl_KISm}Pw3S`OsypzcZlXY4R(7SZdpVo%E?v1IU0ZC zE4OTFB!0F4+kW4&7II1t{u_%dKa&|gxgp@owQ8cju8$&`4|58n%B`C!=WiWqPt7%* zk>O_Ua~A@=TsadbjlUC!-UmemNcH(VrR96hB1XPeS`RfbDm@>fy6>IV{yI-;_4Gn9 zuKdnwt#U6am}PgzEW2R}e02?(jm6hA#yca;(XqNCWx;-a4)XG!CNIGUVrAjQ?{c!8 PSS!CM@w|`E3KaTZILdQv literal 0 HcmV?d00001 diff --git a/src/WINNT/kfw/lib/i386/krbcc32.lib b/src/WINNT/kfw/lib/i386/krbcc32.lib new file mode 100644 index 0000000000000000000000000000000000000000..03bbcdcbadd156913b2873f0ec7dc574e5179934 GIT binary patch literal 6844 zcmcIoOK($06h2N!6HK1YJ3MMyTG0(9u}u=GLWY1;L3STF5d zPJW-Zzxj)ci}Tsc((;0>zo?4ynT*OlNCLnjK=LEN&5*)DWd}bLaLaO>`NKD z3?SqUrYI?FC*(P%BnMK)?*j;Vk15JTUdd}rQ6{mSkQbPeU^|kjdrID6iZZ>V1lvrb z%$!m35>u2}9H)?Hn38;uGPemZx9K=HZmr+mC^*-y-&xtXv0k{n;XJB8ER`|~;5ch{ zS65pN;CE#q>kB{LUAyUAyHdCU&dN&R`kex{^mg~0K&e!6N|jo}1;@`xJ1W=RVpCPA ztf?!zjb^>}t7vEPrgp3Dy3X2)<5jn6!o*hCb_i2$_*SZD+f<9Yav-83S+Xtm>Rz?v z?G-D2PfTTOx80^SFsp1?m3E5NZP#gf3Yjb|oo$ViaGtvLhF7bK5eRcjY1x|zkzHUu zq+(;ood{@5PhQn)dc}(On_L`TG&Yr5>5)@+A3wnz6C<+~#;&&K%8|>A(bwJG+EbUD zp)8tPWnhVGifbZjqfREVR6Lpp=~$lLsIKFjZNJlYhnHQ= z{#9)JMen}ZQLRuuqKoFL5x&xTvGDffA(k&-Cqif4WJ+l|4qQ)I&G#IO_LYMQbJ)DVzLY6N<~oc=c3%~a#qE= z50a~iUMT#V$qy!w8B%oX+QJf|!eZ ziMUI@IoV$E(;ds-v*v#R8)FI)5`=+dEU(M1P%_Fn0yDud6+J|u$g7ycbiQJm<^wnw z1|v&J9DUDoAeN7}YTDTYICQ3tDI5_M=oo+jKcyo(5RcXXJ z&aik$$S^uS#kq*{br$iG9FK>a9I$hr%!RKeJ~HtoDR+-nQ^c}eA?5U6l>tA&zy2_; z@{#-ioWrqvtewlYIcq}-jRoPX`$KqS8x|Q>SXPAJ9hweo0_%u>9pIZ^uA_K9bcfRB zl#MDB{x;!YEFWvHauHm04rer`u)^Lw45#yx7IDLTg_x;OOnOswg&1+tzDC6HP(<;_ z;*cGm?p(w!ev6nBEtvc<$YEK&>;0UJK<#>UBhLFbIMb;J%p+LeHk>wXQ27g)ttI!S gSnHaN@F3#q8I7i2-yEo8ziAgu&T1s_wC6DY0c0A`d;kCd literal 0 HcmV?d00001 diff --git a/src/WINNT/kfw/lib/i386/krbv4w32.lib b/src/WINNT/kfw/lib/i386/krbv4w32.lib new file mode 100644 index 0000000000000000000000000000000000000000..31e0a63522cee8a48388b781e0bd33eb7a34bb01 GIT binary patch literal 19668 zcmd5@OKe<47QIPGm}8G6HI>O<4^mOzwOxhx%0u80GWZ8c6ZzEal6}ew+TT= zvx!(C#DXPDq>)&J4MK>K5Msf05F;@x5JHR;X*P&emN4hmef6s9^?Q|WcSf3)uHU=2 z?yFP(d+S#DsUx{se*W0{16}T~w`XXmH`9MG)8ooDo9Q14U$3kuqK}ET-yrJ#k!Z&j zqMc=-zUxFxyE8(&J|kl4`$g!$Eh46#uZ4P{$CUX(XkZ7CqIdBG4OWB>eNM!5_BwC|2QeO*4xJSm zL)n;)e!~<5XU<)`Ff|>FPdtBO>deLI3sb@5)YzrWi~W5R1m|DKW}7wWuUbVErcb|c zeli#zogSrNyj(t)D^*5%`Sa4^Qjj2-e{QlibEZ;njPy|8FxmQiFi~j~Yr(}_y?(V? zD+J@ET)8?oGOV-ns&L|o`CMhL=+EGGI;Bdf0o>A?#b6;*31>Qud zbD>yo1dW9T1?Ejs=8BDAp*F)g28}nM&?HFI3yPIS?b=ADN#7*McMCzOUP9ASVBSnh zCAWwQaEiQ{lv*)YUX-NpHB4j0U@2Ft^M^JQrlT%gg|f~d#=BZeSJ8UXFx&|Ip(S#4 z8?!+yPa`p!^{`=?NxS)L>0CfyaX zu1;wv1Bd z7wXHH2&`uFqGb=TV7aiApI>lCT_jA_Z&udJ8s}{K-sMbQs`GgaOGXxJbg*Wc-ijEL zUcqqV{*WvT=W1N7l^Q(bQ7l#oS);?ySQ+Q-qG(>U%295i`yh)xsS%T{VpHRJRh>~Z<>NA=EiJ-R9d@bI2$zUvsriDJ@vxv#3DLxQ)$k-s9^5aON?0jn zO6d16m0Or+r7XG&E*t8w8zI9jxK>@Rq3Gh^Aj9+|`IcKzdm|`_I3u&mmAvbV#F9+O zxq9}9@V+(>I)w0MjxIcsRMBwNkr%BRsLqlE$ngM64MT)N|JoLTq(VQR)#+} zx7Y}ns~0hbQpBcK@Db{{*|6#nW74^8*jk(RaV17mfkTtir6pa7(bPHQnllYWMpp^A z04Cd*$mn9`nz}@cN#`EKh{;zgvr<4uAbPxfW~;fvWNjvsE#~U;6TCf`=G{SE7T5Gt z7b$XnVX}+t#v06oB=_5}l%d;e6%&#sP37yls#;`p>$%s9YI0$-f%OJ;0S1~YE;V21 zb%FK5_x7VH!%;NlWg@ztph|~_dwQ5^hE|S zmjR-8L6t$G&#^Cl|1i;&qeRmuh?d5P-aJFJ4s;WA9(&-=K;4r>?}4r#C)x`72zhPa zPxLnOp505dZ4c2W`w&kUC;AHcbPr>1k9_+^i7t--AN1)E_Vqz^bB>=X&RvmG)+BpfCgzF?WO&+g&v}Z=@ELAw$fwNM_Ky+ zFX0+D4st5ZuZ-ElEY_9u$ONaR$3|8X#z_s(q!w6aeyrG`&|7$;lU@ZCElPD{*}6GC zhh(Y5?ER~)pY{h$T8iuHwUeA@tDbA(hBMuDb=@XY%;v2o7lOBG_O{vRvxku4(7H-Z z{)LsSHsjGYJ4y&6SHiPh5r50@yxK?ct3+`;DurCwj)zeK`6Rw03Z-^zP(-%-%dWEc zzhN-0Sw#wmaGiL_qLAcd>J${tIPY4hqiBY=BPtw0Q}#15wYT%(Q$lB{eoFJMk6WF4 z14zoh4NDeE?LN|)+B&|D*`8PICgu7?NRFSa85| zx$LqqbzPNYLW~>YizC-jrQlg1uEHwJBuUWMf&)v92sgv8$Zqx2UXP*-~cX zR+MF~{bY%4Ihn_pcWfrhJl0YtH`z&*;95wCLfdG1iQl--BYPMV7)yu*%Lc}+pK}c6 zwRm=-07tei$;!o|QRY<0oB~6oy(Z8g|Qo~X@%#Rjci58*fC3!Ma(j=ZnI5L(zNq6u>-bBboL=ad+pZ}ds$+c zJA(Wxee)VG60^E9&m)eX(Ynrzy`n3g=a4y;(5tv!quupeOT(2LJ#UWk7){2ryH0CP zR%mbxi1Rn=h#+}APCr@KNACLzPxe1X3{%x=;wTm`wyc5TD4xCZFKFL+TE2sa~`pk zgx?0p_)E@#gB$#|5r5aJHya1V;BYg_yLQ7X^!x7`k-y;|7jQM{YL5`9BF}4ysvsk+ z(UJ`7KtPesfRV8LDgG1wIClhULXID+5%3_`?Un4{(}&A?yUMMMm%f2MYrL#h0X2K_rm;cc?Xr*tTKrvG9wzS=D!@X9!$vpcP0HmXn z+s!l25DAnY4@aJ7_RpGUh#Ja|_5P`u@Og*Zx0N>C2IxCD8Z!f7qjvEfJD#N3RlI^d z3K%RZPJGSoF=~6<4-6+GA^eO;Balv|MDH9}n`vdXWl~Td2jV$Kbz^LH_GB}yU=8*s z*AM|@wNM6Gn8?()qm9;n>kjHgCDxA!fUD(NVW))z9cY_rrPk4M7DMg=GD6}MH1B+D zh_+jKKwl4y;qk;iOaJS&9I8Je#> zyEIxXK+zfEU?zFA?giSIMobTXIN&zZ(&$OCVQe{-OPdy3v4Ps2pT2dS$E{jt-RpuK z;bl_h$iu)|7vf1&$bo5p-g|H^Fiy1B>`F{aB=k_hU4+mR0!BKIs4slW}-y^`dN8?C1)&a7aR@%)s z8gab_^+`SYwV~Rc1sTsw=U|uf&lnvc`7G+66cQ$xdr;jGp3f)az?eEuu}%^ku=eMe zXMJX$UZJsV4bLe$MDtjloi>_^8h420sTl`Jqnd>$5uKs={DxO-H24nc1jm81nO0_< zZ=W!ifY#^CuNACXp0>Og!{fszyFTrs`DWaF3{5RzvFh3At+b|Z#@%bknl z0NY+S2U6@S#~_}w5plW|9fdlOHq%Pm`sV!oF~kJJ-gXUrG3LK$ygRdYrbI!zfO1(Q z=>uUoBeol_?NRD$$(Q1I>Hyk-YriEuzKS|*;r*mO-gcmDrj;?`TU*#`R`bBzzp}G$ zyA^#N*ozjHI#urs$>TNPD!9}tI`wy;+V3mRoX4VL`Np95wyE%laXTyTU+^_IS{ zU}xTbU!}yu`Ml_ag~YcZ9H92w&r_#ATS%Rc3ZHFzAVT8*+m5dIIaRZnR(fk7r49K^ zp``JeZi(0^?fVKouab}N)d`@B=)S0XI*{i5Yf|zFKa~SUQuUwzSGk@LFS>En8Jf?-JgU)nXU;9G?{hhjHq*-N@YN6h0w(pd zE{oauw?8+0QE2>ASBR#sqIHPnu}XY(OSPfCuIxbBOe<~Zvl4vQM_smMf6uu^XQQm3 zB|SdNCL2@k=s93E(@On(@ymx83;P|p0BGmDf;xG6Y)gp4gTFaYWaG9}Bae5vl?RI>vk}&vhybVTs<`#o?_(@=@6xG~&9u~dDP9pH;9o3(VlH*sdAHwo S11TedmlQu38i2lT&urYqL~ literal 0 HcmV?d00001 diff --git a/src/WINNT/kfw/lib/i386/leashw32.lib b/src/WINNT/kfw/lib/i386/leashw32.lib new file mode 100644 index 0000000000000000000000000000000000000000..ff059831dd649594b9163a4fe136b0543c029c9c GIT binary patch literal 20078 zcmc&*No-tI7QN00CLKazx*?-8PmaebPZ>NU8z)8XRln|8D6G4yZXh?*O~#~?*OO2066;t!1+@E z{r5xp6~9s19t*kfDga48VNeFvg!Fv|Kr--1$c3*FhthUWNV)((a`o*{e!*{)zCj_q zp97E#PKQFjQD%^XB=we%t1WmRO2;Qc#$N#-xr}8b-R}vR>IEPfLfc8&hlPxO4?uG9 z10g-=JIU0iLWa>^lFoBN#?c3o%h(kBX4@a85)ZchKPryD$P{^hwj9RYuhAOf&3 z{qp>*H$Jj30^XdTS-vspJiS=KdHx#~XrK}3?Cs3zEr0D!POn)} z8Sol|bPHn%Y&RGq`)0P6N<+_b{(8Aod{e0?E)7wI{CZh|h@!{?Kf8<$%aH8ts5C-_ z?V`fsVu8Emm%Re^j$bOR7G6!Lfd=(b|XD`yr9K6oyj=yGDp7FUSPTPqc_ z5L6ICkESU(tx6_&=7+evPPf_#Y`@CHk&CF z7Bksp*?J2^+`o=JbK5Vhc}sa}TyCqP5_sw^3tmwPd^x}3ufM4_Xi}Qgn)8=38wHG$ z{E|<4*%+!^M za6PX>_JgBzPnL?MJDE~WJaoJg-W3u^_eE0kI=C|u$mER#;I+u^NHE=>z+1OB45ItO zl-vgH34@sYU}|22>;(hqKCI%?ocvvo~pSK#VZjA8Yyj ziuo}{w|-;Y_i$cG*{x3yy7h^Uvvcbcgvt6u%kP)1PcXXmG*@^l`Bl612|~9%(Q$Te zeS$DqpJ@60vh@kZW_?CkfAZl~+)W6Z_3GWa^~v2P%hdaA7~T3{pmH}pgXs1%C2v0N z0E3A8W$T!l*I)%%eNY>LcR@&!w4%X4^?nP);e%R((TBtaGO$q0E(fbN`jsi?i>rn? z!3awF!l>qLNuC%%+!rH&*CM8}3DmC1t}El?gs^rB8;uJhBYem~z7eQ5uaBl08aLn02egvX@!)My}6@ zfo5d#=9FJvC@%Xrv^tfdO;yP3jnOn!kk2mrWwfA@-dxLM$@fJSbHQd+twq(FYe8F5 z6>O38=30UpR{WcO=`Vh1K116R)f@xFT$eYJ{qsh?;^Kr+mR$KvJ zdseSI&g#tqz!#?hemDzo>O8>xet=(59%Jt3)eBgLzt;u;KI;Q`gx_Cd**(-1(g1H` z9_Sa8LDYSYd8+9_{6;x71Mn8+g<4SeNe93y z0X)PybNKrp{%%38hm&X{a=nlDj^ghf`1?n^_W|1XI&!~*ylq&|&&c}-{ke)hq|lz9 zu-*bT%;GhG@9_KEIjk4u8@$F8DEtm~z)si&hoJ{L;RQGWr{Nq7KrbACqc8*);P-F| zcEc!)!CrU{n&Bzf2HW9jcn0=C3yec6q@f%3!znlmZEz9#;Sd~$5$J#kxB^EY1zqqW zoP;xQ9tNQg4#F`QhIV)!F2f(73AX&-ZFm;;z$8q=RhWS(m<9EEYcv+cxh}0hq|(HQ z7Ne+;WyI8c(=E1Budv-ymrnfFN{cd)eh{Yd`>Nl~==Z9d0A8=Q#xN*pk*n7#?iA?; zi&o4iy3#yPac0xXo8^9zDl5$FEb}Msu}^%VK1u&ATe4&oQ*z5{!jtZZnvi9Q1!G*m zf=`sO#468^){u)64E7n?Geoj9O$RA4ZzWm&nY2lK=vp4nveppMGC#=RPokzEOo9msWB_ZgICYxS zOlLLvMvV7>8l|?Xk||V0u!vPv#<GRE>08bNOFY)_)0D*aiML9VA!LB?~3-0^IFF(ynZK9Z~gc?rOIILI6%Iznwk z6`=ElJb3KRE0d2vz_!7a<+}C zR9i*W8`?vKs4Zd8OKqU)D|l}|*%TdlYR?r4lYA-b~5T4(At$D6#E1Y}WGyH55 zU=}L)G_~ja#f@7hZi-7hLxw;87F~qj!?0(xJ)g^zGbb>UCO$3r^-q-lgx6c~dl)*u z3~`t}6CXV822IEp;iz;NTEEGQ)b(D?Y)-ImWu1e zrE=?;8)sYRX67kbseg815#32OU~(|{wFm!h4}NhTGy@L-t)ac!cl`-|`z>Omd+0+3 zZh^?{VSvEo+fhm2ATe!?N>YTu0*Eo`q=d?k(x31{wPUh0yrQoyuz-IXeGsmhyIf7Y zbf>#nyle^L%gL;Ucg@T_ z<`ENLSL1t7V{5Z*Bxl>iGwtwtw}U&_o=VjGqN?_`%oF&+8{f7Xy;gR;oN*JLJ7Ro~ zg+JO&*T?Ldlb@5BlU=$*$uFvEYsV3*(Ghc6bvZYm-6YwYrp2~=y8kUjKUNB1z^NXq?DgIA7 zdG(4%Q}E=5kzY=zbHbWq$+gORAz_d6^b%RkZJo0Cx*vUgk+B6Y-X$u2QBAA5_5}MC zrUtCgE%Oa+<_{Ryp6u%UpvqYPUck|BhZtM%c7=CU&GDFawB%vN#9!J-gf+)xuVcPG zk}#TI21(TXqM8_WJq@i1bFeaz8dAEbhN;)me>BD%wm7xA5pMo^y@YF!GDl#_hNqo}YKJ>&wTQJ-1}Z@BlHM z)3tcs*j<++-Y-}!XwbgP((lL7`*sWWx-@%j;u&*{Y#l0R!}ngUJY{FX{$%D+%g%`M zlwD@-M$MuQ=580WIz?%FNuj`O~o`O`EwJHG4YRyVt_ppt;lG zbDx>HQ8TB5x!=jGhIh@ghhyv>a4`qR_c_}p#!-jYgAVQn%$b&K66Gl`nwc9rV>)8| zl7+uP^QC1>p?8OuW#<1up7M&!*zmd1m0KE0xM{2o4p!G0&yHRlCN`GAQ_ob@$Lz{j zju5kU5~)5uSH@zL_|$Vm{0x{x%`fU*=Z~3~l|xjVZxbVyBU3wWV%LvoNe1wXdcB`8 t@hj)QINv6`x2&~kk2Psw=cmi+V~-E6C|Pp+r%U{AK10k^IJ+iW^IvdT2wVUF literal 0 HcmV?d00001 diff --git a/src/WINNT/kfw/lib/i386/loadfuncs.lib b/src/WINNT/kfw/lib/i386/loadfuncs.lib new file mode 100644 index 0000000000000000000000000000000000000000..979f351f6c8901d7c1a8a6a455b29a4b469db786 GIT binary patch literal 1646 zcmb7ETWb?h5T5O(ZH(1Mt>}ZwS{7-gO%qdVy&#EABbBYzrd7n%ZMr$Ft4&ijC*DwB z>ORCp@Imkg=uhwmL@JbmA}E57zDh+qXEe=jVPN{@4Fn+^LX&0rudA zK|sLYA7lIyv{=xeu zAbc#s*>zrrm#|ycaDAkfAvNQYU~J0smv%r01K5Rm9mPdN>g2C4HJnaPDig}cu|u7s znKMJ<6P;26cuGl~OpXp`Iwi6>3+u=n#)b~5MN?O=Fmsxjg`%1_c&~o7s4f`AJTsY^ z<(JreRxNR(uE&3A{UB@!Q&ugo0YcE+=I*;k4IRA~X1LTf-YuP4;6~oKY0S?`Lxuc; zF~>{*Tag3S3g2c6R)ue}Ym3i<%TA62ls?-jIf#PRvD#KbmtHJ>3?kNHRhCn7fFR!D z>8IrFsEMZ=3``rg#Vk%+S@tBlOXRk&S*5XH6T zC+3Ur>*|mEhG-2)2~Q0Vw5A#P1x-tvj48&nnKf@D`Ws$aSALxFF|(j2bNGT4i-|$- a?C9C|?2=^YYG)W9HqC-LTF5a(Lq7o6>}7)h literal 0 HcmV?d00001 diff --git a/src/WINNT/kfw/lib/i386/wshelp32.lib b/src/WINNT/kfw/lib/i386/wshelp32.lib new file mode 100644 index 0000000000000000000000000000000000000000..7bdc3132d52982c4f6736eb3d733d5e8c17b255c GIT binary patch literal 6982 zcmcIpOK%iM5dLfj2*%*|6GN5=A?IRj@2)XX6b%6+BNl^%9Oj1HB)Ble567EnxJ8ps@phY5akpv3JBX zofS0xhU7&3uLO;}1(+tM1x-8$m`08Y8h!>a4F-}(caUg!M$k|RU>aQ(G~rNvq7l+( z8n__oDZPmXy9G_YCp@MDK|?R89il1fTSy+gJ=eW)>(1@fHTT-}yH{6l+*!N5>i&Fp z`FiP2egUq#a<5cs*1+#dMJTK--&?uqUc0h(g{o9`_gpvd>u#l5X*hGRzIEwu`+o4m zS&-$L(;9W3moZW?SgjM*^J=^0O4V5?2&}kFYw!LlaPo^n)8w^Q-LHDiyi|!8QSMdU z&D!o>*eUZ{)+Ukvc&|+L!-3hX)Vc3Bwrlmq#*=D!*LS$jO_I1~+4BNtp4LOFMk1lR zP4nHTxf>ONUV59D;)3$`2d)-3hb;*U|1Nq+Blfc#~;Ke9#Fa|sr z2j0>9EYTbKe$@}W9Ra2%f#(yzQTl#13V%HLDH z1EQCt^JWV0h{)Ze3*G3&I3_TO0Ssao(-=ZOPGJluFoLh}HICpIj^a2*aT0wvjVYYP zna`}%L;mt}{IB$~%^rwX)3#c%dL(blD7E!`dgE(dYCX0~&`{y ziZid*I^tqkg|WV@60NLY1dtWXqX^x+j?G?MuU+D*HLq9e3{0hFv);}Q`{GY!y@kt{ zW&XR~Tk7h;#sBh7e;3Hpg-_S4=Wp!aKYv%Sz*YL7l+t<}4E!`(@ydVyM(9oSneSAn$lSEzsH$HpE;-*3=bS5Aveg+F><~~`i5>* zHiKHdw$;eZtbUg(-B`IPietZh#B)t<0p!s6i=qO#b^bDOs2iN?QGbv0{eq7l6(ZN+ zhdbB}HEah6yS%L=;Q$$_M@b5-LjpuPMJ-|ZIsTCkw+?(SIev9xjeb8bV6--uUUSIp z*vmq3!LXO^&|dxwyT_eGqP@^j!+H#R$*Tgkmp>FE-)t{m$PU_B+cVUSmS>=j=WS`; zm^ZP{{viOd(8=?bvd@ZYs@NQPpP7%b&k9P;dVecMz7KhR+nG~N@ea`%3(;AAo$^NB zq@^zQV3gd29?Ui3nz>@=*zSvJ`EoYWH-toKCc;eG%DuATsjN5`!# zOs1VZ9c}3tR*rBe-43y00pEnM+-5s?g+;j)VtAB>hw;EVdS*gO8yOuUl8&#L@CquJ z#zw}jgbp4Np30Xku#Rmq4UOkg9nRG`FdJI2ki2T&5)y|{g=Xb&7Np6vWhe4vn6wAz zh$s*#1Cw_eX7iofWC|814dLi?_L&VU#r`=CS{D-8kWxm)xs_|@&0h?Q4%*_*O(*5q zuu}X!M^y9H(E>WuJw{i!0?9Z}WJJ4^yvI%x5+{@4xT4caHmqVk8H>|UPKPy?J_}_- zOp9rppM;3|q-BAbOk2JqWsh<4FR{d3ui5yadJejXQb_8ImXoHFSWpx0} zhL@7{@Sh~cm9)I2u;4o0ZE0B+=X4=n>j2X+UZKSv;H-x(4hc`)#%3H>O6;7Zdqj2d YYTedYkS5cP{ij*Vl!0j6{+bZ@AMzKny#N3J literal 0 HcmV?d00001 diff --git a/src/WINNT/kfw/lib/i386/xpprof32.lib b/src/WINNT/kfw/lib/i386/xpprof32.lib new file mode 100644 index 0000000000000000000000000000000000000000..47166293ef358db1db3e85b399d5976f079ced45 GIT binary patch literal 6114 zcmcIoL2naB6n=3C3C6*WodhneOcmN7p%6Q^6RN5*g-VSG0hw^DHXC~rujJU)+NpBu zAE-F+3nC8mNA$vpYY#=L#I>Ay;s+qn_q;p1Z)RuhT|!rSo}D-E&A0RB%{Mc?{+;PG z+ux^e7v-n4zPVYdRPa~UuY1)}xwhrL?xz9ZCP3N&$h-iUe+y7}?aE>WfF$?KmE}1A zlI*%Gg$CN8g>TED{?Cw#$ z%torH!#;L*XdPKj$cgL2UKkd0X!p8C*F4sYO4A(fV{mdXu$p6f(HhA8*h9-Phdsw= zI+i)K>ZMu`UR_&+H^r65*>@EUdOvA4h0jPS+j~hQ=7&vBxJC9n>9=rLhKQ#$K3$va z-NbZu0%x|a!Y#6=W6{JK-uy`8)HKPyW~&uo@_bhtlJn)J&zDF{;2>+h$N;>Z2Y6io zs4N0J%K^+`<9ZgLfw~V^-_HYd7XaR&yutTtO90PNUZVXe+P1GE!=c@Kd_O}!Bx0C? z6wJXgEW$-dLk8yIGF*X6Z~{aSPm7ti405Hh>c>*8Wv5QX_S5i7wJjETk1qJvfm^Qn7H6{L?HGU zmN335YJG;2M7a3r;VX2z6U_xr31Lin!C(;^M%2zVX^YV8s$$Xwx-{Ls(wi%Z*>qE^ zIv8SdMFX2wMWvW}xu4#dnuhs*H|p6bWJ+W@ zBD=Mgb#QXD^2DtI+{2gOM8zxXko#fH#_h;lDT^i~Q1}z&A5SrjWgXUEd3H5Vjm(K4 zh$rkwUx(tW6qW^KReCafP^(bL&7zVzq-PdMcqWs7Xg8hSpm#Vdt~PEKceZyQxXsEh z?g=AL>H(0l$shS0shi$74t_?ncihMCoyq(RA3q92@}Y-5Fa=`Rb%4<)w}oajK>EgM zp{bA!D!{j?1{%^|ryuX3-T}V#YE-0P4}U*xtB6jQG#_%Dd?{DUEMHQieEDPadGwL` zd})oEf*+PI8$wI@^1G;bCFRTilm~I<_6z)s$a_oTxNVhK+}w5cHv+g5t&iK7bygLj zqI9Hn#viuMDnd_oe~F4$e&+bbiRqUJ{TZ{-PsSqMlWCFeOc8?>M z_&C{L^-h^Z1@CLbo5Hi8e}PjEUFSm;6s@3sgQzKv8rr5M*u-nSD*ld8aA^{!Ij%Sa zNN~IoE4CGHfhcHSA=(8Ajh!$!Nb=eA|9z3O=LRCqa75+!B7r83YAs@%w-EKBiW)u~ zN#MK^E5clZUK}QIlxq=~Ylt})!qgn=&V^o$K&KI3QqhAm - -#define AFS_GCPAGS 1 /* if nonzero, garbage collect PAGs */ -#define AFS_GLOBAL_SUNLOCK 1 /* For global locking */ - -#define AFS_3DISPARES 1 /* Utilize the 3 available disk inode 'spares' */ -#define AFS_SYSCALL 31 - -/* File system entry (used if mount.h doesn't define MOUNT_AFS */ -#define AFS_MOUNT_AFS "afs" - -/* Machine / Operating system information */ -#define sys_sun4_413 1 -#define SYS_NAME "sun4_413" -#define SYS_NAME_ID SYS_NAME_ID_sun4_411 -#define AFSBIG_ENDIAN 1 -#define AFS_HAVE_FFS 1 /* Use system's ffs. */ -#define AFS_HAVE_STATVFS 0 -#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ - -#define KERNEL_HAVE_UERROR 1 - -/* Extra kernel definitions (from kdefs file) */ -#ifdef KERNEL -/* sun definitions here */ -#define AFS_UIOFMODE 1 /* Only in afs/afs_vnodeops.c (afs_ustrategy) */ -#define afsio_iov uio_iov -#define afsio_iovcnt uio_iovcnt -#define afsio_offset uio_offset -#define afsio_seg uio_segflg -#define afsio_fmode uio_fmode -#define afsio_resid uio_resid -#define AFS_UIOSYS UIO_SYSSPACE -#define AFS_UIOUSER UIO_USERSPACE -#define AFS_CLBYTES MCLBYTES -#define AFS_MINCHANGE 2 -#define osi_GetTime(x) uniqtime(x) -#define AFS_KALLOC(n) kmem_alloc(n, KMEM_SLEEP) -#define AFS_KALLOC_NOSLEEP(n) kmem_alloc(n, KMEM_NOSLEEP) -#define AFS_KFREE kmem_free -#define VATTR_NULL vattr_null -#endif /* KERNEL */ -#define memset(A, B, S) bzero(A, S) -#define memcpy(B, A, S) bcopy(A, B, S) -#define memcmp(A, B, S) bcmp(A, B, S) -#define memmove(B, A, S) bcopy(A, B, S) -#define AFS_DIRENT -#ifndef CMSERVERPREF -#define CMSERVERPREF -#endif /* */ - -#endif /* AFS_PARAM_H */ +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +#define AFS_VFSINCL_ENV 1 /* NOBODY uses this.... */ +#define AFS_ENV 1 +#define AFS_SUN_ENV 1 +#define AFS_SUN4_ENV 1 + +#include + +#define AFS_GCPAGS 1 /* if nonzero, garbage collect PAGs */ +#define AFS_GLOBAL_SUNLOCK 1 /* For global locking */ + +#define AFS_3DISPARES 1 /* Utilize the 3 available disk inode 'spares' */ +#define AFS_SYSCALL 31 + +/* File system entry (used if mount.h doesn't define MOUNT_AFS */ +#define AFS_MOUNT_AFS "afs" + +/* Machine / Operating system information */ +#define sys_sun4_413 1 +#define SYS_NAME "sun4_413" +#define SYS_NAME_ID SYS_NAME_ID_sun4_411 +#define AFSBIG_ENDIAN 1 +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ +#define AFS_HAVE_STATVFS 0 +#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ + +#define KERNEL_HAVE_UERROR 1 + +/* Extra kernel definitions (from kdefs file) */ +#ifdef KERNEL +/* sun definitions here */ +#define AFS_UIOFMODE 1 /* Only in afs/afs_vnodeops.c (afs_ustrategy) */ +#define afsio_iov uio_iov +#define afsio_iovcnt uio_iovcnt +#define afsio_offset uio_offset +#define afsio_seg uio_segflg +#define afsio_fmode uio_fmode +#define afsio_resid uio_resid +#define AFS_UIOSYS UIO_SYSSPACE +#define AFS_UIOUSER UIO_USERSPACE +#define AFS_CLBYTES MCLBYTES +#define AFS_MINCHANGE 2 +#define osi_GetTime(x) uniqtime(x) +#define AFS_KALLOC(n) kmem_alloc(n, KMEM_SLEEP) +#define AFS_KALLOC_NOSLEEP(n) kmem_alloc(n, KMEM_NOSLEEP) +#define AFS_KFREE kmem_free +#define VATTR_NULL vattr_null +#endif /* KERNEL */ +#define memset(A, B, S) bzero(A, S) +#define memcpy(B, A, S) bcopy(A, B, S) +#define memcmp(A, B, S) bcmp(A, B, S) +#define memmove(B, A, S) bcopy(A, B, S) +#define AFS_DIRENT +#ifndef CMSERVERPREF +#define CMSERVERPREF +#endif /* */ + +#endif /* AFS_PARAM_H */ #else /* !defined(UKERNEL) */ /* This section for user space compiles only */ -/* - * Copyright 2000, International Business Machines Corporation and others. - * All Rights Reserved. - * - * This software has been released under the terms of the IBM Public - * License. For details, see the LICENSE file in the top-level source - * directory or online at http://www.openafs.org/dl/license10.html - */ - -#ifndef AFS_PARAM_H -#define AFS_PARAM_H - -#define UKERNEL -#define AFS_ENV 1 -/* define AFS_USR_XXX_ENV XXX */ - -#include - -#define RXK_LISTENER_ENV 1 -#define AFS_USERSPACE_IP_ADDR 1 -#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ - -#define AFS_3DISPARES 1 /* Utilize the 3 available disk inode 'spares' */ -#define AFS_SYSCALL 31 - -/* File system entry (used if mount.h doesn't define MOUNT_AFS */ -#define AFS_MOUNT_AFS 1 - -/* Machine / Operating system information */ -#define sys_sun4_413 1 -#define SYS_NAME "sun4_413" -#define SYS_NAME_ID SYS_NAME_ID_sun4_411 -#define AFSBIG_ENDIAN 1 -#define AFS_HAVE_FFS 1 /* Use system's ffs. */ -#define AFS_HAVE_STATVFS 0 - -/* Extra kernel definitions (from kdefs file) */ -#ifdef KERNEL -/* sun definitions here */ -#define AFS_UIOFMODE 1 /* Only in afs/afs_vnodeops.c (afs_ustrategy) */ -#define afsio_iov uio_iov -#define afsio_iovcnt uio_iovcnt -#define afsio_offset uio_offset -#define afsio_seg uio_segflg -#define afsio_fmode uio_fmode -#define afsio_resid uio_resid -#define AFS_UIOSYS 1 -#define AFS_UIOUSER UIO_USERSPACE -#define AFS_CLBYTES MCLBYTES -#define AFS_MINCHANGE 2 -#define VATTR_NULL usr_vattr_null -#endif /* KERNEL */ -#define AFS_DIRENT -#ifndef CMSERVERPREF -#define CMSERVERPREF -#endif /* */ - -#endif /* AFS_PARAM_H */ +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +#define UKERNEL +#define AFS_ENV 1 +/* define AFS_USR_XXX_ENV XXX */ + +#include + +#define RXK_LISTENER_ENV 1 +#define AFS_USERSPACE_IP_ADDR 1 +#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ + +#define AFS_3DISPARES 1 /* Utilize the 3 available disk inode 'spares' */ +#define AFS_SYSCALL 31 + +/* File system entry (used if mount.h doesn't define MOUNT_AFS */ +#define AFS_MOUNT_AFS 1 + +/* Machine / Operating system information */ +#define sys_sun4_413 1 +#define SYS_NAME "sun4_413" +#define SYS_NAME_ID SYS_NAME_ID_sun4_411 +#define AFSBIG_ENDIAN 1 +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ +#define AFS_HAVE_STATVFS 0 + +/* Extra kernel definitions (from kdefs file) */ +#ifdef KERNEL +/* sun definitions here */ +#define AFS_UIOFMODE 1 /* Only in afs/afs_vnodeops.c (afs_ustrategy) */ +#define afsio_iov uio_iov +#define afsio_iovcnt uio_iovcnt +#define afsio_offset uio_offset +#define afsio_seg uio_segflg +#define afsio_fmode uio_fmode +#define afsio_resid uio_resid +#define AFS_UIOSYS 1 +#define AFS_UIOUSER UIO_USERSPACE +#define AFS_CLBYTES MCLBYTES +#define AFS_MINCHANGE 2 +#define VATTR_NULL usr_vattr_null +#endif /* KERNEL */ +#define AFS_DIRENT +#ifndef CMSERVERPREF +#define CMSERVERPREF +#endif /* */ + +#endif /* AFS_PARAM_H */ #endif /* !defined(UKERNEL) */ diff --git a/src/libafsauthent/NTMakefile b/src/libafsauthent/NTMakefile index 86dc00e00..565ebd7a5 100644 --- a/src/libafsauthent/NTMakefile +++ b/src/libafsauthent/NTMakefile @@ -140,7 +140,7 @@ DLLLIBS =\ $(DESTDIR)\lib\afs\afseventlog.lib $(LIBFILE): $(DLLOBJS) $(DLLLIBS) $(RXOBJS) - $(DLLCONLINK) /DEF:afsauthent.def rpcrt4.lib + $(DLLCONLINK) /DEF:afsauthent.def rpcrt4.lib dnsapi.lib $(DLLPREP) # Definitions for generating versioninfo resources diff --git a/src/libafsrpc/afsrpc.def b/src/libafsrpc/afsrpc.def index 95ec3c992..37cfd4d87 100644 --- a/src/libafsrpc/afsrpc.def +++ b/src/libafsrpc/afsrpc.def @@ -198,3 +198,4 @@ EXPORTS rx_enable_hot_thread @203 DATA xdr_int64 @204 xdr_uint64 @205 + rx_SetMaxMTU @206 diff --git a/src/rx/rx_clock_nt.c b/src/rx/rx_clock_nt.c index c77cbdfab..5e8942ed4 100644 --- a/src/rx/rx_clock_nt.c +++ b/src/rx/rx_clock_nt.c @@ -23,6 +23,8 @@ RCSID #include #include "rx_clock.h" +void clock_UpdateTime(void); /* forward reference */ + struct clock clock_now; /* The last elapsed time ready by clock_GetTimer */ /* This is set to 1 whenever the time is read, and reset to 0 whenever diff --git a/src/rx/rx_user.c b/src/rx/rx_user.c index 82022598a..240cee7b0 100644 --- a/src/rx/rx_user.c +++ b/src/rx/rx_user.c @@ -121,7 +121,7 @@ rxi_GetUDPSocket(u_short port) goto error; } - taddr.sin_addr.s_addr = 0; + taddr.sin_addr.s_addr = ADDR_ANY; taddr.sin_family = AF_INET; taddr.sin_port = (u_short) port; #ifdef STRUCT_SOCKADDR_HAS_SA_LEN @@ -625,12 +625,12 @@ rxi_InitPeerParams(struct rx_peer *pp) } UNLOCK_IF if (!pp->ifMTU) { /* not local */ pp->timeout.sec = 3; - pp->ifMTU = RX_REMOTE_PACKET_SIZE; + pp->ifMTU = MIN(rx_MyMaxSendSize, RX_REMOTE_PACKET_SIZE); } #else /* ADAPT_MTU */ pp->rateFlag = 2; /* start timing after two full packets */ pp->timeout.sec = 2; - pp->ifMTU = OLD_MAX_PACKET_SIZE; + pp->ifMTU = MIN(rx_MyMaxSendSize, OLD_MAX_PACKET_SIZE); #endif /* ADAPT_MTU */ pp->ifMTU = rxi_AdjustIfMTU(pp->ifMTU); pp->maxMTU = OLD_MAX_PACKET_SIZE; /* for compatibility with old guys */ @@ -656,3 +656,11 @@ rx_SetNoJumbo(void) rx_maxReceiveSize = OLD_MAX_PACKET_SIZE; rxi_nSendFrags = rxi_nRecvFrags = 1; } + +/* Override max MTU. If rx_SetNoJumbo is called, it must be + called before calling rx_SetMaxMTU since SetNoJumbo clobbers rx_maxReceiveSize */ +void rx_SetMaxMTU(int mtu) +{ + rx_MyMaxSendSize = rx_maxReceiveSizeUser = rx_maxReceiveSize = mtu; +} + diff --git a/src/sys/pioctl_nt.c b/src/sys/pioctl_nt.c index f924b4fe2..a35a24312 100644 --- a/src/sys/pioctl_nt.c +++ b/src/sys/pioctl_nt.c @@ -38,6 +38,11 @@ RCSID #include #include + +/* Are we using the canonical Netbios name (AFS)? */ +BOOL smb_TruncateNetbios = FALSE; /* what the registry says */ +BOOL smb_TruncateNetbiosReal = FALSE; /* what we actually grant */ + static char AFSConfigKeyName[] = "SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters"; @@ -101,7 +106,9 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep) char *drivep; char hostName[256]; char tbuffer[100]; + char buf[200]; char explicitNetbiosName[32]; + DWORD isGateway = 0; char *ctemp; HANDLE fh; HKEY parmKey; @@ -109,48 +116,66 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep) long code; if (fileNamep) { - drivep = strchr(fileNamep, ':'); - if (drivep && (drivep - fileNamep) >= 1) { - tbuffer[0] = *(drivep - 1); - tbuffer[1] = ':'; - strcpy(tbuffer + 2, SMB_IOCTL_FILENAME); - } else - strcpy(tbuffer, SMB_IOCTL_FILENAME); + drivep = strchr(fileNamep, ':'); + if (drivep && (drivep - fileNamep) >= 1) { + tbuffer[0] = *(drivep - 1); + tbuffer[1] = ':'; + strcpy(tbuffer + 2, SMB_IOCTL_FILENAME); + } else + strcpy(tbuffer, SMB_IOCTL_FILENAME); } else { - /* No file name specified, use UNC name */ - /* First look for gateway host in Registry */ - code = - RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSConfigKeyName, 0, - KEY_QUERY_VALUE, &parmKey); - if (code != ERROR_SUCCESS) - goto nogateway; - dummyLen = sizeof(explicitNetbiosName); - code = RegQueryValueEx(parmKey, "NetbiosName", NULL, NULL, - (BYTE *) &explicitNetbiosName, &dummyLen); - if (!code == ERROR_SUCCESS) - { - explicitNetbiosName[0] = 0; - } - dummyLen = sizeof(hostName); - code = - RegQueryValueEx(parmKey, "Gateway", NULL, NULL, hostName, - &dummyLen); - RegCloseKey(parmKey); - if (code == ERROR_SUCCESS) - goto havehost; + /* No file name specified, use UNC name */ + code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSConfigKeyName, 0, + KEY_QUERY_VALUE, &parmKey); + if (code != ERROR_SUCCESS) + goto nogateway; + + dummyLen = sizeof(buf); + code = RegQueryValueEx(parmKey, "TruncateNetbios", NULL, NULL, + (BYTE *) buf, &dummyLen); + if (code == ERROR_SUCCESS) + { + if (!stricmp( (const char *) buf, "on")) + { + smb_TruncateNetbios = TRUE; + smb_TruncateNetbiosReal = TRUE; + } + } + + dummyLen = sizeof(isGateway); + code = RegQueryValueEx(parmKey, "IsGateway", NULL, NULL, + (BYTE *) &isGateway, &dummyLen); + + /* Is there an explicit name we should use? */ + dummyLen = sizeof(explicitNetbiosName); + code = RegQueryValueEx(parmKey, "NetbiosName", NULL, NULL, + (BYTE *) &explicitNetbiosName, &dummyLen); + if (!code == ERROR_SUCCESS) + { + explicitNetbiosName[0] = 0; + } + + /* Look for gateway host in Registry */ + dummyLen = sizeof(hostName); + code = RegQueryValueEx(parmKey, "Gateway", NULL, NULL, hostName, + &dummyLen); + RegCloseKey(parmKey); + if (code == ERROR_SUCCESS) + goto havehost; + nogateway: - /* No gateway name in registry; use ourself */ + /* No gateway name in registry; use ourself */ #ifndef AFS_WIN95_ENV - gethostname(hostName, sizeof(hostName)); + gethostname(hostName, sizeof(hostName)); #else - { - int hostsize; - /* DJGPP version of gethostname gets the NetBIOS - * name of the machine, so that is what we are using for - * the AFS server name instead of the DNS name. */ - hostsize = sizeof(hostName); - GetComputerName(hostName, &hostsize); - } + { + int hostsize; + /* DJGPP version of gethostname gets the NetBIOS + * name of the machine, so that is what we are using for + * the AFS server name instead of the DNS name. */ + hostsize = sizeof(hostName); + GetComputerName(hostName, &hostsize); + } #endif /* AFS_WIN95_ENV */ havehost: @@ -165,6 +190,9 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep) sprintf(tbuffer, "\\\\%s\\all%s", explicitNetbiosName, SMB_IOCTL_FILENAME); } + else if (smb_TruncateNetbiosReal) { + sprintf(tbuffer, "\\\\AFS\\all%s", SMB_IOCTL_FILENAME); + } else { _strupr(hostName); -- 2.39.5