On Tue, Oct 05, 1999, EKR wrote:
> "Ralf S. Engelschall" <[EMAIL PROTECTED]> writes:
> > On Sun, Oct 03, 1999, Eric Rescorla wrote:
> > Yes, someone else also reported that the pass phrase dialog doesn't work
> > correctly under Win32. But I cannot fix it myself, because I've both no real
> > Win32 development environment available nor the knowledge to find out what
> > Win32 dislikes in the mod_ssl/OpenSSL dialog. And I have also to admit that
> > fixing Win32-*only* bugs is maximum low-priority on my TODO list, of course.
> >
> > So if you want the dialog fixed for Win32, you have to help me in finding out
> > the problem. Where are the Win32 hackers under us? Can someone help us here
> > and provide a patch to make the dialog working under this Win32 environment?
> Ok, I've got the problem debugged somewhat more fully.
>
> Password _reading_ works fine.
> What doesn't work is that the prompt isn't getting printed.
>
> EVP_read_pw_string() writes it's prompt to stderr, but
> at this stage in the game, stderr has already been remapped.
> To accomodate this, mod_ssl dup2()s stdout onto stderr,
> but stdout has also been redirected under Win32. (I don't
> know where) so this doesn't help.
>
> I've successfully been able to open "con" in write mode
> and write there, but for some reason the obvious handoff
> to stderr with dup2() isn't working correctly. I suspect I've
> made some trivial mistake, but I'm not sure what it is.
>
> That said, if you blindly type in the password, the server
> starts no problem, so it's easy to make it workable,
> if a little ugly.
>
> If I manage to produce a shippable patch, I'll post it.
Hmmm... I'm not a Win32 guy and I've not tested it, but it would propose the
solution as following (patch against 2.4.4 plus/minus a few lines offset
because I've deleted other changes from 2.4.5):
Index: ssl_engine_pphrase.c
===================================================================
RCS file: /e/modssl/cvs/mod_ssl/pkg.apache/src/modules/ssl/ssl_engine_pphrase.c,v
retrieving revision 1.36
diff -u -r1.36 ssl_engine_pphrase.c
--- ssl_engine_pphrase.c 1999/08/03 09:27:41 1.36
+++ ssl_engine_pphrase.c 1999/10/08 14:09:33
@@ -433,6 +436,9 @@
if (sc->nPassPhraseDialogType == SSL_PPTYPE_BUILTIN) {
char *prompt;
int i;
+#ifdef WIN32
+ FILE *con;
+#endif
ssl_log(s, SSL_LOG_INFO,
"Init: Requesting pass phrase via builtin terminal dialog");
@@ -443,11 +449,16 @@
* to the general error logfile.
*/
dup2(STDERR_FILENO, STDERR_FILENO_STORE);
+#ifdef WIN32
+ if ((con = fopen("con", "w")) != NULL)
+ dup2(fileno(con), STDERR_FILENO);
+#else
dup2(STDOUT_FILENO, STDERR_FILENO);
+#endif
/*
* The first time display a header to inform the user about what
- * program he actually speaks to, which modules is responsible for
+ * program he actually speaks to, which module is responsible for
* this terminal dialog and why to the hell he has to enter
* something...
*/
@@ -485,6 +496,9 @@
* Restore STDERR to Apache error logfile
*/
dup2(STDERR_FILENO_STORE, STDERR_FILENO);
+#ifdef WIN32
+ fclose(con);
+#endif
}
/*
Can you try this out for me? If it doesn't work then I've also no clue what's
going on this brain-dead platform...
Ralf S. Engelschall
[EMAIL PROTECTED]
www.engelschall.com
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl) www.modssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]