summaryrefslogtreecommitdiffstats
path: root/src/windows/gina
diff options
context:
space:
mode:
authorRichard Basch <probe@mit.edu>1997-02-06 02:31:41 +0000
committerRichard Basch <probe@mit.edu>1997-02-06 02:31:41 +0000
commita0b9ce4bee60136363cfff7a93c4e42eab972c02 (patch)
tree400984337fe3766653ff4cc2cb6b7d3d7f87f3f4 /src/windows/gina
parenta9266b1dec31de9f33b0d032b885edd377a23ee5 (diff)
downloadkrb5-a0b9ce4bee60136363cfff7a93c4e42eab972c02.tar.gz
krb5-a0b9ce4bee60136363cfff7a93c4e42eab972c02.tar.xz
krb5-a0b9ce4bee60136363cfff7a93c4e42eab972c02.zip
Windows/NT integration (V1_0_WIN32_BRANCH merge)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9788 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/windows/gina')
-rw-r--r--src/windows/gina/Makefile.in36
-rw-r--r--src/windows/gina/gina.def21
-rw-r--r--src/windows/gina/ginastub.c365
-rw-r--r--src/windows/gina/ginastub.h39
4 files changed, 461 insertions, 0 deletions
diff --git a/src/windows/gina/Makefile.in b/src/windows/gina/Makefile.in
new file mode 100644
index 0000000000..21576ffc9d
--- /dev/null
+++ b/src/windows/gina/Makefile.in
@@ -0,0 +1,36 @@
+##DOSBUILDTOP=..\..
+
+OBJS= ginastub.$(OBJEXT)
+
+DEBUG=1
+
+INCLUDES = -I$(BUILDTOP)\include
+
+WINLIBS = advapi32.lib comctl32.lib \
+ libc.lib kernel32.lib wsock32.lib user32.lib shell32.lib oldnames.lib
+
+#comctl32.lib msvcrt.lib advapi32.lib gdi32.lib comdlg32.lib winspool.lib
+
+WINDLLFLAGS = /nodefaultlib /incremental:no /pdb:none /release \
+ /nologo /align:0x1000 /base:0x1c000000 /dll /debug
+
+##WIN32##!if defined(DEBUG)
+##WIN32##CFLAGS = $(CCOPTS2) $(INCLUDES) -DUNICODE -D_UNICODE -DDBG
+##WIN32##!else
+##WIN32##CFLAGS = $(CCOPTS2) $(INCLUDES) -DUNICODE -D_UNICODE
+##WIN32##!endif
+
+all-windows::
+##WIN32##all-windows:: kgina.dll
+
+clean-windows::
+ $(RM) kgina.dll
+
+kgina.dll: $(OBJS) $(KLIB)
+ link $(WINDLLFLAGS) -def:gina.def -out:$*.dll \
+ $** $(WINLIBS)
+
+ginastub.obj: ginastub.h
+
+#gina.res: res.rc
+# $(RC) $(RFLAGS) -r -fo $@ res.rc
diff --git a/src/windows/gina/gina.def b/src/windows/gina/gina.def
new file mode 100644
index 0000000000..99e066becc
--- /dev/null
+++ b/src/windows/gina/gina.def
@@ -0,0 +1,21 @@
+LIBRARY KGINA
+
+DESCRIPTION 'Alternate Windows NT Logon GUI'
+
+EXPORTS
+; Version 1.0
+ WlxNegotiate
+ WlxInitialize
+ WlxDisplaySASNotice
+ WlxLoggedOutSAS
+ WlxActivateUserShell
+ WlxLoggedOnSAS
+ WlxDisplayLockedNotice
+ WlxWkstaLockedSAS
+ WlxIsLockOk
+ WlxIsLogoffOk
+ WlxLogoff
+ WlxShutdown
+; Version 1.1
+ WlxScreenSaverNotify
+ WlxStartApplication
diff --git a/src/windows/gina/ginastub.c b/src/windows/gina/ginastub.c
new file mode 100644
index 0000000000..ec4291b2b3
--- /dev/null
+++ b/src/windows/gina/ginastub.c
@@ -0,0 +1,365 @@
+
+/*
+ Copyright (c) 1996 Microsoft Corporation
+
+Module Name:
+ ginastub.c
+
+Abstract:
+ This sample illustrates a pass-thru "stub" gina which can be used
+ in some cases to simplify gina development.
+
+ A common use for a gina is to implement code which requires the
+ credentials of the user logging onto the workstation. The credentials
+ may be required for syncronization with foreign account databases
+ or custom authentication activities.
+
+ In this example case, it is possible to implement a simple gina
+ stub layer which simply passes control for the required functions
+ to the previously installed gina, and captures the interesting
+ parameters from that gina. In this scenario, the existing functionality
+ in the existent gina is retained. In addition, the development time
+ is reduced drastically, as existing functionality does not need to
+ be duplicated.
+
+ When dealing with credentials, take steps to maintain the security
+ of the credentials. For instance, if transporting credentials over
+ a network, be sure to encrypt the credentials.
+
+Author:
+ Scott Field (sfield) 18-Jul-96
+*/
+
+
+#include <windows.h>
+#include <stdio.h>
+#include <winwlx.h>
+#include "ginastub.h"
+
+
+/* Location of the real msgina. */
+
+#define REALGINA_PATH TEXT("MSGINA.DLL")
+
+
+/* winlogon function dispatch table */
+PGWLX_DISPATCH_VERSION pWlxFuncs;
+
+
+/* winlogon version */
+DWORD WlxVersion;
+
+
+/* Functions pointers to the real msgina which we will call. */
+
+PGWLX_Negotiate GWlxNegotiate;
+PGWLX_Initialize GWlxInitialize;
+PGWLX_DisplaySASNotice GWlxDisplaySASNotice;
+PGWLX_LoggedOutSAS GWlxLoggedOutSAS;
+PGWLX_ActivateUserShell GWlxActivateUserShell;
+PGWLX_LoggedOnSAS GWlxLoggedOnSAS;
+PGWLX_DisplayLockedNotice GWlxDisplayLockedNotice;
+PGWLX_WkstaLockedSAS GWlxWkstaLockedSAS;
+PGWLX_IsLockOk GWlxIsLockOk;
+PGWLX_IsLogoffOk GWlxIsLogoffOk;
+PGWLX_Logoff GWlxLogoff;
+PGWLX_Shutdown GWlxShutdown;
+
+
+/* NEW for version 1.1 */
+
+PGWLX_StartApplication GWlxStartApplication;
+PGWLX_ScreenSaverNotify GWlxScreenSaverNotify;
+
+
+/* hook into the real GINA. */
+
+static BOOL
+MyInitialize(void)
+{
+ HINSTANCE hDll;
+
+ /* Load MSGINA.DLL. */
+
+ if (! (hDll = LoadLibrary(REALGINA_PATH)))
+ return FALSE;
+
+
+ /* Get pointers to all of the WLX functions in the real MSGINA. */
+
+ GWlxNegotiate = (PGWLX_Negotiate)
+ GetProcAddress(hDll, "WlxNegotiate");
+ if (! GWlxNegotiate)
+ return FALSE;
+
+ GWlxInitialize = (PGWLX_Initialize)
+ GetProcAddress(hDll, "WlxInitialize");
+ if (! GWlxInitialize)
+ return FALSE;
+
+ GWlxDisplaySASNotice = (PGWLX_DisplaySASNotice)
+ GetProcAddress(hDll, "WlxDisplaySASNotice");
+ if (! GWlxDisplaySASNotice)
+ return FALSE;
+
+ GWlxLoggedOutSAS = (PGWLX_LoggedOutSAS)
+ GetProcAddress(hDll, "WlxLoggedOutSAS");
+ if (! GWlxLoggedOutSAS)
+ return FALSE;
+
+ GWlxActivateUserShell = (PGWLX_ActivateUserShell)
+ GetProcAddress(hDll, "WlxActivateUserShell");
+ if (! GWlxActivateUserShell)
+ return FALSE;
+
+ GWlxLoggedOnSAS = (PGWLX_LoggedOnSAS)
+ GetProcAddress(hDll, "WlxLoggedOnSAS");
+ if (! GWlxLoggedOnSAS)
+ return FALSE;
+
+ GWlxDisplayLockedNotice = (PGWLX_DisplayLockedNotice)
+ GetProcAddress(hDll, "WlxDisplayLockedNotice");
+ if (! GWlxDisplayLockedNotice)
+ return FALSE;
+
+ GWlxIsLockOk = (PGWLX_IsLockOk)
+ GetProcAddress(hDll, "WlxIsLockOk");
+ if (! GWlxIsLockOk)
+ return FALSE;
+
+ GWlxWkstaLockedSAS = (PGWLX_WkstaLockedSAS)
+ GetProcAddress(hDll, "WlxWkstaLockedSAS");
+ if (! GWlxWkstaLockedSAS)
+ return FALSE;
+
+ GWlxIsLogoffOk = (PGWLX_IsLogoffOk)
+ GetProcAddress(hDll, "WlxIsLogoffOk");
+ if (! GWlxIsLogoffOk)
+ return FALSE;
+
+ GWlxLogoff = (PGWLX_Logoff)
+ GetProcAddress(hDll, "WlxLogoff");
+ if (! GWlxLogoff)
+ return FALSE;
+
+ GWlxShutdown = (PGWLX_Shutdown)
+ GetProcAddress(hDll, "WlxShutdown");
+ if (! GWlxShutdown)
+ return FALSE;
+
+
+ /* Don't check for failure because these don't exist prior to NT 4.0 */
+
+ GWlxStartApplication = (PGWLX_StartApplication)
+ GetProcAddress(hDll, "WlxStartApplication");
+ GWlxScreenSaverNotify = (PGWLX_ScreenSaverNotify)
+ GetProcAddress(hDll, "WlxScreenSaverNotify");
+
+
+ /* Everything loaded ok. Return success. */
+ return TRUE;
+}
+
+BOOL
+WINAPI
+WlxNegotiate(
+ DWORD dwWinlogonVersion,
+ DWORD *pdwDllVersion)
+{
+ if (! MyInitialize())
+ return FALSE;
+
+ WlxVersion = dwWinlogonVersion;
+ return (* GWlxNegotiate)(dwWinlogonVersion, pdwDllVersion);
+}
+
+BOOL
+WINAPI
+WlxInitialize(
+ LPWSTR lpWinsta,
+ HANDLE hWlx,
+ PVOID pvReserved,
+ PVOID pWinlogonFunctions,
+ PVOID *pWlxContext)
+{
+ pWlxFuncs = (PGWLX_DISPATCH_VERSION) pWinlogonFunctions;
+
+ return (* GWlxInitialize)(
+ lpWinsta,
+ hWlx,
+ pvReserved,
+ pWinlogonFunctions,
+ pWlxContext
+ );
+}
+
+VOID
+WINAPI
+WlxDisplaySASNotice(
+ PVOID pWlxContext)
+{
+ (* GWlxDisplaySASNotice)(pWlxContext);
+}
+
+int
+WINAPI
+WlxLoggedOutSAS(
+ PVOID pWlxContext,
+ DWORD dwSasType,
+ PLUID pAuthenticationId,
+ PSID pLogonSid,
+ PDWORD pdwOptions,
+ PHANDLE phToken,
+ PWLX_MPR_NOTIFY_INFO pMprNotifyInfo,
+ PVOID *pProfile)
+{
+ int iRet;
+
+ iRet = (* GWlxLoggedOutSAS)(
+ pWlxContext,
+ dwSasType,
+ pAuthenticationId,
+ pLogonSid,
+ pdwOptions,
+ phToken,
+ pMprNotifyInfo,
+ pProfile
+ );
+
+ if (iRet == WLX_SAS_ACTION_LOGON) {
+ /* copy pMprNotifyInfo and pLogonSid for later use */
+
+ /* pMprNotifyInfo->pszUserName */
+ /* pMprNotifyInfo->pszDomain */
+ /* pMprNotifyInfo->pszPassword */
+ /* pMprNotifyInfo->pszOldPassword */
+ }
+
+ return iRet;
+}
+
+BOOL
+WINAPI
+WlxActivateUserShell(
+ PVOID pWlxContext,
+ PWSTR pszDesktopName,
+ PWSTR pszMprLogonScript,
+ PVOID pEnvironment)
+{
+ return (* GWlxActivateUserShell)(
+ pWlxContext,
+ pszDesktopName,
+ pszMprLogonScript,
+ pEnvironment
+ );
+}
+
+int
+WINAPI
+WlxLoggedOnSAS(
+ PVOID pWlxContext,
+ DWORD dwSasType,
+ PVOID pReserved)
+{
+ return (* GWlxLoggedOnSAS)(pWlxContext, dwSasType, pReserved);
+}
+
+VOID
+WINAPI
+WlxDisplayLockedNotice(
+ PVOID pWlxContext)
+{
+ (* GWlxDisplayLockedNotice)(pWlxContext);
+}
+
+BOOL
+WINAPI
+WlxIsLockOk(
+ PVOID pWlxContext)
+{
+ return (* GWlxIsLockOk)(pWlxContext);
+}
+
+int
+WINAPI
+WlxWkstaLockedSAS(
+ PVOID pWlxContext,
+ DWORD dwSasType)
+{
+ return (* GWlxWkstaLockedSAS)(pWlxContext, dwSasType);
+}
+
+BOOL
+WINAPI
+WlxIsLogoffOk(
+ PVOID pWlxContext
+ )
+{
+ BOOL bSuccess;
+
+ bSuccess = (* GWlxIsLogoffOk)(pWlxContext);
+ if (bSuccess) {
+ /* if it's ok to logoff, finish with the stored credentials */
+ /* and scrub the buffers */
+ }
+
+ return bSuccess;
+}
+
+VOID
+WINAPI
+WlxLogoff(
+ PVOID pWlxContext
+ )
+{
+ (* GWlxLogoff)(pWlxContext);
+}
+
+VOID
+WINAPI
+WlxShutdown(
+PVOID pWlxContext,
+DWORD ShutdownType
+)
+{
+ (* GWlxShutdown)(pWlxContext, ShutdownType);
+}
+
+
+/* NEW for version 1.1 */
+
+BOOL
+WINAPI
+WlxScreenSaverNotify(
+PVOID pWlxContext,
+BOOL * pSecure
+)
+{
+ if (GWlxScreenSaverNotify)
+ return (* GWlxScreenSaverNotify)(pWlxContext, pSecure);
+
+ /* if not exported, return something intelligent */
+ *pSecure = TRUE;
+ return TRUE;
+}
+
+BOOL
+WINAPI
+WlxStartApplication(
+ PVOID pWlxContext,
+ PWSTR pszDesktopName,
+ PVOID pEnvironment,
+ PWSTR pszCmdLine
+ )
+{
+ if (GWlxStartApplication)
+ return (* GWlxStartApplication)(
+ pWlxContext,
+ pszDesktopName,
+ pEnvironment,
+ pszCmdLine
+ );
+
+ /* if not exported, return something intelligent */
+ return TRUE; /* ??? */
+}
diff --git a/src/windows/gina/ginastub.h b/src/windows/gina/ginastub.h
new file mode 100644
index 0000000000..e9c833492d
--- /dev/null
+++ b/src/windows/gina/ginastub.h
@@ -0,0 +1,39 @@
+/* WinLogin 1.0 */
+typedef BOOL (CALLBACK * PGWLX_Negotiate)
+ (DWORD, DWORD *);
+typedef BOOL (CALLBACK * PGWLX_Initialize)
+ (LPWSTR, HANDLE, PVOID, PVOID, PVOID);
+typedef VOID (CALLBACK * PGWLX_DisplaySASNotice)
+ (PVOID);
+typedef int (CALLBACK * PGWLX_LoggedOutSAS)
+ (PVOID, DWORD, PLUID, PSID, PDWORD, PHANDLE,
+ PWLX_MPR_NOTIFY_INFO, PVOID *);
+typedef BOOL (CALLBACK * PGWLX_ActivateUserShell)
+ (PVOID, PWSTR, PWSTR, PVOID);
+typedef int (CALLBACK * PGWLX_LoggedOnSAS)
+ (PVOID, DWORD, PVOID);
+typedef VOID (CALLBACK * PGWLX_DisplayLockedNotice)
+ (PVOID);
+typedef int (CALLBACK * PGWLX_WkstaLockedSAS)
+ (PVOID, DWORD);
+typedef BOOL (CALLBACK * PGWLX_IsLockOk)
+ (PVOID);
+typedef BOOL (CALLBACK * PGWLX_IsLogoffOk)
+ (PVOID);
+typedef VOID (CALLBACK * PGWLX_Logoff)
+ (PVOID);
+typedef VOID (CALLBACK * PGWLX_Shutdown)
+ (PVOID, DWORD);
+
+/* WinLogin 1.1 */
+typedef BOOL (CALLBACK * PGWLX_StartApplication)
+ (PVOID, PWSTR, PVOID, PWSTR);
+typedef BOOL (CALLBACK * PGWLX_ScreenSaverNotify)
+ (PVOID, BOOL *);
+
+
+#if defined(WLX_VERSION_1_1)
+typedef PWLX_DISPATCH_VERSION_1_1 PGWLX_DISPATCH_VERSION;
+#else
+typedef PWLX_DISPATCH_VERSION_1_0 PGWLX_DISPATCH_VERSION;
+#endif