Point 3 is your problem, s_client handles stdin in a special
way :(

s_client assumes that if either stdin or the ssl socket
hits end of file, that it should shut down operation.
Unfortunately, when redirecting stdin from a file,
what happens is that you read the command to send to
the remote web server, send it, and then quit before
the response can be read in.

If you need to get around this, the easiest is probably
to go into the s_client code and modify it to not
shut down the connection. We've done this in the past
on older releases of SSLeay, and its about a 5 line
code change. There are a number of ways of doing it,
but here's one:

 1) When the FDSET is built to do a select on, have
    a flag called "stdin_open" that must be true
    before adding stdin to the FDSET.
 2) At the start of the main select loop, set stdin_open
    to true.
 3) When end-of-file is detected on stdin, set stdin_open
    to false.

Cheers, Thomas

Heiko Nardmann wrote:
> 
> Are you using "expect" ?
> 
> [EMAIL PROTECTED] schrieb:
> >
> > I would like to use the openssl app from a shell script but have found
> > things don't go as expected.
> > To illustrate what I am trying to do, here is an analogous situation using
> > ftp:
> >
> > file listCmds:
> > ?
> > quit
> >
> > file showFtpCommands
> > ftp < listCmds
> >
> > If I run the 'showFtpCommands' file I get a list of the ftp commands.
> > I would like to have something using openssl such that I open a connection
> > to a web server (say) and then do a GET / HTTP/1.0
> >
> > (including 2* CRLF) I can do this interactively but would like to automate
> > the procedure.
> > Eg
> > openssl s_client -connect some.web.server:443 < httpRequestFile
> >
> > Questions I have are:
> > 1. Is what I'm trying to do reasonable?
> > 2. Can the effect be achieved with openssl as it stands?
> > 3. Does openssl/s_client handle stdin in a special way?
> 
> --
> Ciao ... Heiko Nardmann (Dipl.-Ing.), [EMAIL PROTECTED], Software
> Development
> secunet (www.secunet.de), Security Networks GmbH - Sicherheit in
> Netzwerken
> Weidenauer Str. 223-225, D-57076 Siegen
> Tel. : +49 271 48950-13, Fax  : +49 271 48950-50
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    [EMAIL PROTECTED]
> Automated List Manager                           [EMAIL PROTECTED]

-- 
------------------------------------------------------------
Thomas Reinke                            Tel: (416) 460-7021
Director of Technology                   Fax: (416) 598-2319
E-Soft Inc.                         http://www.e-softinc.com
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to