summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Hartman <hartmans@mit.edu>2011-09-28 20:54:28 +0000
committerSam Hartman <hartmans@mit.edu>2011-09-28 20:54:28 +0000
commit560ac14a1eeedf6b246186ab5e6abb819cf2afb3 (patch)
tree1eeb1862c212ab91ee531f45dcd06e9a2fe59039
parentb801b385330cd24c44a549a9327ab707ccec403f (diff)
downloadkrb5-560ac14a1eeedf6b246186ab5e6abb819cf2afb3.tar.gz
krb5-560ac14a1eeedf6b246186ab5e6abb819cf2afb3.tar.xz
krb5-560ac14a1eeedf6b246186ab5e6abb819cf2afb3.zip
Initial update to KFW related source to build with K5 1.9 on Windows
From: Alexey Melnikov <alexey.melnikov@isode.com> git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25245 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r--src/Makefile.in12
-rw-r--r--src/windows/Makefile.in2
-rw-r--r--src/windows/leashdll/AFSroutines.c24
-rw-r--r--src/windows/leashdll/Makefile.in76
-rw-r--r--src/windows/leashdll/include/leashwin.h10
-rw-r--r--src/windows/leashdll/krb5routines.c4
-rw-r--r--src/windows/leashdll/leashdll.c1
-rw-r--r--src/windows/leashdll/leashdll.h3
-rw-r--r--src/windows/leashdll/leasherr.c3
-rw-r--r--src/windows/leashdll/lsh_pwd.c2
-rw-r--r--src/windows/leashdll/lshcallb.c1
-rw-r--r--src/windows/leashdll/lshfunc.c10
-rw-r--r--src/windows/leashdll/timesync.c4
-rw-r--r--src/windows/leashdll/winerr.c129
-rw-r--r--src/windows/lib/registry.c1
-rw-r--r--src/windows/version.rc12
-rw-r--r--src/windows/wshelper/Makefile.in65
-rw-r--r--src/windows/wshelper/hesiod.c1
-rw-r--r--src/windows/wshelper/resource.rc2
19 files changed, 221 insertions, 141 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index 9e048ad7ab..660aebee54 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -190,10 +190,10 @@ WINMAKEFILES=Makefile \
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)
@@ -307,6 +307,8 @@ WINMAKEFILES=Makefile \
##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)
@@ -317,6 +319,8 @@ WINMAKEFILES=Makefile \
##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
@@ -359,9 +363,9 @@ WINFILES= \
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
diff --git a/src/windows/Makefile.in b/src/windows/Makefile.in
index 9cadd576d6..7e75a6c803 100644
--- a/src/windows/Makefile.in
+++ b/src/windows/Makefile.in
@@ -3,4 +3,4 @@ NO_OUTPRE=1
!if "$(KRB5_KFW_COMPILE)"=="1"
KFWLOGON= kfwlogon
!endif
-SUBDIRS= lib cns gss gina ms2mit $(KFWLOGON)
+SUBDIRS= wshelper lib leashdll cns gss gina ms2mit $(KFWLOGON)
diff --git a/src/windows/leashdll/AFSroutines.c b/src/windows/leashdll/AFSroutines.c
index a67b164e3b..cdf751d508 100644
--- a/src/windows/leashdll/AFSroutines.c
+++ b/src/windows/leashdll/AFSroutines.c
@@ -1,18 +1,21 @@
//* 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"
@@ -267,10 +270,12 @@ Leash_afs_klog(
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;
@@ -348,12 +353,15 @@ Leash_afs_klog(
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)
@@ -519,6 +527,7 @@ Leash_afs_klog(
#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
@@ -527,9 +536,13 @@ Leash_afs_klog(
}
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)
@@ -546,8 +559,11 @@ Leash_afs_klog(
}
else
{
+#endif
return(rc);
+#ifndef NO_KRB4
}
+#endif
}
memset(&aserver, '\0', sizeof(aserver));
@@ -645,11 +661,13 @@ static char *afs_realm_of_cell(afsconf_cell *cellconfig)
}
#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] )
{
diff --git a/src/windows/leashdll/Makefile.in b/src/windows/leashdll/Makefile.in
new file mode 100644
index 0000000000..fd9b0f4319
--- /dev/null
+++ b/src/windows/leashdll/Makefile.in
@@ -0,0 +1,76 @@
+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
diff --git a/src/windows/leashdll/include/leashwin.h b/src/windows/leashdll/include/leashwin.h
index 477c6c30cd..6a26c43f93 100644
--- a/src/windows/leashdll/include/leashwin.h
+++ b/src/windows/leashdll/include/leashwin.h
@@ -1,7 +1,17 @@
#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
diff --git a/src/windows/leashdll/krb5routines.c b/src/windows/leashdll/krb5routines.c
index 7f2d28306e..0bb30ca15c 100644
--- a/src/windows/leashdll/krb5routines.c
+++ b/src/windows/leashdll/krb5routines.c
@@ -21,6 +21,8 @@
#include <time.h>
#include <assert.h>
+#include <winsock2.h>
+
/* Private Include files */
#include "leashdll.h"
#include <leashwin.h>
@@ -1527,4 +1529,4 @@ leash_krb5_prompter( krb5_context context,
}
return errcode;
}
-#endif /* NO_KRB5 */ \ No newline at end of file
+#endif /* NO_KRB5 */
diff --git a/src/windows/leashdll/leashdll.c b/src/windows/leashdll/leashdll.c
index f5e2653423..08ebbe0780 100644
--- a/src/windows/leashdll/leashdll.c
+++ b/src/windows/leashdll/leashdll.c
@@ -1,6 +1,5 @@
#include <windows.h>
#include "leashdll.h"
-#include <krb.h>
#include <leashwin.h>
#include "leash-int.h"
diff --git a/src/windows/leashdll/leashdll.h b/src/windows/leashdll/leashdll.h
index 162fb4f21a..74cceab823 100644
--- a/src/windows/leashdll/leashdll.h
+++ b/src/windows/leashdll/leashdll.h
@@ -112,7 +112,8 @@ typedef struct TicketList
#include <errno.h>
#ifndef NO_AFS
-#include "afscompat.h"
+////Can't find it!
+////#include "afscompat.h"
#endif
// service definitions
diff --git a/src/windows/leashdll/leasherr.c b/src/windows/leashdll/leasherr.c
index ec2616b21c..686f48bac7 100644
--- a/src/windows/leashdll/leasherr.c
+++ b/src/windows/leashdll/leasherr.c
@@ -85,7 +85,6 @@ void initialize_lsh_error_table(struct et_list **__et_list) {
#endif
#ifdef WINDOWS
-#include <krberr.h>
void Leash_initialize_krb_error_func(err_func func, HANDLE *__et_list)
{
@@ -94,8 +93,6 @@ 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
diff --git a/src/windows/leashdll/lsh_pwd.c b/src/windows/leashdll/lsh_pwd.c
index 6be1ea3c0a..23f761e4c7 100644
--- a/src/windows/leashdll/lsh_pwd.c
+++ b/src/windows/leashdll/lsh_pwd.c
@@ -33,7 +33,9 @@
#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 */
diff --git a/src/windows/leashdll/lshcallb.c b/src/windows/leashdll/lshcallb.c
index 3f2afb3459..0344b796f3 100644
--- a/src/windows/leashdll/lshcallb.c
+++ b/src/windows/leashdll/lshcallb.c
@@ -1,5 +1,4 @@
#include <windows.h>
-#include <krb.h>
int (*Lcom_err)(LPSTR,long,LPSTR,...);
LPSTR (*Lerror_message)(long);
diff --git a/src/windows/leashdll/lshfunc.c b/src/windows/leashdll/lshfunc.c
index 73b10c3579..c2b6d9216d 100644
--- a/src/windows/leashdll/lshfunc.c
+++ b/src/windows/leashdll/lshfunc.c
@@ -1,10 +1,16 @@
#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>
@@ -14,7 +20,9 @@
#include <mitwhich.h>
+#ifndef NO_KRB4
#include <winkrbid.h>
+#endif
#include "reminder.h"
static char FAR *err_context;
diff --git a/src/windows/leashdll/timesync.c b/src/windows/leashdll/timesync.c
index c9feadb3e8..1c0bbbed2b 100644
--- a/src/windows/leashdll/timesync.c
+++ b/src/windows/leashdll/timesync.c
@@ -8,10 +8,14 @@
#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>
diff --git a/src/windows/leashdll/winerr.c b/src/windows/leashdll/winerr.c
index 10806d8b88..2d487b4495 100644
--- a/src/windows/leashdll/winerr.c
+++ b/src/windows/leashdll/winerr.c
@@ -15,7 +15,6 @@
// Private Include files
#include "leashdll.h"
-#include <krb.h>
#include <leashwin.h>
// Global Variables.
@@ -54,135 +53,17 @@ LPSTR err_describe(LPSTR buf, long code)
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)"
diff --git a/src/windows/lib/registry.c b/src/windows/lib/registry.c
index 5b7ff1e828..5b0e7a1aba 100644
--- a/src/windows/lib/registry.c
+++ b/src/windows/lib/registry.c
@@ -4,6 +4,7 @@
* Author: Michael Graff
*/
+#include <stdlib.h>
#include <windows.h>
#include <windowsx.h>
diff --git a/src/windows/version.rc b/src/windows/version.rc
index e0b9235418..166d961a51 100644
--- a/src/windows/version.rc
+++ b/src/windows/version.rc
@@ -108,6 +108,18 @@
#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"
diff --git a/src/windows/wshelper/Makefile.in b/src/windows/wshelper/Makefile.in
new file mode 100644
index 0000000000..c4647e5de9
--- /dev/null
+++ b/src/windows/wshelper/Makefile.in
@@ -0,0 +1,65 @@
+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
diff --git a/src/windows/wshelper/hesiod.c b/src/windows/wshelper/hesiod.c
index c912f7d44b..b448849cfd 100644
--- a/src/windows/wshelper/hesiod.c
+++ b/src/windows/wshelper/hesiod.c
@@ -33,6 +33,7 @@
#define index(str, c) strchr(str,c)
#include <stdio.h>
+#include <stdlib.h>
#include <errno.h>
#include <windows.h>
diff --git a/src/windows/wshelper/resource.rc b/src/windows/wshelper/resource.rc
index d94e2deb7b..f6244a7cf8 100644
--- a/src/windows/wshelper/resource.rc
+++ b/src/windows/wshelper/resource.rc
@@ -57,7 +57,7 @@ END
//
// Generated from the TEXTINCLUDE 3 resource.
//
-#include "version.rc"
+#include "..\version.rc"
#include "string.rc"
/////////////////////////////////////////////////////////////////////////////