httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcus Carey <marcus.ca...@verizon.net>
Subject [users@httpd] I/O does not work with CGI applications and the AliasMatch directive
Date Thu, 20 Feb 2003 17:22:56 GMT

I added the ExeCGI directive to the default httpd.conf file to all cgi  
scripts.
Then I used the AliasMatch directive to remove the "~" from the username 
in the URL.
When using the "~" in a URL a cgi application can create files for 
reading and writing.
However if you use AliasMatch the application cannot create files for 
read and write access.


<Directory /home/*/public_html>
      AllowOverride FileInfo AuthConfig Limit
      Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec 
ExecCGI
      <Limit GET POST OPTIONS>
          Order allow,deny
          Allow from all
      </Limit>
      <LimitExcept GET POST OPTIONS>
          Order deny,allow
          Deny from all
      </LimitExcept>
</Directory>

http://www.example.com/~user/file.html

http://www.example.com/~user/cgi-bin/file.cgi

file.cgi creates a file in the user directory and prints out html  content.

/* File.c */
     int fd = 0;
     print("Content-Type: text/html\n\n");
     fd = open("/home/user/file", O_RDWR | O_CREAT | O_TRUNC);
     if(fd == -1)
     {
         printf("Could not create file: %d<br>\n",errno);
         printf("strerror says open failed: %s<br>\n",strerror(errno));
         printf("<br>\n");
     }
     else
     {
         printf("File created<br>\n");
     }
     close(fd);
/* end File.c */

In the above case, the output is: File created!


AliasMatch ^/upages/([a-zA-Z0-9]*)/?(.*) /home/$1/public_html/$2

http://www.example.com/upages/user/file.html

http://www.example.com/upages/user/cgi-bin/file.cgi

file.cgi does not create a file in the user directory but prints out 
html content.

The error log shows the normal request string with the 200 response code.
Then I added the strerror(errno) to the code to get more information which
returned: Permission Denied.

Is there a way to use AliasMatch and I/O routines in cgi applications?


Thank You!

Marcus



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message