This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

socket reads garbage


Hi,
    I posted last week a message about ssh client not working anymore after
I upgraded cygwin.
Since it seems I am the only one having this problem I downloaded compiled
and traced ssh
to find that in fact it doesn't read correctly the ID string coming form the
sshd server. The problem
is that after the connection, the read gives garbage. I have here a simple
program which
reproduces this problem

--BEGIN
#include <sys/socket.h>
#include <arpa/inet.h>


int main(int argc,char *args[])
{
  int sock, lus, i;
  struct sockaddr_in serveraddr;
  char chaine[255];

  sock = socket(AF_INET, SOCK_STREAM, 0);
  if (sock < 0)
    printf("error");

  bzero(&serveraddr,sizeof(serveraddr));

  serveraddr.sin_family = AF_INET;
  serveraddr.sin_port = htons(22); /* 22 = sshd port */

/* 192.168.238.1" is a linux machine on my private home network, replace by
something else. */
  inet_aton("192.168.238.1",&serveraddr.sin_addr);

  if (connect(sock,(struct sockaddr *) &serveraddr, sizeof(serveraddr)) >=
0) {
    printf("connected\n");

    lus = read(sock,chaine,255);

    for (i = 0; i < lus; i++)
      printf("%c",chaine[i]);

    printf("\n");
  }
  close(sock);
}
--END

make bidon
will compile the program.

Execution on linux gives
connected
SSH-1.99-OpenSSH_2.5.2p2

execution on cygwin gives
bash-2.05b$ ./bidon.exe
connected
 uo

So something really basic must be wrong on my system, but what ?

I deleted and reinstalled cygwin, I redownloaded and reinstalled
cygwin1.3.17-1 but it didn't help.
Enclose cygcheck -svr output

Attachment: cygcheck.txt
Description: Text document

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]