madwolf> I have a problem while writing a PERL module. When I want to issue an
madwolf> openssl command (that requires input) the following code (which works
madwolf> in common PERL programs) does not pass the required input to openssl
madwolf> so it waits for user input:
madwolf>
madwolf> open(FD, "|$command" ) || return;
madwolf> ## Send Password
madwolf> print FD "$passwd\n";
madwolf>
madwolf> ## Send Confirmation Password
madwolf> print FD "$passwd\n";
madwolf> close(FD);
[...]
madwolf> but it should not hang asking for passwd as I pass it to openssl with
madwolf> the print command. What's wrong here in ??
What's wrong is that you assume OpenSSL takes password input from
standard input. This is not the case. Instead, a separate handle to
the TTY is opened, and that is used as password input. Under Unix,
the file used is "/dev/tty". Under DOS, it's "con", and under VMS
it's "TT:".
In the current snapshot of OpenSSL, there's a new parameter that gives
you the possibility to give the password on the command line to most
utilities that need it, called -passin, -passout, -passin and -envpassin.
Check it out.
BTW, I wonder if there shouldn't be a mechanism to get the password
from stdin as well. '-passin -' or yet another switch, like
'-pipepassin'? '-passin' has a real danger if you consider what 'ps'
gives as output...
--
Richard Levitte \ Spannvägen 38, II \ [EMAIL PROTECTED]
Redakteur@Stacken \ S-161 43 BROMMA \ T: +46-8-26 52 47
\ SWEDEN \ or +46-708-26 53 44
Procurator Odiosus Ex Infernis -- [EMAIL PROTECTED]
Unsolicited commercial email is subject to an archival fee of $400.
See <http://www.stacken.kth.se/~levitte/mail/> for more info.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]