Re: svn commit: r1907980 - in /httpd/httpd/trunk: changes-entries/proxy_uwsgi_response_validation.txt modules/proxy/mod_proxy_uwsgi.c

2023-03-02 Thread Yann Ylavic
On Thu, Mar 2, 2023 at 8:22 PM Ruediger Pluem  wrote:
>
> On 3/2/23 7:21 PM, Christophe JAILLET wrote:
> > Le 02/03/2023 à 16:10, yla...@apache.org a écrit :
> >> @@ -313,18 +313,16 @@ static int uwsgi_response(request_rec *r
> >>   pass_bb = apr_brigade_create(r->pool, c->bucket_alloc);
> >> len = ap_getline(buffer, sizeof(buffer), rp, 1);
> >> -
> >>   if (len <= 0) {
> >> -/* oops */
> >> +/* invalid or empty */
> >>   return HTTP_INTERNAL_SERVER_ERROR;
> >>   }
> >> -
> >>   backend->worker->s->read += len;
> >> -
> >> -if (len >= sizeof(buffer) - 1) {
> >> -/* oops */
> >> +if ((apr_size_t)len >= sizeof(buffer)) {
> >
> > Hi Yann,
> >
> > Why removing the -1?
> >
> > My understading is that it is there in case of:
> >   uwsgi_response()
> > ap_getline()
> >   ap_rgetline()
> > ap_fgetline_core()
> >   code around cleanup:
> >
> > In this path, IIUC, sizeof(buffer) - 1 is returned.
> > Can this happen?
>
> I think ap_fgetline_core can only return a len of sizeof(buffer) - 1 when:
>
> 1. The line is really that long.
> 2. The line is longer, but then rv != APR_SUCCESS.
>
> In case 1. all is fine and we should proceed the result.
> In case 2. ap_getline will return sizeof(buffer).
>
> Hence I think the change is correct.

Yes exactly, ap_fgetline_core() returns APR_ENOSPC if the buffer is
truncated, and ap_getline() returns sizeof(buffer).
This change avoids failing unnecessarily for a valid response line of
exactly sizeof(buffer)-1 bytes length.

Regards;
Yann.

>
> Regards
>
> Rüdiger
>


Re: svn commit: r1907980 - in /httpd/httpd/trunk: changes-entries/proxy_uwsgi_response_validation.txt modules/proxy/mod_proxy_uwsgi.c

2023-03-02 Thread Ruediger Pluem



On 3/2/23 7:21 PM, Christophe JAILLET wrote:
> Le 02/03/2023 à 16:10, yla...@apache.org a écrit :
>> Author: ylavic
>> Date: Thu Mar  2 15:10:30 2023
>> New Revision: 1907980
>>
>> URL: http://svn.apache.org/viewvc?rev=1907980=rev
>> Log:
>> mod_proxy_uwsgi: Stricter backend HTTP response parsing/validation
>>
>>
>> Added:
>>  httpd/httpd/trunk/changes-entries/proxy_uwsgi_response_validation.txt
>> Modified:
>>  httpd/httpd/trunk/modules/proxy/mod_proxy_uwsgi.c
>>
>> Added: httpd/httpd/trunk/changes-entries/proxy_uwsgi_response_validation.txt
>> URL: 
>> http://svn.apache.org/viewvc/httpd/httpd/trunk/changes-entries/proxy_uwsgi_response_validation.txt?rev=1907980=auto
>> ==
>> --- httpd/httpd/trunk/changes-entries/proxy_uwsgi_response_validation.txt 
>> (added)
>> +++ httpd/httpd/trunk/changes-entries/proxy_uwsgi_response_validation.txt 
>> Thu Mar  2 15:10:30 2023
>> @@ -0,0 +1,2 @@
>> +  *) mod_proxy_uwsgi: Stricter backend HTTP response parsing/validation.
>> + [Yann Ylavic]
>>
>> Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_uwsgi.c
>> URL: 
>> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_uwsgi.c?rev=1907980=1907979=1907980=diff
>> ==
>> --- httpd/httpd/trunk/modules/proxy/mod_proxy_uwsgi.c (original)
>> +++ httpd/httpd/trunk/modules/proxy/mod_proxy_uwsgi.c Thu Mar  2 15:10:30 
>> 2023
>> @@ -313,18 +313,16 @@ static int uwsgi_response(request_rec *r
>>   pass_bb = apr_brigade_create(r->pool, c->bucket_alloc);
>>     len = ap_getline(buffer, sizeof(buffer), rp, 1);
>> -
>>   if (len <= 0) {
>> -    /* oops */
>> +    /* invalid or empty */
>>   return HTTP_INTERNAL_SERVER_ERROR;
>>   }
>> -
>>   backend->worker->s->read += len;
>> -
>> -    if (len >= sizeof(buffer) - 1) {
>> -    /* oops */
>> +    if ((apr_size_t)len >= sizeof(buffer)) {
> 
> Hi Yann,
> 
> Why removing the -1?
> 
> My understading is that it is there in case of:
>   uwsgi_response()
>     ap_getline()
>   ap_rgetline()
>     ap_fgetline_core()
>   code around cleanup:
> 
> In this path, IIUC, sizeof(buffer) - 1 is returned.
> Can this happen?

I think ap_fgetline_core can only return a len of sizeof(buffer) - 1 when:

1. The line is really that long.
2. The line is longer, but then rv != APR_SUCCESS.

In case 1. all is fine and we should proceed the result.
In case 2. ap_getline will return sizeof(buffer).

Hence I think the change is correct.

Regards

Rüdiger



Re: svn commit: r1907980 - in /httpd/httpd/trunk: changes-entries/proxy_uwsgi_response_validation.txt modules/proxy/mod_proxy_uwsgi.c

2023-03-02 Thread Christophe JAILLET

Le 02/03/2023 à 16:10, yla...@apache.org a écrit :

Author: ylavic
Date: Thu Mar  2 15:10:30 2023
New Revision: 1907980

URL: http://svn.apache.org/viewvc?rev=1907980=rev
Log:
mod_proxy_uwsgi: Stricter backend HTTP response parsing/validation


Added:
 httpd/httpd/trunk/changes-entries/proxy_uwsgi_response_validation.txt
Modified:
 httpd/httpd/trunk/modules/proxy/mod_proxy_uwsgi.c

Added: httpd/httpd/trunk/changes-entries/proxy_uwsgi_response_validation.txt
URL: 
http://svn.apache.org/viewvc/httpd/httpd/trunk/changes-entries/proxy_uwsgi_response_validation.txt?rev=1907980=auto
==
--- httpd/httpd/trunk/changes-entries/proxy_uwsgi_response_validation.txt 
(added)
+++ httpd/httpd/trunk/changes-entries/proxy_uwsgi_response_validation.txt Thu 
Mar  2 15:10:30 2023
@@ -0,0 +1,2 @@
+  *) mod_proxy_uwsgi: Stricter backend HTTP response parsing/validation.
+ [Yann Ylavic]

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_uwsgi.c
URL: 
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_uwsgi.c?rev=1907980=1907979=1907980=diff
==
--- httpd/httpd/trunk/modules/proxy/mod_proxy_uwsgi.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_uwsgi.c Thu Mar  2 15:10:30 2023
@@ -313,18 +313,16 @@ static int uwsgi_response(request_rec *r
  pass_bb = apr_brigade_create(r->pool, c->bucket_alloc);
  
  len = ap_getline(buffer, sizeof(buffer), rp, 1);

-
  if (len <= 0) {
-/* oops */
+/* invalid or empty */
  return HTTP_INTERNAL_SERVER_ERROR;
  }
-
  backend->worker->s->read += len;
-
-if (len >= sizeof(buffer) - 1) {
-/* oops */
+if ((apr_size_t)len >= sizeof(buffer)) {


Hi Yann,

Why removing the -1?

My understading is that it is there in case of:
  uwsgi_response()
ap_getline()
  ap_rgetline()
ap_fgetline_core()
  code around cleanup:

In this path, IIUC, sizeof(buffer) - 1 is returned.
Can this happen?

CJ


+/* too long */
  return HTTP_INTERNAL_SERVER_ERROR;
  }
+


[...]



Re: svn commit: r1907989 - /httpd/httpd/trunk/modules/dav/fs/quota.c

2023-03-02 Thread Yann Ylavic
On Thu, Mar 2, 2023 at 5:09 PM  wrote:
>
> Author: manu
> Date: Thu Mar  2 16:09:50 2023
> New Revision: 1907989
>
> URL: http://svn.apache.org/viewvc?rev=1907989=rev
> Log:
> Add RFC4331 quotas for mod_dav_fs
>
> Fix warnings

Thanks! All good now.

Regards;
Yann.


Re: svn commit: r1907984 - /httpd/httpd/trunk/modules/dav/fs/quota.c

2023-03-02 Thread Yann Ylavic
Hi Emmanuel,

On Thu, Mar 2, 2023 at 4:46 PM  wrote:
>
> Author: manu
> Date: Thu Mar  2 15:46:12 2023
> New Revision: 1907984
>
> URL: http://svn.apache.org/viewvc?rev=1907984=rev
> Log:
> Add RFC4331 quotas for mod_dav_fs
>
> Address forgotten svn add in previous commit
>
> Added:
> httpd/httpd/trunk/modules/dav/fs/quota.c

Some warnings (errors with -Werror) raised by the ci:
https://github.com/apache/httpd/actions/runs/4315730441/jobs/7530520652#step:10:2809

Regards;
Yann.


Re: svn commit: r1907974 - in /httpd/httpd/trunk: CMakeLists.txt modules/dav/fs/config6.m4 modules/dav/fs/mod_dav_fs.c modules/dav/fs/mod_dav_fs.dsp modules/dav/fs/repos.c modules/dav/fs/repos.h modul

2023-03-02 Thread Joe Orton
On Thu, Mar 02, 2023 at 02:36:32PM -, m...@apache.org wrote:
> Author: manu
> Date: Thu Mar  2 14:36:31 2023
> New Revision: 1907974
> 
> URL: http://svn.apache.org/viewvc?rev=1907974=rev
> Log:
> Add RFC4331 quotas for mod_dav_fs

Hi Emmanuel - looks like you forgot to "svn add" the new quota.c in this 
commit.

Regards, Joe



intent to T this weekend

2023-03-02 Thread Eric Covener
so get all of your destabilizing fixes in while you can!