You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by David Yan <da...@yahoo-inc.com> on 1999/10/30 03:42:10 UTC

general/5222: _popen in CGI program does not return output of the popen'd program.

>Number:         5222
>Category:       general
>Synopsis:       _popen in CGI program does not return output of the popen'd program.
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Fri Oct 29 18:50:00 PDT 1999
>Last-Modified:
>Originator:     davidyan@yahoo-inc.com
>Organization:
apache
>Release:        1.3.9
>Environment:
Operating System: Windows NT 4.0 SP5
I installed Apache 1.3.9 using OpenSA 0.10. (http://www.opensa.de/)
>Description:
The FILE* _popen returns in any CGI program does not contain the output of the program, but instead appears in the console of the machine on which the web server is running.  (It pops up a Command-Prompt-like window with the output of the program and disappears really quickly.)  
This happens *only* on 1.3.9.  It worked fine on 1.3.6.
>How-To-Repeat:
compile a program like the following on VC++ 5.0 or 6.0 and call it through CGI:

#include <stdlib.h>
#include <stdio.h>

int main() {
  FILE *f = _popen("dir c:\\", "rt");
  char buf[1024];
  printf("Content-Type: text/plain\n\n");
  while (fgets(buf, 1024, f)) {
    fputs(buf, stdout);
  }
  _pclose(f);
  return 0;
}

will not print anything on 1.3.9 in the browser.  
Please try it on 1.3.6 and you will see it correctly prints out the content of the directory C:\ in the browser.
>Fix:
no, sorry.
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, you need]
[to include <ap...@Apache.Org> in the Cc line and make sure the]
[subject line starts with the report component and number, with ]
[or without any 'Re:' prefixes (such as "general/1098:" or      ]
["Re: general/1098:").  If the subject doesn't match this       ]
[pattern, your message will be misfiled and ignored.  The       ]
["apbugs" address is not added to the Cc line of messages from  ]
[the database automatically because of the potential for mail   ]
[loops.  If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request from a  ]
[developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]