httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Prud'hommeaux" <e...@w3.org>
Subject ap_set_sub_req_protocol assumes "GET" method
Date Tue, 22 Feb 2000 02:58:54 GMT
When mod_negotiation or mod_dir call ap_sub_req_lookup_file, it
creates a new request structure
    rnew = make_sub_request(r);
initializes a bit of the connection info
    rnew->hostname       = r->hostname;
    rnew->request_time   = r->request_time;
    rnew->connection     = r->connection;
    rnew->server         = r->server;
    rnew->request_config = ap_create_request_config(rnew->pool);
    rnew->htaccess       = r->htaccess;
and calls
    ap_set_sub_req_protocol(rnew, r);
to duplicate the protocol info. ap_set_sub_req_protocol assumes the
method is a GET
    rnew->method          = "GET";
    rnew->method_number   = M_GET;
which defeats any method-dependent authorization. The case I ran into
was where user X was allowed to GET /script.php3 but not POST
/script.php3. Because X was accessing the script as /script instead of
/script.php3, mod_negotiation was checking access
    sub_req = ap_sub_req_lookup_file(dir_entry->d_name, r);
but sub_req (the newly generated request structure) had the method set
to "GET".

This patch doesn't seem to have any unfortunate side effects; is there
any reason not to apply it to the dist source tree?


*** src/main/http_protocol-old.c	Thu Apr 29 15:27:46 1999
--- src/main/http_protocol.c	Thu Apr 29 15:19:49 1999
***************
*** 1120,1127 ****
      rnew->assbackwards    = 1;   /* Don't send headers from this. */
      rnew->no_local_copy   = 1;   /* Don't try to send USE_LOCAL_COPY for a
                                    * fragment. */
!     rnew->method          = "GET";
!     rnew->method_number   = M_GET;
      rnew->protocol        = "INCLUDED";
  
      rnew->status          = HTTP_OK;
--- 1120,1127 ----
      rnew->assbackwards    = 1;   /* Don't send headers from this. */
      rnew->no_local_copy   = 1;   /* Don't try to send USE_LOCAL_COPY for a
                                    * fragment. */
!     rnew->method          = ap_pstrdup(rnew->pool, r->method);
!     rnew->method_number   = r->method_number;
      rnew->protocol        = "INCLUDED";
  
      rnew->status          = HTTP_OK;


Mime
View raw message