summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@toad.com>1995-03-29 02:08:58 +0000
committerJohn Gilmore <gnu@toad.com>1995-03-29 02:08:58 +0000
commit87acb0f2471655640df7aaaa07ef53f27bc02f62 (patch)
treea9643b2cac510cbd623a439583c6b48be133a6ee
parent907816ecf31d3bff6f7fbb46c20dc80fc19fa8c9 (diff)
downloadkrb5-87acb0f2471655640df7aaaa07ef53f27bc02f62.tar.gz
krb5-87acb0f2471655640df7aaaa07ef53f27bc02f62.tar.xz
krb5-87acb0f2471655640df7aaaa07ef53f27bc02f62.zip
* Makefile.in (KRB5_HEADERS, install): Account for file renames.
(all-mac): Add. * configure.in (CONFIG_RULES): Remove. (krb5_sigtype): Define as either void or int. * encryption.h: Insert parentheses in macros to avoid mis-expansion. * k5-config.h: Further parameterize socket support. * macsock.h: Support connect(), recv(), send(), getmyipaddr(). (WSAGetLastError): Fix typo -- there's no argument to this macro. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5292 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r--src/include/krb5/ChangeLog10
-rw-r--r--src/include/krb5/Makefile.in10
-rw-r--r--src/include/krb5/configure.in5
-rw-r--r--src/include/krb5/encryption.h6
-rw-r--r--src/include/krb5/k5-config.h47
-rw-r--r--src/include/krb5/macsock.h36
6 files changed, 94 insertions, 20 deletions
diff --git a/src/include/krb5/ChangeLog b/src/include/krb5/ChangeLog
index 5f3fb554bc..69152b0bdc 100644
--- a/src/include/krb5/ChangeLog
+++ b/src/include/krb5/ChangeLog
@@ -1,3 +1,13 @@
+Tue Mar 28 18:02:41 1995 John Gilmore (gnu at toad.com)
+
+ * Makefile.in (KRB5_HEADERS, install): Account for file renames.
+ (all-mac): Add.
+ * configure.in (CONFIG_RULES): Remove.
+ (krb5_sigtype): Define as either void or int.
+ * encryption.h: Insert parentheses in macros to avoid mis-expansion.
+ * k5-config.h: Further parameterize socket support.
+ * macsock.h: Support connect(), recv(), send(), getmyipaddr().
+ (WSAGetLastError): Fix typo -- there's no argument to this macro.
Mon Mar 27 09:33:10 1995 Chris Provenzano (proven@mit.edu)
diff --git a/src/include/krb5/Makefile.in b/src/include/krb5/Makefile.in
index bf1652a5dd..53e4f9c026 100644
--- a/src/include/krb5/Makefile.in
+++ b/src/include/krb5/Makefile.in
@@ -5,9 +5,9 @@ KRB5SRVTABDIR = /etc
##DOS!include $(BUILDTOP)\config\windows.in
KRB5_HEADERS = asn1.h base-defs.h ccache.h k5-config.h encryption.h \
- error_def.h errors.h ext-proto.h fieldbits.h \
+ error_def.h k5-errors.h ext-proto.h fieldbits.h \
k5-free.h func-proto.h hostaddr.h kdb.h kdb_dbm.h \
- keytab.h krb5.h libos.h los-proto.h macros.h mit-des.h \
+ keytab.h libos.h los-proto.h macros.h mit-des.h \
proto.h rcache.h safepriv.h sysincl.h wordsize.h
# these are installed here for the build from lib/krb5/error_tables but
# also need to be in the installed tree
@@ -17,7 +17,7 @@ BUILT_HEADERS = autoconf.h osconf.h
all:: all-$(WHAT)
all-unix:: $(BUILT_HEADERS)
-
+all-mac:: $(BUILT_HEADERS)
all-windows:
copy stock\osconf.win osconf.h
echo /* not used in windows */ > autoconf.h
@@ -36,14 +36,14 @@ clean::
depend::
-install:: $(KRB5_HEADERS) config.h osconf.h autoconf.h
+install:: $(KRB5_HEADERS) osconf.h autoconf.h
@set -x; for f in $(KRB5_HEADERS) ; \
do if cmp -s $$f $(DESTDIR)$(KRB5_INCDIR)/krb5/$$f; \
then true; else \
$(RM) $(DESTDIR)$(KRB5_INCDIR)/krb5/$$f; \
cp $(srcdir)/$$f $(DESTDIR)$(KRB5_INCDIR)/krb5/$$f ; \
fi; done
- @set -x; for f in config.h osconf.h autoconf.h ; \
+ @set -x; for f in osconf.h autoconf.h ; \
do if cmp -s $$f $(DESTDIR)$(KRB5_INCDIR)/krb5/$$f; \
then true; else \
$(RM) $(DESTDIR)$(KRB5_INCDIR)/krb5/$$f; \
diff --git a/src/include/krb5/configure.in b/src/include/krb5/configure.in
index 81ca5f8064..f41285a60a 100644
--- a/src/include/krb5/configure.in
+++ b/src/include/krb5/configure.in
@@ -2,7 +2,6 @@ AC_INIT(ext-proto.h)
WITH_CCOPTS
WITH_KRB5ROOT
AC_SET_BUILDTOP
-CONFIG_RULES
AC_CONFIG_HEADER(autoconf.h)
AC_PROG_LEX
AC_PROG_INSTALL
@@ -37,8 +36,12 @@ AC_MSG_RESULT($krb5_cv_has_posix_signals)
if test $krb5_cv_has_posix_signals = yes; then
AC_DEFINE(krb5_sigtype, void) AC_DEFINE(POSIX_SIGTYPE)
else
+if test $ac_cv_type_signal = void; then
+AC_DEFINE(krb5_sigtype, void)
+else
AC_DEFINE(krb5_sigtype, int)
fi
+fi
dnl
dnl
AC_HEADER_CHECK(string.h,AC_DEFINE(USE_STRING_H))
diff --git a/src/include/krb5/encryption.h b/src/include/krb5/encryption.h
index d1e5565f06..c54630e38e 100644
--- a/src/include/krb5/encryption.h
+++ b/src/include/krb5/encryption.h
@@ -169,11 +169,11 @@ extern int krb5_max_keytype; /* max entry in array */
extern krb5_checksum_entry * NEAR krb5_cksumarray[];
extern int krb5_max_cksum; /* max entry in array */
-#define valid_etype(etype) ((((int) etype) <= krb5_max_cryptosystem) && (etype > 0) && krb5_csarray[etype])
+#define valid_etype(etype) ((((int) (etype)) <= krb5_max_cryptosystem) && ((etype) > 0) && krb5_csarray[etype])
-#define valid_keytype(ktype) ((((int) ktype) <= krb5_max_keytype) && (ktype > 0) && krb5_keytype_array[ktype])
+#define valid_keytype(ktype) ((((int) (ktype)) <= krb5_max_keytype) && ((ktype) > 0) && krb5_keytype_array[ktype])
-#define valid_cksumtype(cktype) ((((int) cktype) <= krb5_max_cksum) && (cktype > 0) && krb5_cksumarray[cktype])
+#define valid_cksumtype(cktype) ((((int) (cktype)) <= krb5_max_cksum) && ((cktype) > 0) && krb5_cksumarray[cktype])
#define is_coll_proof_cksum(cktype) (krb5_cksumarray[cktype]->is_collision_proof)
#define is_keyed_cksum(cktype) (krb5_cksumarray[cktype]->uses_key)
diff --git a/src/include/krb5/k5-config.h b/src/include/krb5/k5-config.h
index 080440fe60..278033f667 100644
--- a/src/include/krb5/k5-config.h
+++ b/src/include/krb5/k5-config.h
@@ -96,6 +96,20 @@ typedef unsigned char u_char;
#ifdef NEED_SOCKETS
#include <winsock.h>
+
+/* Some of our own infrastructure where the WinSock stuff was too hairy
+ to dump into a clean Unix program... */
+
+#define SOCKET_INITIALIZE() win_socket_initialize()
+#define SOCKET_CLEANUP() WSACleanup()
+#define SOCKET_ERRNO (WSAGetLastError())
+#define SOCKET_SET_ERRNO(x) (WSASetLastError (x))
+#define SOCKET_NFDS(f) (0) /* select()'s first arg is ignored */
+#define SOCKET_READ(fd, b, l) (recv(fd, b, l, 0))
+#define SOCKET_WRITE(fd, b, l) (send(fd, b, l, 0))
+#define SOCKET_EINTR WSAEINTR
+
+int win_socket_initialize();
#endif
#ifdef NEED_LOWLEVEL_IO
@@ -243,6 +257,18 @@ typedef unsigned char u_char;
#ifdef HAVE_MACSOCK_H /* Sockets stuff differs on Mac */
#include "macsock.h" /* Macintosh sockets emulation library */
+/* Some of our own infrastructure where the WinSock stuff was too hairy
+ to dump into a clean Unix program... */
+
+#define SOCKET_INITIALIZE() (WSAStartup(0x0101, (WSADATA *)0))
+#define SOCKET_CLEANUP() (WSACleanup())
+#define SOCKET_ERRNO (WSAGetLastError())
+#define SOCKET_SET_ERRNO(x) (WSASetLastError(x))
+#define SOCKET_NFDS(f) (0) /* select()'s first arg is ignored */
+#define SOCKET_READ(fd, b, l) (recv(fd, b, l, 0))
+#define SOCKET_WRITE(fd, b, l) (send(fd, b, l, 0))
+#define SOCKET_EINTR WSAEINTR
+
#else /* HAVE_MACSOCK_H */ /* Sockets stuff for Unix machines */
#include <netinet/in.h> /* For struct sockaddr_in and in_addr */
@@ -253,6 +279,27 @@ typedef unsigned char u_char;
#include <sys/time.h> /* For struct timeval */
#include <net/if.h> /* For struct ifconf, for localaddr.c */
+/*
+ * Compatability with WinSock calls on MS-Windows...
+ */
+#define SOCKET unsigned int
+#define INVALID_SOCKET ((SOCKET)~0)
+#define closesocket close
+#define ioctlsocket ioctl
+#define SOCKET_ERROR (-1)
+
+/* Some of our own infrastructure where the WinSock stuff was too hairy
+ to dump into a clean Unix program... */
+
+#define SOCKET_INITIALIZE() (0) /* No error (or anything else) */
+#define SOCKET_CLEANUP() /* nothing */
+#define SOCKET_ERRNO errno
+#define SOCKET_SET_ERRNO(x) (errno = (x))
+#define SOCKET_NFDS(f) ((f)+1) /* select() arg for a single fd */
+#define SOCKET_READ read
+#define SOCKET_WRITE write
+#define SOCKET_EINTR EINTR
+
#endif /* HAVE_MACSOCK_H */
#endif /* NEED_SOCKETS */
diff --git a/src/include/krb5/macsock.h b/src/include/krb5/macsock.h
index 5c5ee976d8..dc0d6619fd 100644
--- a/src/include/krb5/macsock.h
+++ b/src/include/krb5/macsock.h
@@ -29,16 +29,6 @@
#define PROTOTYPE(p) p
#endif
-/* The socket data structure itself. */
-struct socket {
- short fMacTCPRef; /* refnum of MacTCP driver */
- unsigned long fStream; /* MacTCP socket/stream */
-# define UDPbuflen 4096
- char fRecvBuf[UDPbuflen]; /* receive buffer area */
-};
-
-typedef struct socket *SOCKET;
-
#define WORD short
#define LOBYTE(x) ((x) & 0xFF)
#define HIBYTE(x) (((x) >> 8) & 0xFF)
@@ -86,6 +76,19 @@ struct sockaddr_in {
/* Socket address, other styles */
#define sockaddr sockaddr_in
+#define sa_family sin_family
+
+
+/* The socket data structure itself. */
+struct socket {
+ short fMacTCPRef; /* refnum of MacTCP driver */
+ unsigned long fStream; /* MacTCP socket/stream */
+ struct sockaddr_in connect_addr; /* Address from connect call */
+# define UDPbuflen 4096
+ char fRecvBuf[UDPbuflen]; /* receive buffer area */
+};
+
+typedef struct socket *SOCKET;
/*
* Host name<->address mapping entries
@@ -155,6 +158,10 @@ extern int
sendto PROTOTYPE ((SOCKET theUDP, const char *buf, const int len, int flags,
const struct sockaddr *to, int tolen));
+/* Send a packet to a connected UDP peer. */
+extern int
+send PROTOTYPE ((SOCKET theUDP, const char *buf, const int len, int flags));
+
/* Select for sockets that are ready for I/O.
This version just remembers the timeout for a future receive...
It always reports that one socket is ready for I/O. */
@@ -167,6 +174,10 @@ extern int
recvfrom PROTOTYPE ((SOCKET theUDP, char *buf, int len, int flags,
struct sockaddr *from, int *fromlen));
+/* Receive a packet from a connected UDP peer. */
+extern int
+recv PROTOTYPE ((SOCKET theUDP, char *buf, int len, int flags));
+
extern char *
inet_ntoa PROTOTYPE ((struct in_addr ina));
@@ -176,6 +187,9 @@ gethostbyname PROTOTYPE ((char *));
extern struct hostent *
gethostbyaddr PROTOTYPE ((char *addr, int len, int type));
+extern struct hostent *
+getmyipaddr PROTOTYPE ((void));
+
/* Bypass a few other functions we don't really need. */
#define getservbyname(name,prot) 0
@@ -191,7 +205,7 @@ gethostbyaddr PROTOTYPE ((char *addr, int len, int type));
*/
#define INVALID_SOCKET ((SOCKET)~0)
#define SOCKET_ERROR (-1)
-#define WSAGetLastError(x) (errno)
+#define WSAGetLastError() (errno)
#define WSASetLastError(x) (errno = (x))
extern int errno;