summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2003-11-07 21:44:40 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2003-11-07 21:44:40 +0000
commitf281bf3b3b561b47ba80e7223602494069907a9d (patch)
tree06ec9e16b54f439b58883a05a35e3f348a4c3af8
parent172b4b7ed6f294f8bf549dc6f664b41cb5ddf586 (diff)
downloadgnutls-f281bf3b3b561b47ba80e7223602494069907a9d.tar.gz
*** empty log message ***
-rw-r--r--NEWS3
-rw-r--r--src/certtool-gaa.c2
-rw-r--r--src/certtool.gaa2
-rw-r--r--src/cli.c6
-rw-r--r--src/common.c17
-rw-r--r--src/common.h6
-rw-r--r--src/crypt-gaa.c2
-rw-r--r--src/crypt.gaa2
-rw-r--r--src/serv.c12
-rw-r--r--src/tls_test.c8
10 files changed, 31 insertions, 29 deletions
diff --git a/NEWS b/NEWS
index 6d2ebc72ed..cf4385e83a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+Version 0.9.96
+- Some changes to allow compiling with mingw32.
+
Version 0.9.95 (02/11/2003)
- Improved the verification functions. Added new verification
output flags and removed the unused and redundant ones.
diff --git a/src/certtool-gaa.c b/src/certtool-gaa.c
index e0dc26fb26..6f00ac3e0f 100644
--- a/src/certtool-gaa.c
+++ b/src/certtool-gaa.c
@@ -6,7 +6,7 @@
/* C declarations */
-#ifndef _WIN32
+#ifdef _WIN32
# include <windows.h>
#endif
diff --git a/src/certtool.gaa b/src/certtool.gaa
index 7b8cd4e56b..590dea9418 100644
--- a/src/certtool.gaa
+++ b/src/certtool.gaa
@@ -2,7 +2,7 @@
/* C declarations */
-#ifndef _WIN32
+#ifdef _WIN32
# include <windows.h>
#endif
diff --git a/src/cli.c b/src/cli.c
index 5101c61503..d99da1f1d6 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -316,17 +316,11 @@ int main(int argc, char **argv)
sa.sin_addr.s_addr = *((unsigned int *) server_host->h_addr);
-#ifdef HAVE_INET_NTOP
if (inet_ntop(AF_INET, &sa.sin_addr, buffer, MAX_BUF) == NULL) {
perror("inet_ntop()");
return(1);
}
fprintf(stderr, "Connecting to '%s:%d'...\n", buffer, port);
-#else /* use inet_ntoa */
- fprintf(stderr, "Connecting to '%s:%d'...\n", inet_ntoa( ((struct sockaddr_in*)&sa)->sin_addr),
- port);
-#endif
-
err = connect(sd, (SA *) & sa, sizeof(sa));
ERR(err, "connect");
diff --git a/src/common.c b/src/common.c
index eb27fd3d3c..8ed9d98602 100644
--- a/src/common.c
+++ b/src/common.c
@@ -635,3 +635,20 @@ void parse_comp(char **comp, int ncomp, int *comp_priority)
}
}
+
+#ifndef HAVE_INET_NTOP
+const char *inet_ntop(int af, const void *src,
+ char *dst, size_t cnt)
+{
+char* ret;
+
+ ret = inet_atop( src);
+
+ if (strlen(ret) > cnt) {
+ return NULL;
+ }
+ strcpy( dst, ret);
+
+ return dst;
+}
+#endif
diff --git a/src/common.h b/src/common.h
index 7def7bde99..2adaf8a8f3 100644
--- a/src/common.h
+++ b/src/common.h
@@ -1,6 +1,7 @@
#define PORT 5556
#define SERVER "127.0.0.1"
+#include <config.h>
#include <gnutls/gnutls.h>
/* the number of elements in the priority structures.
@@ -19,3 +20,8 @@ void parse_ctypes( char** ctype, int nctype, int * cert_type_priority);
void parse_macs( char** macs, int nmacs, int *mac_priority);
void parse_ciphers( char** ciphers, int nciphers, int* cipher_priority);
void parse_protocols( char** protocols, int protocols_size, int* protocol_priority);
+
+#ifndef HAVE_INET_NTOP
+const char *inet_ntop(int af, const void *src,
+ char *dst, size_t cnt);
+#endif
diff --git a/src/crypt-gaa.c b/src/crypt-gaa.c
index 5618cd85ba..90c0a00eda 100644
--- a/src/crypt-gaa.c
+++ b/src/crypt-gaa.c
@@ -6,7 +6,7 @@
/* C declarations */
-#ifndef _WIN32
+#ifdef _WIN32
# include <windows.h>
#endif
diff --git a/src/crypt.gaa b/src/crypt.gaa
index 56b47f2391..476f6813bf 100644
--- a/src/crypt.gaa
+++ b/src/crypt.gaa
@@ -2,7 +2,7 @@
/* C declarations */
-#ifndef _WIN32
+#ifdef _WIN32
# include <windows.h>
#endif
diff --git a/src/serv.c b/src/serv.c
index 14df1db4dd..70babdb425 100644
--- a/src/serv.c
+++ b/src/serv.c
@@ -825,16 +825,10 @@ int main(int argc, char **argv)
printf("*** This is a resumed session\n");
if (quiet == 0) {
-#ifdef HAVE_INET_NTOP
printf("\n* connection from %s, port %d\n",
inet_ntop(AF_INET, &client_address.sin_addr,
topbuf, sizeof(topbuf)),
ntohs(client_address.sin_port));
-#else
- printf("\n* connection from %s, port %d\n",
- inet_ntoa(((struct sockaddr_in*)&client_address)->sin_addr),
- ntohs(client_address.sin_port));
-#endif
print_info(j->tls_session, NULL);
}
j->handshake_ok = 1;
@@ -905,16 +899,10 @@ int main(int argc, char **argv)
&& quiet == 0)
printf("*** This is a resumed session\n");
if (quiet == 0) {
-#ifdef HAVE_INET_NTOP
printf("- connection from %s, port %d\n",
inet_ntop(AF_INET, &client_address.sin_addr,
topbuf, sizeof(topbuf)),
ntohs(client_address.sin_port));
-#else
- printf("\n* connection from %s, port %d\n",
- inet_ntoa(((struct sockaddr_in*)&client_address)->sin_addr),
- ntohs(client_address.sin_port));
-#endif
print_info(j->tls_session, NULL);
}
diff --git a/src/tls_test.c b/src/tls_test.c
index 491163e1b1..ed7159adbc 100644
--- a/src/tls_test.c
+++ b/src/tls_test.c
@@ -136,12 +136,6 @@ static const TLS_TEST tls_tests[] = {
static int tt = 0;
char* ip;
-#ifdef HAVE_INET_NTOP
-# define IP inet_ntop(AF_INET, &sa.sin_addr, buffer, MAX_BUF)
-#else
-# define IP inet_ntoa( ((struct sockaddr_in*)&sa)->sin_addr)
-#endif
-
#define CONNECT() \
sd = socket(AF_INET, SOCK_STREAM, 0); \
ERR(sd, "socket"); \
@@ -149,7 +143,7 @@ char* ip;
sa.sin_family = AF_INET; \
sa.sin_port = htons(port); \
sa.sin_addr.s_addr = *((unsigned int *) server_host->h_addr); \
- ip = IP; \
+ ip = inet_ntop(AF_INET, &sa.sin_addr, buffer, MAX_BUF); \
if (tt++ == 0) printf("Connecting to '%s:%d'...\n", ip, port); \
err = connect(sd, (SA *) & sa, sizeof(sa)); \
ERR(err, "connect")