Commit d452726bfe81212a613ba56dbfb597c4210a64cf

Authored by Georg Hopp
1 parent 17dd31f3

small workaround to make this module work on apache 2.2.x as well as 2.4.x

Showing 1 changed file with 15 additions and 10 deletions
... ... @@ -70,15 +70,19 @@ entropy_filter_in(
70 70 apr_read_type_e block,
71 71 apr_off_t readbytes)
72 72 {
73   - apr_bucket * bucket;
74   - apr_status_t status;
75   - request_rec * request = filter->r;
76   - conn_rec * connection = filter->c;
77   - apr_sha1_ctx_t sha1_ctx;
78   - unsigned char digest[APR_SHA1_DIGESTSIZE];
  73 + apr_bucket * bucket;
  74 + apr_status_t status;
  75 + request_rec * request = filter->r;
  76 + conn_rec * connection = filter->c;
  77 + apr_sha1_ctx_t sha1_ctx;
  78 + unsigned char digest[APR_SHA1_DIGESTSIZE];
  79 + ap_version_t ap_version;
  80 + char * remote_ip;
79 81
80 82 struct timespec ts;
81 83
  84 + ap_get_server_revision(&ap_version);
  85 +
82 86 clock_gettime(CLOCK_REALTIME, &ts);
83 87
84 88 apr_sha1_init(&sha1_ctx);
... ... @@ -94,10 +98,11 @@ entropy_filter_in(
94 98 /**
95 99 * add client ip to sha1
96 100 */
97   - apr_sha1_update(
98   - &sha1_ctx,
99   - connection->remote_ip,
100   - strlen(connection->remote_ip));
  101 + remote_ip = (ap_version.minor < 4)?
  102 + connection->remote_ip:
  103 + connection->client_ip;
  104 +
  105 + apr_sha1_update(&sha1_ctx, remote_ip, strlen(remote_ip));
101 106
102 107 /**
103 108 * add request line to sha1
... ...
Please register or login to post a comment