summaryrefslogtreecommitdiffstats
path: root/src/appl
diff options
context:
space:
mode:
authorDanilo Almeida <dalmeida@mit.edu>2000-02-01 20:49:25 +0000
committerDanilo Almeida <dalmeida@mit.edu>2000-02-01 20:49:25 +0000
commitf79a926e85cab3392427c0830c1e8c77ea9edd52 (patch)
tree70838032937fcfdbcfef6f7c204efa19762027a7 /src/appl
parent44f882afab547c3fd60d1bfca6fc7fcda93ecf35 (diff)
downloadkrb5-f79a926e85cab3392427c0830c1e8c77ea9edd52.tar.gz
krb5-f79a926e85cab3392427c0830c1e8c77ea9edd52.tar.xz
krb5-f79a926e85cab3392427c0830c1e8c77ea9edd52.zip
* gss-client.c, gss-server.c, gss-misc.c: Include Windows headers
instead of Unix headers under Windows. * gss-server.c (usage): Fix usage info to reflect that service_name is required. * gss-misc.c (read_all, write_all): Change write to send and read to recv for portability. (gettimeofday): Add an implementation of gettimeofday() for Windows. * Makefile.in: Build under Windows. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11981 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/appl')
-rw-r--r--src/appl/gss-sample/ChangeLog15
-rw-r--r--src/appl/gss-sample/Makefile.in17
-rw-r--r--src/appl/gss-sample/gss-client.c7
-rw-r--r--src/appl/gss-sample/gss-misc.c26
-rw-r--r--src/appl/gss-sample/gss-server.c7
5 files changed, 63 insertions, 9 deletions
diff --git a/src/appl/gss-sample/ChangeLog b/src/appl/gss-sample/ChangeLog
index eccd50be67..fb37b228b9 100644
--- a/src/appl/gss-sample/ChangeLog
+++ b/src/appl/gss-sample/ChangeLog
@@ -1,3 +1,18 @@
+2000-01-31 Danilo Almeida <dalmeida@mit.edu>
+
+ * gss-client.c, gss-server.c, gss-misc.c: Include Windows headers
+ instead of Unix headers under Windows.
+
+ * gss-server.c (usage): Fix usage info to reflect that service_name is
+ required.
+
+ * gss-misc.c (read_all, write_all): Change write to send and read
+ to recv for portability.
+ (gettimeofday): Add an implementation of gettimeofday() for
+ Windows.
+
+ * Makefile.in: Build under Windows.
+
1999-10-26 Tom Yu <tlyu@mit.edu>
* Makefile.in: Clean up usage of CFLAGS, CPPFLAGS, DEFS, DEFINES,
diff --git a/src/appl/gss-sample/Makefile.in b/src/appl/gss-sample/Makefile.in
index d564f7ed86..8944ab7f18 100644
--- a/src/appl/gss-sample/Makefile.in
+++ b/src/appl/gss-sample/Makefile.in
@@ -11,7 +11,8 @@ SRCS= gss-client.c gss-misc.c gss-server.c
OBJS= gss-client.o gss-misc.o gss-server.o
-all:: gss-server gss-client
+all-unix:: gss-server gss-client
+all-windows:: $(OUTPRE)gss-server.exe $(OUTPRE)gss-client.exe
gss-server: gss-server.o gss-misc.o $(GSS_DEPLIBS) $(KRB5_BASE_DEPLIBS)
$(CC_LINK) -o gss-server gss-server.o gss-misc.o $(GSS_LIBS) $(KRB5_BASE_LIBS)
@@ -19,9 +20,15 @@ gss-server: gss-server.o gss-misc.o $(GSS_DEPLIBS) $(KRB5_BASE_DEPLIBS)
gss-client: gss-client.o gss-misc.o $(GSS_DEPLIBS) $(KRB5_BASE_DEPLIBS)
$(CC_LINK) -o gss-client gss-client.o gss-misc.o $(GSS_LIBS) $(KRB5_BASE_LIBS)
-clean::
+$(OUTPRE)gss-server.exe: $(OUTPRE)gss-server.obj $(OUTPRE)gss-misc.obj $(GLIB) $(KLIB)
+ link $(EXE_LINKOPTS) -out:$@ $** wsock32.lib
+
+$(OUTPRE)gss-client.exe: $(OUTPRE)gss-client.obj $(OUTPRE)gss-misc.obj $(GLIB) $(KLIB)
+ link $(EXE_LINKOPTS) -out:$@ $** wsock32.lib
+
+clean-unix::
$(RM) gss-server gss-client
-install::
- $(INSTALL_PROGRAM) gss-client ${DESTDIR}$(CLIENT_BINDIR)/gss-client
- $(INSTALL_PROGRAM) gss-server ${DESTDIR}$(SERVER_BINDIR)/gss-server
+install-unix::
+ $(INSTALL_PROGRAM) gss-client $(DESTDIR)$(CLIENT_BINDIR)/gss-client
+ $(INSTALL_PROGRAM) gss-server $(DESTDIR)$(SERVER_BINDIR)/gss-server
diff --git a/src/appl/gss-sample/gss-client.c b/src/appl/gss-sample/gss-client.c
index 33a7e963a3..5e4ed6093e 100644
--- a/src/appl/gss-sample/gss-client.c
+++ b/src/appl/gss-sample/gss-client.c
@@ -25,9 +25,13 @@ static char *rcsid = "$Header$";
#endif
#include <stdio.h>
-#include <unistd.h>
#include <stdlib.h>
#include <string.h>
+#ifdef _WIN32
+#include <windows.h>
+#include <winsock.h>
+#else
+#include <unistd.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -36,6 +40,7 @@ static char *rcsid = "$Header$";
#include <errno.h>
#include <sys/stat.h>
#include <fcntl.h>
+#endif
#include <gssapi/gssapi_generic.h>
#include "gss-misc.h"
diff --git a/src/appl/gss-sample/gss-misc.c b/src/appl/gss-sample/gss-misc.c
index 67e898c1d6..fedd3766a9 100644
--- a/src/appl/gss-sample/gss-misc.c
+++ b/src/appl/gss-sample/gss-misc.c
@@ -25,8 +25,13 @@ static char *rcsid = "$Header$";
#endif
#include <stdio.h>
+#ifdef _WIN32
+#include <windows.h>
+#include <winsock.h>
+#else
#include <sys/types.h>
#include <netinet/in.h>
+#endif
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -53,7 +58,7 @@ static int write_all(int fildes, char *buf, unsigned int nbyte)
char *ptr;
for (ptr = buf; nbyte; ptr += ret, nbyte -= ret) {
- ret = write(fildes, ptr, nbyte);
+ ret = send(fildes, ptr, nbyte, 0);
if (ret < 0) {
if (errno == EINTR)
continue;
@@ -72,7 +77,7 @@ static int read_all(int fildes, char *buf, unsigned int nbyte)
char *ptr;
for (ptr = buf; nbyte; ptr += ret, nbyte -= ret) {
- ret = read(fildes, ptr, nbyte);
+ ret = recv(fildes, ptr, nbyte, 0);
if (ret < 0) {
if (errno == EINTR)
continue;
@@ -301,3 +306,20 @@ void print_token(tok)
fprintf(display_file, "\n");
fflush(display_file);
}
+
+#ifdef _WIN32
+#include <sys\timeb.h>
+#include <time.h>
+
+int gettimeofday (struct timeval *tv, void *ignore_tz)
+{
+ struct _timeb tb;
+ _tzset();
+ _ftime(&tb);
+ if (tv) {
+ tv->tv_sec = tb.time;
+ tv->tv_usec = tb.millitm * 1000;
+ }
+ return 0;
+}
+#endif /* _WIN32 */
diff --git a/src/appl/gss-sample/gss-server.c b/src/appl/gss-sample/gss-server.c
index df7de21f38..6a163db9a8 100644
--- a/src/appl/gss-sample/gss-server.c
+++ b/src/appl/gss-sample/gss-server.c
@@ -25,10 +25,15 @@ static char *rcsid = "$Header$";
#endif
#include <stdio.h>
+#ifdef _WIN32
+#include <windows.h>
+#include <winsock.h>
+#else
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
+#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -47,7 +52,7 @@ static char *rcsid = "$Header$";
void usage()
{
fprintf(stderr, "Usage: gss-server [-port port] [-verbose]\n");
- fprintf(stderr, " [-inetd] [-logfile file] [service_name]\n");
+ fprintf(stderr, " [-inetd] [-logfile file] service_name\n");
exit(1);
}