You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ja...@apache.org on 2021/04/18 19:40:13 UTC

svn commit: r1888929 - in /httpd/httpd/branches/2.4.x: ./ .gdbinit changes-entries/pr64413.txt include/http_core.h modules/dav/fs/repos.c modules/proxy/proxy_util.c server/util.c support/htpasswd.c

Author: jailletc36
Date: Sun Apr 18 19:40:13 2021
New Revision: 1888929

URL: http://svn.apache.org/viewvc?rev=1888929&view=rev
Log:
Merge r1730128, r1878140, r1878265, r1881736, r1882775, r1883872, r1884509, r1887720 from trunk

  *) Easy patches: synch 2.4.x and trunk
         - doxygen: Correct doxygen groupname
         - .gdbinit: align columns
         - .gdbinit: fix indentation
         - mod_dav: Add specific logs for different modes
         - core: ap_pbase64encode(): save double NUL byte allocation and assignment
         - core: ap_pbase64decode(): save double NUL byte allocation and assignment
         - support: Fix a typo in a comment
         - proxy_util.c: Fix leak in error path in the do_malloc case

Submitted by: wrowe, ylavic, ylavic, jorton, rpluem, ylavic, jorton, jorton
Reviewed by: jailletc36, gbechis, ylavic
Backported by: jailletc36

Added:
    httpd/httpd/branches/2.4.x/changes-entries/pr64413.txt
      - copied unchanged from r1881736, httpd/httpd/trunk/changes-entries/pr64413.txt
Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/.gdbinit
    httpd/httpd/branches/2.4.x/include/http_core.h
    httpd/httpd/branches/2.4.x/modules/dav/fs/repos.c
    httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c
    httpd/httpd/branches/2.4.x/server/util.c
    httpd/httpd/branches/2.4.x/support/htpasswd.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1730128,1878140,1878265,1881736,1882775,1883872,1884509,1887720

Modified: httpd/httpd/branches/2.4.x/.gdbinit
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/.gdbinit?rev=1888929&r1=1888928&r2=1888929&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/.gdbinit (original)
+++ httpd/httpd/branches/2.4.x/.gdbinit Sun Apr 18 19:40:13 2021
@@ -6,12 +6,12 @@ define dump_table
     set $n = ((apr_array_header_t *)$arg0)->nelts
     set $i = 0
     while $i < $n
-    if $t[$i].val == (void *)0L
-        printf "[%u] '%s'=>NULL\n", $i, $t[$i].key
-    else
-        printf "[%u] '%s'='%s' [%p]\n", $i, $t[$i].key, $t[$i].val, $t[$i].val
-    end
-    set $i = $i + 1
+        if $t[$i].val == (void *)0L
+            printf "[%u] '%s'=>NULL\n", $i, $t[$i].key
+        else
+            printf "[%u] '%s'='%s' [%p]\n", $i, $t[$i].key, $t[$i].val, $t[$i].val
+        end
+        set $i = $i + 1
     end
 end
 document dump_table
@@ -157,7 +157,7 @@ define dump_bucket_ex
         set $fd = ((apr_bucket_file*)$bucket->data)->fd->filedes
         print_bkt_datacol "contents" "[***file***] fd=%-6ld" (long)$fd $sh
         set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
-        print_bkt_datacol "rc" "%d" $refcount $sh
+        print_bkt_datacol "rc" "%-3d" $refcount $sh
 
     else
     if (($bucket->type == &apr_bucket_type_heap)      || \
@@ -223,7 +223,7 @@ define dump_bucket_ex
         end
 
         if $refcount != -1
-            print_bkt_datacol "rc" "%d" $refcount $sh
+            print_bkt_datacol "rc" "%-3d" $refcount $sh
         else
             print_bkt_datacol "rc" "n/%c" 'a' $sh
         end
@@ -232,25 +232,25 @@ define dump_bucket_ex
         if ($bucket->type == &apr_bucket_type_pipe)
 
             # pipe bucket, can show fd
-            set $fd = ((apr_file_t*)$bucket->data)->filedes;
-            print_bkt_datacol "contents" "[***pipe***] fd=%-6ld" (long)$fd $sh
+            set $fd = ((apr_file_t*)$bucket->data)->filedes
+            print_bkt_datacol "contents" "[***pipe***] fd=%-3ld" (long)$fd $sh
 
         else
         if ($bucket->type == &apr_bucket_type_socket)
 
             # file bucket, can show fd
-            set $fd = ((apr_socket_t*)$bucket->data)->socketdes;
-            print_bkt_datacol "contents" "[**socket**] fd=%-6ld" (long)$fd $sh
+            set $fd = ((apr_socket_t*)$bucket->data)->socketdes
+            print_bkt_datacol "contents" "[**socket**] fd=%-3ld" (long)$fd $sh
 
         else
 
             # 3rd-party bucket type
-            print_bkt_datacol "contents" "[**opaque**]%-10c" ' ' $sh
+            print_bkt_datacol "contents" "[**opaque**]%-7c" ' ' $sh
         end
         end
 
         # no refcount
-        printf "         "
+        printf "   "
         print_bkt_datacol "rc" "n/%c" 'a' $sh
     end
     end
@@ -277,7 +277,7 @@ define dump_brigade
 
     printf "   | type     (address)      | length | "
     printf "data address | contents               | rc\n"
-    printf "------------------------------------------"
+    printf "-------------------------------------------"
     printf "----------------------------------------\n"
 
     if $bucket == $sentinel

Modified: httpd/httpd/branches/2.4.x/include/http_core.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/include/http_core.h?rev=1888929&r1=1888928&r2=1888929&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/include/http_core.h (original)
+++ httpd/httpd/branches/2.4.x/include/http_core.h Sun Apr 18 19:40:13 2021
@@ -160,7 +160,7 @@ AP_DECLARE(const char *) ap_document_roo
 
 /**
  * Lookup the remote user agent's DNS name or IP address
- * @ingroup get_remote_hostname
+ * @ingroup get_remote_host
  * @param req The current request
  * @param type The type of lookup to perform.  One of:
  * <pre>

Modified: httpd/httpd/branches/2.4.x/modules/dav/fs/repos.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/dav/fs/repos.c?rev=1888929&r1=1888928&r2=1888929&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/dav/fs/repos.c (original)
+++ httpd/httpd/branches/2.4.x/modules/dav/fs/repos.c Sun Apr 18 19:40:13 2021
@@ -948,15 +948,29 @@ static dav_error * dav_fs_open_stream(co
         else if (APR_STATUS_IS_EEXIST(rv)) {
             rv = apr_file_open(&ds->f, ds->pathname, flags, APR_OS_DEFAULT,
                                ds->p);
+            if (rv != APR_SUCCESS) {
+                return dav_new_error(p, MAP_IO2HTTP(rv), 0, rv,
+                                    apr_psprintf(p, "Could not open an existing "
+                                                 "resource for writing: %s.",
+                                                 ds->pathname));
+            }
         }
     }
     else {
         rv = apr_file_open(&ds->f, ds->pathname, flags, APR_OS_DEFAULT, ds->p);
+        if (rv != APR_SUCCESS) {
+            return dav_new_error(p, MAP_IO2HTTP(rv), 0, rv,
+                                 apr_psprintf(p, "Could not open an existing "
+                                              "resource for reading: %s.",
+                                              ds->pathname));
+        }
     }
 
     if (rv != APR_SUCCESS) {
         return dav_new_error(p, MAP_IO2HTTP(rv), 0, rv,
-                             "An error occurred while opening a resource.");
+                             apr_psprintf(p, "An error occurred while opening "
+                                          "a resource for writing: %s.",
+                                          ds->pathname));
     }
 
     /* (APR registers cleanups for the fd with the pool) */

Modified: httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c?rev=1888929&r1=1888928&r2=1888929&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c Sun Apr 18 19:40:13 2021
@@ -1187,6 +1187,7 @@ PROXY_DECLARE(char *) ap_proxy_define_ba
     bshared->was_malloced = (do_malloc != 0);
     PROXY_STRNCPY(bshared->lbpname, "byrequests");
     if (PROXY_STRNCPY(bshared->name, uri) != APR_SUCCESS) {
+        if (do_malloc) free(bshared);
         return apr_psprintf(p, "balancer name (%s) too long", uri);
     }
     (*balancer)->lbmethod_set = 1;
@@ -1199,6 +1200,7 @@ PROXY_DECLARE(char *) ap_proxy_define_ba
                    &sname);
     sname = apr_pstrcat(p, conf->id, "_", sname, NULL);
     if (PROXY_STRNCPY(bshared->sname, sname) != APR_SUCCESS) {
+        if (do_malloc) free(bshared);
         return apr_psprintf(p, "balancer safe-name (%s) too long", sname);
     }
     bshared->hash.def = ap_proxy_hashfunc(bshared->name, PROXY_HASHFUNC_DEFAULT);

Modified: httpd/httpd/branches/2.4.x/server/util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/util.c?rev=1888929&r1=1888928&r2=1888929&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/util.c (original)
+++ httpd/httpd/branches/2.4.x/server/util.c Sun Apr 18 19:40:13 2021
@@ -2413,11 +2413,9 @@ char *ap_get_local_host(apr_pool_t *a)
 AP_DECLARE(char *) ap_pbase64decode(apr_pool_t *p, const char *bufcoded)
 {
     char *decoded;
-    int l;
 
-    decoded = (char *) apr_palloc(p, 1 + apr_base64_decode_len(bufcoded));
-    l = apr_base64_decode(decoded, bufcoded);
-    decoded[l] = '\0'; /* make binary sequence into string */
+    decoded = (char *) apr_palloc(p, apr_base64_decode_len(bufcoded));
+    apr_base64_decode(decoded, bufcoded);
 
     return decoded;
 }
@@ -2427,9 +2425,8 @@ AP_DECLARE(char *) ap_pbase64encode(apr_
     char *encoded;
     int l = strlen(string);
 
-    encoded = (char *) apr_palloc(p, 1 + apr_base64_encode_len(l));
-    l = apr_base64_encode(encoded, string, l);
-    encoded[l] = '\0'; /* make binary sequence into string */
+    encoded = (char *) apr_palloc(p, apr_base64_encode_len(l));
+    apr_base64_encode(encoded, string, l);
 
     return encoded;
 }

Modified: httpd/httpd/branches/2.4.x/support/htpasswd.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/support/htpasswd.c?rev=1888929&r1=1888928&r2=1888929&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/support/htpasswd.c (original)
+++ httpd/httpd/branches/2.4.x/support/htpasswd.c Sun Apr 18 19:40:13 2021
@@ -351,7 +351,7 @@ int main(int argc, const char * const ar
         }
         else {
             /*
-             * Error out if -c was omitted for this non-existant file.
+             * Error out if -c was omitted for this non-existent file.
              */
             if (!(mask & APHTP_NEWFILE)) {
                 apr_file_printf(errfile,