]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1749402, r1656549, r1840776, r1800126, r1817131, r1834226 from trunk:
authorJim Jagielski <jim@apache.org>
Wed, 19 Sep 2018 12:54:51 +0000 (12:54 +0000)
committerJim Jagielski <jim@apache.org>
Wed, 19 Sep 2018 12:54:51 +0000 (12:54 +0000)
Style only

Be more consistent:
   - add space between (if|while) and \(
   - place of 'break ' statement

Fix cut and paste typo in error message + remove empty lines to be consistent

follow-up to r1656549.

Instead of logging a password (which is not a good practice), clarify the associated message

* Silence compiler warning

Be less tolerant when parsing the credencial for Basic authorization. Only spaces  should be accepted after the authorization scheme. \t are also tolerated.

The current code accepts \v and \f as well.

The same behavior is already used in 'ap_get_basic_auth_pw()' which is mostly the same function as 'get_basic_auth()'.

Function used as 'apr_reslist_destructor' when calling 'apr_reslist_create()' should have the following prototype:

apr_status_t (*apr_reslist_destructor)(void *resource, void *params, apr_pool_t *pool);
Submitted by: jailletc36, rpluem, jailletc36, jailletc36
Reviewed by: jailletc36, minfrin, jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1841329 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/aaa/mod_auth_basic.c
modules/filters/sed1.c
modules/http/http_core.c
modules/lua/lua_vmprep.c

diff --git a/CHANGES b/CHANGES
index 756ce9f4672cecb5eced3a49dc6ac427fccf141a..8a4cfe7b2c813eb1705cd25763bb30d90626e027 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.4.36
 
+  *) mod_auth_basic: Be less tolerant when parsing the credencial. Only spaces
+     should be accepted after the authorization scheme. \t are also tolerated.
+     [Christophe Jaillet]
+
   *) mod_proxy_hcheck: Fix issues with interval determination. PR 62318
      [Jim Jagielski]
 
diff --git a/STATUS b/STATUS
index 193d676501c75f3989f54281927864ab9a02a1d5..7eb488db31266409c197520540d906ea82816ce3 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -124,21 +124,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) Easy patches: synch 2.4.x and trunk
-     - mod_sed: Style only
-     - mod_auth_basic: Clarify a log message + style
-     - http: Remove a compiler warning
-     - mod_auth_basic: Fix parsing of the credencial for Basic authorization
-     - mod_lua: fix function prototype
-     trunk patch: http://svn.apache.org/r1749402
-                  http://svn.apache.org/r1656549
-                  http://svn.apache.org/r1840776 (follow-up to r1656549)
-                  http://svn.apache.org/r1800126
-                  http://svn.apache.org/r1817131
-                  http://svn.apache.org/r1834226
-     2.4.x patch: svn merge -c 1749402,1656549,1840776,1800126,1817131,1834226 ^/httpd/httpd/trunk . 
-     +1: jailletc36, minfrin, jim
-
   *) mod_http2: silence compiler warnings, share less memory between
      streams/tasks, add some util fixes from mod_md copies, although not called in h2. 
      trunk patch: http://svn.apache.org/r1835118
index 62d7f0c678cbe156e5f859c3b021348b06444647..e8163d0f90901d95ac7b097833c484c88c105641 100644 (file)
@@ -146,14 +146,11 @@ static const char *add_basic_fake(cmd_parms * cmd, void *config,
     const char *err;
 
     if (!strcasecmp(user, "off")) {
-
         conf->fakeuser = NULL;
         conf->fakepass = NULL;
         conf->fake_set = 1;
-
     }
     else {
-
         /* if password is unspecified, set it to the fixed string "password" to
          * be compatible with the behaviour of mod_ssl.
          */
@@ -174,11 +171,10 @@ static const char *add_basic_fake(cmd_parms * cmd, void *config,
                         &err, NULL);
         if (err) {
             return apr_psprintf(cmd->pool,
-                    "Could not parse fake password expression '%s': %s", user,
-                    err);
+                    "Could not parse fake password expression associated to user '%s': %s",
+                    user, err);
         }
         conf->fake_set = 1;
-
     }
 
     return NULL;
@@ -274,7 +270,7 @@ static int get_basic_auth(request_rec *r, const char **user,
     }
 
     /* Skip leading spaces. */
-    while (apr_isspace(*auth_line)) {
+    while (*auth_line == ' ' || *auth_line == '\t') {
         auth_line++;
     }
 
index f463ec9e034b861ece1b2f073780018d4f7ea29e..be0350678856fb83db6d9df8af0bc16dfa9f3abf 100644 (file)
@@ -106,7 +106,7 @@ static void grow_buffer(apr_pool_t *pool, char **buffer,
     }
 
     /* Align it to 4 KB boundary */
-    newsize = (newsize  + ((1 << 12) - 1)) & ~((1 << 12) -1);
+    newsize = (newsize  + ((1 << 12) - 1)) & ~((1 << 12) - 1);
     newbuffer = apr_pcalloc(pool, newsize);
     if (*spend && *buffer && (*cursize > 0)) {
         spendsize = *spend - *buffer;
@@ -586,8 +586,8 @@ static int match(sed_eval_t *eval, char *expbuf, int gf,
     char   *p1;
     int circf;
 
-    if(gf) {
-        if(*expbuf)    return(0);
+    if (gf) {
+        if (*expbuf)    return(0);
         step_vars->locs = p1 = step_vars->loc2;
     } else {
         p1 = eval->linebuf;
@@ -604,16 +604,16 @@ static int match(sed_eval_t *eval, char *expbuf, int gf,
 static int substitute(sed_eval_t *eval, sed_reptr_t *ipc,
                       step_vars_storage *step_vars)
 {
-    if(match(eval, ipc->re1, 0, step_vars) == 0)    return(0);
+    if (match(eval, ipc->re1, 0, step_vars) == 0)    return(0);
 
     eval->numpass = 0;
     eval->sflag = 0;        /* Flags if any substitution was made */
     if (dosub(eval, ipc->rhs, ipc->gfl, step_vars) != APR_SUCCESS)
         return -1;
 
-    if(ipc->gfl) {
-        while(*step_vars->loc2) {
-            if(match(eval, ipc->re1, 1, step_vars) == 0) break;
+    if (ipc->gfl) {
+        while (*step_vars->loc2) {
+            if (match(eval, ipc->re1, 1, step_vars) == 0) break;
             if (dosub(eval, ipc->rhs, ipc->gfl, step_vars) != APR_SUCCESS)
                 return -1;
         }
@@ -631,9 +631,9 @@ static apr_status_t dosub(sed_eval_t *eval, char *rhsbuf, int n,
     int c;
     apr_status_t rv = APR_SUCCESS;
 
-    if(n > 0 && n < 999) {
+    if (n > 0 && n < 999) {
         eval->numpass++;
-        if(n != eval->numpass) return APR_SUCCESS;
+        if (n != eval->numpass) return APR_SUCCESS;
     }
     eval->sflag = 1;
     lp = eval->linebuf;
@@ -703,7 +703,7 @@ static apr_status_t command(sed_eval_t *eval, sed_reptr_t *ipc,
     switch(ipc->command) {
 
         case ACOM:
-            if(eval->aptr >= &eval->abuf[SED_ABUFSIZE]) {
+            if (eval->aptr >= &eval->abuf[SED_ABUFSIZE]) {
                 eval_errf(eval, SEDERR_TMAMES, eval->lnum);
             } else {
                 *eval->aptr++ = ipc;
@@ -713,20 +713,22 @@ static apr_status_t command(sed_eval_t *eval, sed_reptr_t *ipc,
 
         case CCOM:
             eval->delflag = 1;
-            if(!eval->inar[ipc->nrep] || eval->dolflag) {
+            if (!eval->inar[ipc->nrep] || eval->dolflag) {
                 for (p1 = ipc->re1; *p1; p1++)
                     ;
                 rv = wline(eval, ipc->re1, p1 - ipc->re1);
             }
             break;
+
         case DCOM:
             eval->delflag++;
             break;
+
         case CDCOM:
             p1 = eval->linebuf;
 
-            while(*p1 != '\n') {
-                if(*p1++ == 0) {
+            while (*p1 != '\n') {
+                if (*p1++ == 0) {
                     eval->delflag++;
                     return APR_SUCCESS;
                 }
@@ -769,17 +771,16 @@ static apr_status_t command(sed_eval_t *eval, sed_reptr_t *ipc,
             eval->jflag = 1;
             break;
 
-
         case LCOM:
             p1 = eval->linebuf;
             p2 = eval->genbuf;
             eval->genbuf[72] = 0;
-            while(*p1)
-                if((unsigned char)*p1 >= 040) {
-                    if(*p1 == 0177) {
+            while (*p1) {
+                if ((unsigned char)*p1 >= 040) {
+                    if (*p1 == 0177) {
                         p3 = rub;
                         while ((*p2++ = *p3++) != 0)
-                            if(p2 >= eval->lcomend) {
+                            if (p2 >= eval->lcomend) {
                                 *p2 = '\\';
                                 rv = wline(eval, eval->genbuf,
                                            strlen(eval->genbuf));
@@ -791,9 +792,9 @@ static apr_status_t command(sed_eval_t *eval, sed_reptr_t *ipc,
                         p1++;
                         continue;
                     }
-                    if(!isprint(*p1 & 0377)) {
+                    if (!isprint(*p1 & 0377)) {
                         *p2++ = '\\';
-                        if(p2 >= eval->lcomend) {
+                        if (p2 >= eval->lcomend) {
                             *p2 = '\\';
                             rv = wline(eval, eval->genbuf,
                                        strlen(eval->genbuf));
@@ -802,7 +803,7 @@ static apr_status_t command(sed_eval_t *eval, sed_reptr_t *ipc,
                             p2 = eval->genbuf;
                         }
                         *p2++ = (*p1 >> 6) + '0';
-                        if(p2 >= eval->lcomend) {
+                        if (p2 >= eval->lcomend) {
                             *p2 = '\\';
                             rv = wline(eval, eval->genbuf,
                                        strlen(eval->genbuf));
@@ -811,7 +812,7 @@ static apr_status_t command(sed_eval_t *eval, sed_reptr_t *ipc,
                             p2 = eval->genbuf;
                         }
                         *p2++ = ((*p1 >> 3) & 07) + '0';
-                        if(p2 >= eval->lcomend) {
+                        if (p2 >= eval->lcomend) {
                             *p2 = '\\';
                             rv = wline(eval, eval->genbuf,
                                        strlen(eval->genbuf));
@@ -820,7 +821,7 @@ static apr_status_t command(sed_eval_t *eval, sed_reptr_t *ipc,
                             p2 = eval->genbuf;
                         }
                         *p2++ = (*p1++ & 07) + '0';
-                        if(p2 >= eval->lcomend) {
+                        if (p2 >= eval->lcomend) {
                             *p2 = '\\';
                             rv = wline(eval, eval->genbuf,
                                        strlen(eval->genbuf));
@@ -830,7 +831,7 @@ static apr_status_t command(sed_eval_t *eval, sed_reptr_t *ipc,
                         }
                     } else {
                         *p2++ = *p1++;
-                        if(p2 >= eval->lcomend) {
+                        if (p2 >= eval->lcomend) {
                             *p2 = '\\';
                             rv = wline(eval, eval->genbuf,
                                        strlen(eval->genbuf));
@@ -842,7 +843,7 @@ static apr_status_t command(sed_eval_t *eval, sed_reptr_t *ipc,
                 } else {
                     p3 = trans[(unsigned char)*p1-1];
                     while ((*p2++ = *p3++) != 0)
-                        if(p2 >= eval->lcomend) {
+                        if (p2 >= eval->lcomend) {
                             *p2 = '\\';
                             rv = wline(eval, eval->genbuf,
                                        strlen(eval->genbuf));
@@ -853,28 +854,29 @@ static apr_status_t command(sed_eval_t *eval, sed_reptr_t *ipc,
                     p2--;
                     p1++;
                 }
+            }
             *p2 = 0;
             rv = wline(eval, eval->genbuf, strlen(eval->genbuf));
             break;
 
         case NCOM:
-            if(!eval->commands->nflag) {
+            if (!eval->commands->nflag) {
                 rv = wline(eval, eval->linebuf, eval->lspend - eval->linebuf);
                 if (rv != APR_SUCCESS)
                     return rv;
             }
 
-            if(eval->aptr > eval->abuf) {
+            if (eval->aptr > eval->abuf) {
                 rv = arout(eval);
                 if (rv != APR_SUCCESS)
                     return rv;
             }
             eval->lspend = eval->linebuf;
             eval->pending = ipc->next;
-
             break;
+
         case CNCOM:
-            if(eval->aptr > eval->abuf) {
+            if (eval->aptr > eval->abuf) {
                 rv = arout(eval);
                 if (rv != APR_SUCCESS)
                     return rv;
@@ -886,6 +888,7 @@ static apr_status_t command(sed_eval_t *eval, sed_reptr_t *ipc,
         case PCOM:
             rv = wline(eval, eval->linebuf, eval->lspend - eval->linebuf);
             break;
+
         case CPCOM:
             for (p1 = eval->linebuf; *p1 != '\n' && *p1 != '\0'; p1++);
             rv = wline(eval, eval->linebuf, p1 - eval->linebuf);
@@ -898,7 +901,7 @@ static apr_status_t command(sed_eval_t *eval, sed_reptr_t *ipc,
                     break;
             }
 
-            if(eval->aptr > eval->abuf) {
+            if (eval->aptr > eval->abuf) {
                 rv = arout(eval);
                 if (rv != APR_SUCCESS)
                     return rv;
@@ -906,8 +909,9 @@ static apr_status_t command(sed_eval_t *eval, sed_reptr_t *ipc,
 
             eval->quitflag = 1;
             break;
+
         case RCOM:
-            if(eval->aptr >= &eval->abuf[SED_ABUFSIZE]) {
+            if (eval->aptr >= &eval->abuf[SED_ABUFSIZE]) {
                 eval_errf(eval, SEDERR_TMRMES, eval->lnum);
             } else {
                 *eval->aptr++ = ipc;
@@ -920,8 +924,8 @@ static apr_status_t command(sed_eval_t *eval, sed_reptr_t *ipc,
             if (i == -1) {
                 return APR_EGENERAL;
             }
-            if(ipc->pfl && eval->commands->nflag && i) {
-                if(ipc->pfl == 1) {
+            if (ipc->pfl && eval->commands->nflag && i) {
+                if (ipc->pfl == 1) {
                     rv = wline(eval, eval->linebuf, eval->lspend -
                                eval->linebuf);
                     if (rv != APR_SUCCESS)
@@ -939,7 +943,7 @@ static apr_status_t command(sed_eval_t *eval, sed_reptr_t *ipc,
             break;
 
         case TCOM:
-            if(eval->sflag == 0)  break;
+            if (eval->sflag == 0)  break;
             eval->sflag = 0;
             eval->jflag = 1;
             break;
@@ -949,6 +953,7 @@ static apr_status_t command(sed_eval_t *eval, sed_reptr_t *ipc,
                 apr_file_printf(eval->fcode[ipc->findex], "%s\n",
                                 eval->linebuf);
             break;
+
         case XCOM:
             copy_to_genbuf(eval, eval->linebuf);
             copy_to_linebuf(eval, eval->holdbuf);
@@ -958,7 +963,7 @@ static apr_status_t command(sed_eval_t *eval, sed_reptr_t *ipc,
         case YCOM:
             p1 = eval->linebuf;
             p2 = ipc->re1;
-            while((*p1 = p2[(unsigned char)*p1]) != 0)    p1++;
+            while ((*p1 = p2[(unsigned char)*p1]) != 0)    p1++;
             break;
     }
     return rv;
index ccc3f141f4294b6b07b87fa33e7ba8c1bb090fb2..35869b45b3f8369a4d5e1d2127725e2f5040fc8c 100644 (file)
@@ -134,7 +134,7 @@ static apr_port_t http_port(const request_rec *r)
 
 static int ap_process_http_async_connection(conn_rec *c)
 {
-    request_rec *r;
+    request_rec *r = NULL;
     conn_state_t *cs = c->cs;
 
     AP_DEBUG_ASSERT(cs != NULL);
index e6d68cf000a7a9955c2c5ee65e2588dfeb5ec162..001897a11c86690ae0b2ff16f013e57a871b02da 100644 (file)
@@ -244,7 +244,7 @@ static apr_status_t cleanup_lua(void *l)
     return APR_SUCCESS;
 }
 
-static apr_status_t server_cleanup_lua(void *resource)
+static apr_status_t server_cleanup_lua(void *resource, void *params, apr_pool_t *pool)
 {
     ap_lua_server_spec* spec = (ap_lua_server_spec*) resource;
     AP_DEBUG_ASSERT(spec != NULL);
@@ -311,7 +311,8 @@ static void munge_path(lua_State *L,
 }
 
 #ifdef AP_ENABLE_LUAJIT
-static int loadjitmodule(lua_State *L, apr_pool_t *lifecycle_pool) {
+static int loadjitmodule(lua_State *L, apr_pool_t *lifecycle_pool)
+{
     lua_getglobal(L, "require");
     lua_pushliteral(L, "jit.");
     lua_pushvalue(L, -3);