summaryrefslogtreecommitdiffstats
path: root/src/lib/krb4
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/krb4')
-rw-r--r--src/lib/krb4/ChangeLog12
-rw-r--r--src/lib/krb4/Makefile.in111
-rw-r--r--src/lib/krb4/ad_print.c4
-rw-r--r--src/lib/krb4/dest_tkt.c4
-rw-r--r--src/lib/krb4/err_txt.c12
-rw-r--r--src/lib/krb4/g_admhst.c6
-rw-r--r--src/lib/krb4/g_cnffile.c2
-rw-r--r--src/lib/krb4/g_cred.c10
-rw-r--r--src/lib/krb4/g_krbhst.c6
-rw-r--r--src/lib/krb4/g_krbrlm.c2
-rw-r--r--src/lib/krb4/g_phost.c6
-rw-r--r--src/lib/krb4/g_pw_in_tkt.c23
-rw-r--r--src/lib/krb4/g_svc_in_tkt.c17
-rw-r--r--src/lib/krb4/g_tf_fname.c2
-rw-r--r--src/lib/krb4/g_tf_realm.c1
-rw-r--r--src/lib/krb4/g_tkt_svc.c10
-rw-r--r--src/lib/krb4/getst.c1
-rw-r--r--src/lib/krb4/in_tkt.c2
-rw-r--r--src/lib/krb4/kerberos.def68
-rw-r--r--src/lib/krb4/klog.c3
-rw-r--r--src/lib/krb4/kname_parse.c7
-rw-r--r--src/lib/krb4/kparse.c7
-rw-r--r--src/lib/krb4/kuserok.c11
-rw-r--r--src/lib/krb4/log.c3
-rw-r--r--src/lib/krb4/memcache.c40
-rw-r--r--src/lib/krb4/mk_auth.c21
-rw-r--r--src/lib/krb4/mk_err.c8
-rw-r--r--src/lib/krb4/mk_preauth.c8
-rw-r--r--src/lib/krb4/mk_priv.c18
-rw-r--r--src/lib/krb4/mk_req.c12
-rw-r--r--src/lib/krb4/mk_safe.c6
-rw-r--r--src/lib/krb4/put_svc_key.c13
-rw-r--r--src/lib/krb4/rd_err.c8
-rw-r--r--src/lib/krb4/rd_priv.c10
-rw-r--r--src/lib/krb4/rd_req.c10
-rw-r--r--src/lib/krb4/rd_safe.c14
-rw-r--r--src/lib/krb4/rd_svc_key.c30
-rw-r--r--src/lib/krb4/realmofhost.c9
-rw-r--r--src/lib/krb4/recvauth.c26
-rw-r--r--src/lib/krb4/save_creds.c18
-rw-r--r--src/lib/krb4/send_to_kdc.c2
-rw-r--r--src/lib/krb4/tf_util.c1
-rw-r--r--src/lib/krb4/tkt_string.c14
-rw-r--r--src/lib/krb4/unix_glue.c8
-rw-r--r--src/lib/krb4/win_glue.c69
-rw-r--r--src/lib/krb4/win_store.c35
-rw-r--r--src/lib/krb4/win_time.c23
-rw-r--r--src/lib/krb4/winsock.def90
48 files changed, 325 insertions, 498 deletions
diff --git a/src/lib/krb4/ChangeLog b/src/lib/krb4/ChangeLog
index 3d6fc389fe..97b7d21a3f 100644
--- a/src/lib/krb4/ChangeLog
+++ b/src/lib/krb4/ChangeLog
@@ -1,3 +1,15 @@
+Sun Feb 16 21:11:51 1997 Richard Basch <basch@lehman.com>
+
+ * Makefile.in: Win16/Win32 cleanup
+
+ * err_txt.c g_admhst.c g_cred.c g_krbhst.c g_krbrlm.c g_phost.c
+ g_pw_in_tkt.c g_svc_in_tkt.c g_tkt_svc.c kname_parse.c mk_auth.c
+ mk_err.c mk_preauth.c mk_priv.c mk_req.c mk_safe.c rd_err.c
+ rd_priv.c rd_req.c rd_safe.c rd_svc_key.c realmofhost.c
+ recvauth.c save_creds.c unix_glue.c
+ Changed declaration of functions to use
+ KRB5_DLLIMP/KRB5_CALLCONV instead of INTERFACE.
+
Sat Feb 1 08:44:00 1997 Ezra Peisach <epeisach@mit.edu>
* Makefile.in (STOBJLISTS): Fix up des425 reference.
diff --git a/src/lib/krb4/Makefile.in b/src/lib/krb4/Makefile.in
index e22da54ef3..1a369f73e4 100644
--- a/src/lib/krb4/Makefile.in
+++ b/src/lib/krb4/Makefile.in
@@ -1,8 +1,9 @@
CFLAGS = $(CCOPTS) $(DEFS) $(DEFINES)
DEFINES=-I$(srcdir)/../../include/kerberosIV
-##DOSBUILDTOP = ..\..\..
-##DOSLIBNAME=..\krb5.lib
+##DOS##BUILDTOP = ..\..
+##DOS##LIBNAME=krb4.lib
+##DOS##OBJFILE=krb4.lst
LIB=krb4
LIBMAJOR=1
@@ -50,8 +51,7 @@ OBJS = \
stime.$(OBJEXT) \
rd_preauth.$(OBJEXT) \
mk_preauth.$(OBJEXT) \
- unix_time.$(OBJEXT) \
- $(CACHEOBJS) $(SETENVOBJS) $(STRCASEOBJS) $(SHMOBJS) \
+ $(OSOBJS) $(CACHEOBJS) $(SETENVOBJS) $(STRCASEOBJS) $(SHMOBJS) \
$(LIB_KRB_HOSTOBJS) $(SERVER_KRB_OBJS) $(NETIO_OBJS) $(REALMDBOBJS)
SRCS = \
@@ -87,7 +87,7 @@ SRCS = \
$(srcdir)/rd_preauth.c \
$(srcdir)/mk_preauth.c \
$(srcdir)/unix_time.c \
- $(CACHESRCS) $(SETENVSRCS) $(STRCASESRCS) $(SHMSRCS) \
+ $(OSSRCS) $(CACHESRCS) $(SETENVSRCS) $(STRCASESRCS) $(SHMSRCS) \
$(LIB_KRB_HOSTSRCS) $(SERVER_KRB_SRCS) $(NETIO_SRCS) $(REALMDBSRCS)
STLIBOBJS = $(OBJS)
@@ -107,6 +107,13 @@ SHLIB_EXPLIBS=-lkrb5 $(KRB4_CRYPTO_LIBS) -lcrypto -lcom_err
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)
+#
+# These objects implement the time computation routines.
+#
+OSOBJS = unix_time.$(OBJEXT)
+OSSRCS = unix_time.c
+
+##DOS##OSOBJS = win_time.obj
#
# These objects implement ticket cacheing for Unix. They are
@@ -119,14 +126,20 @@ CACHEOBJS=tf_util.$(OBJEXT) dest_tkt.$(OBJEXT) in_tkt.$(OBJEXT) \
tkt_string.$(OBJEXT) g_tf_fname.$(OBJEXT) g_tf_realm.$(OBJEXT) \
g_cred.$(OBJEXT) save_creds.$(OBJEXT)
+##DOS##CACHEOBJS = memcache.$(OBJEXT)
+
#
# These objects implement Kerberos realm<->host database lookup.
# They read config files and/or network databases in various ways
# on various platforms.
#
-REALMDBSRCS= $(srcdir)/g_cnffile.c $(srcdir)/g_krbhst.c $(srcdir)/g_krbrlm.c \
+
+CNFFILE = g_cnffile
+##DOS##CNFFILE = win_store
+
+REALMDBSRCS= $(srcdir)/$(CNFFILE).c $(srcdir)/g_krbhst.c $(srcdir)/g_krbrlm.c \
$(srcdir)/g_admhst.c $(srcdir)/realmofhost.c
-REALMDBOBJS= g_cnffile.$(OBJEXT) g_krbhst.$(OBJEXT) g_krbrlm.$(OBJEXT) \
+REALMDBOBJS= $(CNFFILE).$(OBJEXT) g_krbhst.$(OBJEXT) g_krbrlm.$(OBJEXT) \
g_admhst.$(OBJEXT) realmofhost.$(OBJEXT)
#
@@ -162,35 +175,30 @@ NETIO_OBJS=netread.$(OBJEXT) netwrite.$(OBJEXT)
LIB_KRB_HOSTSRCS=$(srcdir)/unix_glue.c
LIB_KRB_HOSTOBJS=unix_glue.$(OBJEXT)
-LIBNAME=libkrb4.$(STEXT)
+##DOS##LIB_KRB_HOSTOBJS=win_glue.obj
ARCHIVEARGS= $@ $(OBJS)
CODE=$(SRCS) Makefile.in krb_err.et
-all:: all-really
-
-#### include configury here
-##DOS!include ..\..\config\common
-##DOS!include ..\..\config\mt-win
-
-# We only have a final value of $(WHAT) at this point, and Microsoft
-# NMAKE expands the macros in dependency lines before it finishes reading
-# the whole file (sigh)...
-all-really:: all-$(WHAT)
-
# We want *library* compiler options...
DBG=$(DBG_LIB)
+
all-unix:: krb_err.h includes all-liblinks
+all-windows:: $(OBJFILE)
+
+##DOS$(OBJFILE): $(OBJS)
+##DOS $(RM) $(OBJFILE)
+##WIN16## $(CP) nul: $(OBJFILE)
+##WIN32## $(LIBECHO) *.obj > $(OBJFILE)
+
# comp_et_depend(krb_err)
krb_err.h:: krb_err.et
krb_err.c: krb_err.et
depend:: krb_err.h
-#
-
depend:: $(CODE)
#install-unix::
@@ -199,50 +207,11 @@ depend:: $(CODE)
DEFINES=$(FALLBACK) $(OLD_SRVTAB) $(OLD_KLOGIN) -I$(srcdir)/../../include/kerberosIV
-#
-# What we build for `all' and `install' targets on Windows
-#
-all-windows: winsock.lib kerberos.lib kerberos.dll
-
-install-windows:
- copy winsock.lib ..\..\floppy
- copy kerberos.lib ..\..\floppy
- copy kerberos.dll ..\..\floppy
-
-#
-# The "Import Library" definitions for MS-Windows
-#
-kerberos.lib: kerberos.dll
- implib /nologo $@ $(@R).dll
-
-winsock.lib: winsock.def
- implib /nologo winsock.lib winsock.def
-
-#
-# The Kerberos "Dynamic Link Library" for MS-Windows
-#
-kerberos.dll: kerberos.def winsock.lib \
- $(DES_LIB_FOR_DLL) $(KADM_LIB_FOR_DLL) $(KSTREAM_LIB_FOR_DLL) \
- $(LIBNAME)
- $(RM) $@
-# this a.def and a.dll stuff is for line-too-long crap
- copy kerberos.def a.def
- copy $(DES_LIB_FOR_DLL) a.lib
- copy $(KADM_LIB_FOR_DLL) b.lib
- copy $(KSTREAM_LIB_FOR_DLL) c.lib
- link /nologo /noe debug, $@,,\
- $(LIBNAME) a.lib b.lib c.lib\
- winsock ldllcew libw, $(@R).def
- del a.lib
- del b.lib
- del c.lib
- rc /p /k $@
-
clean::
- -$(RM) $(LIBNAME)
- -$(RM) *.$(OBJEXT)
+ -$(RM) $(OBJS)
clean-:: clean-unix
+
clean-unix::
-$(RM) krb_err.c
-$(RM) krb_err.h
@@ -250,26 +219,10 @@ clean-unix::
clean-unix:: clean-liblinks clean-libs clean-libobjs
-clean-windows::
- -$(RM) kerberos.lib
- -$(RM) kerberos.bak
- -$(RM) kerberos.dll
- -$(RM) kerberos.lst
- -$(RM) kerberos.map
- -$(RM) libkrb.lst
- -$(RM) libkrb.bak
- -$(RM) winsock.lib
- -$(RM) msvc.pdb
- -$(RM) proj.err
- -$(RM) ..\..\floppy\winsock.lib
- -$(RM) ..\..\floppy\kerberos.lib
- -$(RM) ..\..\floppy\kerberos.dll
-
-
check-unix:: $(TEST_PROGS)
check-mac:: $(TEST_PROGS)
-
check-windows::
+
install-unix:: install-libs
diff --git a/src/lib/krb4/ad_print.c b/src/lib/krb4/ad_print.c
index 797293751c..0d83fbe2a6 100644
--- a/src/lib/krb4/ad_print.c
+++ b/src/lib/krb4/ad_print.c
@@ -15,6 +15,8 @@
#include "des.h"
#include <stdio.h>
+#ifndef _WINDOWS
+
/*
* Print some of the contents of the given authenticator structure
* (AUTH_DAT defined in "krb.h"). Fields printed are:
@@ -64,3 +66,5 @@ placebo_cblock_print(x)
printf(" }");
}
#endif /* NOENCRYPTION */
+
+#endif
diff --git a/src/lib/krb4/dest_tkt.c b/src/lib/krb4/dest_tkt.c
index 7830a859fa..560c3e3683 100644
--- a/src/lib/krb4/dest_tkt.c
+++ b/src/lib/krb4/dest_tkt.c
@@ -11,13 +11,12 @@
#include "mit-copyright.h"
#include "krb.h"
#include <stdio.h>
-#include <sys/file.h>
+#include <fcntl.h>
#include <sys/stat.h>
#ifdef TKT_SHMEM
#include <sys/param.h>
#endif
#include <errno.h>
-#include <fcntl.h>
#ifndef O_SYNC
#define O_SYNC 0
@@ -32,6 +31,7 @@
* The ticket file (TKT_FILE) is defined in "krb.h".
*/
+KRB5_DLLIMP int KRB5_CALLCONV
dest_tkt()
{
char *file = TKT_FILE;
diff --git a/src/lib/krb4/err_txt.c b/src/lib/krb4/err_txt.c
index 0b7697ea8b..8cf0092873 100644
--- a/src/lib/krb4/err_txt.c
+++ b/src/lib/krb4/err_txt.c
@@ -22,7 +22,7 @@ const
#ifdef MULTIDIMENSIONAL_ERR_TXT
char krb_err_txt[256][60] = {
#else
- char *const krb_err_txt [256] = {
+ char FAR *const krb_err_txt [256] = {
#endif
"OK", /* 000 */
"Principal expired (kerberos)", /* 001 */
@@ -283,12 +283,12 @@ const
};
-const char * INTERFACE
-krb_get_err_text (errno)
- int errno;
+KRB5_DLLIMP const char FAR * KRB5_CALLCONV
+krb_get_err_text (code)
+ int code;
{
- if (errno >= 0 && errno < (sizeof (krb_err_txt))/(sizeof *krb_err_txt))
- return krb_err_txt[errno];
+ if (code >= 0 && code < (sizeof (krb_err_txt))/(sizeof *krb_err_txt))
+ return krb_err_txt[code];
else
return "Invalid Kerberos error code";
}
diff --git a/src/lib/krb4/g_admhst.c b/src/lib/krb4/g_admhst.c
index 68ac1f0dac..c5bed3f68b 100644
--- a/src/lib/krb4/g_admhst.c
+++ b/src/lib/krb4/g_admhst.c
@@ -34,10 +34,10 @@
* provided by a nameserver.
*/
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_get_admhst(h, r, n)
- char *h;
- char *r;
+ char FAR *h;
+ char FAR *r;
int n;
{
FILE *cnffile, *krb__get_cnffile();
diff --git a/src/lib/krb4/g_cnffile.c b/src/lib/krb4/g_cnffile.c
index a212beb122..07175b1460 100644
--- a/src/lib/krb4/g_cnffile.c
+++ b/src/lib/krb4/g_cnffile.c
@@ -16,7 +16,7 @@
it solves a problem for now. */
#include <stdio.h>
-#include <krb.h>
+#include "krb.h"
#include "k5-int.h"
static FILE*
diff --git a/src/lib/krb4/g_cred.c b/src/lib/krb4/g_cred.c
index 491861be66..c05fb9ba57 100644
--- a/src/lib/krb4/g_cred.c
+++ b/src/lib/krb4/g_cred.c
@@ -22,12 +22,12 @@
* On failure it returns a Kerberos error code.
*/
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_get_cred(service,instance,realm,c)
- char *service; /* Service name */
- char *instance; /* Instance */
- char *realm; /* Auth domain */
- CREDENTIALS *c; /* Credentials struct */
+ char FAR *service; /* Service name */
+ char FAR *instance; /* Instance */
+ char FAR *realm; /* Auth domain */
+ CREDENTIALS FAR *c; /* Credentials struct */
{
int tf_status; /* return value of tf function calls */
diff --git a/src/lib/krb4/g_krbhst.c b/src/lib/krb4/g_krbhst.c
index eaab289281..c95abdb207 100644
--- a/src/lib/krb4/g_krbhst.c
+++ b/src/lib/krb4/g_krbhst.c
@@ -61,10 +61,10 @@ get_krbhst_default(h, r, n)
return(KFAILURE);
}
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_get_krbhst(h,r,n)
- char *h;
- char *r;
+ char FAR *h;
+ char FAR *r;
int n;
{
FILE *cnffile, *krb__get_cnffile();
diff --git a/src/lib/krb4/g_krbrlm.c b/src/lib/krb4/g_krbrlm.c
index f83beba366..c6f9345856 100644
--- a/src/lib/krb4/g_krbrlm.c
+++ b/src/lib/krb4/g_krbrlm.c
@@ -31,7 +31,7 @@
static char *krb_conf = KRB_CONF;
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_get_lrealm(r,n)
char *r;
int n;
diff --git a/src/lib/krb4/g_phost.c b/src/lib/krb4/g_phost.c
index c740a49533..8caece3729 100644
--- a/src/lib/krb4/g_phost.c
+++ b/src/lib/krb4/g_phost.c
@@ -32,9 +32,9 @@
* to the original "alias" argument is returned.
*/
-char * INTERFACE
+KRB5_DLLIMP char FAR * KRB5_CALLCONV
krb_get_phost(alias)
- char *alias;
+ char FAR *alias;
{
struct hostent FAR *h;
char *p;
@@ -59,7 +59,7 @@ krb_get_phost(alias)
}
#endif
/* We don't want to return a FAR *, so we copy to a safe location. */
- _fstrncpy (hostname_mem, h->h_name, sizeof (hostname_mem));
+ strncpy (hostname_mem, h->h_name, sizeof (hostname_mem));
hostname_mem[MAXHOSTNAMELEN-1]='\0';
p = strchr( hostname_mem, '.' );
if (p)
diff --git a/src/lib/krb4/g_pw_in_tkt.c b/src/lib/krb4/g_pw_in_tkt.c
index b633d16488..6723df87e3 100644
--- a/src/lib/krb4/g_pw_in_tkt.c
+++ b/src/lib/krb4/g_pw_in_tkt.c
@@ -9,6 +9,7 @@
#include "mit-copyright.h"
#include "krb.h"
+#include "krb_err.h"
#include "prot.h"
#include <string.h>
@@ -16,6 +17,10 @@
#define NULL 0
#endif
+#ifndef INTK_PW_NULL
+#define INTK_PW_NULL KRBET_GT_PW_NULL
+#endif
+
/*
* This file contains two routines: passwd_to_key() converts
* a password into a DES key (prompting for the password if
@@ -87,11 +92,11 @@ passwd_to_key(user,instance,realm,passwd,key)
* The result of the call to krb_get_in_tkt() is returned.
*/
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_get_pw_in_tkt(user,instance,realm,service,sinstance,life,password)
- char *user, *instance, *realm, *service, *sinstance;
+ char FAR *user, FAR *instance, FAR *realm, FAR *service, FAR *sinstance;
int life;
- char *password;
+ char FAR *password;
{
#if defined(_WINDOWS) || defined(macintosh)
/* In spite of the comments above, we don't allow that path here,
@@ -105,7 +110,7 @@ krb_get_pw_in_tkt(user,instance,realm,service,sinstance,life,password)
#endif
return(krb_get_in_tkt(user,instance,realm,service,sinstance,life,
- passwd_to_key,
+ (key_proc_type)passwd_to_key,
(decrypt_tkt_type)NULL, password));
}
@@ -126,11 +131,11 @@ static int stub_key(user,instance,realm,passwd,key)
return 0;
}
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_get_pw_in_tkt_preauth(user,instance,realm,service,sinstance,life,password)
- char *user, *instance, *realm, *service, *sinstance;
+ char FAR *user, FAR *instance, FAR *realm, FAR *service, FAR *sinstance;
int life;
- char *password;
+ char FAR *password;
{
char *preauth_p;
int preauth_len;
@@ -143,8 +148,8 @@ krb_get_pw_in_tkt_preauth(user,instance,realm,service,sinstance,life,password)
return INTK_PW_NULL;
#endif
- krb_mk_preauth(&preauth_p,&preauth_len, passwd_to_key,
- user,instance,realm,password,old_key);
+ krb_mk_preauth(&preauth_p, &preauth_len, (key_proc_type)passwd_to_key,
+ user, instance, realm, password, old_key);
ret_st = krb_get_in_tkt_preauth(user,instance,realm,service,sinstance,life,
(key_proc_type) stub_key,
(decrypt_tkt_type) NULL, password,
diff --git a/src/lib/krb4/g_svc_in_tkt.c b/src/lib/krb4/g_svc_in_tkt.c
index e34ba5bdff..0a8f499c93 100644
--- a/src/lib/krb4/g_svc_in_tkt.c
+++ b/src/lib/krb4/g_svc_in_tkt.c
@@ -62,14 +62,14 @@ static int srvtab_to_key(user, instance, realm, srvtab, key)
* It returns the return value of the krb_get_in_tkt() call.
*/
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_get_svc_in_tkt(user, instance, realm, service, sinstance, life, srvtab)
- char *user, *instance, *realm, *service, *sinstance;
+ char FAR *user, FAR *instance, FAR *realm, FAR *service, FAR *sinstance;
int life;
- char *srvtab;
+ char FAR *srvtab;
{
- return(krb_get_in_tkt(user, instance, realm, service, sinstance,
- life, srvtab_to_key, NULL, srvtab));
+ return(krb_get_in_tkt(user, instance, realm, service, sinstance, life,
+ (key_proc_type) srvtab_to_key, NULL, srvtab));
}
/* and we need a preauth version as well. */
@@ -92,10 +92,11 @@ krb_get_svc_in_tkt_preauth(user, instance, realm, service, sinstance, life, srvt
int preauth_len;
int ret_st;
- krb_mk_preauth(&preauth_p,&preauth_len,
- srvtab_to_key,user,instance,realm,srvtab,old_key);
+ krb_mk_preauth(&preauth_p, &preauth_len,
+ (key_proc_type) srvtab_to_key, user, instance, realm,
+ srvtab, old_key);
ret_st = krb_get_in_tkt_preauth(user,instance,realm,service,sinstance,life,
- stub_key, NULL, srvtab,
+ (key_proc_type) stub_key, NULL, srvtab,
preauth_p, preauth_len);
krb_free_preauth(preauth_p, preauth_len);
diff --git a/src/lib/krb4/g_tf_fname.c b/src/lib/krb4/g_tf_fname.c
index 9aef3cfdf2..5235ff3a2c 100644
--- a/src/lib/krb4/g_tf_fname.c
+++ b/src/lib/krb4/g_tf_fname.c
@@ -26,7 +26,7 @@
* krb_get_in_tkt().
*/
-int
+KRB5_DLLIMP int KRB5_CALLCONV
krb_get_tf_fullname(ticket_file, name, instance, realm)
char *ticket_file;
char *name;
diff --git a/src/lib/krb4/g_tf_realm.c b/src/lib/krb4/g_tf_realm.c
index 5de1528494..55fe79ef04 100644
--- a/src/lib/krb4/g_tf_realm.c
+++ b/src/lib/krb4/g_tf_realm.c
@@ -21,6 +21,7 @@
*
*/
+KRB5_DLLIMP int KRB5_CALLCONV
krb_get_tf_realm(ticket_file, realm)
char *ticket_file;
char *realm;
diff --git a/src/lib/krb4/g_tkt_svc.c b/src/lib/krb4/g_tkt_svc.c
index a4f5c183c3..48b407e024 100644
--- a/src/lib/krb4/g_tkt_svc.c
+++ b/src/lib/krb4/g_tkt_svc.c
@@ -102,16 +102,16 @@ CredIsExpired( cr )
* to get a new TGT.
*/
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_get_ticket_for_service (serviceName, buf, buflen, checksum, sessionKey,
schedule, version, includeVersion)
- char *serviceName;
- char *buf;
- unsigned KRB4_32 *buflen;
+ char FAR *serviceName;
+ char FAR *buf;
+ unsigned KRB4_32 FAR *buflen;
int checksum;
des_cblock sessionKey;
Key_schedule schedule;
- char *version;
+ char FAR *version;
int includeVersion;
{
char service[SNAME_SZ];
diff --git a/src/lib/krb4/getst.c b/src/lib/krb4/getst.c
index 3ff05bd31f..c2f15edc01 100644
--- a/src/lib/krb4/getst.c
+++ b/src/lib/krb4/getst.c
@@ -8,6 +8,7 @@
*/
#include "mit-copyright.h"
+#include "krb.h"
/*
* getst() takes a file descriptor, a string and a count. It reads
diff --git a/src/lib/krb4/in_tkt.c b/src/lib/krb4/in_tkt.c
index 42cfed43d9..bc5c2b31c7 100644
--- a/src/lib/krb4/in_tkt.c
+++ b/src/lib/krb4/in_tkt.c
@@ -12,7 +12,6 @@
#include <stdio.h>
#include <string.h>
#include "krb.h"
-#include <sys/file.h>
#include <fcntl.h>
#include <sys/stat.h>
#ifdef TKT_SHMEM
@@ -42,6 +41,7 @@ extern int krb_debug;
#define O_SYNC 0
#endif
+KRB5_DLLIMP int KRB5_CALLCONV
in_tkt(pname,pinst)
char *pname;
char *pinst;
diff --git a/src/lib/krb4/kerberos.def b/src/lib/krb4/kerberos.def
deleted file mode 100644
index f8124aa8c3..0000000000
--- a/src/lib/krb4/kerberos.def
+++ /dev/null
@@ -1,68 +0,0 @@
-;-----------------------------
-; KERBEROS.DEF - module definition file
-;-----------------------------
-
-LIBRARY KERBEROS
-DESCRIPTION 'DLL for Kerberos support'
-EXETYPE WINDOWS
-CODE PRELOAD MOVEABLE DISCARDABLE
-DATA PRELOAD MOVEABLE SINGLE
-HEAPSIZE 8192
-
-EXPORTS
- WEP @1 RESIDENTNAME
- LIBMAIN @2
-
- DES_CBC_ENCRYPT @3
- DES_KEY_SCHED @4
- DES_STRING_TO_KEY @5
- DEST_TKT @6
- KNAME_PARSE @7
- KRB_CHECK_AUTH @8
- KRB_END_SESSION @9
- KRB_GET_ADMHST @10
- KRB_GET_CRED @11
- KRB_GET_DEFAULT_USER @12
- KRB_GET_ERR_TEXT @14
- KRB_GET_LREALM @15
- KRB_GET_PHOST @16
- KRB_GET_PW_IN_TKT @17
- KRB_MK_AUTH @18
- KRB_MK_PRIV @19
- KRB_MK_REQ @20
- KRB_RD_PRIV @21
- KRB_REALMOFHOST @22
- KRB_SAVE_CREDENTIALS @23
- KRB_START_SESSION @24
- KRB_GET_PW_IN_TKT_PREAUTH @25
- KRB_GET_NOTIFICATION_MESSAGE @26
- KADM_CHANGE_PW2 @27
- KADM_INIT_LINK @28
- KADM_GET_ERR_TEXT @29
- KADM_CHANGE_PW @30
- DES_ECB_ENCRYPT @31
- DES_PCBC_ENCRYPT @32
- DES_IS_WEAK_KEY @33
- DES_FIXUP_KEY_PARITY @34
- DES_CHECK_KEY_PARITY @35
- IN_TKT @36
- KRB_DELETE_CRED @37
- KRB_GET_KRBHST @38
- KRB_GET_NTH_CRED @39
- KRB_GET_NUM_CRED @40
- KRB_GET_TF_FULLNAME @41
- KRB_GET_TICKET_FOR_SERVICE @42
- KRB_MK_ERR @43
- KRB_MK_SAFE @44
- KRB_RD_ERR @45
- KRB_RD_SAFE @46
- KRB_SET_DEFAULT_USER @47
- KSTREAM_CREATE_FROM_FD @48
- KSTREAM_CREATE_RLOGIN_FROM_FD @49
- KSTREAM_CREATE_RCP_FROM_FD @50
- KSTREAM_WRITE @51
- KSTREAM_READ @52
- KSTREAM_FLUSH @53
- KSTREAM_DESTROY @54
- KSTREAM_SET_BUFFER_MODE @55
-
diff --git a/src/lib/krb4/klog.c b/src/lib/krb4/klog.c
index f838fb7856..e04e0200dd 100644
--- a/src/lib/krb4/klog.c
+++ b/src/lib/krb4/klog.c
@@ -9,10 +9,11 @@
*/
#include "mit-copyright.h"
+#include "krb.h"
#ifdef HAVE_TIME_H
#include <time.h>
#endif
-#ifndef VMS
+#if !defined(VMS) && !defined(_WINDOWS)
#include <sys/time.h>
#endif
#include <stdio.h>
diff --git a/src/lib/krb4/kname_parse.c b/src/lib/krb4/kname_parse.c
index 059d084283..53d8fb77c6 100644
--- a/src/lib/krb4/kname_parse.c
+++ b/src/lib/krb4/kname_parse.c
@@ -51,9 +51,12 @@
* of name, instance, and realm. FIXME-gnu: Does anyone use it this way?
*/
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
kname_parse(np, ip, rp, fullname)
- char *np, *ip, *rp, *fullname;
+ char FAR *np;
+ char FAR *ip;
+ char FAR *rp;
+ char FAR *fullname;
{
char buf[FULL_SZ];
char *rnext, *wnext; /* next char to read, write */
diff --git a/src/lib/krb4/kparse.c b/src/lib/krb4/kparse.c
index e0fc20ceb5..198ae1e898 100644
--- a/src/lib/krb4/kparse.c
+++ b/src/lib/krb4/kparse.c
@@ -33,6 +33,7 @@
*/
#include "mit-copyright.h"
+#include "krb.h"
#include <stdio.h>
#include <ctype.h>
#include <kparse.h>
@@ -48,12 +49,14 @@
#define MAXKEY 80
#define MAXVALUE 80
-extern char *malloc();
-
static char *strutol();
+
#ifndef HAVE_STRSAVE
static char *strsave();
#endif
+#ifndef HAS_STDLIB_H
+extern char *malloc();
+#endif
static int sLineNbr=1; /* current line nbr in parameter file */
static char ErrorMsg[80]; /* meaningful only when KV_SYNTAX, PS_SYNTAX,
diff --git a/src/lib/krb4/kuserok.c b/src/lib/krb4/kuserok.c
index 6f45afeb38..8f9a0b0503 100644
--- a/src/lib/krb4/kuserok.c
+++ b/src/lib/krb4/kuserok.c
@@ -11,8 +11,10 @@
*/
#include "mit-copyright.h"
-
#include "krb.h"
+
+#if !defined(_WINDOWS)
+
#include <stdio.h>
#include <pwd.h>
#include <sys/param.h>
@@ -93,9 +95,10 @@ parmtable kparm[] = {
#define KPARMS kparm,PARMCOUNT(kparm)
#endif
+KRB5_DLLIMP int KRB5_CALLCONV
kuserok(kdata, luser)
- AUTH_DAT *kdata;
- char *luser;
+ AUTH_DAT FAR *kdata;
+ char FAR *luser;
{
struct stat sbuf;
struct passwd *pwd;
@@ -231,3 +234,5 @@ kuserok(kdata, luser)
fclose(fp);
return(isok);
}
+
+#endif
diff --git a/src/lib/krb4/log.c b/src/lib/krb4/log.c
index b41954491a..d317550556 100644
--- a/src/lib/krb4/log.c
+++ b/src/lib/krb4/log.c
@@ -15,10 +15,11 @@
#endif
#include "mit-copyright.h"
+#include "krb.h"
#ifdef HAVE_TIME_H
#include <time.h>
#endif
-#ifndef VMS
+#if !defined(VMS) && !defined(_WINDOWS)
#include <sys/time.h>
#endif
#include <stdio.h>
diff --git a/src/lib/krb4/memcache.c b/src/lib/krb4/memcache.c
index 46376885c8..52d3601f9c 100644
--- a/src/lib/krb4/memcache.c
+++ b/src/lib/krb4/memcache.c
@@ -12,9 +12,20 @@
* in_tkt.c, dest_tkt.c, tf_util.c, and tkt_string.c.
*/
+#include "krb.h"
+
#ifdef _WINDOWS
-#include <windows.h>
-#include <malloc.h> /* REQUIRED for near/far declarations */
+#include <errno.h>
+
+typedef DWORD OSErr;
+#define noErr 0
+#define cKrbCredsDontExist 12001
+#define cKrbSessDoesntExist 12002
+#define OFFSETOF(x) x
+#define _nmalloc malloc
+#define _nrealloc realloc
+#define _nfree free
+#define memFullErr ENOMEM
#endif
#ifndef unix
@@ -24,7 +35,6 @@
#endif
#ifdef unix
-
/* Unix interface to memory cache Mac functions. */
#include <stdio.h>
@@ -47,9 +57,9 @@ typedef int OSErr;
#endif /* unix */
-#include "krb.h"
#include "memcache.h"
+
/* Lower level data structures */
static int fNumSessions = 0;
@@ -206,7 +216,7 @@ change_cache()
* message will be broadcast to all top level windows when
* the credential cache changes.
*/
-unsigned int INTERFACE
+unsigned int
krb_get_notification_message(void)
{
static UINT message = 0;
@@ -221,8 +231,6 @@ krb_get_notification_message(void)
#endif /* Windows */
-#include "krb_driver.h"
-
/* The low level routines in this file are capable of storing
tickets for multiple "sessions", each led by a different
ticket-granting ticket. For now, since the top level code
@@ -264,7 +272,7 @@ static char curr_auth_uinst [INST_SZ];
via ResEdit.
*/
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
in_tkt(pname,pinst)
char *pname;
char *pinst;
@@ -291,7 +299,7 @@ in_tkt(pname,pinst)
* failure.
*
*/
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
dest_tkt()
{
/*
@@ -350,7 +358,7 @@ int dest_all_tkts()
/* krb_get_tf_realm -- return the realm of the current ticket file. */
-int
+KRB5_DLLIMP int KRB5_CALLCONV
krb_get_tf_realm (tktfile, lrealm)
char *tktfile;
char *lrealm; /* Result stored through here */
@@ -362,7 +370,7 @@ krb_get_tf_realm (tktfile, lrealm)
/* krb_get_tf_fullname -- return name, instance and realm of the
principal in the current ticket file. */
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_get_tf_fullname (tktfile, name, instance, realm)
char *tktfile;
char *name;
@@ -413,7 +421,7 @@ krb_get_tf_fullname (tktfile, name, instance, realm)
* information from the file. If successful, it returns KSUCCESS.
* On failure it returns a Kerberos error code.
*/
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_get_cred (service, instance, realm, c)
char *service; /* Service name */
char *instance; /* Instance */
@@ -453,7 +461,7 @@ krb_get_cred (service, instance, realm, c)
* Returns KSUCCESS if all goes well, otherwise KFAILURE.
*/
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_save_credentials(sname, sinst, srealm, session,
lifetime, kvno, ticket, issue_date)
@@ -484,7 +492,7 @@ krb_save_credentials(sname, sinst, srealm, session,
return KSUCCESS;
}
-int INTERFACE
+int
krb_delete_cred (sname, sinstance, srealm)
char *sname;
char *sinstance;
@@ -504,7 +512,7 @@ krb_delete_cred (sname, sinstance, srealm)
*/
}
-int INTERFACE
+int
krb_get_nth_cred (sname, sinstance, srealm, n)
char *sname;
char *sinstance;
@@ -521,7 +529,7 @@ krb_get_nth_cred (sname, sinstance, srealm, n)
* Return the number of credentials in the current credential cache (ticket cache).
* On error, returns -1.
*/
-int INTERFACE
+int
krb_get_num_cred ()
{
int n;
diff --git a/src/lib/krb4/mk_auth.c b/src/lib/krb4/mk_auth.c
index 2b09280941..39a2e2f68b 100644
--- a/src/lib/krb4/mk_auth.c
+++ b/src/lib/krb4/mk_auth.c
@@ -14,7 +14,6 @@
#define DEFINE_SOCKADDR /* Ask for sockets declarations from krb.h. */
#include <stdio.h>
#include "krb.h"
-#include "krb4-proto.h"
#include <errno.h>
#include <string.h>
@@ -99,16 +98,16 @@
/*
* Build a "sendauth" packet compatible with Unix sendauth/recvauth.
*/
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_mk_auth(options, ticket, service, inst, realm, checksum, version, buf)
long options; /* bit-pattern of options */
KTEXT ticket; /* where to put ticket (return); or
supplied in case of KOPT_DONT_MK_REQ */
- char *service; /* service name */
- char *inst; /* instance (OUTPUT canonicalized) */
- char *realm; /* realm */
+ char FAR *service; /* service name */
+ char FAR *inst; /* instance (OUTPUT canonicalized) */
+ char FAR *realm; /* realm */
unsigned KRB4_32 checksum; /* checksum to include in request */
- char *version; /* version string */
+ char FAR *version; /* version string */
KTEXT buf; /* Output buffer to fill */
{
int rem, i;
@@ -186,15 +185,15 @@ krb_mk_auth(options, ticket, service, inst, realm, checksum, version, buf)
* and "schedule" returns the key schedule for that decryption. The
* the local and server addresses are given in "laddr" and "faddr".
*/
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_check_auth (buf, checksum, msg_data, session, schedule, laddr, faddr)
KTEXT buf; /* The response we read from app server */
unsigned KRB4_32 checksum; /* checksum we included in request */
- MSG_DAT *msg_data; /* mutual auth MSG_DAT (return) */
+ MSG_DAT FAR *msg_data; /* mutual auth MSG_DAT (return) */
C_Block session; /* credentials (input) */
Key_schedule schedule; /* key schedule (return) */
- struct sockaddr_in *laddr; /* local address */
- struct sockaddr_in *faddr; /* address of foreign host on fd */
+ struct sockaddr_in FAR *laddr; /* local address */
+ struct sockaddr_in FAR *faddr; /* address of foreign host on fd */
{
int cc;
unsigned KRB4_32 cksum;
@@ -204,7 +203,7 @@ krb_check_auth (buf, checksum, msg_data, session, schedule, laddr, faddr)
key_sched(session, schedule);
#endif /* !NOENCRYPTION */
if (cc = krb_rd_priv(buf->dat, buf->length, schedule,
- (C_Block *)session, faddr, laddr, msg_data))
+ session, faddr, laddr, msg_data))
return(cc);
/* fetch the (incremented) checksum that we supplied in the request */
diff --git a/src/lib/krb4/mk_err.c b/src/lib/krb4/mk_err.c
index 830ee716b9..e30e299bc4 100644
--- a/src/lib/krb4/mk_err.c
+++ b/src/lib/krb4/mk_err.c
@@ -33,11 +33,11 @@
* string e_string given error text
*/
-long INTERFACE
+KRB5_DLLIMP long KRB5_CALLCONV
krb_mk_err(p,e,e_string)
- u_char *p; /* Where to build error packet */
- KRB4_32 e; /* Error code */
- char *e_string; /* Text of error */
+ u_char FAR *p; /* Where to build error packet */
+ KRB4_32 e; /* Error code */
+ char FAR *e_string; /* Text of error */
{
u_char *start;
diff --git a/src/lib/krb4/mk_preauth.c b/src/lib/krb4/mk_preauth.c
index 5f26111c3b..feb12b7ab9 100644
--- a/src/lib/krb4/mk_preauth.c
+++ b/src/lib/krb4/mk_preauth.c
@@ -21,14 +21,6 @@
extern char *malloc(), *calloc(), *realloc();
#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 FAR types during calls. These definitions are found in
- <krb-sed.h> but the code is too opaque unless they are also here. */
-#ifndef KEY_PROC_TYPE_DEFINED
-typedef int (*key_proc_type) PROTOTYPE ((char *, char *, char *,
- char *, C_Block));
-#endif
int
krb_mk_preauth(preauth_p, preauth_len,
diff --git a/src/lib/krb4/mk_priv.c b/src/lib/krb4/mk_priv.c
index 72fff70071..068b17dec7 100644
--- a/src/lib/krb4/mk_priv.c
+++ b/src/lib/krb4/mk_priv.c
@@ -79,17 +79,17 @@ extern int krb_debug;
#endif
*/
-long INTERFACE
+KRB5_DLLIMP long KRB5_CALLCONV
krb_mk_priv(in,out,length,schedule,key,sender,receiver)
- u_char *in; /* application data */
- u_char *out; /* put msg here, leave room for
- * header! breaks if in and out
- * (header stuff) overlap */
+ u_char FAR *in; /* application data */
+ u_char FAR *out; /* put msg here, leave room for
+ * header! breaks if in and out
+ * (header stuff) overlap */
unsigned KRB4_32 length; /* of in data */
- Key_schedule schedule; /* precomputed key schedule */
- C_Block *key; /* encryption key for seed and ivec */
- struct sockaddr_in *sender; /* sender address */
- struct sockaddr_in *receiver; /* receiver address */
+ Key_schedule schedule; /* precomputed key schedule */
+ C_Block key; /* encryption key for seed and ivec */
+ struct sockaddr_in FAR *sender; /* sender address */
+ struct sockaddr_in FAR *receiver; /* receiver address */
{
register u_char *p,*q;
u_char *c_length_ptr;
diff --git a/src/lib/krb4/mk_req.c b/src/lib/krb4/mk_req.c
index 0cb953fc53..7fb01d2f82 100644
--- a/src/lib/krb4/mk_req.c
+++ b/src/lib/krb4/mk_req.c
@@ -68,13 +68,13 @@ static int lifetime = 255; /* Default based on the TGT */
* all rounded up to multiple of 8.
*/
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_mk_req(authent,service,instance,realm,checksum)
- register KTEXT authent; /* Place to build the authenticator */
- char *service; /* Name of the service */
- char *instance; /* Service instance */
- char *realm; /* Authentication domain of service */
- KRB4_32 checksum; /* Checksum of data (optional) */
+ register KTEXT authent; /* Place to build the authenticator */
+ char FAR *service; /* Name of the service */
+ char FAR *instance; /* Service instance */
+ char FAR *realm; /* Authentication domain of service */
+ KRB4_32 checksum; /* Checksum of data (optional) */
{
KTEXT_ST req_st; /* Temp storage for req id */
KTEXT req_id = &req_st;
diff --git a/src/lib/krb4/mk_safe.c b/src/lib/krb4/mk_safe.c
index c3ed94d323..9e24db0c42 100644
--- a/src/lib/krb4/mk_safe.c
+++ b/src/lib/krb4/mk_safe.c
@@ -60,7 +60,7 @@ extern int krb_debug;
* above using "key"
*/
-long INTERFACE
+KRB5_DLLIMP long KRB5_CALLCONV
krb_mk_safe(in,out,length,key,sender,receiver)
u_char *in; /* application data */
u_char *out; /*
@@ -69,7 +69,7 @@ krb_mk_safe(in,out,length,key,sender,receiver)
* overlap
*/
unsigned KRB4_32 length; /* of in data */
- C_Block *key; /* encryption key for seed and ivec */
+ C_Block key; /* encryption key for seed and ivec */
struct sockaddr_in *sender; /* sender address */
struct sockaddr_in *receiver; /* receiver address */
{
@@ -142,7 +142,7 @@ krb_mk_safe(in,out,length,key,sender,receiver)
memset((char*) big_cksum, 0, sizeof(big_cksum));
#else /* Do encryption */
/* calculate the checksum of length, timestamps, and input data */
- cksum = quad_cksum(q,big_cksum,p-q,2,(C_Block*) key);
+ cksum = quad_cksum(q, (u_char *)big_cksum, p-q, 2, key);
#endif /* NOENCRYPTION */
DEB (("\ncksum = %u",cksum));
diff --git a/src/lib/krb4/put_svc_key.c b/src/lib/krb4/put_svc_key.c
index 275e5cbea9..4149be9642 100644
--- a/src/lib/krb4/put_svc_key.c
+++ b/src/lib/krb4/put_svc_key.c
@@ -23,8 +23,8 @@
*/
#include "krb.h"
+
#include <string.h>
-#include <sys/file.h>
#include <stdio.h>
#include <fcntl.h>
#ifdef HAS_UNISTD_H
@@ -39,13 +39,14 @@ extern char *krb__get_srvtabname();
The key (exact match) must already be in the file;
version numbers are not checked.
*/
+KRB5_DLLIMP int KRB5_CALLCONV
put_svc_key(sfile,name,inst,realm,newvno,key)
- char *sfile;
- char *name;
- char *inst;
- char *realm;
+ char FAR *sfile;
+ char FAR *name;
+ char FAR *inst;
+ char FAR *realm;
int newvno;
- char *key;
+ char FAR *key;
{
int fd;
char fname[SNAME_SZ], finst[INST_SZ], frlm[REALM_SZ];
diff --git a/src/lib/krb4/rd_err.c b/src/lib/krb4/rd_err.c
index 2b105a01f8..b7f6a8cc93 100644
--- a/src/lib/krb4/rd_err.c
+++ b/src/lib/krb4/rd_err.c
@@ -32,12 +32,12 @@
* The AUTH_MSG_APPL_ERR message format can be found in mk_err.c
*/
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_rd_err(in,in_length,code,m_data)
- u_char *in; /* pointer to the msg received */
+ u_char FAR *in; /* pointer to the msg received */
u_long in_length; /* of in msg */
- long *code; /* received error code */
- MSG_DAT *m_data;
+ long FAR *code; /* received error code */
+ MSG_DAT FAR *m_data;
{
register u_char *p;
int swap_bytes = 0;
diff --git a/src/lib/krb4/rd_priv.c b/src/lib/krb4/rd_priv.c
index 7c4f613a42..4a30886169 100644
--- a/src/lib/krb4/rd_priv.c
+++ b/src/lib/krb4/rd_priv.c
@@ -65,12 +65,12 @@ int private_msg_ver = KRB_PROT_VERSION;
* information, MSG_DAT, is defined in "krb.h".
*/
-long INTERFACE
+KRB5_DLLIMP long KRB5_CALLCONV
krb_rd_priv(in,in_length,schedule,key,sender,receiver,m_data)
u_char *in; /* pointer to the msg received */
unsigned KRB4_32 in_length; /* length of "in" msg */
Key_schedule schedule; /* precomputed key schedule */
- C_Block *key; /* encryption key for seed and ivec */
+ C_Block key; /* encryption key for seed and ivec */
struct sockaddr_in *sender;
struct sockaddr_in *receiver;
MSG_DAT *m_data; /*various input/output data from msg */
@@ -113,8 +113,8 @@ krb_rd_priv(in,in_length,schedule,key,sender,receiver,m_data)
#ifndef NOENCRYPTION
/* pcbc decrypt, use key as ivec */
- pcbc_encrypt((C_Block *) q,(C_Block *) q, (long) c_length,
- schedule,key,DECRYPT);
+ pcbc_encrypt((C_Block *)q, (C_Block *)q, (long)c_length,
+ schedule, (C_Block *)key, DECRYPT);
#endif
/* safely get application data length */
@@ -206,7 +206,7 @@ krb_rd_priv(in,in_length,schedule,key,sender,receiver,m_data)
* calculate the checksum of the length, sequence,
* and input data, on the sending byte order!!
*/
- calc_cksum = quad_cksum(q,NULL,p-q,0,key);
+ calc_cksum = quad_cksum(q, NULL, p-q, 0, key);
DEB (("\ncalc_cksum = %u, received cksum = %u",
calc_cksum, cksum));
diff --git a/src/lib/krb4/rd_req.c b/src/lib/krb4/rd_req.c
index fc9580ce65..bb03f7ef46 100644
--- a/src/lib/krb4/rd_req.c
+++ b/src/lib/krb4/rd_req.c
@@ -121,14 +121,14 @@ krb_set_key(key,cvt)
* Mutual authentication is not implemented.
*/
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_rd_req(authent,service,instance,from_addr,ad,fn)
register KTEXT authent; /* The received message */
- char *service; /* Service name */
- char *instance; /* Service instance */
+ char FAR *service; /* Service name */
+ char FAR *instance; /* Service instance */
unsigned KRB4_32 from_addr; /* Net address of originating host */
- AUTH_DAT *ad; /* Structure to be filled in */
- char *fn; /* Filename to get keys from */
+ AUTH_DAT FAR *ad; /* Structure to be filled in */
+ char FAR *fn; /* Filename to get keys from */
{
KTEXT_ST ticket; /* Temp storage for ticket */
KTEXT tkt = &ticket;
diff --git a/src/lib/krb4/rd_safe.c b/src/lib/krb4/rd_safe.c
index 1135e801cc..ad75f4d385 100644
--- a/src/lib/krb4/rd_safe.c
+++ b/src/lib/krb4/rd_safe.c
@@ -48,14 +48,14 @@ extern int krb_debug;
* information, MSG_DAT, is defined in "krb.h".
*/
-long INTERFACE
+KRB5_DLLIMP long KRB5_CALLCONV
krb_rd_safe(in,in_length,key,sender,receiver,m_data)
- u_char *in; /* pointer to the msg received */
- unsigned KRB4_32 in_length; /* length of "in" msg */
- C_Block *key; /* encryption key for seed and ivec */
- struct sockaddr_in *sender; /* sender's address */
- struct sockaddr_in *receiver; /* receiver's address -- me */
- MSG_DAT *m_data; /* where to put message information */
+ u_char FAR *in; /* pointer to the msg received */
+ unsigned KRB4_32 in_length; /* length of "in" msg */
+ C_Block FAR key; /* encryption key for seed and ivec */
+ struct sockaddr_in FAR *sender; /* sender's address */
+ struct sockaddr_in FAR *receiver; /* receiver's address -- me */
+ MSG_DAT FAR *m_data; /* where to put message information */
{
unsigned KRB4_32 calc_cksum[4];
unsigned KRB4_32 big_cksum[4];
diff --git a/src/lib/krb4/rd_svc_key.c b/src/lib/krb4/rd_svc_key.c
index 5701cd3f6a..c6be216fa2 100644
--- a/src/lib/krb4/rd_svc_key.c
+++ b/src/lib/krb4/rd_svc_key.c
@@ -113,13 +113,14 @@ int vxworks_srvtab_read(fd, s, n)
}
#endif
-int read_service_key(service,instance,realm,kvno,file,key)
- char *service; /* Service Name */
- char *instance; /* Instance name or "*" */
- char *realm; /* Realm */
- int kvno; /* Key version number */
- char *file; /* Filename */
- char *key; /* Pointer to key to be filled in */
+KRB5_DLLIMP int KRB5_CALLCONV
+read_service_key(service,instance,realm,kvno,file,key)
+ char FAR *service; /* Service Name */
+ char FAR *instance; /* Instance name or "*" */
+ char FAR *realm; /* Realm */
+ int kvno; /* Key version number */
+ char FAR *file; /* Filename */
+ char FAR *key; /* Pointer to key to be filled in */
{
int kret;
@@ -192,13 +193,14 @@ int read_service_key(service,instance,realm,kvno,file,key)
/* kvno is passed by reference, so that if it is zero, and we find a match,
the match gets written back into *kvno so the caller can find it.
*/
-int get_service_key(service,instance,realm,kvno,file,key)
- char *service; /* Service Name */
- char *instance; /* Instance name or "*" */
- char *realm; /* Realm */
- int *kvno; /* Key version number */
- char *file; /* Filename */
- char *key; /* Pointer to key to be filled in */
+KRB5_DLLIMP int KRB5_CALLCONV
+get_service_key(service,instance,realm,kvno,file,key)
+ char FAR *service; /* Service Name */
+ char FAR *instance; /* Instance name or "*" */
+ char FAR *realm; /* Realm */
+ int FAR *kvno; /* Key version number */
+ char FAR *file; /* Filename */
+ char FAR *key; /* Pointer to key to be filled in */
{
char serv[SNAME_SZ];
char inst[INST_SZ];
diff --git a/src/lib/krb4/realmofhost.c b/src/lib/krb4/realmofhost.c
index cff11cc8e3..73af92931d 100644
--- a/src/lib/krb4/realmofhost.c
+++ b/src/lib/krb4/realmofhost.c
@@ -10,6 +10,9 @@
*/
#include "mit-copyright.h"
+#define DEFINE_SOCKADDR /* Ask for MAXHOSTNAMELEN */
+#include "krb.h"
+
#include <string.h>
#include <stdio.h>
#include <ctype.h>
@@ -18,8 +21,6 @@
#else
extern char *malloc();
#endif
-#define DEFINE_SOCKADDR /* Ask for MAXHOSTNAMELEN */
-#include "krb.h"
/*
* krb_realmofhost.
@@ -41,9 +42,9 @@ extern char *malloc();
static char ret_realm[REALM_SZ+1];
-char * INTERFACE
+KRB5_DLLIMP char FAR * KRB5_CALLCONV
krb_realmofhost(host)
-char *host;
+char FAR *host;
{
char *domain;
FILE *trans_file;
diff --git a/src/lib/krb4/recvauth.c b/src/lib/krb4/recvauth.c
index 2a1f3bc056..e62e3f954c 100644
--- a/src/lib/krb4/recvauth.c
+++ b/src/lib/krb4/recvauth.c
@@ -25,7 +25,9 @@
* be sure to support old versions of krb_sendauth!
*/
+#ifndef _WINDOWS
extern int errno;
+#endif
/*
* krb_recvauth() reads (and optionally responds to) a message sent
@@ -112,20 +114,20 @@ extern int errno;
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif /* max */
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_recvauth(options, fd, ticket, service, instance, faddr, laddr, kdata,
filename, schedule, version)
-long options; /* bit-pattern of options */
-int fd; /* file descr. to read from */
-KTEXT ticket; /* storage for client's ticket */
-char *service; /* service expected */
-char *instance; /* inst expected (may be filled in) */
-struct sockaddr_in *faddr; /* address of foreign host on fd */
-struct sockaddr_in *laddr; /* local address */
-AUTH_DAT *kdata; /* kerberos data (returned) */
-char *filename; /* name of file with service keys */
-Key_schedule schedule; /* key schedule (return) */
-char *version; /* version string (filled in) */
+ long options; /* bit-pattern of options */
+ int fd; /* file descr. to read from */
+ KTEXT ticket; /* storage for client's ticket */
+ char FAR *service; /* service expected */
+ char FAR *instance; /* inst expected (may be filled in) */
+ struct sockaddr_in FAR *faddr; /* address of foreign host on fd */
+ struct sockaddr_in FAR *laddr; /* local address */
+ AUTH_DAT FAR *kdata; /* kerberos data (returned) */
+ char FAR *filename; /* name of file with service keys */
+ Key_schedule schedule; /* key schedule (return) */
+ char FAR *version; /* version string (filled in) */
{
int i, cc, old_vers = 0;
diff --git a/src/lib/krb4/save_creds.c b/src/lib/krb4/save_creds.c
index d8a89cdcfa..12033787c1 100644
--- a/src/lib/krb4/save_creds.c
+++ b/src/lib/krb4/save_creds.c
@@ -28,17 +28,17 @@
* to avoid namespace pollution.
*/
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_save_credentials(service, instance, realm, session, lifetime, kvno,
ticket, issue_date)
- char *service; /* Service name */
- char *instance; /* Instance */
- char *realm; /* Auth domain */
- C_Block session; /* Session key */
- int lifetime; /* Lifetime */
- int kvno; /* Key version number */
- KTEXT ticket; /* The ticket itself */
- long issue_date; /* The issue time */
+ char FAR *service; /* Service name */
+ char FAR *instance; /* Instance */
+ char FAR *realm; /* Auth domain */
+ C_Block FAR *session; /* Session key */
+ int lifetime; /* Lifetime */
+ int kvno; /* Key version number */
+ KTEXT ticket; /* The ticket itself */
+ long issue_date; /* The issue time */
{
int tf_status; /* return values of the tf_util calls */
diff --git a/src/lib/krb4/send_to_kdc.c b/src/lib/krb4/send_to_kdc.c
index 97fdac780b..7f9620d128 100644
--- a/src/lib/krb4/send_to_kdc.c
+++ b/src/lib/krb4/send_to_kdc.c
@@ -224,7 +224,7 @@ send_to_kdc(pkt,rpkt,realm)
retval = /*errno */SKDC_CANT;
goto rtn;
}
- _fmemcpy(cp, host->h_addr, host->h_length);
+ memcpy(cp, host->h_addr, host->h_length);
/* At least Sun OS version 3.2 (or worse) and Ultrix version 2.2
(or worse) only return one name ... */
diff --git a/src/lib/krb4/tf_util.c b/src/lib/krb4/tf_util.c
index 05902faad7..3470dc2090 100644
--- a/src/lib/krb4/tf_util.c
+++ b/src/lib/krb4/tf_util.c
@@ -15,7 +15,6 @@
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
-#include <sys/file.h>
#include <fcntl.h>
#ifdef TKT_SHMEM
diff --git a/src/lib/krb4/tkt_string.c b/src/lib/krb4/tkt_string.c
index aac6ec467f..f1554ab97f 100644
--- a/src/lib/krb4/tkt_string.c
+++ b/src/lib/krb4/tkt_string.c
@@ -9,12 +9,22 @@
*/
#include "mit-copyright.h"
-#include <stdio.h>
#include "krb.h"
+#include <stdio.h>
#include <string.h>
-#include <sys/param.h>
+#include <sys/types.h>
+#ifdef HAS_STDLIB_H
+#include <stdlib.h>
+#else
char *getenv();
+#endif
+
+
+#ifdef _WINDOWS
+typedef unsigned long uid_t;
+uid_t getuid(void) { return 0; }
+#endif /* _WINDOWS */
/*
* This routine is used to generate the name of the file that holds
diff --git a/src/lib/krb4/unix_glue.c b/src/lib/krb4/unix_glue.c
index eeafdb9d7e..a05b0c05bf 100644
--- a/src/lib/krb4/unix_glue.c
+++ b/src/lib/krb4/unix_glue.c
@@ -11,27 +11,27 @@
#include <sys/time.h>
/* Start and end Kerberos library access. On Unix, this is a No-op. */
-int INTERFACE
+int
krb_start_session (x)
char *x;
{
return KSUCCESS;
}
-int INTERFACE
+int
krb_end_session (x)
char *x;
{
return KSUCCESS;
}
-char FAR * INTERFACE
+char FAR *
krb_get_default_user ()
{
return 0; /* FIXME */
}
-int INTERFACE
+int
krb_set_default_user (x)
char *x;
{
diff --git a/src/lib/krb4/win_glue.c b/src/lib/krb4/win_glue.c
index de8b62015f..c22584656e 100644
--- a/src/lib/krb4/win_glue.c
+++ b/src/lib/krb4/win_glue.c
@@ -14,39 +14,6 @@
#include <stdio.h>
#include <windows.h>
-static HINSTANCE hlibinstance;
-
-/*
- * WinSock support.
- *
- * Do the WinSock initialization call, keeping all the hair here.
- *
- * This routine is called by SOCKET_INITIALIZE in include/c-windows.h.
- * The code is pretty much copied from winsock.txt from winsock-1.1,
- * available from:
- * ftp://sunsite.unc.edu/pub/micro/pc-stuff/ms-windows/winsock/winsock-1.1
- */
-int
-win_socket_initialize()
-{
- WORD wVersionRequested;
- WSADATA wsaData;
- int err;
-
- wVersionRequested = 0x0101; /* We need version 1.1 */
-
- err = WSAStartup (wVersionRequested, &wsaData);
- if (err != 0)
- return err; /* Library couldn't initialize */
-
- if (wVersionRequested != wsaData.wVersion) {
- /* DLL couldn't support our version of the spec */
- WSACleanup ();
- return -104; /* FIXME -- better error? */
- }
-
- return 0;
-}
/*
* We needed a way to print out what might be FAR pointers on Windows,
@@ -64,43 +31,14 @@ far_fputs(string, stream)
return fprintf(stream, "%Fs", string);
}
-
-BOOL CALLBACK
-LibMain(hInst, wDataSeg, cbHeap, CmdLine)
- HINSTANCE hInst;
- WORD wDataSeg;
- WORD cbHeap;
- LPSTR CmdLine;
-{
- hlibinstance = hInst;
-
- return 1;
-}
-
-
-int CALLBACK __export
-WEP(nParam)
- int nParam;
-{
- return 1;
-}
-
-
-HINSTANCE
-get_lib_instance()
-{
- return hlibinstance;
-}
-
-
-int INTERFACE
+int
krb_start_session(x)
char *x;
{
return KSUCCESS;
}
-int INTERFACE
+int
krb_end_session(x)
char *x;
{
@@ -112,6 +50,3 @@ krb_set_tkt_string(val)
char *val;
{
}
-
-/* FIXME -- Mark... */
-int krb_ignore_ip_address = 0;
diff --git a/src/lib/krb4/win_store.c b/src/lib/krb4/win_store.c
index 914ba77413..706205fe5c 100644
--- a/src/lib/krb4/win_store.c
+++ b/src/lib/krb4/win_store.c
@@ -9,11 +9,38 @@
* g_cnffil.c
*/
-#include <windows.h>
+#include "krb.h"
+#include "k5-int.h"
#include <stdio.h>
#include <assert.h>
-#include "krb.h"
+
+char *
+krb__get_srvtabname(default_srvtabname)
+ char *default_srvtabname;
+{
+ krb5_context context;
+ const char* names[3];
+ char **full_name = 0, **cpp;
+ krb5_error_code retval;
+ char *retname;
+
+ krb5_init_context(&context);
+ names[0] = "libdefaults";
+ names[1] = "krb4_srvtab";
+ names[2] = 0;
+ retval = profile_get_values(context->profile, names, &full_name);
+ if (retval == 0 && full_name && full_name[0]) {
+ retname = strdup(full_name[0]);
+ for (cpp = full_name; *cpp; cpp++)
+ krb5_xfree(*cpp);
+ krb5_xfree(full_name);
+ } else {
+ retname = strdup(default_srvtabname);
+ }
+ krb5_free_context(context);
+ return retname;
+}
/*
* Returns an open file handle to the configuration file. This
@@ -84,7 +111,7 @@ krb__get_realmsfile()
* the [DEFAULTS] section of the "kerberos.ini" file located in the
* Windows directory.
*/
-char FAR * INTERFACE
+KRB5_DLLIMP char FAR * KRB5_CALLCONV
krb_get_default_user()
{
static char username[ANAME_SZ];
@@ -99,7 +126,7 @@ krb_get_default_user()
/*
* Sets the default user name stored in the "kerberos.ini" file.
*/
-int INTERFACE
+KRB5_DLLIMP int KRB5_CALLCONV
krb_set_default_user(username)
char *username;
{
diff --git a/src/lib/krb4/win_time.c b/src/lib/krb4/win_time.c
index 9022d1b9a2..2334d289d3 100644
--- a/src/lib/krb4/win_time.c
+++ b/src/lib/krb4/win_time.c
@@ -17,6 +17,24 @@
#include <windows.h>
#include <dos.h>
+#ifdef _WIN32
+
+unsigned KRB4_32
+win_time_gmt_unixsec (usecptr)
+ unsigned KRB4_32 *usecptr;
+{
+ struct _timeb timeptr;
+
+ _ftime(&timeptr); /* Get the current time */
+
+ if (usecptr)
+ *usecptr = timeptr.millitm * 1000;
+
+ return timeptr.time + CONVERT_TIME_EPOCH;
+}
+
+#else
+
/*
* Time handling. Translate Unix time calls into Kerberos internal
* procedure calls. See ../../include/c-win.h.
@@ -25,9 +43,9 @@
* to using the AT hardware clock and converting it to Unix time.
*/
-unsigned KRB_INT32
+unsigned KRB4_32
win_time_gmt_unixsec (usecptr)
- unsigned KRB_INT32 *usecptr;
+ unsigned KRB4_32 *usecptr;
{
struct tm tm;
union _REGS inregs;
@@ -77,6 +95,7 @@ win_time_gmt_unixsec (usecptr)
return time + CONVERT_TIME_EPOCH;
}
+#endif
/*
* This routine figures out the current time epoch and returns the
diff --git a/src/lib/krb4/winsock.def b/src/lib/krb4/winsock.def
deleted file mode 100644
index cada779858..0000000000
--- a/src/lib/krb4/winsock.def
+++ /dev/null
@@ -1,90 +0,0 @@
-;
-; File: winsock.def
-; System: MS-Windows 3.x
-; Summary: Module definition file for Windows Sockets DLL.
-;
-; This file is from
-; ftp://sunsite.unc.edu/pub/micro/pc-stuff/ms-windows/winsock/winsock-1.1
-; except that we made all the routine names uppercase, to match what
-; MicroSoft C does when you declare an interface routine PASCAL
-; (the way all these routines are declared in .../include/winsock.h).
-;
-
-LIBRARY WINSOCK ; Application's module name
-
-DESCRIPTION 'BSD Socket API for Windows'
-
-EXETYPE WINDOWS ; required for all windows applications
-
-STUB 'WINSTUB.EXE' ; generates error message if application
- ; is run without Windows
-
-;CODE can be FIXED in memory because of potential upcalls
-CODE PRELOAD FIXED
-
-;DATA must be SINGLE and at a FIXED location since this is a DLL
-DATA PRELOAD FIXED SINGLE
-
-HEAPSIZE 1024
-STACKSIZE 16384
-
-; All functions that will be called by any Windows routine
-; must be exported. Any additional exports beyond those defined
-; here must have ordinal numbers 1000 or above.
-
-EXPORTS
- ACCEPT @1
- BIND @2
- CLOSESOCKET @3
- CONNECT @4
- GETPEERNAME @5
- GETSOCKNAME @6
- GETSOCKOPT @7
- HTONL @8
- HTONS @9
- INET_ADDR @10
- INET_NTOA @11
- IOCTLSOCKET @12
- LISTEN @13
- NTOHL @14
- NTOHS @15
- RECV @16
- RECVFROM @17
- SELECT @18
- SEND @19
- SENDTO @20
- SETSOCKOPT @21
- SHUTDOWN @22
- SOCKET @23
-
- GETHOSTBYADDR @51
- GETHOSTBYNAME @52
- GETPROTOBYNAME @53
- GETPROTOBYNUMBER @54
- GETSERVBYNAME @55
- GETSERVBYPORT @56
- GETHOSTNAME @57
-
- WSAASYNCSELECT @101
- WSAASYNCGETHOSTBYADDR @102
- WSAASYNCGETHOSTBYNAME @103
- WSAASYNCGETPROTOBYNUMBER @104
- WSAASYNCGETPROTOBYNAME @105
- WSAASYNCGETSERVBYPORT @106
- WSAASYNCGETSERVBYNAME @107
- WSACANCELASYNCREQUEST @108
- WSASETBLOCKINGHOOK @109
- WSAUNHOOKBLOCKINGHOOK @110
- WSAGETLASTERROR @111
- WSASETLASTERROR @112
- WSACANCELBLOCKINGCALL @113
- WSAISBLOCKING @114
- WSASTARTUP @115
- WSACLEANUP @116
-
- __WSAFDISSET @151
-
- WEP @500 RESIDENTNAME
-
-;eof
-