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
+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,
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)
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
#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>
#include <errno.h>
#include <sys/stat.h>
#include <fcntl.h>
+#endif
#include <gssapi/gssapi_generic.h>
#include "gss-misc.h"
#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>
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;
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;
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 */
#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
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);
}