You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2013/04/22 16:08:42 UTC

svn commit: r1470524 - in /httpd/httpd/branches/2.4.x: ./ STATUS docs/manual/ docs/manual/expr.xml server/util_expr_eval.c

Author: jim
Date: Mon Apr 22 14:08:42 2013
New Revision: 1470524

URL: http://svn.apache.org/r1470524
Log:
Merge r1458004 from trunk:

add md5 function, too

Submitted by: sf
Reviewed/backported by: jim

Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/STATUS
    httpd/httpd/branches/2.4.x/docs/manual/   (props changed)
    httpd/httpd/branches/2.4.x/docs/manual/expr.xml
    httpd/httpd/branches/2.4.x/server/util_expr_eval.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1458004

Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1470524&r1=1470523&r2=1470524&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Mon Apr 22 14:08:42 2013
@@ -90,12 +90,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-   * ap_expr: Expression parser: Add the ability to apply a md5 hash to
-     strings within the parser.
-     trunk patch: http://svn.apache.org/r1458004
-     2.4.x patch: trunk patch applies if previous proposals for ap_expr get applied.
-     +1: rjung, minfrin, sf
-
     * various: Use %pm available since apr 1.3 instead of an extra call to apr_strerror
       trunk patches: https://svn.apache.org/r1463056
       2.4.x patch: trunk patch works (with offset)

Propchange: httpd/httpd/branches/2.4.x/docs/manual/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk/docs/manual:r1458004

Modified: httpd/httpd/branches/2.4.x/docs/manual/expr.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/docs/manual/expr.xml?rev=1470524&r1=1470523&r2=1470524&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/docs/manual/expr.xml (original)
+++ httpd/httpd/branches/2.4.x/docs/manual/expr.xml Mon Apr 22 14:08:42 2013
@@ -464,6 +464,9 @@ listfunction ::= listfuncname "<strong>(
     <tr><td><code>unbase64</code></td>
         <td>Decode base64 encoded string, return truncated string if 0x00 is
             found</td><td></td></tr>
+    <tr><td><code>md5</code></td>
+        <td>Hash the string using MD5, then encode the hash with hexadecimal
+            encoding</td><td></td></tr>
     <tr><td><code>sha1</code></td>
         <td>Hash the string using SHA1, then encode the hash with hexadecimal
             encoding</td><td></td></tr>

Modified: httpd/httpd/branches/2.4.x/server/util_expr_eval.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/util_expr_eval.c?rev=1470524&r1=1470523&r2=1470524&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/util_expr_eval.c (original)
+++ httpd/httpd/branches/2.4.x/server/util_expr_eval.c Mon Apr 22 14:08:42 2013
@@ -25,6 +25,7 @@
 #include "http_request.h"
 #include "ap_provider.h"
 #include "util_expr_private.h"
+#include "util_md5.h"
 
 #include "apr_lib.h"
 #include "apr_fnmatch.h"
@@ -1051,6 +1052,13 @@ static const char *sha1_func(ap_expr_eva
     return out;
 }
 
+static const char *md5_func(ap_expr_eval_ctx_t *ctx, const void *data,
+                               const char *arg)
+{
+	return ap_md5(ctx->p, (const unsigned char *)arg);
+}
+
+
 #define MAX_FILE_SIZE 10*1024*1024
 static const char *file_func(ap_expr_eval_ctx_t *ctx, const void *data,
                              char *arg)
@@ -1610,6 +1618,7 @@ static const struct expr_provider_single
     { base64_func,          "base64",         NULL, 0 },
     { unbase64_func,        "unbase64",       NULL, 0 },
     { sha1_func,            "sha1",           NULL, 0 },
+    { md5_func,             "md5",            NULL, 0 },
     { NULL, NULL, NULL}
 };