From 23f0a92549ead4dd580769f3e79ccd3c9bdd624e Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Tue, 29 Jul 1997 03:30:32 +0000 Subject: [PATCH] Add additional debugging messages so we can see the winsock error numbers. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10138 dc483132-0cff-0310-8789-dd5450dbe970 --- src/windows/gss/ChangeLog | 5 +++ src/windows/gss/gss-misc.c | 63 +++++++++++++++++++++++--------------- 2 files changed, 44 insertions(+), 24 deletions(-) diff --git a/src/windows/gss/ChangeLog b/src/windows/gss/ChangeLog index c22de32aa..cd21b1453 100644 --- a/src/windows/gss/ChangeLog +++ b/src/windows/gss/ChangeLog @@ -1,3 +1,8 @@ +Mon Jul 28 23:30:03 1997 Theodore Y. Ts'o + + * gss-misc.c: Add additional debugging messages so we can see the + winsock error numbers. + Tue Apr 29 06:45:32 1997 Theodore Ts'o * gss.rc: Add version resource information to test version server diff --git a/src/windows/gss/gss-misc.c b/src/windows/gss/gss-misc.c index 8cc27c22c..cb84e9327 100644 --- a/src/windows/gss/gss-misc.c +++ b/src/windows/gss/gss-misc.c @@ -46,29 +46,36 @@ int send_token(int s, gss_buffer_t tok) { long len; size_t ret; + size_t ws_err; len = htonl(tok->length); ret = send (s, (char *) &len, 4, 0); // Send length over the socket if (ret < 0) { - errno = WSAGetLastError(); + ws_err = WSAGetLastError(); + errno = ws_err; my_perror("sending token length"); - return -1; + OkMsgBox ("Winsock error %d \n", ws_err); + return -1; } else if (ret != 4) { - OkMsgBox ("sending token length: %d of %d bytes written\n", - ret, 4); - return -1; + ws_err = WSAGetLastError(); + OkMsgBox("sending token length: %d of %d bytes written\nWinsock error = %d\n", + ret, 4, ws_err); + return -1; } ret = send (s, tok->value, tok->length, 0); // Send the data if (ret < 0) { - errno = WSAGetLastError(); - my_perror("sending token data"); - return -1; + ws_err = WSAGetLastError(); + errno = ws_err; + my_perror("sending token data"); + OkMsgBox ("Winsock error %d \n", ws_err); + return -1; } else if (ret != tok->length) { - OkMsgBox ("sending token data: %d of %d bytes written\n", - ret, tok->length); - return -1; + ws_err = WSAGetLastError(); + OkMsgBox ("sending token data: %d of %d bytes written\nWinsock error = %d\n", + ret, tok->length, ws_err); + return -1; } return 0; @@ -99,16 +106,20 @@ int recv_token (int s, gss_buffer_t tok) { int ret; unsigned long len; + size_t ws_err; ret = recv (s, (char *) &len, 4, 0); if (ret < 0) { - errno = WSAGetLastError(); - my_perror("reading token length"); + ws_err = WSAGetLastError(); + errno = ws_err; + my_perror("reading token length"); + OkMsgBox ("Winsock error %d \n", ws_err); return -1; } else if (ret != 4) { - OkMsgBox ("reading token length: %d of %d bytes read\n", - ret, 4); - return -1; + ws_err = WSAGetLastError(); + OkMsgBox ("reading token length: %d of %d bytes written\nWinsock error = %d\n", + ret, 4, ws_err); + return -1; } len = ntohl(len); @@ -121,15 +132,18 @@ recv_token (int s, gss_buffer_t tok) { ret = recv (s, (char *) tok->value, tok->length, 0); if (ret < 0) { - errno = WSAGetLastError(); - my_perror("reading token data"); - free(tok->value); - return -1; + ws_err = WSAGetLastError(); + errno = ws_err; + my_perror("reading token data"); + OkMsgBox ("Winsock error %d \n", ws_err); + free(tok->value); + return -1; } else if ((size_t) ret != tok->length) { - OkMsgBox ("sending token data: %d of %d bytes written\n", - ret, tok->length); - free(tok->value); - return -1; + ws_err = WSAGetLastError(); + OkMsgBox ("reading token data: %d of %d bytes written\nWinsock error = %d\n", + ret, tok->length, ws_err); + free(tok->value); + return -1; } return 0; @@ -211,3 +225,4 @@ my_perror (char *msg) { else MessageBox (NULL, err, "", MB_OK); } + -- 2.26.2