Hi,
well, I didn't tell everything...
If I do a 'openssl s_client -connect localhost:443' on a UNIX
machine where no SSL-server is running I get a 'connection refused'
(which is okay, obviously). The same a the Windows NT host brings
this 'bad file descriptor' (so in my opinion the client did not
try a connection at all because the error occurred before the
connect).
If I try to connect (from the WinNT client) to host with a
SSL server running I get all the certificate & handshake stuff,
then the client waits for a HTTP command. However, the client
at this point becomes "dead", you do not see the characters
typed in. Pressing CTRL-C show the command appearing on the
command shell :-(.
-- Original Message --
Martin Glas <[EMAIL PROTECTED]>:
> I have a problem with openssl-0.9.[0123] on WinNT 4.0 SP3.
> I compiled it using VC-6 (and also mingw32) [...] cannot connect to
> a SSL server properly (neither using 'openssl s_client -connect...'
> nor doing a request from the Net:SSLeay package). I get the
> following error:
> (...)
> connect: Bad file descriptor
> connect: errno = 10061
> error in s_client
>
> I tried it on Linux and Solaris where everything worked
> well. I understand that a 'socket' on WinNT is something
> different than on UNIX machines. Could this be the problem?
I have no idea. The relevant code is in apps/s_socket.c, namely
int init_client_ip(int *sock, unsigned char ip[4], int port)
{
unsigned long addr;
struct sockaddr_in them;
int s,i;
if (!sock_init()) return(0);
memset((char *)&them,0,sizeof(them));
them.sin_family=AF_INET;
them.sin_port=htons((unsigned short)port);
addr=(unsigned long)
((unsigned long)ip[0]<<24L)|
((unsigned long)ip[1]<<16L)|
((unsigned long)ip[2]<< 8L)|
((unsigned long)ip[3]);
them.sin_addr.s_addr=htonl(addr);
s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
if (s == INVALID_SOCKET) { perror("socket"); return(0); }
i=0;
i=setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i));
if (i < 0) { perror("keepalive"); return(0); }
if (connect(s,(struct sockaddr *)&them,sizeof(them)) == -1)
{ close(s); perror("connect"); return(0); }
*sock=s;
return(1);
}
While setsockopt works, connect fails (the "connect: Bad file
descriptor" error message). Both use the same identifier (s), so it
seems unlikely that the difference between sockets and proper files is
responsible for the error. Do you have non-standard header files
installed on your system, or non-standard libraries?
-- End of Original Message --
Mh, it's NT 4, SP 3 with the VC 6++ stuff installed (as I said I also
tried mingw32). What do you means by "non-standard" libraries? Any
special DLLs?
Anyway, thanks for your help,
Martin.
============================================================================
Martin Glas, Infineon Technologies AG, DAT CIF, Balanstr. 73, 81541 Muenchen
Phone: +49 89 234-22473, Fax: -27681, Mail: [EMAIL PROTECTED]
============================================================================
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]