From: Richard Basch Date: Sat, 15 Feb 1997 21:37:11 +0000 (+0000) Subject: Makefile.in: build comerr dll X-Git-Tag: krb5-1.1-beta1~1316 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=441763d0b69e15def56d6141345e0eac7fe580de;p=krb5.git Makefile.in: build comerr dll comerr16.def comerr32.def: New definition files for Windows comerr library krb5_16.def krb5_32.def: Removed comerr exports win_glue.c: win32 dll entry/exit code added gssapi32.def krb5_32.def: Removed obsolete WEP & LibMain exports git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9875 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/ChangeLog b/src/lib/ChangeLog index c8c3e2b07..fa2a3c54d 100644 --- a/src/lib/ChangeLog +++ b/src/lib/ChangeLog @@ -1,3 +1,11 @@ +Fri Feb 14 16:40:03 1997 Richard Basch + + * Makefile.in: Build separate ComErr DLL + * comerr16.def comerr32.def: ComErr exported API + * krb5_16.def krb5_32.def: Removed ComErr/Win16 entries + * no_glue.c: Dummy stub for ComErr (win16/win32) + * win_glue.c: Win32 DLL startup/exit code added + Sat Feb 8 12:21:53 1997 Richard Basch * krb5_16.def krb5_32.def: diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in index c94909b80..201a9942c 100644 --- a/src/lib/Makefile.in +++ b/src/lib/Makefile.in @@ -24,12 +24,14 @@ clean-windows:: # Windows stuff to make krb5 and gssapi DLLs. -GLIBS = gssapi\gssapi.lib +CLIBS = $(BUILDTOP)\util\et\comerr.lib KLIBS = krb5\krb5.lib crypto\crypto.lib \ $(BUILDTOP)\util\profile\profile.lib \ - $(BUILDTOP)\util\et\comerr.lib \ kadm\kadm.lib des425\des425.lib +GLIBS = gssapi\gssapi.lib +##WIN16##CDEF = comerr16.def +##WIN32##CDEF = comerr32.def ##WIN16##KDEF = krb5_16.def ##WIN32##KDEF = krb5_32.def ##WIN16##GDEF = gssapi16.def @@ -39,35 +41,54 @@ KLIBS = krb5\krb5.lib crypto\crypto.lib \ ##WIN32##WINLIBS = msvcrt.lib kernel32.lib wsock32.lib \ ##WIN32## user32.lib shell32.lib oldnames.lib ##WIN32##WINDLLFLAGS = /nodefaultlib /incremental:no /pdb:none /release \ -##WIN32## /nologo /align:0x1000 /base:0x1c000000 /dll /debug +##WIN32## /nologo /align:0x1000 /base:0x1c000000 /dll \ +##WIN32## /entry:DllMain -$(KLIB): $(KLIBS) $(WLIB) $(KDEF) win_glue.obj +$(CLIB): $(CLIBS) $(WLIB) $(CDEF) no_glue.obj +##WIN16## link /co /seg:400 /noe /nod /nol \ +##WIN16## no_glue, $*.dll, $*.map, $(CLIBS) $(WINLIBS), $(CDEF) +##WIN16## rc /nologo /p /k $*.dll +##WIN16## implib /nologo $@ $*.dll +##WIN32## link $(WINDLLFLAGS) /def:$(CDEF) /out:$*.dll \ +##WIN32## no_glue.obj $(CLIBS) $(WINLIBS) + +$(KLIB): $(KLIBS) $(CLIB) $(WLIB) $(KDEF) krb_glue.obj ##WIN16## link /co /seg:400 /noe /nod /nol \ -##WIN16## win_glue, $*.dll, $*.map, \ -##WIN16## $(KLIBS) $(WINLIBS), $(KDEF) +##WIN16## krb_glue, $*.dll, $*.map, \ +##WIN16## $(KLIBS) $(CLIB) $(WINLIBS), $(KDEF) ##WIN16## rc /nologo /p /k $*.dll ##WIN16## implib /nologo $@ $*.dll ##WIN32## link $(WINDLLFLAGS) /def:$(KDEF) /out:$*.dll \ -##WIN32## win_glue.obj $(KLIBS) $(WINLIBS) +##WIN32## krb_glue.obj $(KLIBS) $(CLIB) $(WINLIBS) -$(GLIB): $(GLIBS) $(KLIB) $(GDEF) win_glue.obj +$(GLIB): $(GLIBS) $(KLIB) $(CLIB) $(GDEF) gss_glue.obj ##WIN16## link /co /seg:400 /noe /nod /nol \ -##WIN16## win_glue, $*.dll, $*.map, \ -##WIN16## $(GLIBS) $(KLIB) $(WINLIBS), $(GDEF) +##WIN16## gss_glue, $*.dll, $*.map, \ +##WIN16## $(GLIBS) $(KLIB) $(CLIB) $(WINLIBS), $(GDEF) ##WIN16## rc /nologo /p /k $*.dll ##WIN16## implib /nologo $@ $*.dll ##WIN32## link $(WINDLLFLAGS) /def:$(GDEF) /out:$*.dll \ -##WIN32## win_glue.obj $(GLIBS) $(KLIB) $(WINLIBS) +##WIN32## gss_glue.obj $(GLIBS) $(KLIB) $(CLIB) $(WINLIBS) -win_glue.obj: win_glue.c - $(CC) $(CFLAGS) /c win_glue.c +krb_glue.obj: win_glue.c + $(CC) $(CFLAGS) /c /DKRB5=1 /Fo$@ $** +gss_glue.obj: win_glue.c + $(CC) $(CFLAGS) /c /DGSSAPI=1 /Fo$@ $** +no_glue.obj: win_glue.c + $(CC) $(CFLAGS) /c /Fo$@ $** ##WIN16##$(WLIB): winsock.def ##WIN16## implib /nologo $@ winsock.def +# Build Convenience +comerr.lib: $(CLIB) +krb5.lib: $(KLIB) +gssapi.lib: $(GLIB) + + sap_glue.obj: win_glue.c $(CC) $(CFLAGS) -DSAP_TIMEBOMB -I$(VERS_DIR) /c /Fo$@ win_glue.c diff --git a/src/lib/comerr16.def b/src/lib/comerr16.def new file mode 100644 index 000000000..c85c4bcc7 --- /dev/null +++ b/src/lib/comerr16.def @@ -0,0 +1,16 @@ +LIBRARY COMERR16 +DESCRIPTION 'DLL for ComErr' +EXETYPE WINDOWS +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE SINGLE +HEAPSIZE 8192 + +EXPORTS + WEP @1001 RESIDENTNAME + LibMain @1002 +; + _com_err + com_err_va + error_message + add_error_table + remove_error_table diff --git a/src/lib/comerr32.def b/src/lib/comerr32.def new file mode 100644 index 000000000..91f6d1920 --- /dev/null +++ b/src/lib/comerr32.def @@ -0,0 +1,12 @@ +;LIBRARY COMERR32 +DESCRIPTION 'DLL for ComErr' +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE SINGLE +HEAPSIZE 8192 + +EXPORTS + com_err + com_err_va + error_message + add_error_table + remove_error_table diff --git a/src/lib/gssapi32.def b/src/lib/gssapi32.def index 38484149f..d80e85bbc 100644 --- a/src/lib/gssapi32.def +++ b/src/lib/gssapi32.def @@ -9,9 +9,6 @@ DATA PRELOAD MOVEABLE SINGLE HEAPSIZE 8192 EXPORTS - WEP @1001 - LibMain @1002 -; gss_acquire_cred gss_release_cred gss_init_sec_context diff --git a/src/lib/krb5_16.def b/src/lib/krb5_16.def index afe3d2af6..db9b26f9d 100644 --- a/src/lib/krb5_16.def +++ b/src/lib/krb5_16.def @@ -159,17 +159,6 @@ EXPORTS krb5_free_adm_data krb5_read_adm_reply krb5_send_adm_cmd -;Com_err routines - _com_err - error_message - et_init - et_shutdown - et_add_error_table - et_error_message - _et_com_err - _et_com_err_va - et_set_hook - __et_list ; ;Temporary exports (DO NOT USE) _sscanf diff --git a/src/lib/krb5_32.def b/src/lib/krb5_32.def index 0c2bd3e1b..c8f43ac63 100644 --- a/src/lib/krb5_32.def +++ b/src/lib/krb5_32.def @@ -9,8 +9,6 @@ DATA PRELOAD MOVEABLE SINGLE HEAPSIZE 8192 EXPORTS - WEP @1001 - LibMain @1002 ; Kerberos 5 krb5_build_principal krb5_build_principal_ext @@ -158,17 +156,6 @@ EXPORTS krb5_free_adm_data krb5_read_adm_reply krb5_send_adm_cmd -;Com_err routines - com_err - error_message - et_init - et_shutdown - et_add_error_table - et_error_message - et_com_err - et_com_err_va - et_set_hook - _et_list ; ;Temporary exports (DO NOT USE) decode_krb5_ticket diff --git a/src/lib/win_glue.c b/src/lib/win_glue.c index 519bbcf94..b05024a65 100644 --- a/src/lib/win_glue.c +++ b/src/lib/win_glue.c @@ -57,6 +57,15 @@ #include #include + +#if defined(GSSAPI) && !defined(KRB5) +#define KRB5 1 +#endif +#if defined(KRB5) && !defined(NEED_WINSOCK) +#define NEED_WINSOCK 1 +#endif + + /* * Use the version server to give us some control on distribution and usage * We're going to test track as well @@ -149,10 +158,8 @@ static krb5_error_code do_timebomb() */ krb5_error_code krb5_vercheck() { - krb5_error_code retval; - #ifdef TIMEBOMB - retval = do_timebomb(); + krb5_error_code retval = do_timebomb(); if (retval) return retval; #endif @@ -163,6 +170,7 @@ krb5_error_code krb5_vercheck() return 0; } +#ifdef NEED_WINSOCK int win_socket_initialize() { @@ -184,6 +192,54 @@ win_socket_initialize() return 0; } +#endif + +#ifdef _WIN32 + +BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved) +{ + switch (fdwReason) + { + case DLL_PROCESS_ATTACH: +#ifdef NEED_WINSOCK + win_socket_initialize (); +#endif +#ifdef KRB5 + krb5_init_ets((krb5_context)0); +#endif +#ifdef GSSAPI + initialize_k5g_error_table(); + initialize_ggss_error_table(); +#endif + break; + + case DLL_THREAD_ATTACH: + break; + + case DLL_THREAD_DETACH: + break; + + case DLL_PROCESS_DETACH: +#ifdef GSSAPI + cleanup_k5g_error_table(); + cleanup_ggss_error_table(); +#endif +#ifdef KRB5 + krb5_finish_ets((krb5_context)0); +#endif +#ifdef NEED_WINSOCK + WSACleanup (); +#endif + break; + + default: + return FALSE; + } + + return TRUE; // successful DLL_PROCESS_ATTACH +} + +#else BOOL CALLBACK LibMain (hInst, wDataSeg, cbHeap, CmdLine) @@ -192,7 +248,16 @@ WORD wDataSeg; WORD cbHeap; LPSTR CmdLine; { +#ifdef NEED_WINSOCK win_socket_initialize (); +#endif +#ifdef KRB5 + krb5_init_ets((krb5_context)0); +#endif +#ifdef GSSAPI + initialize_k5g_error_table(); + initialize_ggss_error_table(); +#endif return 1; } @@ -200,6 +265,17 @@ int CALLBACK __export WEP(nParam) int nParam; { +#ifdef GSSAPI + cleanup_k5g_error_table(); + cleanup_ggss_error_table(); +#endif +#ifdef KRB5 + krb5_finish_ets((krb5_context)0); +#endif +#ifdef NEED_WINSOCK WSACleanup(); +#endif return 1; } + +#endif