summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2003-11-06 20:47:12 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2003-11-06 20:47:12 +0000
commitef99ffa3d9e041340e7e259eb13cc8aa25fc8363 (patch)
tree190aaa6f91a70f9fbadce8f57c7234bc0db97660
parenta6bc25dcac9e81aafa0761e9ef4aaed2291abc89 (diff)
downloadgnutls-ef99ffa3d9e041340e7e259eb13cc8aa25fc8363.tar.gz
*** empty log message ***
-rw-r--r--configure.in2
-rw-r--r--src/crypt.c20
-rw-r--r--src/tests.c16
-rw-r--r--src/tls_test.c2
4 files changed, 33 insertions, 7 deletions
diff --git a/configure.in b/configure.in
index 8ef47d2d36..05d72014ff 100644
--- a/configure.in
+++ b/configure.in
@@ -51,7 +51,7 @@ AC_SUBST(LT_AGE)
case "${target}" in
*-*-mingw32*)
- SERV_LIBS="$SERV_LIBS -lwsock32"
+ LIBS="$LIBS -lwsock32"
;;
*)
;;
diff --git a/src/crypt.c b/src/crypt.c
index 4a017ca125..89ed0797c5 100644
--- a/src/crypt.c
+++ b/src/crypt.c
@@ -35,7 +35,6 @@ int main (int argc, char **argv)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <unistd.h>
#include "crypt-gaa.h"
#include <gnutls/gnutls.h>
#include <gnutls/extra.h>
@@ -49,6 +48,25 @@ int main (int argc, char **argv)
# include <unistd.h>
#endif
+#ifdef _WIN32
+
+# define getpass read_str
+
+static const char* read_str( const char* input_str)
+{
+static char input[128];
+
+ fputs( input_str, stderr);
+ fgets( input, sizeof(input), stdin);
+
+ input[strlen(input)-1] = 0;
+
+ if (strlen(input)==0) return NULL;
+
+ return input;
+}
+#endif
+
#define _MAX(x,y) (x>y?x:y)
/* This may need some rewrite. A lot of stuff which should be here
diff --git a/src/tests.c b/src/tests.c
index 792fdd75a2..be350fb0ca 100644
--- a/src/tests.c
+++ b/src/tests.c
@@ -22,17 +22,20 @@
#include <gnutls/gnutls.h>
#include <gnutls/extra.h>
#include <gnutls/x509.h>
-#include <tests.h>
#ifndef _WIN32
# include <unistd.h>
# include <signal.h>
+#else
+# include <winsock.h>
+# include <errno.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <common.h>
+#include <tests.h>
extern gnutls_srp_client_credentials srp_cred;
extern gnutls_anon_client_credentials anon_cred;
@@ -258,7 +261,7 @@ void got_alarm(int k) {
int test_bye( gnutls_session session) {
int ret;
char data[20];
-int old;
+int old, secs = 6;
#ifndef _WIN32
signal( SIGALRM, got_alarm);
@@ -280,7 +283,9 @@ int old;
#ifndef _WIN32
old = siginterrupt( SIGALRM, 1);
- alarm(6);
+ alarm(secs);
+#else
+ setsockopt( gnutls_transport_get_ptr(session), SOL_SOCKET, SO_RCVTIMEO, (char*) &secs, sizeof(int));
#endif
do {
@@ -289,9 +294,12 @@ int old;
#ifndef _WIN32
siginterrupt( SIGALRM, old);
+#else
+ /* we cannot distinguish timeouts */
+ alrm = 1;
#endif
if (ret==0) return SUCCEED;
-
+
if (alrm == 0) return UNSURE;
return FAILED;
diff --git a/src/tls_test.c b/src/tls_test.c
index f287923a86..491163e1b1 100644
--- a/src/tls_test.c
+++ b/src/tls_test.c
@@ -110,7 +110,7 @@ static const TLS_TEST tls_tests[] = {
{ "for certificate information", test_certificate, "", "", "" },
{ "for trusted CAs", test_server_cas, "", "", "" },
{ "whether the server understands TLS closure alerts", test_bye, "yes", "no", "partially"},
- /* the fact that is after the closure alert test matter.
+ /* the fact that is after the closure alert test does matter.
*/
{ "whether the server supports session resumption", test_session_resume2, "yes", "no", "dunno"},
{ "for export-grade ciphersuite support", test_export, "yes", "no", "dunno" },