summaryrefslogtreecommitdiffstats
path: root/patches/0001-Port-TPS-to-httpd-2.4.patch
blob: 7fcde14b2583b231f25ad7d6e1753f10583dd92d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
From 2d5b430b5fa6087f2e349913edbdb7292fab9084 Mon Sep 17 00:00:00 2001
From: Nathan Kinder <nkinder@redhat.com>
Date: Mon, 6 Aug 2012 15:46:50 -0700
Subject: [PATCH] Port TPS to httpd 2.4

The API changed between httpd 2.2 and 2.4.  We now need to pass
the module index to ap_log_error() when calling it.  The remote_ip
member of the connection struct also was renamed to client_ip.
---
 base/tps/src/modules/tokendb/mod_tokendb.cpp | 123 ++++++++++++++-------------
 base/tps/src/modules/tps/AP_Context.cpp      |   8 +-
 base/tps/src/modules/tps/AP_Session.cpp      |   2 +-
 base/tps/src/modules/tps/mod_tps.cpp         |   9 +-
 4 files changed, 73 insertions(+), 69 deletions(-)

diff --git a/base/tps/src/modules/tokendb/mod_tokendb.cpp b/base/tps/src/modules/tokendb/mod_tokendb.cpp
index 3e411c99a40ebe2742e4afd505041f1697757537..9454715b0773ce5d4136681ae8a76533c581c814 100644
--- a/base/tps/src/modules/tokendb/mod_tokendb.cpp
+++ b/base/tps/src/modules/tokendb/mod_tokendb.cpp
@@ -111,7 +111,7 @@ extern TOKENDB_PUBLIC char *nss_var_lookup( apr_pool_t *p, server_rec *s,
         msg1,"\";\n", JS_STOP ); \
     buf = getData( errorTemplate, injection ); \
     ap_log_error( ( const char * ) "tus", __LINE__, \
-        APLOG_ERR, 0, rq->server, \
+        APLOG_MODULE_INDEX, APLOG_ERR, 0, rq->server, \
         ( const char * ) msg2 ); \
     ( void ) ap_rwrite( ( const void * ) buf, PL_strlen( buf ), rq );
 
@@ -123,14 +123,14 @@ extern TOKENDB_PUBLIC char *nss_var_lookup( apr_pool_t *p, server_rec *s,
         "\";\n", JS_STOP ); \
     buf = getData( errorTemplate, injection ); \
     ap_log_error( ( const char * ) "tus", __LINE__, \
-        APLOG_ERR, 0, rq->server, \
+        APLOG_MODULE_INDEX, APLOG_ERR, 0, rq->server, \
         ( const char * ) msg2, \
         ldap_err2string( status ) ); \
     ( void ) ap_rwrite( ( const void * ) buf, PL_strlen( buf ), rq );
 
 #define post_ldap_error(msg) \
     ap_log_error( ( const char * ) "tus", __LINE__, \
-        APLOG_ERR, 0, rq->server, \
+        APLOG_MODULE_INDEX, APLOG_ERR, 0, rq->server, \
         (const char *) msg,  ldap_err2string( status ) );
 
 #define get_cfg_string(cname, vname) \
@@ -302,6 +302,7 @@ typedef struct {
 */
 
 #define MOD_TOKENDB_CONFIG_KEY tokendb_module
+APLOG_USE_MODULE(tokendb);
 
 static const char MOD_TOKENDB_CONFIG_KEY_NAME[] = "tokendb_module";
 
@@ -2482,7 +2483,7 @@ mod_tokendb_initialize( apr_pool_t *p,
    } else {
         /* Log information regarding this failure. */
         ap_log_error( "mod_tokendb_initialize",
-                      __LINE__, APLOG_ERR, 0, sv,
+                      __LINE__, APLOG_MODULE_INDEX, APLOG_ERR, 0, sv,
                       "The tokendb module was installed incorrectly since the "
                       "parameter named '%s' is missing from the Apache "
                       "Configuration file!",
@@ -3751,7 +3752,7 @@ mod_tokendb_handler( request_rec *rq )
 
             PR_snprintf((char *)msg, 256,
               "'%s' marked token physically damaged", userid);
-            RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "initiated",
+            RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "initiated",
                      msg, cuidUserId, tokenType);
 
             /* get the certificates on this lost token */
@@ -3817,13 +3818,13 @@ mod_tokendb_handler( request_rec *rq )
                         if (statusNum != 0) { // revocation errors
                             if( strcmp( revokeReason, "6" ) == 0 ) {
                                 PR_snprintf((char *)msg, 256, "Errors in marking certificate on_hold '%s' : %s", attr_cn, statusString);
-                                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "failure", msg, cuidUserId, attr_tokenType);
+                                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "failure", msg, cuidUserId, attr_tokenType);
 
                                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CERT_STATUS_CHANGE, userid, 
                                   "Failure", "revoked_on_hold", serial, connid, statusString); 
                             } else {
                                 PR_snprintf((char *)msg, 256, "Errors in revoking certificate '%s' : %s", attr_cn, statusString);
-                                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "failure", msg, cuidUserId, attr_tokenType);
+                                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "failure", msg, cuidUserId, attr_tokenType);
 
                                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CERT_STATUS_CHANGE, userid, 
                                   "Failure", "revoke", serial, connid, statusString); 
@@ -3832,14 +3833,14 @@ mod_tokendb_handler( request_rec *rq )
                             // update certificate status
                             if( strcmp( revokeReason, "6" ) == 0 ) {
                                 PR_snprintf((char *)msg, 256, "Certificate '%s' is marked as revoked_on_hold", attr_cn);
-                                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "success", msg, cuidUserId, attr_tokenType);
+                                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "success", msg, cuidUserId, attr_tokenType);
                                 update_cert_status( attr_cn, "revoked_on_hold" );
 
                                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CERT_STATUS_CHANGE, userid, 
                                   "Success", "revoked_on_hold", serial, connid, ""); 
                             } else {
                                 PR_snprintf((char *)msg, 256, "Certificate '%s' is marked as revoked", attr_cn);
-                                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "success", msg, cuidUserId, attr_tokenType);
+                                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "success", msg, cuidUserId, attr_tokenType);
                                 update_cert_status( attr_cn, "revoked" );
 
                                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CERT_STATUS_CHANGE, userid, 
@@ -3897,7 +3898,7 @@ mod_tokendb_handler( request_rec *rq )
                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CONFIG, userid, "Agent", "Failure", oString, pString, "token marked physically damaged, rc=-1");
 
                 PR_snprintf((char *)msg, 256, "Failed to update token status as physically damaged");
-                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "failure",
+                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "failure",
                      msg, cuidUserId, tokenType);
 
                 PR_snprintf( injection, MAX_INJECTION_SIZE,
@@ -3908,7 +3909,7 @@ mod_tokendb_handler( request_rec *rq )
                 buf = getData( errorTemplate, injection );
 
                 ap_log_error( ( const char * ) "tus", __LINE__,
-                              APLOG_ERR, 0, rq->server,
+                              APLOG_MODULE_INDEX, APLOG_ERR, 0, rq->server,
                               ( const char * ) "Failed to create LDAPMod" );
 
                 ( void ) ap_rwrite( ( const void * ) buf,
@@ -3927,7 +3928,7 @@ mod_tokendb_handler( request_rec *rq )
                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CONFIG, userid, "Agent", "Failure", oString, pString, "token marked physically damaged, rc>0");
 
                 PR_snprintf((char *)msg, 256, "Failed to update token status as physically damaged");
-                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "failure",
+                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "failure",
                      msg, cuidUserId, tokenType);
 
                 PR_snprintf( injection, MAX_INJECTION_SIZE,
@@ -3939,7 +3940,7 @@ mod_tokendb_handler( request_rec *rq )
                 buf = getData( errorTemplate, injection );
 
                 ap_log_error( ( const char * ) "tus", __LINE__,
-                              APLOG_ERR, 0, rq->server,
+                              APLOG_MODULE_INDEX, APLOG_ERR, 0, rq->server,
                               ( const char * ) "LDAP error: %s", 
                               ldap_err2string( rc ) );
 
@@ -3958,7 +3959,7 @@ mod_tokendb_handler( request_rec *rq )
             RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CONFIG, userid, "Agent", "Success", oString, pString, "token marked physically damaged");
 
             PR_snprintf((char *)msg, 256, "Token marked as physically damaged");
-            RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "success",
+            RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "success",
                      msg, cuidUserId, tokenType);
 
         /* Is this token permanently lost? */
@@ -3971,7 +3972,7 @@ mod_tokendb_handler( request_rec *rq )
               PR_snprintf((char *)msg, 256,
                 "'%s' marked token terminated", userid);             
             }
-            RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "initiated",
+            RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "initiated",
                      msg, cuidUserId, tokenType);
 
             /* get the certificates on this lost token */
@@ -4040,13 +4041,13 @@ mod_tokendb_handler( request_rec *rq )
                         if (statusNum != 0) { // revocation errors
                             if( strcmp( revokeReason, "6" ) == 0 ) {
                                 PR_snprintf((char *)msg, 256, "Errors in marking certificate on_hold '%s' : %s", attr_cn, statusString);
-                                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "failure", msg, cuidUserId, attr_tokenType);
+                                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "failure", msg, cuidUserId, attr_tokenType);
 
                                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CERT_STATUS_CHANGE, userid,
                                   "Failure", "revoked_on_hold", serial, connid, statusString);
                             } else {
                                 PR_snprintf((char *)msg, 256, "Errors in revoking certificate '%s' : %s", attr_cn, statusString);
-                                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "failure", msg, cuidUserId, attr_tokenType);
+                                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "failure", msg, cuidUserId, attr_tokenType);
 
                                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CERT_STATUS_CHANGE, userid,
                                   "Failure", "revoke", serial, connid, statusString);
@@ -4055,14 +4056,14 @@ mod_tokendb_handler( request_rec *rq )
                             // update certificate status
                             if( strcmp( revokeReason, "6" ) == 0 ) {
                                 PR_snprintf((char *)msg, 256, "Certificate '%s' is marked as revoked_on_hold", attr_cn);
-                                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "success", msg, cuidUserId, attr_tokenType);
+                                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "success", msg, cuidUserId, attr_tokenType);
                                 update_cert_status( attr_cn, "revoked_on_hold" );
 
                                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CERT_STATUS_CHANGE, userid,
                                   "Success", "revoked_on_hold", serial, connid, "");                 
                             } else {
                                 PR_snprintf((char *)msg, 256, "Certificate '%s' is marked as revoked", attr_cn);
-                                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "success", msg, cuidUserId, attr_tokenType);
+                                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "success", msg, cuidUserId, attr_tokenType);
                                 update_cert_status( attr_cn, "revoked" );
 
                                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CERT_STATUS_CHANGE, userid,
@@ -4133,7 +4134,7 @@ mod_tokendb_handler( request_rec *rq )
                     RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CONFIG, userid, "Agent", "Failure", oString, pString, "token marked permanently lost, rc=-1");
                     PR_snprintf((char *)msg, 256, "Failure in updating token status to permanently lost");
                 }
-                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "failure",
+                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "failure",
                      msg, cuidUserId, tokenType);
 
                 PR_snprintf( injection, MAX_INJECTION_SIZE,
@@ -4144,7 +4145,7 @@ mod_tokendb_handler( request_rec *rq )
                 buf = getData( errorTemplate, injection );
 
                 ap_log_error( ( const char * ) "tus", __LINE__,
-                              APLOG_ERR, 0, rq->server,
+                              APLOG_MODULE_INDEX, APLOG_ERR, 0, rq->server,
                               ( const char * ) "Failed to create LDAPMod" );
 
                 ( void ) ap_rwrite( ( const void * ) buf,
@@ -4163,7 +4164,7 @@ mod_tokendb_handler( request_rec *rq )
                     RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CONFIG, userid, "Agent", "Failure", oString, pString, "token marked permanently lost, rc>0");
                     PR_snprintf((char *)msg, 256, "Failure in updating token status to permanently lost");
                 }
-                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "failure",
+                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "failure",
                      msg, cuidUserId, tokenType);
 
                 PR_snprintf( injection, MAX_INJECTION_SIZE,
@@ -4175,7 +4176,7 @@ mod_tokendb_handler( request_rec *rq )
                 buf = getData( errorTemplate, injection );
 
                 ap_log_error( ( const char * ) "tus", __LINE__,
-                              APLOG_ERR, 0, rq->server,
+                              APLOG_MODULE_INDEX, APLOG_ERR, 0, rq->server,
                               ( const char * ) "LDAP error: %s",
                               ldap_err2string( rc ) );
 
@@ -4195,7 +4196,7 @@ mod_tokendb_handler( request_rec *rq )
                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CONFIG, userid, "Agent", "Success", oString, pString, "token marked permanently lost");
                 PR_snprintf((char *)msg, 256, "Token marked permanently lost");
             }
-            RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "success",
+            RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "success",
                  msg, cuidUserId, tokenType);
 
         /* Is this token temporarily lost? */
@@ -4203,7 +4204,7 @@ mod_tokendb_handler( request_rec *rq )
             bool revocation_errors = false;
             PR_snprintf((char *)msg, 256,
               "'%s' marked token temporarily lost", userid);
-            RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "initiated",
+            RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "initiated",
                      msg, cuidUserId, tokenType);
 
             /* all certs on the token are revoked (onHold) */
@@ -4277,13 +4278,13 @@ mod_tokendb_handler( request_rec *rq )
                         if (statusNum != 0) { // revocation errors
                             if( strcmp( revokeReason, "6" ) == 0 ) {
                                 PR_snprintf((char *)msg, 256, "Errors in marking certificate on_hold '%s' : %s", attr_cn, statusString);
-                                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "failure", msg, cuidUserId, attr_tokenType);
+                                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "failure", msg, cuidUserId, attr_tokenType);
 
                                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CERT_STATUS_CHANGE, userid,
                                   "Failure", "revoked_on_hold", serial, connid, statusString);
                             } else {
                                 PR_snprintf((char *)msg, 256, "Errors in revoking certificate '%s' : %s", attr_cn, statusString);
-                                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "failure", msg, cuidUserId, attr_tokenType);
+                                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "failure", msg, cuidUserId, attr_tokenType);
 
                                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CERT_STATUS_CHANGE, userid,
                                   "Failure", "revoke", serial, connid, statusString);
@@ -4293,14 +4294,14 @@ mod_tokendb_handler( request_rec *rq )
                             // update certificate status
                             if( strcmp( revokeReason, "6" ) == 0 ) {
                                 PR_snprintf((char *)msg, 256, "Certificate '%s' is marked as revoked_on_hold", attr_cn);
-                                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "success", msg, cuidUserId, attr_tokenType);
+                                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "success", msg, cuidUserId, attr_tokenType);
                                 update_cert_status( attr_cn, "revoked_on_hold" );
 
                                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CERT_STATUS_CHANGE, userid,
                                   "Success", "revoked_on_hold", serial, connid, "");
                             } else {
                                 PR_snprintf((char *)msg, 256, "Certificate '%s' is marked as revoked", attr_cn);
-                                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "success", msg, cuidUserId, attr_tokenType);
+                                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "success", msg, cuidUserId, attr_tokenType);
                                 update_cert_status( attr_cn, "revoked" );
 
                                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CERT_STATUS_CHANGE, userid,
@@ -4349,7 +4350,7 @@ mod_tokendb_handler( request_rec *rq )
                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CONFIG, userid, "Agent", "Failure", oString, pString, "token marked temporarily lost failed, failed to revoke certificates");
                 
                 PR_snprintf((char *)msg, 256, "Failed to revoke certificates");
-                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "failure",
+                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "failure",
                      msg, cuidUserId, tokenType);
 
                 error_out("Errors in revoking certificates.", "Errors in revoking certificates.");
@@ -4365,7 +4366,7 @@ mod_tokendb_handler( request_rec *rq )
                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CONFIG, userid, "Agent", "Failure", oString, pString, "token marked temporarily lost, rc=-1");
 
                 PR_snprintf((char *)msg, 256, "Failed to update token status as temporarily lost");
-                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "failure",
+                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "failure",
                      msg, cuidUserId, tokenType);
 
                 PR_snprintf( injection, MAX_INJECTION_SIZE,
@@ -4376,7 +4377,7 @@ mod_tokendb_handler( request_rec *rq )
                 buf = getData( errorTemplate, injection );
 
                 ap_log_error( ( const char * ) "tus", __LINE__,
-                              APLOG_ERR, 0, rq->server,
+                              APLOG_MODULE_INDEX, APLOG_ERR, 0, rq->server,
                               ( const char * ) "Failed to create LDAPMod" );
 
                 ( void ) ap_rwrite( ( const void * ) buf,
@@ -4390,7 +4391,7 @@ mod_tokendb_handler( request_rec *rq )
                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CONFIG, userid, "Agent", "Failure", oString, pString, "token marked temporarily lost, rc>0");
 
                 PR_snprintf((char *)msg, 256, "Failed to update token status as temporarily lost");
-                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "failure",
+                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "failure",
                      msg, cuidUserId, tokenType);
 
                 PR_snprintf( injection, MAX_INJECTION_SIZE,
@@ -4402,7 +4403,7 @@ mod_tokendb_handler( request_rec *rq )
                 buf = getData( errorTemplate, injection );
 
                 ap_log_error( ( const char * ) "tus", __LINE__,
-                              APLOG_ERR, 0, rq->server,
+                              APLOG_MODULE_INDEX, APLOG_ERR, 0, rq->server,
                               ( const char * ) "LDAP error: %s",
                               ldap_err2string( rc ) );
 
@@ -4417,7 +4418,7 @@ mod_tokendb_handler( request_rec *rq )
             }
             RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CONFIG, userid, "Agent", "Success", oString, pString, "token marked temporarily lost");
             PR_snprintf((char *)msg, 256, "Token marked temporarily lost");
-            RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "success",
+            RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "success",
                  msg, cuidUserId, tokenType);
 
         /* Is this temporarily lost token found? */
@@ -4425,7 +4426,7 @@ mod_tokendb_handler( request_rec *rq )
 
             PR_snprintf((char *)msg, 256,
               "'%s' marked lost token found", userid);
-            RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "initiated",
+            RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "initiated",
                      msg, cuidUserId, tokenType);
 
             tokendbDebug( "The temporarily lost token is found.\n" );
@@ -4490,14 +4491,14 @@ mod_tokendb_handler( request_rec *rq )
 
                         if (statusNum == 0) {
                             PR_snprintf((char *)msg, 256, "Certificate '%s' is marked as active", attr_cn);
-                            RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "success", msg, cuidUserId, attr_tokenType);
+                            RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "success", msg, cuidUserId, attr_tokenType);
                             update_cert_status( attr_cn, "active" );
 
                             RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CERT_STATUS_CHANGE, userid,
                               "Success", "unrevoke", serial, connid, "");
                         } else {
                             PR_snprintf((char *)msg, 256, "Errors in unrevoking Certificate '%s': %s", attr_cn, statusString);
-                            RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "failure", msg, cuidUserId, attr_tokenType);
+                            RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "failure", msg, cuidUserId, attr_tokenType);
 
                             RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CERT_STATUS_CHANGE, userid,
                               "Failure", "unrevoke", serial, connid, statusString);
@@ -4544,7 +4545,7 @@ mod_tokendb_handler( request_rec *rq )
             if( rc == -1 ) {
                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CONFIG, userid, "Agent", "Failure", oString, pString, "lost token marked found, rc=-1");
                 PR_snprintf((char *)msg, 256, "Failed to update lost token status as found");
-                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "failure",
+                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "failure",
                      msg, cuidUserId, tokenType);
 
                 error_out("Failed to create LDAPMod: ", "Failed to create LDAPMod");
@@ -4556,7 +4557,7 @@ mod_tokendb_handler( request_rec *rq )
             } else if( rc > 0 ) {
                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CONFIG, userid, "Agent", "Failure", oString, pString, "lost token marked found, rc>0");
                 PR_snprintf((char *)msg, 256, "Failed to update lost token status as found");
-                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "failure",
+                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "failure",
                      msg, cuidUserId, tokenType);
 
                 ldap_error_out("LDAP mod error: ", "LDAP error: %s");
@@ -4568,7 +4569,7 @@ mod_tokendb_handler( request_rec *rq )
             }
             RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CONFIG, userid, "Agent", "Success", oString, pString, "lost token marked found");
             PR_snprintf((char *)msg, 256, "Lost token marked found");
-            RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "success",
+            RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "success",
                  msg, cuidUserId, tokenType);
 
         /* Does this temporarily lost token become permanently lost? */
@@ -4576,7 +4577,7 @@ mod_tokendb_handler( request_rec *rq )
 
             PR_snprintf((char *)msg, 256,
               "'%s' marked lost token permanently lost", userid);
-            RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "initiated",
+            RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "initiated",
                      msg, cuidUserId, tokenType);
 
             tokendbDebug( "Change the revocation reason from onHold "
@@ -4655,7 +4656,7 @@ mod_tokendb_handler( request_rec *rq )
                                                              statusString );
                             if (statusNum == 0) {
                                 PR_snprintf((char *)msg, 256, "Certificate '%s' is marked as active", attr_cn);
-                                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "initiated", msg, cuidUserId, attr_tokenType);
+                                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "initiated", msg, cuidUserId, attr_tokenType);
                                 update_cert_status( attr_cn, "active" );
 
                                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CERT_STATUS_CHANGE, userid,
@@ -4669,21 +4670,21 @@ mod_tokendb_handler( request_rec *rq )
                                                            statusString );
                                 if (statusNum == 0) {
                                     PR_snprintf((char *)msg, 256, "Certificate '%s' is marked as revoked", attr_cn);
-                                    RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "success", msg, cuidUserId, attr_tokenType);
+                                    RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "success", msg, cuidUserId, attr_tokenType);
                                     update_cert_status( attr_cn, "revoked" );
 
                                     RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CERT_STATUS_CHANGE, userid,
                                       "Success", "revoke", serial, connid, "");
                                 } else {
                                     PR_snprintf((char *)msg, 256, "Errors in revoking Certificate '%s' : %s", attr_cn, statusString);
-                                    RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "failure", msg, cuidUserId, attr_tokenType);
+                                    RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "failure", msg, cuidUserId, attr_tokenType);
 
                                     RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CERT_STATUS_CHANGE, userid,
                                       "Failure", "revoke", serial, connid, statusString);
                                 }
                             } else {
                                 PR_snprintf((char *)msg, 256, "Errors in unrevoking Certificate '%s' : %s", attr_cn, statusString);
-                                RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "failure", msg, cuidUserId, attr_tokenType);
+                                RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "failure", msg, cuidUserId, attr_tokenType);
 
                                 RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CERT_STATUS_CHANGE, userid,
                                   "Failure", "unrevoke", serial, connid, statusString);
@@ -4732,7 +4733,7 @@ mod_tokendb_handler( request_rec *rq )
             RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CONFIG, userid, "Agent", "Success", oString, pString, "lost token marked permanently lost");
 
             PR_snprintf((char *)msg, 256, "Lost token marked permanently lost");
-            RA::tdb_activity(rq->connection->remote_ip, cuid, "do_token", "success",
+            RA::tdb_activity(rq->connection->client_ip, cuid, "do_token", "success",
                      msg, cuidUserId, tokenType);
         } else {
             // invalid operation or transition
@@ -6053,7 +6054,7 @@ mod_tokendb_handler( request_rec *rq )
 
             // TODO: error check to confirm that search filter is non-empty
             ap_log_error( ( const char * ) "tus", __LINE__,
-                          APLOG_ERR, 0, rq->server,
+                          APLOG_MODULE_INDEX, APLOG_ERR, 0, rq->server,
                           ( const char * ) "LDAP filter: %s", complete_filter);
 
             status = find_tus_certificate_entries_by_order_no_vlv( complete_filter,
@@ -6061,7 +6062,7 @@ mod_tokendb_handler( request_rec *rq )
                                                                    0 );
         } else if( PL_strstr( query, "op=view_certificate" )) {
             ap_log_error( ( const char * ) "tus", __LINE__,
-                          APLOG_ERR, 0, rq->server,
+                          APLOG_MODULE_INDEX, APLOG_ERR, 0, rq->server,
                           ( const char * ) "LDAP filter: %s", complete_filter);
 
             status = find_tus_certificate_entries_by_order( complete_filter,
@@ -6581,7 +6582,7 @@ mod_tokendb_handler( request_rec *rq )
 
         PR_snprintf((char *)msg, 512,
             "'%s' has added profile %s to user %s", userid, profile, uid);
-        RA::tdb_activity(rq->connection->remote_ip, "", "add_profile", "success", msg, uid, NO_TOKEN_TYPE);
+        RA::tdb_activity(rq->connection->client_ip, "", "add_profile", "success", msg, uid, NO_TOKEN_TYPE);
 
         PR_snprintf(oString, 512, "userid;;%s", uid);
         PR_snprintf(pString, 512, "profile;;%s", profile);
@@ -6780,7 +6781,7 @@ mod_tokendb_handler( request_rec *rq )
 
         PR_snprintf((char *)msg, 512,
             "'%s' has modified user %s", userid, uid);
-        RA::tdb_activity(rq->connection->remote_ip, "", "modify_user", "success", msg, uid, NO_TOKEN_TYPE);
+        RA::tdb_activity(rq->connection->client_ip, "", "modify_user", "success", msg, uid, NO_TOKEN_TYPE);
 
         PR_snprintf(injection, MAX_INJECTION_SIZE,
                     "/tus/tus?op=edit_user&uid=%s&flash=User+record+%s+has+been+updated", 
@@ -6849,7 +6850,7 @@ mod_tokendb_handler( request_rec *rq )
 
         RA::Audit(EV_CONFIG_TOKEN, AUDIT_MSG_CONFIG, userid, "Agent", "Success", oString, pLongString, "token record modified");
         PR_snprintf((char *)msg, 256, "Token record modified by %s", userid);
-        RA::tdb_activity(rq->connection->remote_ip, cuid, "save", "success",
+        RA::tdb_activity(rq->connection->client_ip, cuid, "save", "success",
             msg, cuidUserId, tokenType);
 
         PR_snprintf( injection, MAX_INJECTION_SIZE,
@@ -6956,7 +6957,7 @@ mod_tokendb_handler( request_rec *rq )
 
         PR_snprintf((char *)msg, 256,
             "'%s' has deleted user %s", userid, uid);
-        RA::tdb_activity(rq->connection->remote_ip, "", "delete_user", "success", msg, uid, NO_TOKEN_TYPE);
+        RA::tdb_activity(rq->connection->client_ip, "", "delete_user", "success", msg, uid, NO_TOKEN_TYPE);
         PR_snprintf(oString, 512, "uid;;%s", uid);
         RA::Audit(EV_CONFIG_ROLE, AUDIT_MSG_CONFIG, userid, "Admin", "success", oString, "", "tokendb user deleted"); 
 
@@ -7042,7 +7043,7 @@ mod_tokendb_handler( request_rec *rq )
 
         PR_snprintf((char *)msg, 512,
             "'%s' has created new user %s", userid, uid);
-        RA::tdb_activity(rq->connection->remote_ip, "", "add_user", "success", msg, uid, NO_TOKEN_TYPE);
+        RA::tdb_activity(rq->connection->client_ip, "", "add_user", "success", msg, uid, NO_TOKEN_TYPE);
 
         RA::Audit(EV_CONFIG_ROLE, AUDIT_MSG_CONFIG, userid, "Admin", "success", oString, pString, "tokendb user added"); 
 
@@ -7178,7 +7179,7 @@ mod_tokendb_handler( request_rec *rq )
 
         PR_snprintf((char *)msg, 256,
             "'%s' has created new token", userid);
-        RA::tdb_activity(rq->connection->remote_ip, filter, "add", "token", msg, "success", tokenType);
+        RA::tdb_activity(rq->connection->client_ip, filter, "add", "token", msg, "success", tokenType);
 
         PR_snprintf( injection, MAX_INJECTION_SIZE,
                      "%s%s%s%s%s%s%s%s%s%s%s", JS_START,
@@ -7218,7 +7219,7 @@ mod_tokendb_handler( request_rec *rq )
 
         PR_snprintf((char *)msg, 256,
             "'%s' has deleted token", userid);
-        RA::tdb_activity(rq->connection->remote_ip, filter, "delete", "token", msg, "", tokenType);
+        RA::tdb_activity(rq->connection->client_ip, filter, "delete", "token", msg, "", tokenType);
 
         PR_snprintf(oString, 512, "token_id;;%s", filter);
         status = delete_tus_db_entry( userid, filter );
@@ -7364,7 +7365,7 @@ mod_tokendb_handler( request_rec *rq )
 
             RA::Audit(EV_CONFIG_AUDIT, AUDIT_MSG_CONFIG, userid, "Admin", "Success", "", pString, "audit log config modified");
             PR_snprintf((char *)msg, 512, "'%s' has modified audit log config: %s", userid, pString);
-               RA::tdb_activity(rq->connection->remote_ip, "", "modify_audit_signing", "success", msg, userid, NO_TOKEN_TYPE);
+               RA::tdb_activity(rq->connection->client_ip, "", "modify_audit_signing", "success", msg, userid, NO_TOKEN_TYPE);
         }
 
         char *logSigningInterval_str = get_post_field(post, "logSigningInterval", SHORT_LEN);
@@ -7374,7 +7375,7 @@ mod_tokendb_handler( request_rec *rq )
         if ((logSigningInterval>=0) &&(logSigningInterval != RA::m_flush_interval)) {
             RA::SetFlushInterval(logSigningInterval);
             PR_snprintf((char *)msg, 512, "'%s' has modified the  audit log signing interval to %d seconds", userid, logSigningInterval);
-            RA::tdb_activity(rq->connection->remote_ip, "", "modify_audit_signing", "success", msg, userid, NO_TOKEN_TYPE);
+            RA::tdb_activity(rq->connection->client_ip, "", "modify_audit_signing", "success", msg, userid, NO_TOKEN_TYPE);
 
             PR_snprintf(pString, 512, "logging.audit.flush.interval;;%d", logSigningInterval);
             RA::Audit(EV_CONFIG_AUDIT, AUDIT_MSG_CONFIG, userid, "Admin", "Success", "", pString, "audit log configuration modified");
@@ -7387,7 +7388,7 @@ mod_tokendb_handler( request_rec *rq )
         if ((logSigningBufferSize >= 512) && (logSigningBufferSize != (int) RA::m_buffer_size)) {
             RA::SetBufferSize(logSigningBufferSize);
             PR_snprintf((char *)msg, 512, "'%s' has modified the  audit log signing buffer size to %d bytes", userid, logSigningBufferSize);
-            RA::tdb_activity(rq->connection->remote_ip, "", "modify_audit_signing", "success", msg, userid, NO_TOKEN_TYPE);
+            RA::tdb_activity(rq->connection->client_ip, "", "modify_audit_signing", "success", msg, userid, NO_TOKEN_TYPE);
 
             PR_snprintf(pString, 512, "logging.audit.buffer.size;;%d", logSigningBufferSize);
             RA::Audit(EV_CONFIG_AUDIT, AUDIT_MSG_CONFIG, userid, "Admin", "Success", "", pString, "audit log configuration modified");
@@ -7420,7 +7421,7 @@ mod_tokendb_handler( request_rec *rq )
 
             PR_snprintf((char *)msg, 512,
             "'%s' has modified audit signing configuration", userid);
-            RA::tdb_activity(rq->connection->remote_ip, "", "modify_audit_signing", "success", msg, userid, NO_TOKEN_TYPE);
+            RA::tdb_activity(rq->connection->client_ip, "", "modify_audit_signing", "success", msg, userid, NO_TOKEN_TYPE);
 
             PR_snprintf(pLongString, 4096, "logging.audit.selected.events;;%s", new_selected);
             RA::Audit(EV_CONFIG_AUDIT, AUDIT_MSG_CONFIG, userid, "Admin", "Success", "", pLongString, "audit log configuration modified");
@@ -7650,7 +7651,7 @@ static const char *mod_tokendb_get_config_path_file( cmd_parms *cmd,
                                                      const char *tokendbconf )
 {
     if( cmd->path ) {
-        ap_log_error( APLOG_MARK, APLOG_ERR, 0, NULL,
+        ap_log_error( APLOG_MARK, APLOG_ERR, APLOG_MODULE_INDEX, 0, NULL,
                       "The %s config param cannot be specified "
                       "in a Directory section.",
                       cmd->directive->directive );
diff --git a/base/tps/src/modules/tps/AP_Context.cpp b/base/tps/src/modules/tps/AP_Context.cpp
index cde314254e764fbacf851f31bd2f766530eb6ce1..b7e0242fb31666adcebcdb31d30d9228bd742972 100644
--- a/base/tps/src/modules/tps/AP_Context.cpp
+++ b/base/tps/src/modules/tps/AP_Context.cpp
@@ -31,6 +31,8 @@ extern "C"
 
 #define MAX_LOG_MSG_SIZE               4096
 
+APLOG_USE_MODULE(tps);
+
 
 AP_Context::AP_Context( server_rec *sv )
 {
@@ -53,7 +55,7 @@ void AP_Context::LogError( const char *func, int line, const char *fmt, ... )
     PR_vsnprintf( buf, MAX_LOG_MSG_SIZE, fmt, argp );
     va_end( argp );
 
-    ap_log_error( func, line, APLOG_ERR, 0, m_sv, buf );
+    ap_log_error( func, line, APLOG_MODULE_INDEX, APLOG_ERR, 0, m_sv, buf );
 }
 
 
@@ -66,13 +68,13 @@ void AP_Context::LogInfo( const char *func, int line, const char *fmt, ... )
     PR_vsnprintf( buf, MAX_LOG_MSG_SIZE, fmt, argp );
     va_end( argp );
 
-    ap_log_error( func, line, APLOG_INFO, 0, m_sv, buf );
+    ap_log_error( func, line, APLOG_MODULE_INDEX, APLOG_INFO, 0, m_sv, buf );
 }
 
 
 void AP_Context::InitializationError( const char *func, int line )
 {
-    ap_log_error( func, line, APLOG_INFO, 0, m_sv,
+    ap_log_error( func, line, APLOG_MODULE_INDEX, APLOG_INFO, 0, m_sv,
                   "The nss module must be initialized "
                   "prior to calling the tps module." );
 }
diff --git a/base/tps/src/modules/tps/AP_Session.cpp b/base/tps/src/modules/tps/AP_Session.cpp
index 36f45535536f9aae374131532ab5da4d56ae5988..16d6d4e5e001ef559e2bc594817dedd8a6ad1c8e 100644
--- a/base/tps/src/modules/tps/AP_Session.cpp
+++ b/base/tps/src/modules/tps/AP_Session.cpp
@@ -128,7 +128,7 @@ AP_Session::~AP_Session()
 
 char *AP_Session::GetRemoteIP()
 {
-    return ( m_rq->connection->remote_ip );
+    return ( m_rq->connection->client_ip );
 }
 
 
diff --git a/base/tps/src/modules/tps/mod_tps.cpp b/base/tps/src/modules/tps/mod_tps.cpp
index dc6cc95f98e13d703802edef9f0f15ed74119a18..7f3d29ca4a2b5c920e9daa4d8ef6c716d0c9fa45 100644
--- a/base/tps/src/modules/tps/mod_tps.cpp
+++ b/base/tps/src/modules/tps/mod_tps.cpp
@@ -122,6 +122,7 @@ typedef struct {
 */
 
 #define MOD_TPS_CONFIG_KEY tps_module
+APLOG_USE_MODULE(tps);
 
 static const char MOD_TPS_CONFIG_KEY_NAME[] = "tps_module";
 
@@ -315,7 +316,7 @@ mod_tps_initialize( apr_pool_t *p,
    } else {
         /* Log information regarding this failure. */
         ap_log_error( "mod_tps_initialize",
-                      __LINE__, APLOG_ERR, 0, sv,
+                      __LINE__, APLOG_MODULE_INDEX, APLOG_ERR, 0, sv,
                       "The tps module was installed incorrectly since the "
                       "parameter named '%s' is missing from the Apache "
                       "Configuration file!",
@@ -337,7 +338,7 @@ mod_tps_initialize( apr_pool_t *p,
     if( status != RA_INITIALIZATION_SUCCESS ) {
         /* Log information regarding this failure. */
         ap_log_error( "mod_tps_initialize",
-                      __LINE__, APLOG_ERR, 0, sv,
+                      __LINE__, APLOG_MODULE_INDEX, APLOG_ERR, 0, sv,
                       "The tps module was installed incorrectly "
                       "since the file named '%s' does not exist!",
                       cfg_path_file );
@@ -368,7 +369,7 @@ mod_tps_initialize( apr_pool_t *p,
 
     if (status !=  RA_INITIALIZATION_SUCCESS ) {
         ap_log_error( "mod_tps_initialize",
-                      __LINE__, APLOG_ERR, 0, sv,
+                      __LINE__, APLOG_MODULE_INDEX, APLOG_ERR, 0, sv,
                       "The tps module failed to do the initializeInChild tasks. ");
         printf( "\nUnable to start Apache:\n"
                 "    The tps module failed to do the initializeInChild tasks. ");
@@ -636,7 +637,7 @@ static void mod_tps_init_child(apr_pool_t *p, server_rec *sv)
          if (status !=  RA_INITIALIZATION_SUCCESS) {
         /* Need to shut down, the child was not initialized properly. */
            ap_log_error( "mod_tps_init_child",
-                      __LINE__, APLOG_ERR, 0, sv,
+                      __LINE__, APLOG_MODULE_INDEX, APLOG_ERR, 0, sv,
                       "The tps module failed to do the initializeInChild tasks. ");
            printf( "\nUnable to start Apache:\n"
                 "    The tps module failed to do the initializeInChild tasks. ");
-- 
1.7.11.2