util\et\Makefile util\profile\Makefile util\profile\testmod\Makefile \
util\support\Makefile \
util\windows\Makefile \
- windows\Makefile windows\lib\Makefile \
+ windows\Makefile windows\wshelper\Makefile windows\lib\Makefile \
windows\cns\Makefile windows\gina\Makefile \
windows\gss\Makefile windows\ms2mit\Makefile \
- windows\wintel\Makefile windows\kfwlogon\Makefile
+ windows\wintel\Makefile windows\kfwlogon\Makefile windows\leashdll\Makefile
##DOS##Makefile-windows:: $(MKFDEP) $(WINMAKEFILES)
##DOS## $(WCONFIG) config < $@.in > $@
##DOS##windows\cns\Makefile: windows\cns\Makefile.in $(MKFDEP)
##DOS## $(WCONFIG) config < $@.in > $@
+##DOS##windows\wshelper\Makefile: windows\wshelper\Makefile.in $(MKFDEP)
+##DOS## $(WCONFIG) config < $@.in > $@
##DOS##windows\gina\Makefile: windows\gina\Makefile.in $(MKFDEP)
##DOS## $(WCONFIG) config < $@.in > $@
##DOS##windows\gss\Makefile: windows\gss\Makefile.in $(MKFDEP)
##DOS## $(WCONFIG) config < $@.in > $@
##DOS##windows\kfwlogon\Makefile: windows\kfwlogon\Makefile.in $(MKFDEP)
##DOS## $(WCONFIG) config < $@.in > $@
+##DOS##windows\leashdll\Makefile: windows\leashdll\Makefile.in $(MKFDEP)
+##DOS## $(WCONFIG) config < $@.in > $@
clean-windows:: Makefile-windows
ccapi/lib/* ccapi/lib/win/* ccapi/lib/win/OldCC/* \
ccapi/server/* ccapi/server/win/* \
ccapi/test/* \
- util/windows/* windows/* windows/lib/* windows/cns/* \
+ util/windows/* windows/* windows/wshelper/* windows/lib/* windows/cns/* \
windows/wintel/* windows/gss/* windows/gina/* windows/ms2mit/* \
- windows/kfwlogon/*
+ windows/kfwlogon/* windows/leashdll/*
WINBINARYFILES= windows/*/*.ico windows/*/*.doc windows/*/*.hlp \
windows/*/*.hpj
!if "$(KRB5_KFW_COMPILE)"=="1"
KFWLOGON= kfwlogon
!endif
-SUBDIRS= lib cns gss gina ms2mit $(KFWLOGON)
+SUBDIRS= wshelper lib leashdll cns gss gina ms2mit $(KFWLOGON)
//* Module name: AFSroutines.c
#include <windows.h>
+#include <winsock2.h>
#include <stdio.h>
#include <time.h>
/* Private Include files */
#include <conf.h>
#include <leasherr.h>
-#include <krb.h>
#include "leashdll.h"
#include <leashwin.h>
#ifndef NO_AFS
-#include "afscompat.h"
+#include <afs/stds.h>
+#include <afs/auth.h>
+#include <afs/krb.h>
+#include <afs/cellconfig.h>
#endif
#include "leash-int.h"
int LifeTime
)
{
-#ifdef NO_AFS
+/////#ifdef NO_AFS
+#if defined(NO_AFS) || defined(NO_KRB4)
return(0);
#else
long rc;
+////This is defined in krb.h:
CREDENTIALS creds;
KTEXT_ST ticket;
struct ktc_principal aserver;
try_krb5 = 1;
}
#endif /* NO_KRB5 */
+
+#ifndef NO_KRB4
if ( !try_krb5 || !realm_of_user[0] ) {
if ((rc = (*pkrb_get_tf_realm)((*ptkt_string)(), realm_of_user)) != KSUCCESS)
{
return(rc);
}
}
+#endif
strcpy(realm_of_cell, afs_realm_of_cell(&ak_cellconfig));
if (strlen(service) == 0)
#endif /* NO_KRB5 */
{
use_krb4:
+#ifndef NO_KRB4
rc = (*pkrb_get_cred)(ServiceName, CellName, RealmName, &creds);
if (rc == NO_TKT_FIL) {
// if the problem is that we have no krb4 tickets
}
if (rc != KSUCCESS)
rc = (*pkrb_get_cred)(ServiceName, "", RealmName, &creds);
+#else
+ rc = KFAILURE;
+#endif
}
if (rc != KSUCCESS)
{
+#ifndef NO_KRB4
if ((rc = (*pkrb_mk_req)(&ticket, ServiceName, CellName, RealmName, 0)) == KSUCCESS)
{
if ((rc = (*pkrb_get_cred)(ServiceName, CellName, RealmName, &creds)) != KSUCCESS)
}
else
{
+#endif
return(rc);
+#ifndef NO_KRB4
}
+#endif
}
memset(&aserver, '\0', sizeof(aserver));
}
#endif /* NO_KRB5 */
+#ifndef NO_KRB4
if ( !krbrlm[0] ) {
strcpy(krbrlm, (char *)(*pkrb_realmofhost)(cellconfig->hostName[0]));
if ((*pkrb_get_krbhst)(krbhst, krbrlm, 1) != KSUCCESS)
krbrlm[0] = '\0';
}
+#endif /* NO_KRB4 */
if ( !krbrlm[0] )
{
--- /dev/null
+BUILDTOP=..\..
+
+!ifndef NO_AFS
+###AFS_BASE=
+AFS_INCLUDES=-I$(AFS_BASE)\Include
+AFS_LIB=$(AFS_BASE)\lib
+AFS_LIBS=$(AFS_LIB)\afsauthent.lib
+!else
+AFS_INCLUDES=
+AFS_LIBS=
+!endif
+
+DLL_NAME=leashw32
+
+# Use 64-bit DLL_NAME and DEF_FILE on 64-bit platforms
+!if ("$(CPU)" == "IA64") || ("$(CPU)" == "AMD64") || ("$(CPU)" == "ALPHA64")
+DLL_NAME=leashw64
+!endif
+
+DEF_FILE=leashw32.def
+
+OBJS= $(OUTPRE)AFSroutines.$(OBJEXT) \
+ $(OUTPRE)krb5routines.$(OBJEXT) \
+ $(OUTPRE)leashdll.$(OBJEXT) \
+ $(OUTPRE)leasherr.$(OBJEXT) \
+ $(OUTPRE)lsh_pwd.$(OBJEXT) \
+ $(OUTPRE)lshcallb.$(OBJEXT) \
+ $(OUTPRE)lshfunc.$(OBJEXT) \
+ $(OUTPRE)timesync.$(OBJEXT) \
+ $(OUTPRE)winerr.$(OBJEXT) \
+ $(OUTPRE)winutil.$(OBJEXT) \
+ $(OUTPRE)registry.$(OBJEXT) \
+ $(OUTPRE)loadfuncs.$(OBJEXT)
+
+#TODO: Fix resource compilation
+#RESFILE = $(OUTPRE)lsh_pwd.res
+XOBJS = $(RESFILE)
+
+RCFLAGS = /i $(BUILDTOP)\include
+
+###From another project inside K 1.9:
+###VERSIONRC = $(BUILDTOP)\windows\version.rc
+###RCFLAGS=$(CPPFLAGS) -I$(top_srcdir) -D_WIN32 -DRES_ONLY
+
+
+# Set NODEBUG if building release instead of debug
+
+LOCALINCLUDES = -I$(BUILDTOP)\include -I.\include -I.\include\krb4 $(AFS_INCLUDES)
+
+WINLIBS = kernel32.lib advapi32.lib user32.lib gdi32.lib Version.lib \
+ ws2_32.lib dnsapi.lib $(BUILDTOP)\ccapi\lib\win\srctmp\ccapi.lib $(AFS_LIBS)
+
+WINDLLFLAGS = /nologo /dll /incremental:no /release $(LOPTS)
+
+
+DEFINES = -DUNICODE -D_UNICODE -DWINSOCK -DWIN32 -DWINDOWS -DNO_KRB4
+!ifdef NODEBUG
+DEFINES = $(DEFINES)
+!else
+DEFINES = $(DEFINES) -DDBG
+!endif
+
+all-windows::
+all-windows:: $(OUTPRE)$(DLL_NAME).dll
+
+clean-windows::
+ $(RM) $(OUTPRE)$(DLL_NAME).dll
+
+$(OUTPRE)$(DLL_NAME).dll: $(DEF_FILE) $(OBJS) $(XOBJS)
+ link $(WINDLLFLAGS) -def:$(DEF_FILE) -out:$*.dll \
+ $(OBJS) $(XOBJS) $(WINLIBS) $(SCLIB)
+ $(_VC_MANIFEST_EMBED_DLL)
+
+#TODO: Add dependencies on include files here
+
+#$(RESFILE): resource.rc
#ifndef __LEASHWIN__
#define __LEASHWIN__
+////Is this sufficient?
+#ifndef NO_KRB4
#include <krb.h>
+#else
+#define ANAME_SZ 40
+#define REALM_SZ 40
+#define SNAME_SZ 40
+#define INST_SZ 40
+/* include space for '.' and '@' */
+#define MAX_K_NAME_SZ (ANAME_SZ + INST_SZ + REALM_SZ + 2)
+#endif
#define DLGTYPE_PASSWD 0
#define DLGTYPE_CHPASSWD 1
#include <time.h>
#include <assert.h>
+#include <winsock2.h>
+
/* Private Include files */
#include "leashdll.h"
#include <leashwin.h>
}
return errcode;
}
-#endif /* NO_KRB5 */
\ No newline at end of file
+#endif /* NO_KRB5 */
#include <windows.h>
#include "leashdll.h"
-#include <krb.h>
#include <leashwin.h>
#include "leash-int.h"
#include <errno.h>
#ifndef NO_AFS
-#include "afscompat.h"
+////Can't find it!
+////#include "afscompat.h"
#endif
// service definitions
#endif
#ifdef WINDOWS
-#include <krberr.h>
void Leash_initialize_krb_error_func(err_func func, HANDLE *__et_list)
{
#endif
}
-#include <kadm_err.h>
-
void Leash_initialize_kadm_error_table(HANDLE *__et_list)
{
#ifndef NO_KRB4
#include "leash-int.h"
#include "leashids.h"
#include <leasherr.h>
+#ifndef NO_KRB4
#include <krb.h>
+#endif
#ifndef NO_KRB5
#include <krb5.h>
#endif /* NO_KRB5 */
#include <windows.h>
-#include <krb.h>
int (*Lcom_err)(LPSTR,long,LPSTR,...);
LPSTR (*Lerror_message)(long);
#include <windows.h>
#include <stdio.h>
#include <sys/types.h>
-#include <winsock.h>
+#include <winsock2.h>
#include "leashdll.h"
+#ifndef NO_KRB4
#include <KerberosIV/krb.h>
#include <prot.h>
+#else
+/* General definitions */
+#define KSUCCESS 0
+#define KFAILURE 255
+#endif
#include <time.h>
#include <leashwin.h>
#include <mitwhich.h>
+#ifndef NO_KRB4
#include <winkrbid.h>
+#endif
#include "reminder.h"
static char FAR *err_context;
#include <stdlib.h>
#include <string.h>
+#ifndef NO_KRB4
#include <winkrbid.h>
+#endif
#ifdef WSHELPER
#include <wshelper.h>
+#else
+#include <winsock2.h>
#endif
#include <stdio.h>
// Private Include files
#include "leashdll.h"
-#include <krb.h>
#include <leashwin.h>
// Global Variables.
table_num = code - offset;
com_err_msg = Lerror_message(code);
- switch(table_num)
- {
-#ifndef NO_KRB4
- case krb_err_base:
- case kadm_err_base:
- break;
-#endif
- default:
- lstrcpy(buf, com_err_msg);
- return buf;
- }
+ lstrcpy(buf, com_err_msg);
+ return buf;
+
+////Is this needed at all after the return above?
cp = buf;
-#ifndef NO_KRB4
- if (table_num == krb_err_base)
- switch(offset)
- {
- case KDC_NAME_EXP: /* 001 Principal expired */
- case KDC_SERVICE_EXP: /* 002 Service expired */
- case KDC_AUTH_EXP: /* 003 Auth expired */
- case KDC_PKT_VER: /* 004 Protocol version unknown */
- case KDC_P_MKEY_VER: /* 005 Wrong master key version */
- case KDC_S_MKEY_VER: /* 006 Wrong master key version */
- case KDC_BYTE_ORDER: /* 007 Byte order unknown */
- case KDC_PR_N_UNIQUE: /* 009 Principal not unique */
- case KDC_NULL_KEY: /* 010 Principal has null key */
- case KDC_GEN_ERR: /* 011 Generic error from KDC */
- case INTK_W_NOTALL : /* 061 Not ALL tickets returned */
- case INTK_PROT : /* 063 Protocol Error */
- case INTK_ERR : /* 070 Other error */
- com_err_msg = "Something weird happened... try again, and if Leash"
- " continues to fail, contact Network Services as listed in the "
- "About box.";
- break;
- case KDC_PR_UNKNOWN: /* 008 Principal unknown */
- com_err_msg = "You have entered an unknown username/instance/realm"
- " combination.";
- break;
- case GC_TKFIL : /* 021 Can't read ticket file */
- case GC_NOTKT : /* 022 Can't find ticket or TGT */
- com_err_msg = "Something is wrong with the memory where your "
- "tickets are stored. Try exiting Windows and restarting your "
- "computer.";
- break;
- case MK_AP_TGTEXP : /* 026 TGT Expired */
- /* no extra error msg */
- break;
- case RD_AP_TIME : /* 037 delta_t too big */
- com_err_msg = "Your computer's clock is out of sync with the "
- "Kerberos server. Please see the help file about correcting "
- "your clock.";
- break;
-
- case RD_AP_UNDEC : /* 031 Can't decode authenticator */
- case RD_AP_EXP : /* 032 Ticket expired */
- case RD_AP_NYV : /* 033 Ticket not yet valid */
- case RD_AP_REPEAT : /* 034 Repeated request */
- case RD_AP_NOT_US : /* 035 The ticket isn't for us */
- case RD_AP_INCON : /* 036 Request is inconsistent */
- case RD_AP_BADD : /* 038 Incorrect net address */
- case RD_AP_VERSION : /* 039 protocol version mismatch */
- case RD_AP_MSG_TYPE : /* 040 invalid msg type */
- case RD_AP_MODIFIED : /* 041 message stream modified */
- case RD_AP_ORDER : /* 042 message out of order */
- case RD_AP_UNAUTHOR : /* 043 unauthorized request */
- /* no extra error msg */
- break;
- case GT_PW_NULL: /* 51 Current PW is null */
- case GT_PW_BADPW: /* 52 Incorrect current password */
- case GT_PW_PROT: /* 53 Protocol Error */
- case GT_PW_KDCERR: /* 54 Error returned by KDC */
- case GT_PW_NULLTKT: /* 55 Null tkt returned by KDC */
- /* no error msg yet */
- break;
-
- /* Values returned by send_to_kdc */
- case SKDC_RETRY : /* 56 Retry count exceeded */
- case SKDC_CANT : /* 57 Can't send request */
- com_err_msg = "Cannot contact the kerberos server for the selected realm.";
- break;
- /* no error message on purpose: */
- case INTK_BADPW : /* 062 Incorrect password */
- break;
- default:
- /* no extra error msg */
- break;
- }
- else
- switch(code)
- {
- case KADM_INSECURE_PW:
- /* if( kadm_info != NULL ){
- * wsprintf(buf, "%s\n%s", com_err_msg, kadm_info);
- * } else {
- * wsprintf(buf, "%s\nPlease see the help file for information "
- * "about secure passwords.", com_err_msg);
- * }
- * com_err_msg = buf;
- */
-
- /* The above code would be preferred since it allows site specific
- * information to be delivered from the Kerberos server. However the
- * message box is too small for VGA screens.
- * It does work well if we only have to support 1024x768
- */
-
- com_err_msg = "You have entered an insecure or weak password.";
- default:
- /* no extra error msg */
- break;
- }
-#endif /* NO_KRB4 */
if(com_err_msg != buf)
lstrcpy(buf, com_err_msg);
cp = buf + lstrlen(buf);
*cp++ = '\n';
- switch(table_num) {
-#ifndef NO_KRB4
- case krb_err_base:
- etype = "Kerberos";
- break;
- case kadm_err_base:
- etype = "Kerberos supplemental";
- break;
-#endif
- default:
- etype = Lerror_table_name(table_num);
- break;
- }
+ etype = Lerror_table_name(table_num);
wsprintf((LPSTR) cp, (LPSTR) "(%s error %d"
#ifdef DEBUG_COM_ERR
" (absolute error %ld)"
* Author: Michael Graff
*/
+#include <stdlib.h>
#include <windows.h>
#include <windowsx.h>
#endif
#endif /* GSSAPI */
+
+#ifdef WSHELPER_LIB
+#define K5_DESCRIPTION "Winsock Helper (wshelper) API - MIT GSS / Kerberos v5 distribution\0"
+#define K5_INTERNAL_NAME "wshelper\0"
+#define K5_FILETYPE VFT_DLL
+#if !defined(_WIN32)
+#define K5_ORIGINAL_NAME "wshelper.dll\0"
+#else
+#define K5_ORIGINAL_NAME "wshelper32.dll\0"
+#endif
+#endif /* WSHELPER_LIB */
+
#ifdef KRB4_LIB
#define K5_DESCRIPTION "Kerberos v4 - MIT GSS / Kerberos v4 and v5 distribution\0"
#define K5_INTERNAL_NAME "krb4\0"
--- /dev/null
+BUILDTOP=..\..
+
+DLL_NAME=wshelp32
+DEF_FILE=wshelp32.def
+
+# Use 64-bit DLL_NAME and DEF_FILE on 64-bit platforms
+!if ("$(CPU)" == "IA64") || ("$(CPU)" == "AMD64") || ("$(CPU)" == "ALPHA64")
+DLL_NAME=wshelp64
+DEF_FILE=wshelp64.def
+!endif
+
+
+OBJS= $(OUTPRE)dllmain.$(OBJEXT) \
+ $(OUTPRE)gethna.$(OBJEXT) \
+ $(OUTPRE)hesiod.$(OBJEXT) \
+ $(OUTPRE)hesmailh.$(OBJEXT) \
+ $(OUTPRE)hespwnam.$(OBJEXT) \
+ $(OUTPRE)hesservb.$(OBJEXT) \
+ $(OUTPRE)inetaton.$(OBJEXT) \
+ $(OUTPRE)res_comp.$(OBJEXT) \
+ $(OUTPRE)res_init.$(OBJEXT) \
+ $(OUTPRE)res_quer.$(OBJEXT)
+
+RESFILE = $(OUTPRE)resource.res
+XOBJS = $(RESFILE)
+
+RCFLAGS = -I$(BUILDTOP)\include -I$(BUILDTOP) -DWSHELPER_LIB
+
+###From another project inside K 1.9:
+###VERSIONRC = $(BUILDTOP)\windows\version.rc
+###RCFLAGS=$(CPPFLAGS) -I$(top_srcdir) -D_WIN32 -DRES_ONLY
+
+
+# Set NODEBUG if building release instead of debug
+
+LOCALINCLUDES = -I$(BUILDTOP)\include
+
+WINLIBS = advapi32.lib user32.lib ws2_32.lib dnsapi.lib
+
+WINDLLFLAGS = /nologo /dll /incremental:no /release $(LOPTS)
+
+DEFINES = -DUNICODE -D_UNICODE
+!ifdef NODEBUG
+DEFINES = $(DEFINES)
+!else
+DEFINES = $(DEFINES) -DDBG
+!endif
+
+all-windows::
+all-windows:: $(OUTPRE)$(DLL_NAME).dll
+
+clean-windows::
+ $(RM) $(OUTPRE)$(DLL_NAME).dll
+
+$(OUTPRE)$(DLL_NAME).dll: $(DEF_FILE) $(OBJS) $(XOBJS)
+ link $(WINDLLFLAGS) -def:$(DEF_FILE) -out:$*.dll \
+ $(OBJS) $(XOBJS) $(WINLIBS) $(SCLIB)
+ $(_VC_MANIFEST_EMBED_DLL)
+
+$(OUTPRE)dllmain.$(OBJEXT): pwd.h
+$(OUTPRE)hespwnam.$(OBJEXT): pwd.h
+$(OUTPRE)dllmain.$(OBJEXT): wsh-int.h
+$(OUTPRE)res_init.$(OBJEXT): wsh-int.h
+
+$(RESFILE): resource.rc
#define index(str, c) strchr(str,c)
#include <stdio.h>
+#include <stdlib.h>
#include <errno.h>
#include <windows.h>
//
// Generated from the TEXTINCLUDE 3 resource.
//
-#include "version.rc"
+#include "..\version.rc"
#include "string.rc"
/////////////////////////////////////////////////////////////////////////////