httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcus Carey <marcus.ca...@verizon.net>
Subject Re: [users@httpd] Cannot read or write files using the AliasMatch Directive
Date Mon, 17 Feb 2003 19:15:59 GMT
Zac Stevens wrote:

>Hi Marcus,
>
>On Mon, Feb 17, 2003 at 12:40:11AM -0800, Marcus Carey wrote:
>  
>
>>When mapping directories with the AliasMatch directive cgi programs 
>>cannot write or read files.  Using this directive returns a Permission 
>>Denied error.  How do you set the file and directory permissions when 
>>using the AliasMatch Directive?
>>    
>>
>
>I'm not really understanding what you're trying to do here - AliasMatch is
>not used with CGI at all.  Perhaps you are thinking of ScriptAliasMatch ?
>
>In any event, it would be helpful if you could provide some details about
>what you're trying to achieve, the relevant config so far, and the actual
>messages from your error_log
>
>Cheers,
>
>
>Zac
>
>---------------------------------------------------------------------
>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
>
>
>  
>
    |Zac


    I added the ExeCGI directive 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.
       
       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);

    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.
    However, using the AliasMatch directive, the output from
    strerror(errno) retuns: 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